chromium/third_party/blink/renderer/core/html/media/media_video_visibility_tracker.h

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_HTML_MEDIA_MEDIA_VIDEO_VISIBILITY_TRACKER_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_HTML_MEDIA_MEDIA_VIDEO_VISIBILITY_TRACKER_H_

#include "base/functional/callback.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/dom/events/native_event_listener.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/layout/geometry/physical_rect.h"
#include "third_party/blink/renderer/core/layout/hit_test_request.h"
#include "third_party/blink/renderer/platform/graphics/graphics_types.h"
#include "third_party/blink/renderer/platform/heap/heap_traits.h"
#include "third_party/skia/include/core/SkRect.h"

namespace blink {

class Document;
class HTMLVideoElement;

// This class tracks the area of an HTMLVideoElement, measured in square CSS
// pixels, that is visible to the user and reports whether the element's
// visibility is greater or equal than a given threshold of the visible area
// (`visibility_threshold_`) or not.
//
// "Visible" in this context is defined as intersecting with the viewport and
// not occluded by other html elements within the page, with the exception of
// MediaControls.
class CORE_EXPORT MediaVideoVisibilityTracker final
    : public NativeEventListener,
      public LocalFrameView::LifecycleNotificationObserver {};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_HTML_MEDIA_MEDIA_VIDEO_VISIBILITY_TRACKER_H_