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

Side by Side Diff: third_party/WebKit/Source/core/events/TreeScopeEventContext.cpp

Issue 1852663002: Oilpan: Remove WillBe types (part 9) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 // (3) If |this| is descendent of |other|, exclude if any closed shadow root in between. 50 // (3) If |this| is descendent of |other|, exclude if any closed shadow root in between.
51 if (isDescendantOf(other)) 51 if (isDescendantOf(other))
52 return !containingClosedShadowTree()->isDescendantOf(other); 52 return !containingClosedShadowTree()->isDescendantOf(other);
53 53
54 // (4) |this| and |other| must be in exclusive branches. 54 // (4) |this| and |other| must be in exclusive branches.
55 ASSERT(other.isExclusivePartOf(*this)); 55 ASSERT(other.isExclusivePartOf(*this));
56 return false; 56 return false;
57 } 57 }
58 58
59 WillBeHeapVector<RefPtrWillBeMember<EventTarget>>& TreeScopeEventContext::ensure EventPath(EventPath& path) 59 HeapVector<Member<EventTarget>>& TreeScopeEventContext::ensureEventPath(EventPat h& path)
60 { 60 {
61 if (m_eventPath) 61 if (m_eventPath)
62 return *m_eventPath; 62 return *m_eventPath;
63 63
64 m_eventPath = adoptPtrWillBeNoop(new WillBeHeapVector<RefPtrWillBeMember<Eve ntTarget>>()); 64 m_eventPath = new HeapVector<Member<EventTarget>>();
65 LocalDOMWindow* window = path.windowEventContext().window(); 65 LocalDOMWindow* window = path.windowEventContext().window();
66 m_eventPath->reserveCapacity(path.size() + (window ? 1 : 0)); 66 m_eventPath->reserveCapacity(path.size() + (window ? 1 : 0));
67 67
68 for (size_t i = 0; i < path.size(); ++i) { 68 for (size_t i = 0; i < path.size(); ++i) {
69 if (path[i].treeScopeEventContext().isUnclosedTreeOf(*this)) 69 if (path[i].treeScopeEventContext().isUnclosedTreeOf(*this))
70 m_eventPath->append(path[i].node()); 70 m_eventPath->append(path[i].node());
71 } 71 }
72 if (window) 72 if (window)
73 m_eventPath->append(window); 73 m_eventPath->append(window);
74 return *m_eventPath; 74 return *m_eventPath;
75 } 75 }
76 76
77 TouchEventContext* TreeScopeEventContext::ensureTouchEventContext() 77 TouchEventContext* TreeScopeEventContext::ensureTouchEventContext()
78 { 78 {
79 if (!m_touchEventContext) 79 if (!m_touchEventContext)
80 m_touchEventContext = TouchEventContext::create(); 80 m_touchEventContext = TouchEventContext::create();
81 return m_touchEventContext.get(); 81 return m_touchEventContext.get();
82 } 82 }
83 83
84 PassRefPtrWillBeRawPtr<TreeScopeEventContext> TreeScopeEventContext::create(Tree Scope& treeScope) 84 RawPtr<TreeScopeEventContext> TreeScopeEventContext::create(TreeScope& treeScope )
85 { 85 {
86 return adoptRefWillBeNoop(new TreeScopeEventContext(treeScope)); 86 return new TreeScopeEventContext(treeScope);
87 } 87 }
88 88
89 TreeScopeEventContext::TreeScopeEventContext(TreeScope& treeScope) 89 TreeScopeEventContext::TreeScopeEventContext(TreeScope& treeScope)
90 : m_treeScope(treeScope) 90 : m_treeScope(treeScope)
91 , m_rootNode(treeScope.rootNode()) 91 , m_rootNode(treeScope.rootNode())
92 , m_containingClosedShadowTree(nullptr) 92 , m_containingClosedShadowTree(nullptr)
93 , m_preOrder(-1) 93 , m_preOrder(-1)
94 , m_postOrder(-1) 94 , m_postOrder(-1)
95 { 95 {
96 } 96 }
97 97
98 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(TreeScopeEventContext)
99
100 DEFINE_TRACE(TreeScopeEventContext) 98 DEFINE_TRACE(TreeScopeEventContext)
101 { 99 {
102 visitor->trace(m_treeScope); 100 visitor->trace(m_treeScope);
103 visitor->trace(m_rootNode); 101 visitor->trace(m_rootNode);
104 visitor->trace(m_target); 102 visitor->trace(m_target);
105 visitor->trace(m_relatedTarget); 103 visitor->trace(m_relatedTarget);
106 visitor->trace(m_eventPath); 104 visitor->trace(m_eventPath);
107 visitor->trace(m_touchEventContext); 105 visitor->trace(m_touchEventContext);
108 visitor->trace(m_containingClosedShadowTree); 106 visitor->trace(m_containingClosedShadowTree);
109 #if ENABLE(OILPAN) 107 #if ENABLE(OILPAN)
110 visitor->trace(m_children); 108 visitor->trace(m_children);
111 #endif 109 #endif
112 } 110 }
113 111
114 int TreeScopeEventContext::calculateTreeOrderAndSetNearestAncestorClosedTree(int orderNumber, TreeScopeEventContext* nearestAncestorClosedTreeScopeEventContext) 112 int TreeScopeEventContext::calculateTreeOrderAndSetNearestAncestorClosedTree(int orderNumber, TreeScopeEventContext* nearestAncestorClosedTreeScopeEventContext)
115 { 113 {
116 m_preOrder = orderNumber; 114 m_preOrder = orderNumber;
117 m_containingClosedShadowTree = (rootNode().isShadowRoot() && !toShadowRoot(r ootNode()).isOpenOrV0()) ? this : nearestAncestorClosedTreeScopeEventContext; 115 m_containingClosedShadowTree = (rootNode().isShadowRoot() && !toShadowRoot(r ootNode()).isOpenOrV0()) ? this : nearestAncestorClosedTreeScopeEventContext;
118 for (size_t i = 0; i < m_children.size(); ++i) 116 for (size_t i = 0; i < m_children.size(); ++i)
119 orderNumber = m_children[i]->calculateTreeOrderAndSetNearestAncestorClos edTree(orderNumber + 1, containingClosedShadowTree()); 117 orderNumber = m_children[i]->calculateTreeOrderAndSetNearestAncestorClos edTree(orderNumber + 1, containingClosedShadowTree());
120 m_postOrder = orderNumber + 1; 118 m_postOrder = orderNumber + 1;
121 119
122 return orderNumber + 1; 120 return orderNumber + 1;
123 } 121 }
124 122
125 } // namespace blink 123 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/TreeScopeEventContext.h ('k') | third_party/WebKit/Source/core/events/UIEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698