#include "third_party/blink/renderer/core/html/media/html_video_element.h"
#include <memory>
#include "base/functional/callback_helpers.h"
#include "base/metrics/histogram_functions.h"
#include "cc/paint/paint_canvas.h"
#include "media/base/video_frame.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/platform/web_fullscreen_video_status.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_fullscreen_options.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_image_bitmap_options.h"
#include "third_party/blink/renderer/core/css/css_property_names.h"
#include "third_party/blink/renderer/core/dom/attribute.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/dom/shadow_root.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/picture_in_picture_controller.h"
#include "third_party/blink/renderer/core/frame/settings.h"
#include "third_party/blink/renderer/core/fullscreen/fullscreen.h"
#include "third_party/blink/renderer/core/html/media/media_custom_controls_fullscreen_detector.h"
#include "third_party/blink/renderer/core/html/media/media_remoting_interstitial.h"
#include "third_party/blink/renderer/core/html/media/media_video_visibility_tracker.h"
#include "third_party/blink/renderer/core/html/media/picture_in_picture_interstitial.h"
#include "third_party/blink/renderer/core/html/media/video_frame_callback_requester.h"
#include "third_party/blink/renderer/core/html/media/video_wake_lock.h"
#include "third_party/blink/renderer/core/html/parser/html_parser_idioms.h"
#include "third_party/blink/renderer/core/html_names.h"
#include "third_party/blink/renderer/core/imagebitmap/image_bitmap.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/intersection_observer/intersection_observer_entry.h"
#include "third_party/blink/renderer/core/layout/layout_image.h"
#include "third_party/blink/renderer/core/layout/layout_video.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/loader/document_loader.h"
#include "third_party/blink/renderer/core/loader/resource/video_timing.h"
#include "third_party/blink/renderer/core/paint/timing/paint_timing_detector.h"
#include "third_party/blink/renderer/platform/graphics/canvas_resource_provider.h"
#include "third_party/blink/renderer/platform/graphics/gpu/extensions_3d_util.h"
#include "third_party/blink/renderer/platform/graphics/gpu/shared_gpu_context.h"
#include "third_party/blink/renderer/platform/graphics/graphics_context.h"
#include "third_party/blink/renderer/platform/graphics/video_frame_image_util.h"
#include "third_party/blink/renderer/platform/instrumentation/use_counter.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/web_test_support.h"
namespace blink {
namespace {
constexpr int kVisibilityThreshold = …;
}
HTMLVideoElement::HTMLVideoElement(Document& document)
: … { … }
void HTMLVideoElement::Trace(Visitor* visitor) const { … }
bool HTMLVideoElement::HasPendingActivity() const { … }
Node::InsertionNotificationRequest HTMLVideoElement::InsertedInto(
ContainerNode& insertion_point) { … }
void HTMLVideoElement::RemovedFrom(ContainerNode& insertion_point) { … }
void HTMLVideoElement::ContextDestroyed() { … }
bool HTMLVideoElement::LayoutObjectIsNeeded(const DisplayStyle& style) const { … }
LayoutObject* HTMLVideoElement::CreateLayoutObject(const ComputedStyle&) { … }
void HTMLVideoElement::AttachLayoutTree(AttachContext& context) { … }
void HTMLVideoElement::UpdatePosterImage() { … }
void HTMLVideoElement::CollectStyleForPresentationAttribute(
const QualifiedName& name,
const AtomicString& value,
MutableCSSPropertyValueSet* style) { … }
bool HTMLVideoElement::IsPresentationAttribute(
const QualifiedName& name) const { … }
void HTMLVideoElement::ParseAttribute(
const AttributeModificationParams& params) { … }
unsigned HTMLVideoElement::videoWidth() const { … }
unsigned HTMLVideoElement::videoHeight() const { … }
gfx::Size HTMLVideoElement::videoVisibleSize() const { … }
bool HTMLVideoElement::IsURLAttribute(const Attribute& attribute) const { … }
const AtomicString HTMLVideoElement::ImageSourceURL() const { … }
void HTMLVideoElement::UpdatePictureInPictureAvailability() { … }
void HTMLVideoElement::SetPersistentState(bool persistent) { … }
void HTMLVideoElement::SetPersistentStateInternal(bool persistent) { … }
void HTMLVideoElement::CreateVisibilityTrackerIfNeeded() { … }
void HTMLVideoElement::ReportVisibility(bool meets_visibility_threshold) { … }
bool HTMLVideoElement::IsPersistent() const { … }
void HTMLVideoElement::OnPlay() { … }
void HTMLVideoElement::OnLoadStarted() { … }
void HTMLVideoElement::OnLoadFinished() { … }
void HTMLVideoElement::UpdateVideoVisibilityTracker() { … }
void HTMLVideoElement::RequestEnterPictureInPicture() { … }
void HTMLVideoElement::RequestMediaRemoting() { … }
void HTMLVideoElement::RequestVisibility(
RequestVisibilityCallback request_visibility_cb) { … }
void HTMLVideoElement::PaintCurrentFrame(cc::PaintCanvas* canvas,
const gfx::Rect& dest_rect,
const cc::PaintFlags* flags) const { … }
bool HTMLVideoElement::HasAvailableVideoFrame() const { … }
bool HTMLVideoElement::HasReadableVideoFrame() const { … }
void HTMLVideoElement::OnFirstFrame(base::TimeTicks frame_time,
size_t bytes_to_first_frame) { … }
void HTMLVideoElement::webkitEnterFullscreen() { … }
void HTMLVideoElement::webkitExitFullscreen() { … }
bool HTMLVideoElement::webkitSupportsFullscreen() { … }
bool HTMLVideoElement::webkitDisplayingFullscreen() { … }
void HTMLVideoElement::DidEnterFullscreen() { … }
void HTMLVideoElement::DidExitFullscreen() { … }
void HTMLVideoElement::DidMoveToNewDocument(Document& old_document) { … }
unsigned HTMLVideoElement::webkitDecodedFrameCount() const { … }
unsigned HTMLVideoElement::webkitDroppedFrameCount() const { … }
KURL HTMLVideoElement::PosterImageURL() const { … }
bool HTMLVideoElement::IsDefaultPosterImageURL() const { … }
scoped_refptr<StaticBitmapImage> HTMLVideoElement::CreateStaticBitmapImage(
bool allow_accelerated_images,
std::optional<gfx::Size> size) { … }
scoped_refptr<Image> HTMLVideoElement::GetSourceImageForCanvas(
FlushReason,
SourceImageStatus* status,
const gfx::SizeF&,
const AlphaDisposition alpha_disposition) { … }
bool HTMLVideoElement::WouldTaintOrigin() const { … }
gfx::SizeF HTMLVideoElement::ElementSize(
const gfx::SizeF&,
const RespectImageOrientationEnum) const { … }
gfx::Size HTMLVideoElement::BitmapSourceSize() const { … }
ScriptPromise<ImageBitmap> HTMLVideoElement::CreateImageBitmap(
ScriptState* script_state,
std::optional<gfx::Rect> crop_rect,
const ImageBitmapOptions* options,
ExceptionState& exception_state) { … }
void HTMLVideoElement::MediaRemotingStarted(
const WebString& remote_device_friendly_name) { … }
void HTMLVideoElement::MediaRemotingStopped(int error_code) { … }
bool HTMLVideoElement::SupportsPictureInPicture() const { … }
DisplayType HTMLVideoElement::GetDisplayType() const { … }
bool HTMLVideoElement::IsInAutoPIP() const { … }
void HTMLVideoElement::OnPictureInPictureStateChange() { … }
void HTMLVideoElement::OnEnteredPictureInPicture() { … }
void HTMLVideoElement::OnExitedPictureInPicture() { … }
void HTMLVideoElement::SetIsEffectivelyFullscreen(
blink::WebFullscreenVideoStatus status) { … }
void HTMLVideoElement::SetIsDominantVisibleContent(bool is_dominant) { … }
void HTMLVideoElement::AddedEventListener(
const AtomicString& event_type,
RegisteredEventListener& registered_listener) { … }
bool HTMLVideoElement::IsRemotingInterstitialVisible() const { … }
void HTMLVideoElement::OnIntersectionChangedForLazyLoad(
const HeapVector<Member<IntersectionObserverEntry>>& entries) { … }
void HTMLVideoElement::OnWebMediaPlayerCreated() { … }
void HTMLVideoElement::OnWebMediaPlayerCleared() { … }
void HTMLVideoElement::RecordVideoOcclusionState(
std::string_view occlusion_state) const { … }
void HTMLVideoElement::AttributeChanged(
const AttributeModificationParams& params) { … }
void HTMLVideoElement::OnRequestVideoFrameCallback() { … }
}