OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. |
3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2011, 2012 Google Inc. All rights 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 11 matching lines...) Expand all Loading... |
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #include "core/html/shadow/MediaControls.h" | 27 #include "core/html/shadow/MediaControls.h" |
28 | 28 |
29 #include "bindings/core/v8/ExceptionState.h" | 29 #include "bindings/core/v8/ExceptionState.h" |
30 #include "core/dom/ClientRect.h" | 30 #include "core/dom/ClientRect.h" |
31 #include "core/dom/Fullscreen.h" | 31 #include "core/dom/Fullscreen.h" |
| 32 #include "core/dom/ResizeObserver.h" |
| 33 #include "core/dom/ResizeObserverCallback.h" |
| 34 #include "core/dom/ResizeObserverEntry.h" |
32 #include "core/dom/TaskRunnerHelper.h" | 35 #include "core/dom/TaskRunnerHelper.h" |
33 #include "core/events/MouseEvent.h" | 36 #include "core/events/MouseEvent.h" |
34 #include "core/frame/Settings.h" | 37 #include "core/frame/Settings.h" |
35 #include "core/html/HTMLMediaElement.h" | 38 #include "core/html/HTMLMediaElement.h" |
36 #include "core/html/HTMLVideoElement.h" | 39 #include "core/html/HTMLVideoElement.h" |
37 #include "core/html/shadow/MediaControlsMediaEventListener.h" | 40 #include "core/html/shadow/MediaControlsMediaEventListener.h" |
38 #include "core/html/shadow/MediaControlsOrientationLockDelegate.h" | 41 #include "core/html/shadow/MediaControlsOrientationLockDelegate.h" |
39 #include "core/html/shadow/MediaControlsWindowEventListener.h" | 42 #include "core/html/shadow/MediaControlsWindowEventListener.h" |
40 #include "core/html/track/TextTrackContainer.h" | 43 #include "core/html/track/TextTrackContainer.h" |
41 #include "core/html/track/TextTrackList.h" | 44 #include "core/html/track/TextTrackList.h" |
42 #include "core/layout/LayoutObject.h" | 45 #include "core/layout/LayoutObject.h" |
43 #include "core/layout/LayoutTheme.h" | 46 #include "core/layout/LayoutTheme.h" |
44 #include "platform/EventDispatchForbiddenScope.h" | 47 #include "platform/EventDispatchForbiddenScope.h" |
45 | 48 |
46 namespace blink { | 49 namespace blink { |
47 | 50 |
| 51 namespace { |
| 52 |
| 53 // TODO(steimel): should have better solution than hard-coding pixel values. |
| 54 // Defined in core/css/mediaControls.css, core/css/mediaControlsAndroid.css, |
| 55 // and core/paint/MediaControlsPainter.cpp. |
| 56 constexpr int kOverlayPlayButtonWidth = 48; |
| 57 constexpr int kOverlayPlayButtonHeight = 48; |
| 58 constexpr int kOverlayBottomMargin = 10; |
| 59 constexpr int kAndroidMediaPanelHeight = 48; |
| 60 |
| 61 constexpr int kMinWidthForOverlayPlayButton = kOverlayPlayButtonWidth; |
| 62 constexpr int kMinHeightForOverlayPlayButton = kOverlayPlayButtonHeight + |
| 63 kAndroidMediaPanelHeight + |
| 64 (2 * kOverlayBottomMargin); |
| 65 |
| 66 } // anonymous namespace |
| 67 |
48 // If you change this value, then also update the corresponding value in | 68 // If you change this value, then also update the corresponding value in |
49 // LayoutTests/media/media-controls.js. | 69 // LayoutTests/media/media-controls.js. |
50 static const double timeWithoutMouseMovementBeforeHidingMediaControls = 3; | 70 static const double timeWithoutMouseMovementBeforeHidingMediaControls = 3; |
51 | 71 |
52 static bool shouldShowFullscreenButton(const HTMLMediaElement& mediaElement) { | 72 static bool shouldShowFullscreenButton(const HTMLMediaElement& mediaElement) { |
53 // Unconditionally allow the user to exit fullscreen if we are in it | 73 // Unconditionally allow the user to exit fullscreen if we are in it |
54 // now. Especially on android, when we might not yet know if | 74 // now. Especially on android, when we might not yet know if |
55 // fullscreen is supported, we sometimes guess incorrectly and show | 75 // fullscreen is supported, we sometimes guess incorrectly and show |
56 // the button earlier, and we don't want to remove it here if the | 76 // the button earlier, and we don't want to remove it here if the |
57 // user chose to enter fullscreen. crbug.com/500732 . | 77 // user chose to enter fullscreen. crbug.com/500732 . |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 127 } |
108 | 128 |
109 private: | 129 private: |
110 Member<MediaControls> m_controls; | 130 Member<MediaControls> m_controls; |
111 static int s_batchDepth; | 131 static int s_batchDepth; |
112 }; | 132 }; |
113 | 133 |
114 // Count of number open batches for controls visibility. | 134 // Count of number open batches for controls visibility. |
115 int MediaControls::BatchedControlUpdate::s_batchDepth = 0; | 135 int MediaControls::BatchedControlUpdate::s_batchDepth = 0; |
116 | 136 |
| 137 class MediaControls::MediaControlsResizeObserverCallback final |
| 138 : public ResizeObserverCallback { |
| 139 public: |
| 140 explicit MediaControlsResizeObserverCallback(MediaControls* controls) |
| 141 : m_controls(controls) { |
| 142 DCHECK(controls); |
| 143 } |
| 144 ~MediaControlsResizeObserverCallback() override = default; |
| 145 |
| 146 void handleEvent(const HeapVector<Member<ResizeObserverEntry>>& entries, |
| 147 ResizeObserver* observer) override { |
| 148 DCHECK_EQ(1u, entries.size()); |
| 149 DCHECK_EQ(entries[0]->target(), m_controls->m_mediaElement); |
| 150 m_controls->notifyElementSizeChanged(entries[0]->contentRect()); |
| 151 } |
| 152 |
| 153 DEFINE_INLINE_TRACE() { |
| 154 visitor->trace(m_controls); |
| 155 ResizeObserverCallback::trace(visitor); |
| 156 } |
| 157 |
| 158 private: |
| 159 Member<MediaControls> m_controls; |
| 160 }; |
| 161 |
117 MediaControls::MediaControls(HTMLMediaElement& mediaElement) | 162 MediaControls::MediaControls(HTMLMediaElement& mediaElement) |
118 : HTMLDivElement(mediaElement.document()), | 163 : HTMLDivElement(mediaElement.document()), |
119 m_mediaElement(&mediaElement), | 164 m_mediaElement(&mediaElement), |
120 m_overlayEnclosure(nullptr), | 165 m_overlayEnclosure(nullptr), |
121 m_overlayPlayButton(nullptr), | 166 m_overlayPlayButton(nullptr), |
122 m_overlayCastButton(nullptr), | 167 m_overlayCastButton(nullptr), |
123 m_enclosure(nullptr), | 168 m_enclosure(nullptr), |
124 m_panel(nullptr), | 169 m_panel(nullptr), |
125 m_playButton(nullptr), | 170 m_playButton(nullptr), |
126 m_timeline(nullptr), | 171 m_timeline(nullptr), |
(...skipping 12 matching lines...) Expand all Loading... |
139 this, | 184 this, |
140 WTF::bind(&MediaControls::hideAllMenus, wrapWeakPersistent(this)))), | 185 WTF::bind(&MediaControls::hideAllMenus, wrapWeakPersistent(this)))), |
141 m_orientationLockDelegate(nullptr), | 186 m_orientationLockDelegate(nullptr), |
142 m_hideMediaControlsTimer(TaskRunnerHelper::get(TaskType::UnspecedTimer, | 187 m_hideMediaControlsTimer(TaskRunnerHelper::get(TaskType::UnspecedTimer, |
143 &mediaElement.document()), | 188 &mediaElement.document()), |
144 this, | 189 this, |
145 &MediaControls::hideMediaControlsTimerFired), | 190 &MediaControls::hideMediaControlsTimerFired), |
146 m_hideTimerBehaviorFlags(IgnoreNone), | 191 m_hideTimerBehaviorFlags(IgnoreNone), |
147 m_isMouseOverControls(false), | 192 m_isMouseOverControls(false), |
148 m_isPausedForScrubbing(false), | 193 m_isPausedForScrubbing(false), |
149 m_panelWidthChangedTimer(TaskRunnerHelper::get(TaskType::UnspecedTimer, | 194 m_resizeObserver(ResizeObserver::create( |
150 &mediaElement.document()), | 195 mediaElement.document(), |
151 this, | 196 new MediaControlsResizeObserverCallback(this))), |
152 &MediaControls::panelWidthChangedTimerFired), | 197 m_elementSizeChangedTimer(TaskRunnerHelper::get(TaskType::UnspecedTimer, |
153 m_panelWidth(0), | 198 &mediaElement.document()), |
154 m_keepShowingUntilTimerFires(false) {} | 199 this, |
| 200 &MediaControls::elementSizeChangedTimerFired), |
| 201 m_keepShowingUntilTimerFires(false) { |
| 202 m_resizeObserver->observe(m_mediaElement); |
| 203 } |
155 | 204 |
156 MediaControls* MediaControls::create(HTMLMediaElement& mediaElement, | 205 MediaControls* MediaControls::create(HTMLMediaElement& mediaElement, |
157 ShadowRoot& shadowRoot) { | 206 ShadowRoot& shadowRoot) { |
158 MediaControls* controls = new MediaControls(mediaElement); | 207 MediaControls* controls = new MediaControls(mediaElement); |
159 controls->setShadowPseudoId(AtomicString("-webkit-media-controls")); | 208 controls->setShadowPseudoId(AtomicString("-webkit-media-controls")); |
160 controls->initializeControls(); | 209 controls->initializeControls(); |
161 controls->reset(); | 210 controls->reset(); |
162 | 211 |
163 // Initialize the orientation lock when going fullscreen feature. | 212 // Initialize the orientation lock when going fullscreen feature. |
164 if (RuntimeEnabledFeatures::videoFullscreenOrientationLockEnabled() && | 213 if (RuntimeEnabledFeatures::videoFullscreenOrientationLockEnabled() && |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 | 393 |
345 // TODO(mlamouri): we should show the controls instead of having | 394 // TODO(mlamouri): we should show the controls instead of having |
346 // HTMLMediaElement do it. | 395 // HTMLMediaElement do it. |
347 | 396 |
348 // m_windowEventListener doesn't need to be re-attached as it's only needed | 397 // m_windowEventListener doesn't need to be re-attached as it's only needed |
349 // when a menu is visible. | 398 // when a menu is visible. |
350 m_mediaEventListener->attach(); | 399 m_mediaEventListener->attach(); |
351 if (m_orientationLockDelegate) | 400 if (m_orientationLockDelegate) |
352 m_orientationLockDelegate->attach(); | 401 m_orientationLockDelegate->attach(); |
353 | 402 |
| 403 if (!m_resizeObserver) { |
| 404 m_resizeObserver = |
| 405 ResizeObserver::create(m_mediaElement->document(), |
| 406 new MediaControlsResizeObserverCallback(this)); |
| 407 m_resizeObserver->observe(m_mediaElement); |
| 408 } |
| 409 |
354 return HTMLDivElement::insertedInto(root); | 410 return HTMLDivElement::insertedInto(root); |
355 } | 411 } |
356 | 412 |
357 void MediaControls::removedFrom(ContainerNode*) { | 413 void MediaControls::removedFrom(ContainerNode*) { |
358 DCHECK(!mediaElement().isConnected()); | 414 DCHECK(!mediaElement().isConnected()); |
359 | 415 |
360 // TODO(mlamouri): we hide show the controls instead of having | 416 // TODO(mlamouri): we hide show the controls instead of having |
361 // HTMLMediaElement do it. | 417 // HTMLMediaElement do it. |
362 | 418 |
363 m_windowEventListener->stop(); | 419 m_windowEventListener->stop(); |
364 m_mediaEventListener->detach(); | 420 m_mediaEventListener->detach(); |
365 if (m_orientationLockDelegate) | 421 if (m_orientationLockDelegate) |
366 m_orientationLockDelegate->detach(); | 422 m_orientationLockDelegate->detach(); |
| 423 |
| 424 m_resizeObserver.clear(); |
367 } | 425 } |
368 | 426 |
369 void MediaControls::reset() { | 427 void MediaControls::reset() { |
370 EventDispatchForbiddenScope::AllowUserAgentEvents allowEventsInShadow; | 428 EventDispatchForbiddenScope::AllowUserAgentEvents allowEventsInShadow; |
371 BatchedControlUpdate batch(this); | 429 BatchedControlUpdate batch(this); |
372 | 430 |
373 const double duration = mediaElement().duration(); | 431 const double duration = mediaElement().duration(); |
374 m_durationDisplay->setTextContent( | 432 m_durationDisplay->setTextContent( |
375 LayoutTheme::theme().formatMediaControlsTime(duration)); | 433 LayoutTheme::theme().formatMediaControlsTime(duration)); |
376 m_durationDisplay->setCurrentValue(duration); | 434 m_durationDisplay->setCurrentValue(duration); |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 stopHideMediaControlsTimer(); | 867 stopHideMediaControlsTimer(); |
810 startHideMediaControlsTimer(); | 868 startHideMediaControlsTimer(); |
811 } | 869 } |
812 | 870 |
813 void MediaControls::onExitedFullscreen() { | 871 void MediaControls::onExitedFullscreen() { |
814 m_fullscreenButton->setIsFullscreen(false); | 872 m_fullscreenButton->setIsFullscreen(false); |
815 stopHideMediaControlsTimer(); | 873 stopHideMediaControlsTimer(); |
816 startHideMediaControlsTimer(); | 874 startHideMediaControlsTimer(); |
817 } | 875 } |
818 | 876 |
819 void MediaControls::notifyPanelWidthChanged(const LayoutUnit& newWidth) { | 877 void MediaControls::notifyElementSizeChanged(ClientRect* newSize) { |
820 // Don't bother to do any work if this matches the most recent panel | |
821 // width, since we're called after layout. | |
822 // Note that this code permits a bad frame on resize, since it is | 878 // Note that this code permits a bad frame on resize, since it is |
823 // run after the relayout / paint happens. It would be great to improve | 879 // run after the relayout / paint happens. It would be great to improve |
824 // this, but it would be even greater to move this code entirely to | 880 // this, but it would be even greater to move this code entirely to |
825 // JS and fix it there. | 881 // JS and fix it there. |
826 m_panelWidth = newWidth.toInt(); | 882 |
| 883 IntSize oldSize = m_size; |
| 884 m_size.setWidth(newSize->width()); |
| 885 m_size.setHeight(newSize->height()); |
827 | 886 |
828 // Adjust for effective zoom. | 887 // Adjust for effective zoom. |
829 if (!m_panel->layoutObject() || !m_panel->layoutObject()->style()) | 888 if (m_panel->layoutObject() && m_panel->layoutObject()->style()) { |
830 return; | 889 m_size.setWidth(ceil(m_size.width() / |
831 m_panelWidth = | 890 m_panel->layoutObject()->style()->effectiveZoom())); |
832 ceil(m_panelWidth / m_panel->layoutObject()->style()->effectiveZoom()); | 891 m_size.setHeight(ceil(m_size.height() / |
| 892 m_panel->layoutObject()->style()->effectiveZoom())); |
| 893 } |
833 | 894 |
834 m_panelWidthChangedTimer.startOneShot(0, BLINK_FROM_HERE); | 895 // Don't bother to do any work if this matches the most recent size. |
| 896 if (oldSize != m_size) |
| 897 m_elementSizeChangedTimer.startOneShot(0, BLINK_FROM_HERE); |
835 } | 898 } |
836 | 899 |
837 void MediaControls::panelWidthChangedTimerFired(TimerBase*) { | 900 void MediaControls::elementSizeChangedTimerFired(TimerBase*) { |
838 computeWhichControlsFit(); | 901 computeWhichControlsFit(); |
839 } | 902 } |
840 | 903 |
841 void MediaControls::computeWhichControlsFit() { | 904 void MediaControls::computeWhichControlsFit() { |
842 // Hide all controls that don't fit, and show the ones that do. | 905 // Hide all controls that don't fit, and show the ones that do. |
843 // This might be better suited for a layout, but since JS media controls | 906 // This might be better suited for a layout, but since JS media controls |
844 // won't benefit from that anwyay, we just do it here like JS will. | 907 // won't benefit from that anwyay, we just do it here like JS will. |
845 | 908 |
846 // Controls that we'll hide / show, in order of decreasing priority. | 909 // Controls that we'll hide / show, in order of decreasing priority. |
847 MediaControlElement* elements[] = { | 910 MediaControlElement* elements[] = { |
848 // Exclude m_overflowMenu; we handle it specially. | 911 // Exclude m_overflowMenu; we handle it specially. |
849 m_playButton.get(), | 912 m_playButton.get(), |
850 m_fullscreenButton.get(), | 913 m_fullscreenButton.get(), |
851 m_downloadButton.get(), | 914 m_downloadButton.get(), |
852 m_timeline.get(), | 915 m_timeline.get(), |
853 m_muteButton.get(), | 916 m_muteButton.get(), |
854 m_volumeSlider.get(), | 917 m_volumeSlider.get(), |
855 m_toggleClosedCaptionsButton.get(), | 918 m_toggleClosedCaptionsButton.get(), |
856 m_castButton.get(), | 919 m_castButton.get(), |
857 m_currentTimeDisplay.get(), | 920 m_currentTimeDisplay.get(), |
858 m_durationDisplay.get(), | 921 m_durationDisplay.get(), |
859 }; | 922 }; |
860 | 923 |
861 // TODO(mlamouri): we need a more dynamic way to find out the width of an | 924 // TODO(mlamouri): we need a more dynamic way to find out the width of an |
862 // element. | 925 // element. |
863 const int sliderMargin = 36; // Sliders have 18px margin on each side. | 926 const int sliderMargin = 36; // Sliders have 18px margin on each side. |
864 | 927 |
865 if (!m_panelWidth) { | 928 if (!m_size.width()) { |
866 // No layout yet -- hide everything, then make them show up later. | 929 // No layout yet -- hide everything, then make them show up later. |
867 // This prevents the wrong controls from being shown briefly | 930 // This prevents the wrong controls from being shown briefly |
868 // immediately after the first layout and paint, but before we have | 931 // immediately after the first layout and paint, but before we have |
869 // a chance to revise them. | 932 // a chance to revise them. |
870 for (MediaControlElement* element : elements) { | 933 for (MediaControlElement* element : elements) { |
871 if (element) | 934 if (element) |
872 element->setDoesFit(false); | 935 element->setDoesFit(false); |
873 } | 936 } |
874 return; | 937 return; |
875 } | 938 } |
(...skipping 24 matching lines...) Expand all Loading... |
900 MediaControlElement* firstDisplacedElement = nullptr; | 963 MediaControlElement* firstDisplacedElement = nullptr; |
901 // For each control that fits, enable it in order of decreasing priority. | 964 // For each control that fits, enable it in order of decreasing priority. |
902 for (MediaControlElement* element : elements) { | 965 for (MediaControlElement* element : elements) { |
903 if (!element) | 966 if (!element) |
904 continue; | 967 continue; |
905 int width = minimumWidth; | 968 int width = minimumWidth; |
906 if ((element == m_timeline.get()) || (element == m_volumeSlider.get())) | 969 if ((element == m_timeline.get()) || (element == m_volumeSlider.get())) |
907 width += sliderMargin; | 970 width += sliderMargin; |
908 element->shouldShowButtonInOverflowMenu(false); | 971 element->shouldShowButtonInOverflowMenu(false); |
909 if (element->isWanted()) { | 972 if (element->isWanted()) { |
910 if (usedWidth + width <= m_panelWidth) { | 973 if (usedWidth + width <= m_size.width()) { |
911 element->setDoesFit(true); | 974 element->setDoesFit(true); |
912 usedWidth += width; | 975 usedWidth += width; |
913 } else { | 976 } else { |
914 element->setDoesFit(false); | 977 element->setDoesFit(false); |
915 element->shouldShowButtonInOverflowMenu(true); | 978 element->shouldShowButtonInOverflowMenu(true); |
916 if (element->hasOverflowButton()) | 979 if (element->hasOverflowButton()) |
917 overflowElements.push_front(element); | 980 overflowElements.push_front(element); |
918 // We want a way to access the first media element that was | 981 // We want a way to access the first media element that was |
919 // removed. If we don't end up needing an overflow menu, we can | 982 // removed. If we don't end up needing an overflow menu, we can |
920 // use the space the overflow menu would have taken up to | 983 // use the space the overflow menu would have taken up to |
921 // instead display that media element. | 984 // instead display that media element. |
922 if (!element->hasOverflowButton() && !firstDisplacedElement) | 985 if (!element->hasOverflowButton() && !firstDisplacedElement) |
923 firstDisplacedElement = element; | 986 firstDisplacedElement = element; |
924 } | 987 } |
925 } | 988 } |
926 } | 989 } |
927 | 990 |
928 // If we don't have at least two overflow elements, we will not show the | 991 // If we don't have at least two overflow elements, we will not show the |
929 // overflow menu. | 992 // overflow menu. |
930 if (overflowElements.empty()) { | 993 if (overflowElements.empty()) { |
931 m_overflowMenu->setIsWanted(false); | 994 m_overflowMenu->setIsWanted(false); |
932 usedWidth -= minimumWidth; | 995 usedWidth -= minimumWidth; |
933 if (firstDisplacedElement) { | 996 if (firstDisplacedElement) { |
934 int width = minimumWidth; | 997 int width = minimumWidth; |
935 if ((firstDisplacedElement == m_timeline.get()) || | 998 if ((firstDisplacedElement == m_timeline.get()) || |
936 (firstDisplacedElement == m_volumeSlider.get())) | 999 (firstDisplacedElement == m_volumeSlider.get())) |
937 width += sliderMargin; | 1000 width += sliderMargin; |
938 if (usedWidth + width <= m_panelWidth) | 1001 if (usedWidth + width <= m_size.width()) |
939 firstDisplacedElement->setDoesFit(true); | 1002 firstDisplacedElement->setDoesFit(true); |
940 } | 1003 } |
941 } else if (overflowElements.size() == 1) { | 1004 } else if (overflowElements.size() == 1) { |
942 m_overflowMenu->setIsWanted(false); | 1005 m_overflowMenu->setIsWanted(false); |
943 overflowElements.front()->setDoesFit(true); | 1006 overflowElements.front()->setDoesFit(true); |
944 } | 1007 } |
| 1008 |
| 1009 // Decide if the overlay play button fits. |
| 1010 if (m_overlayPlayButton) { |
| 1011 bool doesFit = m_size.width() >= kMinWidthForOverlayPlayButton && |
| 1012 m_size.height() >= kMinHeightForOverlayPlayButton; |
| 1013 m_overlayPlayButton->setDoesFit(doesFit); |
| 1014 } |
945 } | 1015 } |
946 | 1016 |
947 void MediaControls::invalidate(Element* element) { | 1017 void MediaControls::invalidate(Element* element) { |
948 if (!element) | 1018 if (!element) |
949 return; | 1019 return; |
950 | 1020 |
951 if (LayoutObject* layoutObject = element->layoutObject()) | 1021 if (LayoutObject* layoutObject = element->layoutObject()) |
952 layoutObject | 1022 layoutObject |
953 ->setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); | 1023 ->setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants(); |
954 } | 1024 } |
(...skipping 28 matching lines...) Expand all Loading... |
983 void MediaControls::hideAllMenus() { | 1053 void MediaControls::hideAllMenus() { |
984 m_windowEventListener->stop(); | 1054 m_windowEventListener->stop(); |
985 | 1055 |
986 if (m_overflowList->isWanted()) | 1056 if (m_overflowList->isWanted()) |
987 m_overflowList->setIsWanted(false); | 1057 m_overflowList->setIsWanted(false); |
988 if (m_textTrackList->isWanted()) | 1058 if (m_textTrackList->isWanted()) |
989 m_textTrackList->setVisible(false); | 1059 m_textTrackList->setVisible(false); |
990 } | 1060 } |
991 | 1061 |
992 DEFINE_TRACE(MediaControls) { | 1062 DEFINE_TRACE(MediaControls) { |
| 1063 visitor->trace(m_resizeObserver); |
993 visitor->trace(m_mediaElement); | 1064 visitor->trace(m_mediaElement); |
994 visitor->trace(m_panel); | 1065 visitor->trace(m_panel); |
995 visitor->trace(m_overlayPlayButton); | 1066 visitor->trace(m_overlayPlayButton); |
996 visitor->trace(m_overlayEnclosure); | 1067 visitor->trace(m_overlayEnclosure); |
997 visitor->trace(m_playButton); | 1068 visitor->trace(m_playButton); |
998 visitor->trace(m_currentTimeDisplay); | 1069 visitor->trace(m_currentTimeDisplay); |
999 visitor->trace(m_timeline); | 1070 visitor->trace(m_timeline); |
1000 visitor->trace(m_muteButton); | 1071 visitor->trace(m_muteButton); |
1001 visitor->trace(m_volumeSlider); | 1072 visitor->trace(m_volumeSlider); |
1002 visitor->trace(m_toggleClosedCaptionsButton); | 1073 visitor->trace(m_toggleClosedCaptionsButton); |
1003 visitor->trace(m_fullscreenButton); | 1074 visitor->trace(m_fullscreenButton); |
1004 visitor->trace(m_downloadButton); | 1075 visitor->trace(m_downloadButton); |
1005 visitor->trace(m_durationDisplay); | 1076 visitor->trace(m_durationDisplay); |
1006 visitor->trace(m_enclosure); | 1077 visitor->trace(m_enclosure); |
1007 visitor->trace(m_textTrackList); | 1078 visitor->trace(m_textTrackList); |
1008 visitor->trace(m_overflowMenu); | 1079 visitor->trace(m_overflowMenu); |
1009 visitor->trace(m_overflowList); | 1080 visitor->trace(m_overflowList); |
1010 visitor->trace(m_castButton); | 1081 visitor->trace(m_castButton); |
1011 visitor->trace(m_overlayCastButton); | 1082 visitor->trace(m_overlayCastButton); |
1012 visitor->trace(m_mediaEventListener); | 1083 visitor->trace(m_mediaEventListener); |
1013 visitor->trace(m_windowEventListener); | 1084 visitor->trace(m_windowEventListener); |
1014 visitor->trace(m_orientationLockDelegate); | 1085 visitor->trace(m_orientationLockDelegate); |
1015 HTMLDivElement::trace(visitor); | 1086 HTMLDivElement::trace(visitor); |
1016 } | 1087 } |
1017 | 1088 |
1018 } // namespace blink | 1089 } // namespace blink |
OLD | NEW |