Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2014 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 #include "core/events/TreeScopeEventContext.h" | 28 #include "core/events/TreeScopeEventContext.h" |
| 29 | 29 |
| 30 #include "core/dom/StaticNodeList.h" | 30 #include "core/dom/StaticNodeList.h" |
| 31 #include "core/dom/shadow/ShadowRoot.h" | 31 #include "core/dom/shadow/ShadowRoot.h" |
| 32 #include "core/events/EventPath.h" | 32 #include "core/events/EventPath.h" |
| 33 #include "core/events/TouchEventContext.h" | 33 #include "core/events/TouchEventContext.h" |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 PassRefPtrWillBeRawPtr<StaticNodeList> TreeScopeEventContext::ensureEventPath(Ev entPath& path) | 37 Vector<RefPtrWillBeRawPtr<EventTarget>>& TreeScopeEventContext::ensureEventPath( EventPath& path) |
| 38 { | 38 { |
| 39 if (m_eventPath) | 39 if (m_eventPath) |
| 40 return m_eventPath; | 40 return *m_eventPath; |
| 41 | 41 |
| 42 WillBeHeapVector<RefPtrWillBeMember<Node>> nodes; | 42 LocalDOMWindow* window = path.windowEventContext().window(); |
|
hayato
2015/01/15 04:15:28
Could you make sure that calling path.windowEventC
kojii
2015/01/15 06:56:44
Done.
| |
| 43 nodes.reserveInitialCapacity(path.size()); | 43 m_eventPath = adoptPtrWillBeNoop(new WillBeHeapVector<RefPtrWillBeRawPtr<Eve ntTarget>>()); |
| 44 m_eventPath->reserveCapacity(path.size() + window ? 1 : 0); | |
| 44 for (size_t i = 0; i < path.size(); ++i) { | 45 for (size_t i = 0; i < path.size(); ++i) { |
| 45 Node& rootNode = path[i].treeScopeEventContext().rootNode(); | 46 Node& rootNode = path[i].treeScopeEventContext().rootNode(); |
| 46 if (rootNode.isShadowRoot() && toShadowRoot(rootNode).type() == ShadowRo ot::AuthorShadowRoot) | 47 if (rootNode.isShadowRoot() && toShadowRoot(rootNode).type() == ShadowRo ot::AuthorShadowRoot) |
| 47 nodes.append(path[i].node()); | 48 m_eventPath->append(path[i].node()); |
| 48 else if (path[i].treeScopeEventContext().isInclusiveAncestorOf(*this)) | 49 else if (path[i].treeScopeEventContext().isInclusiveAncestorOf(*this)) |
| 49 nodes.append(path[i].node()); | 50 m_eventPath->append(path[i].node()); |
| 50 } | 51 } |
| 51 m_eventPath = StaticNodeList::adopt(nodes); | 52 if (window) |
| 52 return m_eventPath; | 53 m_eventPath->append(window); |
| 54 return *m_eventPath; | |
| 53 } | 55 } |
| 54 | 56 |
| 55 TouchEventContext* TreeScopeEventContext::ensureTouchEventContext() | 57 TouchEventContext* TreeScopeEventContext::ensureTouchEventContext() |
| 56 { | 58 { |
| 57 if (!m_touchEventContext) | 59 if (!m_touchEventContext) |
| 58 m_touchEventContext = TouchEventContext::create(); | 60 m_touchEventContext = TouchEventContext::create(); |
| 59 return m_touchEventContext.get(); | 61 return m_touchEventContext.get(); |
| 60 } | 62 } |
| 61 | 63 |
| 62 PassRefPtrWillBeRawPtr<TreeScopeEventContext> TreeScopeEventContext::create(Tree Scope& treeScope) | 64 PassRefPtrWillBeRawPtr<TreeScopeEventContext> TreeScopeEventContext::create(Tree Scope& treeScope) |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 90 int TreeScopeEventContext::calculatePrePostOrderNumber(int orderNumber) | 92 int TreeScopeEventContext::calculatePrePostOrderNumber(int orderNumber) |
| 91 { | 93 { |
| 92 m_preOrder = orderNumber; | 94 m_preOrder = orderNumber; |
| 93 for (size_t i = 0; i < m_children.size(); ++i) | 95 for (size_t i = 0; i < m_children.size(); ++i) |
| 94 orderNumber = m_children[i]->calculatePrePostOrderNumber(orderNumber + 1 ); | 96 orderNumber = m_children[i]->calculatePrePostOrderNumber(orderNumber + 1 ); |
| 95 m_postOrder = orderNumber + 1; | 97 m_postOrder = orderNumber + 1; |
| 96 return orderNumber + 1; | 98 return orderNumber + 1; |
| 97 } | 99 } |
| 98 | 100 |
| 99 } | 101 } |
| OLD | NEW |