Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.h

Issue 2511143006: Detect change on the intersection of video and viewport. (Closed)
Patch Set: Addressed comments. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 void didMoveToNewDocument(Document& oldDocument) override; 327 void didMoveToNewDocument(Document& oldDocument) override;
328 virtual KURL posterImageURL() const { return KURL(); } 328 virtual KURL posterImageURL() const { return KURL(); }
329 329
330 enum DisplayMode { Unknown, Poster, Video }; 330 enum DisplayMode { Unknown, Poster, Video };
331 DisplayMode getDisplayMode() const { return m_displayMode; } 331 DisplayMode getDisplayMode() const { return m_displayMode; }
332 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; } 332 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; }
333 333
334 void recordAutoplayMetric(AutoplayMetrics); 334 void recordAutoplayMetric(AutoplayMetrics);
335 335
336 private: 336 private:
337 // Friend class for testing.
338 friend class MediaElementFillingViewportTest;
339
337 void resetMediaPlayerAndMediaSource(); 340 void resetMediaPlayerAndMediaSource();
338 341
339 bool alwaysCreateUserAgentShadowRoot() const final { return true; } 342 bool alwaysCreateUserAgentShadowRoot() const final { return true; }
340 bool areAuthorShadowsAllowed() const final { return false; } 343 bool areAuthorShadowsAllowed() const final { return false; }
341 344
342 bool supportsFocus() const final; 345 bool supportsFocus() const final;
343 bool isMouseFocusable() const final; 346 bool isMouseFocusable() const final;
344 bool layoutObjectIsNeeded(const ComputedStyle&) override; 347 bool layoutObjectIsNeeded(const ComputedStyle&) override;
345 LayoutObject* createLayoutObject(const ComputedStyle&) override; 348 LayoutObject* createLayoutObject(const ComputedStyle&) override;
346 InsertionNotificationRequest insertedInto(ContainerNode*) final; 349 InsertionNotificationRequest insertedInto(ContainerNode*) final;
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 void scheduleNotifyPlaying(); 540 void scheduleNotifyPlaying();
538 void resolveScheduledPlayPromises(); 541 void resolveScheduledPlayPromises();
539 void rejectScheduledPlayPromises(); 542 void rejectScheduledPlayPromises();
540 void rejectPlayPromises(ExceptionCode, const String&); 543 void rejectPlayPromises(ExceptionCode, const String&);
541 void rejectPlayPromisesInternal(ExceptionCode, const String&); 544 void rejectPlayPromisesInternal(ExceptionCode, const String&);
542 545
543 EnumerationHistogram& showControlsHistogram() const; 546 EnumerationHistogram& showControlsHistogram() const;
544 547
545 void onVisibilityChangedForAutoplay(bool isVisible); 548 void onVisibilityChangedForAutoplay(bool isVisible);
546 549
550 void checkViewportIntersectionChanged();
551 void viewportFillDebouncerTimerFired(TimerBase*);
552
547 UnthrottledThreadTimer<HTMLMediaElement> m_loadTimer; 553 UnthrottledThreadTimer<HTMLMediaElement> m_loadTimer;
548 UnthrottledThreadTimer<HTMLMediaElement> m_progressEventTimer; 554 UnthrottledThreadTimer<HTMLMediaElement> m_progressEventTimer;
549 UnthrottledThreadTimer<HTMLMediaElement> m_playbackProgressTimer; 555 UnthrottledThreadTimer<HTMLMediaElement> m_playbackProgressTimer;
550 UnthrottledThreadTimer<HTMLMediaElement> m_audioTracksTimer; 556 UnthrottledThreadTimer<HTMLMediaElement> m_audioTracksTimer;
557 UnthrottledThreadTimer<HTMLMediaElement> m_viewportFillDebouncerTimer;
551 Member<TimeRanges> m_playedTimeRanges; 558 Member<TimeRanges> m_playedTimeRanges;
552 Member<GenericEventQueue> m_asyncEventQueue; 559 Member<GenericEventQueue> m_asyncEventQueue;
553 560
554 double m_playbackRate; 561 double m_playbackRate;
555 double m_defaultPlaybackRate; 562 double m_defaultPlaybackRate;
556 NetworkState m_networkState; 563 NetworkState m_networkState;
557 ReadyState m_readyState; 564 ReadyState m_readyState;
558 ReadyState m_readyStateMaximum; 565 ReadyState m_readyStateMaximum;
559 KURL m_currentSrc; 566 KURL m_currentSrc;
560 Member<MediaStreamDescriptor> m_srcObject; 567 Member<MediaStreamDescriptor> m_srcObject;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 647
641 bool m_textTracksVisible : 1; 648 bool m_textTracksVisible : 1;
642 bool m_shouldPerformAutomaticTrackSelection : 1; 649 bool m_shouldPerformAutomaticTrackSelection : 1;
643 650
644 bool m_tracksAreReady : 1; 651 bool m_tracksAreReady : 1;
645 bool m_processingPreferenceChange : 1; 652 bool m_processingPreferenceChange : 1;
646 bool m_playingRemotely : 1; 653 bool m_playingRemotely : 1;
647 // Whether this element is in overlay fullscreen mode. 654 // Whether this element is in overlay fullscreen mode.
648 bool m_inOverlayFullscreenVideo : 1; 655 bool m_inOverlayFullscreenVideo : 1;
649 656
657 bool m_mostlyFillingViewport : 1;
658
650 TraceWrapperMember<AudioTrackList> m_audioTracks; 659 TraceWrapperMember<AudioTrackList> m_audioTracks;
651 TraceWrapperMember<VideoTrackList> m_videoTracks; 660 TraceWrapperMember<VideoTrackList> m_videoTracks;
652 TraceWrapperMember<TextTrackList> m_textTracks; 661 TraceWrapperMember<TextTrackList> m_textTracks;
653 HeapVector<Member<TextTrack>> m_textTracksWhenResourceSelectionBegan; 662 HeapVector<Member<TextTrack>> m_textTracksWhenResourceSelectionBegan;
654 663
655 Member<CueTimeline> m_cueTimeline; 664 Member<CueTimeline> m_cueTimeline;
656 665
657 HeapVector<Member<ScriptPromiseResolver>> m_playPromiseResolvers; 666 HeapVector<Member<ScriptPromiseResolver>> m_playPromiseResolvers;
658 std::unique_ptr<CancellableTaskFactory> m_playPromiseResolveTask; 667 std::unique_ptr<CancellableTaskFactory> m_playPromiseResolveTask;
659 std::unique_ptr<CancellableTaskFactory> m_playPromiseRejectTask; 668 std::unique_ptr<CancellableTaskFactory> m_playPromiseRejectTask;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 733
725 Member<AutoplayExperimentHelper::Client> m_autoplayHelperClient; 734 Member<AutoplayExperimentHelper::Client> m_autoplayHelperClient;
726 Member<AutoplayExperimentHelper> m_autoplayHelper; 735 Member<AutoplayExperimentHelper> m_autoplayHelper;
727 Member<AutoplayUmaHelper> m_autoplayUmaHelper; 736 Member<AutoplayUmaHelper> m_autoplayUmaHelper;
728 737
729 WebRemotePlaybackClient* m_remotePlaybackClient; 738 WebRemotePlaybackClient* m_remotePlaybackClient;
730 739
731 // class AutoplayVisibilityObserver; 740 // class AutoplayVisibilityObserver;
732 Member<ElementVisibilityObserver> m_autoplayVisibilityObserver; 741 Member<ElementVisibilityObserver> m_autoplayVisibilityObserver;
733 742
743 IntRect m_currentIntersectRect;
744
734 static URLRegistry* s_mediaStreamRegistry; 745 static URLRegistry* s_mediaStreamRegistry;
735 }; 746 };
736 747
737 inline bool isHTMLMediaElement(const HTMLElement& element) { 748 inline bool isHTMLMediaElement(const HTMLElement& element) {
738 return isHTMLAudioElement(element) || isHTMLVideoElement(element); 749 return isHTMLAudioElement(element) || isHTMLVideoElement(element);
739 } 750 }
740 751
741 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); 752 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement);
742 753
743 } // namespace blink 754 } // namespace blink
744 755
745 #endif // HTMLMediaElement_h 756 #endif // HTMLMediaElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698