Chromium Code Reviews| 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); |