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

Unified Diff: Source/core/events/EventPath.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: Test added - now looking for LGTM or detailed comments. 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/events/EventPath.cpp
diff --git a/Source/core/events/EventPath.cpp b/Source/core/events/EventPath.cpp
index 62a549a8e667dca1d6f233a21e8627ab531519b2..c06b41daae71f87ba5ddba81ec6ddeb87dd6f2bf 100644
--- a/Source/core/events/EventPath.cpp
+++ b/Source/core/events/EventPath.cpp
@@ -58,8 +58,11 @@ static inline bool inTheSameScope(ShadowRoot* shadowRoot, EventTarget* target)
return target->toNode() && target->toNode()->treeScope().rootNode() == shadowRoot;
}
-static inline EventDispatchBehavior determineDispatchBehavior(Event* event, ShadowRoot* shadowRoot, EventTarget* target)
+static inline EventDispatchBehavior determineDispatchBehavior(Event* event, Node* current, EventTarget* target)
{
+ ShadowRoot* shadowRoot = current->containingShadowRoot();
+ if (!shadowRoot)
+ return RetargetEvent;
// WebKit never allowed selectstart event to cross the the shadow DOM boundary.
// Changing this breaks existing sites.
// See https://bugs.webkit.org/show_bug.cgi?id=52195 for details.
@@ -76,6 +79,9 @@ static inline EventDispatchBehavior determineDispatchBehavior(Event* event, Shad
|| eventType == EventTypeNames::selectstart))
return StayInsideShadowDOM;
+ if (current->keepEventInShadowDOM(event))
+ return StayInsideShadowDOM;
+
return RetargetEvent;
}
@@ -118,8 +124,11 @@ void EventPath::calculatePath()
addNodeEventContext(current);
if (!m_node->inDocument())
return;
+ bool stopAtShadowRoot = false;
while (current) {
- if (current->isShadowRoot() && m_event && determineDispatchBehavior(m_event, toShadowRoot(current), m_node) == StayInsideShadowDOM)
+ if (m_event && determineDispatchBehavior(m_event, current, m_node) == StayInsideShadowDOM)
hayato 2014/07/30 03:19:11 After the patch, determineDispatchBehavior will be
aberent 2014/07/31 10:52:47 See discussion on main review thread.
+ stopAtShadowRoot = true;
+ if (current->isShadowRoot() && stopAtShadowRoot)
break;
WillBeHeapVector<RawPtrWillBeMember<InsertionPoint>, 8> insertionPoints;
collectDestinationInsertionPoints(*current, insertionPoints);

Powered by Google App Engine
This is Rietveld 408576698