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

Side by Side Diff: Source/core/html/shadow/MediaControls.cpp

Issue 1240573005: Make video.webkitSupportsFullscreen an alias of document.fullscreenEnabled (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: move comments to assert descriptions Created 5 years, 5 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/HTMLVideoElement.idl ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 "config.h" 27 #include "config.h"
28 #include "core/html/shadow/MediaControls.h" 28 #include "core/html/shadow/MediaControls.h"
29 29
30 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 30 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
31 #include "core/dom/ClientRect.h" 31 #include "core/dom/ClientRect.h"
32 #include "core/dom/Fullscreen.h"
32 #include "core/events/MouseEvent.h" 33 #include "core/events/MouseEvent.h"
33 #include "core/frame/Settings.h" 34 #include "core/frame/Settings.h"
34 #include "core/html/HTMLMediaElement.h" 35 #include "core/html/HTMLMediaElement.h"
35 #include "core/html/MediaController.h" 36 #include "core/html/MediaController.h"
36 #include "core/html/track/TextTrackContainer.h" 37 #include "core/html/track/TextTrackContainer.h"
37 #include "core/layout/LayoutTheme.h" 38 #include "core/layout/LayoutTheme.h"
38 39
39 namespace blink { 40 namespace blink {
40 41
41 // If you change this value, then also update the corresponding value in 42 // If you change this value, then also update the corresponding value in
42 // LayoutTests/media/media-controls.js. 43 // LayoutTests/media/media-controls.js.
43 static const double timeWithoutMouseMovementBeforeHidingMediaControls = 3; 44 static const double timeWithoutMouseMovementBeforeHidingMediaControls = 3;
44 45
45 static bool fullscreenIsSupported(const Document& document) 46 static bool shouldShowFullscreenButton(const HTMLMediaElement& mediaElement)
46 { 47 {
47 return !document.settings() || document.settings()->fullscreenSupported(); 48 // Unconditionally allow the user to exit fullscreen if we are in it
49 // now. Especially on android, when we might not yet know if
50 // fullscreen is supported, we sometimes guess incorrectly and show
51 // the button earlier, and we don't want to remove it here if the
52 // user chose to enter fullscreen. crbug.com/500732 .
53 if (mediaElement.isFullscreen())
54 return true;
55
56 if (!mediaElement.hasVideo())
57 return false;
58
59 if (!Fullscreen::fullscreenEnabled(mediaElement.document()))
60 return false;
61
62 return true;
48 } 63 }
49 64
50 MediaControls::MediaControls(HTMLMediaElement& mediaElement) 65 MediaControls::MediaControls(HTMLMediaElement& mediaElement)
51 : HTMLDivElement(mediaElement.document()) 66 : HTMLDivElement(mediaElement.document())
52 , m_mediaElement(&mediaElement) 67 , m_mediaElement(&mediaElement)
53 , m_overlayEnclosure(nullptr) 68 , m_overlayEnclosure(nullptr)
54 , m_overlayPlayButton(nullptr) 69 , m_overlayPlayButton(nullptr)
55 , m_overlayCastButton(nullptr) 70 , m_overlayCastButton(nullptr)
56 , m_enclosure(nullptr) 71 , m_enclosure(nullptr)
57 , m_panel(nullptr) 72 , m_panel(nullptr)
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 m_timeline->setPosition(mediaElement().currentTime()); 192 m_timeline->setPosition(mediaElement().currentTime());
178 193
179 if (!mediaElement().hasAudio()) 194 if (!mediaElement().hasAudio())
180 m_volumeSlider->hide(); 195 m_volumeSlider->hide();
181 else 196 else
182 m_volumeSlider->show(); 197 m_volumeSlider->show();
183 updateVolume(); 198 updateVolume();
184 199
185 refreshClosedCaptionsButtonVisibility(); 200 refreshClosedCaptionsButtonVisibility();
186 201
187 // Unconditionally allow the user to exit fullscreen if we are in it 202 if (shouldShowFullscreenButton(mediaElement()))
188 // now. Especially on android, when we might not yet know if
189 // fullscreen is supported, we sometimes guess incorrectly and show
190 // the button earlier, and we don't want to remove it here if the
191 // user chose to enter fullscreen. crbug.com/500732 .
192 if ((mediaElement().hasVideo() && fullscreenIsSupported(document()))
193 || mediaElement().isFullscreen())
194 m_fullScreenButton->show(); 203 m_fullScreenButton->show();
195 else 204 else
196 m_fullScreenButton->hide(); 205 m_fullScreenButton->hide();
197 206
198 refreshCastButtonVisibility(); 207 refreshCastButtonVisibility();
199 makeOpaque(); 208 makeOpaque();
200 } 209 }
201 210
202 LayoutObject* MediaControls::layoutObjectForTextTrackLayout() 211 LayoutObject* MediaControls::layoutObjectForTextTrackLayout()
203 { 212 {
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 visitor->trace(m_toggleClosedCaptionsButton); 548 visitor->trace(m_toggleClosedCaptionsButton);
540 visitor->trace(m_fullScreenButton); 549 visitor->trace(m_fullScreenButton);
541 visitor->trace(m_durationDisplay); 550 visitor->trace(m_durationDisplay);
542 visitor->trace(m_enclosure); 551 visitor->trace(m_enclosure);
543 visitor->trace(m_castButton); 552 visitor->trace(m_castButton);
544 visitor->trace(m_overlayCastButton); 553 visitor->trace(m_overlayCastButton);
545 HTMLDivElement::trace(visitor); 554 HTMLDivElement::trace(visitor);
546 } 555 }
547 556
548 } 557 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLVideoElement.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698