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

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

Issue 914043002: Tap on the video element toggles controls visibility (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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/MediaControls.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/MediaControls.cpp
diff --git a/Source/core/html/shadow/MediaControls.cpp b/Source/core/html/shadow/MediaControls.cpp
index bd04ac6ae8d41c0d3a59898d537b5670bfb522cc..49c51408b3a3775223b2ac3200bff19b3f30a732 100644
--- a/Source/core/html/shadow/MediaControls.cpp
+++ b/Source/core/html/shadow/MediaControls.cpp
@@ -435,12 +435,44 @@ void MediaControls::stoppedCasting()
m_overlayCastButton->setIsPlayingRemotely(false);
}
+bool MediaControls::isInactiveElement(Node* node) const
+{
+ if (node == m_mediaElement
+ || node == m_textDisplayContainer
+ || node == m_overlayEnclosure
+ || node == m_enclosure)
+ return true;
+
+ return false;
+}
+
void MediaControls::defaultEventHandler(Event* event)
{
HTMLDivElement::defaultEventHandler(event);
m_wasLastEventTouch = event->isTouchEvent() || event->isGestureEvent()
|| (event->isMouseEvent() && toMouseEvent(event)->fromTouch());
+ // Separate tap gestures from mouse clicks unless the tap
+ // is intended for an input element like a button.
+ if (event->type() == EventTypeNames::gesturetap) {
+ Node * targetNode = event->target() ? event->target()->toNode() : nullptr;
+ if (!targetNode || isInactiveElement(targetNode)) {
+ // Do not generate mouse events from this tap
philipj_slow 2015/02/11 06:57:38 Is this necessary? How about simply listening to c
+ event->preventDefault();
qinmin 2015/02/11 22:29:12 What if there is a onclick eventhandler on the Med
Tima Vaisburd 2015/02/11 22:48:20 In this case the solution won't work. We can't sim
philipj_slow 2015/02/12 02:31:20 What causes the pause? Maybe you were testing whil
+
+ if (!m_panel->isOpaque()) {
+ makeOpaque();
+ startHideMediaControlsTimer();
+ // Prevent immediate hiding by playbackProgressed()
philipj_slow 2015/02/11 06:57:38 This seems like a bit of a hack, I think it would
Tima Vaisburd 2015/02/12 03:18:02 Yes, I agree, but so far I haven;t come up with a
+ m_isMouseOverControls = true;
+ } else {
+ stopHideMediaControlsTimer();
+ makeTransparent();
+ }
+ }
+ return;
+ }
+
if (event->type() == EventTypeNames::mouseover) {
if (!containsRelatedTarget(event)) {
m_isMouseOverControls = true;
« no previous file with comments | « Source/core/html/shadow/MediaControls.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698