| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 return referenceNode.parentNode(); | 46 return referenceNode.parentNode(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 return &referenceNode; | 49 return &referenceNode; |
| 50 } | 50 } |
| 51 | 51 |
| 52 static inline bool shouldStopAtShadowRoot(Event& event, ShadowRoot& shadowRoot,
EventTarget& target) | 52 static inline bool shouldStopAtShadowRoot(Event& event, ShadowRoot& shadowRoot,
EventTarget& target) |
| 53 { | 53 { |
| 54 if (shadowRoot.isV1()) { | 54 if (shadowRoot.isV1()) { |
| 55 // In v1, an event is scoped by default unless event.composed flag is se
t. | 55 // In v1, an event is scoped by default unless event.composed flag is se
t. |
| 56 return !event.composed() && target.toNode() && target.toNode()->shadowHo
st() == shadowRoot.host(); | 56 return !event.composed() && target.toNode() && target.toNode()->ownerSha
dowHost() == shadowRoot.host(); |
| 57 } | 57 } |
| 58 // Ignores event.composed() for v0. | 58 // Ignores event.composed() for v0. |
| 59 // Instead, use event.isScopedInV0() for backward compatibility. | 59 // Instead, use event.isScopedInV0() for backward compatibility. |
| 60 return event.isScopedInV0() && target.toNode() && target.toNode()->shadowHos
t() == shadowRoot.host(); | 60 return event.isScopedInV0() && target.toNode() && target.toNode()->ownerShad
owHost() == shadowRoot.host(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 EventPath::EventPath(Node& node, Event* event) | 63 EventPath::EventPath(Node& node, Event* event) |
| 64 : m_node(node) | 64 : m_node(node) |
| 65 , m_event(event) | 65 , m_event(event) |
| 66 { | 66 { |
| 67 initialize(); | 67 initialize(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void EventPath::initializeWith(Node& node, Event* event) | 70 void EventPath::initializeWith(Node& node, Event* event) |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 if (current->isChildOfV1ShadowHost()) { | 145 if (current->isChildOfV1ShadowHost()) { |
| 146 if (HTMLSlotElement* slot = current->assignedSlot()) { | 146 if (HTMLSlotElement* slot = current->assignedSlot()) { |
| 147 current = slot; | 147 current = slot; |
| 148 nodesInPath.append(current); | 148 nodesInPath.append(current); |
| 149 continue; | 149 continue; |
| 150 } | 150 } |
| 151 } | 151 } |
| 152 if (current->isShadowRoot()) { | 152 if (current->isShadowRoot()) { |
| 153 if (m_event && shouldStopAtShadowRoot(*m_event, *toShadowRoot(curren
t), *m_node)) | 153 if (m_event && shouldStopAtShadowRoot(*m_event, *toShadowRoot(curren
t), *m_node)) |
| 154 break; | 154 break; |
| 155 current = current->shadowHost(); | 155 current = current->ownerShadowHost(); |
| 156 nodesInPath.append(current); | 156 nodesInPath.append(current); |
| 157 } else { | 157 } else { |
| 158 current = current->parentNode(); | 158 current = current->parentNode(); |
| 159 if (current) | 159 if (current) |
| 160 nodesInPath.append(current); | 160 nodesInPath.append(current); |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 | 163 |
| 164 m_nodeEventContexts.reserveCapacity(nodesInPath.size()); | 164 m_nodeEventContexts.reserveCapacity(nodesInPath.size()); |
| 165 for (Node* nodeInPath : nodesInPath) { | 165 for (Node* nodeInPath : nodesInPath) { |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 DEFINE_TRACE(EventPath) | 383 DEFINE_TRACE(EventPath) |
| 384 { | 384 { |
| 385 visitor->trace(m_nodeEventContexts); | 385 visitor->trace(m_nodeEventContexts); |
| 386 visitor->trace(m_node); | 386 visitor->trace(m_node); |
| 387 visitor->trace(m_event); | 387 visitor->trace(m_event); |
| 388 visitor->trace(m_treeScopeEventContexts); | 388 visitor->trace(m_treeScopeEventContexts); |
| 389 visitor->trace(m_windowEventContext); | 389 visitor->trace(m_windowEventContext); |
| 390 } | 390 } |
| 391 | 391 |
| 392 } // namespace blink | 392 } // namespace blink |
| OLD | NEW |