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

Side by Side Diff: Source/core/events/EventPathWalker.cpp

Issue 26558004: Revert 158219 "Move dom/*Event* to events to match the DOM vs. E..." (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/1651/
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/events/EventPathWalker.h ('k') | Source/core/events/EventQueue.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its
11 * contributors may be used to endorse or promote products derived from
12 * this software without specific prior written permission.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
18 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27 #include "config.h"
28 #include "core/events/EventPathWalker.h"
29
30 #include "core/dom/shadow/ElementShadow.h"
31 #include "core/dom/shadow/InsertionPoint.h"
32 #include "core/dom/shadow/ShadowRoot.h"
33
34 namespace WebCore {
35
36 EventPathWalker::EventPathWalker(const Node* node)
37 : m_node(node)
38 , m_distributedNode(node)
39 , m_isVisitingInsertionPointInReprojection(false)
40 {
41 ASSERT(node);
42 node->document().updateDistributionForNodeIfNeeded(const_cast<Node*>(node));
43 }
44
45 Node* EventPathWalker::parent(const Node* node)
46 {
47 EventPathWalker walker(node);
48 walker.moveToParent();
49 return walker.node();
50 }
51
52 void EventPathWalker::moveToParent()
53 {
54 ASSERT(m_node);
55 ASSERT(m_distributedNode);
56 if (ElementShadow* shadow = shadowOfParent(m_node)) {
57 if (InsertionPoint* insertionPoint = shadow->findInsertionPointFor(m_dis tributedNode)) {
58 m_node = insertionPoint;
59 m_isVisitingInsertionPointInReprojection = true;
60 return;
61 }
62 }
63 if (!m_node->isShadowRoot()) {
64 m_node = m_node->parentNode();
65 if (!(m_node && m_node->isShadowRoot() && toShadowRoot(m_node)->insertio nPoint()))
66 m_distributedNode = m_node;
67 m_isVisitingInsertionPointInReprojection = false;
68 return;
69 }
70
71 const ShadowRoot* shadowRoot = toShadowRoot(m_node);
72 if (InsertionPoint* insertionPoint = shadowRoot->insertionPoint()) {
73 m_node = insertionPoint;
74 m_isVisitingInsertionPointInReprojection = true;
75 return;
76 }
77 m_node = shadowRoot->host();
78 m_distributedNode = m_node;
79 m_isVisitingInsertionPointInReprojection = false;
80 }
81
82 } // namespace
OLDNEW
« no previous file with comments | « Source/core/events/EventPathWalker.h ('k') | Source/core/events/EventQueue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698