Chromium Code Reviews| Index: Source/core/html/shadow/MediaControlElementTypes.cpp |
| diff --git a/Source/core/html/shadow/MediaControlElementTypes.cpp b/Source/core/html/shadow/MediaControlElementTypes.cpp |
| index 74c4328af679e52feaab3c1de991f37e9c31abc2..ed284c6fdb8fc6b87a2a0acf318b7e40304e56cd 100644 |
| --- a/Source/core/html/shadow/MediaControlElementTypes.cpp |
| +++ b/Source/core/html/shadow/MediaControlElementTypes.cpp |
| @@ -71,6 +71,7 @@ MediaControlElement::MediaControlElement(MediaControls& mediaControls, MediaCont |
| : m_mediaControls(mediaControls) |
| , m_displayType(displayType) |
| , m_element(element) |
| + , m_isHidden(false) |
| { |
| } |
| @@ -82,11 +83,13 @@ HTMLMediaElement& MediaControlElement::mediaElement() const |
| void MediaControlElement::hide() |
| { |
| m_element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); |
|
philipj_slow
2014/07/22 12:56:24
Instead of a flag, hide() and show() could be chan
|
| + m_isHidden = true; |
| } |
| void MediaControlElement::show() |
| { |
| m_element->removeInlineStyleProperty(CSSPropertyDisplay); |
| + m_isHidden = false; |
| } |
| void MediaControlElement::setDisplayType(MediaControlElementType displayType) |
| @@ -137,6 +140,17 @@ void MediaControlInputElement::trace(Visitor* visitor) |
| HTMLInputElement::trace(visitor); |
| } |
| +void* MediaControlInputElement::preDispatchEventHandler(Event* event) |
| +{ |
| + if (event->type() == EventTypeNames::click && !isHidden()) { |
|
philipj_slow
2014/07/22 12:56:24
Why does it actually matter if it's hidden? How ar
|
| + // If the media control is visible the only sensible behaviour is for the media control to handle the click. Anything |
| + // will confuse the user (however the page thinks the click should be handled). |
| + event->stopPropagation(); |
| + return 0; |
| + } |
| + return HTMLInputElement::preDispatchEventHandler(event); |
| +} |
| + |
| // ---------------------------- |
| MediaControlTimeDisplayElement::MediaControlTimeDisplayElement(MediaControls& mediaControls, MediaControlElementType displayType) |