Chromium Code Reviews| Index: Source/core/html/HTMLMediaElement.cpp |
| diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp |
| index 35f8cd734ac77d7fa55aba347ec080f1add8dda1..635ccc6c2502ef121e0931b03833bf43618478bf 100644 |
| --- a/Source/core/html/HTMLMediaElement.cpp |
| +++ b/Source/core/html/HTMLMediaElement.cpp |
| @@ -410,7 +410,7 @@ bool HTMLMediaElement::supportsFocus() const |
| return false; |
| // If no controls specified, we should still be able to focus the element if it has tabIndex. |
| - return controls() || HTMLElement::supportsFocus(); |
| + return shouldDisplayControls() || HTMLElement::supportsFocus(); |
| } |
| bool HTMLMediaElement::isMouseFocusable() const |
| @@ -468,7 +468,7 @@ void HTMLMediaElement::finishParsingChildren() |
| bool HTMLMediaElement::rendererIsNeeded(const RenderStyle& style) |
| { |
| - return controls() ? HTMLElement::rendererIsNeeded(style) : false; |
| + return shouldDisplayControls() ? HTMLElement::rendererIsNeeded(style) : false; |
| } |
| RenderObject* HTMLMediaElement::createRenderer(RenderStyle*) |
| @@ -2297,6 +2297,11 @@ void HTMLMediaElement::setLoop(bool b) |
| bool HTMLMediaElement::controls() const |
| { |
| + return fastHasAttribute(controlsAttr); |
| +} |
| + |
| +bool HTMLMediaElement::shouldDisplayControls() const |
| +{ |
| LocalFrame* frame = document().frame(); |
| // always show controls when scripting is disabled |
| @@ -2307,7 +2312,7 @@ bool HTMLMediaElement::controls() const |
| if (isFullscreen()) |
| return true; |
| - return fastHasAttribute(controlsAttr); |
| + return controls(); |
| } |
| void HTMLMediaElement::setControls(bool b) |
| @@ -3586,7 +3591,7 @@ bool HTMLMediaElement::createMediaControls() |
| ensureUserAgentShadowRoot().appendChild(mediaControls); |
| - if (!controls() || !inDocument()) |
| + if (!shouldDisplayControls() || !inDocument()) |
| mediaControls->hide(); |
| return true; |
| @@ -3594,9 +3599,13 @@ bool HTMLMediaElement::createMediaControls() |
| void HTMLMediaElement::configureMediaControls() |
| { |
| - if (!controls() || !inDocument()) { |
| - if (hasMediaControls()) |
| - mediaControls()->hide(); |
| + if (!shouldDisplayControls() || !inDocument()) { |
| + if (hasMediaControls()) { |
| + if (!shouldDisplayControls()) |
| + userAgentShadowRoot()->removeChild(mediaControls()); |
|
acolwell GONE FROM CHROMIUM
2014/03/05 00:09:50
This still doesn't seem right to me. These control
Fredrik Öhrn
2014/03/06 10:20:16
I can probably patch something together using that
acolwell GONE FROM CHROMIUM
2014/03/06 16:30:56
I guess, I'm confused as to why this is ugly.
|
| + else |
| + mediaControls()->hide(); |
| + } |
| return; |
| } |