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

Unified Diff: Source/core/html/shadow/MediaControlElementTypes.cpp

Issue 406213002: If the media controls are visible they should always grab clicks (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add missing comment Created 6 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 side-by-side diff with in-line comments
Download patch
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)

Powered by Google App Engine
This is Rietveld 408576698