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

Side by Side Diff: Source/core/html/HTMLMediaElement.cpp

Issue 182613006: Remove media controls when not in use. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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
« no previous file with comments | « no previous file | 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) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 2285 matching lines...) Expand 10 before | Expand all | Expand 10 after
2296 } 2296 }
2297 2297
2298 bool HTMLMediaElement::controls() const 2298 bool HTMLMediaElement::controls() const
2299 { 2299 {
2300 LocalFrame* frame = document().frame(); 2300 LocalFrame* frame = document().frame();
2301 2301
2302 // always show controls when scripting is disabled 2302 // always show controls when scripting is disabled
2303 if (frame && !frame->script().canExecuteScripts(NotAboutToExecuteScript)) 2303 if (frame && !frame->script().canExecuteScripts(NotAboutToExecuteScript))
2304 return true; 2304 return true;
2305 2305
2306 // Always show controls when in full screen mode. 2306 #if !OS(ANDROID)
2307 // Always show controls when in full screen mode, except on Android which
qinmin 2014/02/27 18:07:40 This is a wrong assumption
2308 // has a native UI overlay player.
2307 if (isFullscreen()) 2309 if (isFullscreen())
acolwell GONE FROM CHROMIUM 2014/02/27 18:35:23 This and the "script disabled" code above seems mi
2308 return true; 2310 return true;
2311 #endif
2309 2312
2310 return fastHasAttribute(controlsAttr); 2313 return fastHasAttribute(controlsAttr);
2311 } 2314 }
2312 2315
2313 void HTMLMediaElement::setControls(bool b) 2316 void HTMLMediaElement::setControls(bool b)
2314 { 2317 {
2315 WTF_LOG(Media, "HTMLMediaElement::setControls(%s)", boolString(b)); 2318 WTF_LOG(Media, "HTMLMediaElement::setControls(%s)", boolString(b));
2316 setBooleanAttribute(controlsAttr, b); 2319 setBooleanAttribute(controlsAttr, b);
2317 } 2320 }
2318 2321
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after
3588 3591
3589 if (!controls() || !inDocument()) 3592 if (!controls() || !inDocument())
3590 mediaControls->hide(); 3593 mediaControls->hide();
3591 3594
3592 return true; 3595 return true;
3593 } 3596 }
3594 3597
3595 void HTMLMediaElement::configureMediaControls() 3598 void HTMLMediaElement::configureMediaControls()
3596 { 3599 {
3597 if (!controls() || !inDocument()) { 3600 if (!controls() || !inDocument()) {
3598 if (hasMediaControls()) 3601 if (hasMediaControls()) {
3599 mediaControls()->hide(); 3602 if (!controls())
3603 ensureUserAgentShadowRoot().removeChild(mediaControls());
acolwell GONE FROM CHROMIUM 2014/02/27 18:35:23 Why is this needed? What are you trying to solve w
3604 else
3605 mediaControls()->hide();
3606 }
3600 return; 3607 return;
3601 } 3608 }
3602 3609
3603 if (!hasMediaControls() && !createMediaControls()) 3610 if (!hasMediaControls() && !createMediaControls())
3604 return; 3611 return;
3605 3612
3606 mediaControls()->show(); 3613 mediaControls()->show();
3607 } 3614 }
3608 3615
3609 void HTMLMediaElement::configureTextTrackDisplay(VisibilityChangeAssumption assu mption) 3616 void HTMLMediaElement::configureTextTrackDisplay(VisibilityChangeAssumption assu mption)
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
3898 { 3905 {
3899 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource)); 3906 m_mediaSource->setWebMediaSourceAndOpen(adoptPtr(webMediaSource));
3900 } 3907 }
3901 3908
3902 bool HTMLMediaElement::isInteractiveContent() const 3909 bool HTMLMediaElement::isInteractiveContent() const
3903 { 3910 {
3904 return fastHasAttribute(controlsAttr); 3911 return fastHasAttribute(controlsAttr);
3905 } 3912 }
3906 3913
3907 } 3914 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698