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

Unified Diff: Source/core/html/shadow/MediaControlElements.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: Fix layout test - was hitting overlay play button. 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
« no previous file with comments | « Source/core/html/shadow/MediaControlElements.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/shadow/MediaControlElements.cpp
diff --git a/Source/core/html/shadow/MediaControlElements.cpp b/Source/core/html/shadow/MediaControlElements.cpp
index 4aeb87a4f86bb20ff86ff545218f831be198d9fc..5474fb758a3b82a88523b2f8b6babbdf3dd7b490 100644
--- a/Source/core/html/shadow/MediaControlElements.cpp
+++ b/Source/core/html/shadow/MediaControlElements.cpp
@@ -59,6 +59,33 @@ static const AtomicString& getMediaControlTimeRemainingDisplayElementShadowPseud
static const double fadeInDuration = 0.1;
static const double fadeOutDuration = 0.3;
+static bool isUserInteractionEvent(Event* event)
+{
+ const AtomicString& type = event->type();
+ return type == EventTypeNames::mousedown
+ || type == EventTypeNames::mouseup
+ || type == EventTypeNames::click
+ || type == EventTypeNames::dblclick
+ || event->isKeyboardEvent()
+ || event->isTouchEvent();
+}
+
+// Sliders (the volume control and timeline) need to capture some additional events used when dragging the thumb.
+static bool isUserInteractionEventForSlider(Event* event)
+{
+ const AtomicString& type = event->type();
+ return type == EventTypeNames::mousedown
+ || type == EventTypeNames::mouseup
+ || type == EventTypeNames::click
+ || type == EventTypeNames::dblclick
+ || type == EventTypeNames::mouseover
+ || type == EventTypeNames::mouseout
+ || type == EventTypeNames::mousemove
+ || event->isKeyboardEvent()
+ || event->isTouchEvent();
+}
+
+
MediaControlPanelElement::MediaControlPanelElement(MediaControls& mediaControls)
: MediaControlDivElement(mediaControls, MediaControlsPanel)
, m_isDisplayed(false)
@@ -147,6 +174,11 @@ void MediaControlPanelElement::setIsDisplayed(bool isDisplayed)
m_isDisplayed = isDisplayed;
}
+bool MediaControlPanelElement::keepEventInNode(Event* event)
+{
+ return isUserInteractionEvent(event);
+}
+
// ----------------------------
MediaControlPanelEnclosureElement::MediaControlPanelEnclosureElement(MediaControls& mediaControls)
@@ -295,6 +327,11 @@ const AtomicString& MediaControlOverlayPlayButtonElement::shadowPseudoId() const
return id;
}
+bool MediaControlOverlayPlayButtonElement::keepEventInNode(Event* event)
+{
+ return isUserInteractionEvent(event);
+}
+
// ----------------------------
@@ -408,6 +445,11 @@ const AtomicString& MediaControlTimelineElement::shadowPseudoId() const
return id;
}
+bool MediaControlTimelineElement::keepEventInNode(Event* event)
+{
+ return isUserInteractionEventForSlider(event);
+}
+
// ----------------------------
MediaControlVolumeSliderElement::MediaControlVolumeSliderElement(MediaControls& mediaControls)
@@ -471,6 +513,11 @@ const AtomicString& MediaControlVolumeSliderElement::shadowPseudoId() const
return id;
}
+bool MediaControlVolumeSliderElement::keepEventInNode(Event* event)
+{
+ return isUserInteractionEventForSlider(event);
+}
+
// ----------------------------
MediaControlFullscreenButtonElement::MediaControlFullscreenButtonElement(MediaControls& mediaControls)
« no previous file with comments | « Source/core/html/shadow/MediaControlElements.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698