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

Side by Side Diff: third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 STACK_ALLOCATED(); 43 STACK_ALLOCATED();
44 public: 44 public:
45 explicit DistributionPool(const ContainerNode&); 45 explicit DistributionPool(const ContainerNode&);
46 void clear(); 46 void clear();
47 ~DistributionPool(); 47 ~DistributionPool();
48 void distributeTo(InsertionPoint*, ElementShadow*); 48 void distributeTo(InsertionPoint*, ElementShadow*);
49 void populateChildren(const ContainerNode&); 49 void populateChildren(const ContainerNode&);
50 50
51 private: 51 private:
52 void detachNonDistributedNodes(); 52 void detachNonDistributedNodes();
53 WillBeHeapVector<RawPtrWillBeMember<Node>, 32> m_nodes; 53 HeapVector<Member<Node>, 32> m_nodes;
54 Vector<bool, 32> m_distributed; 54 Vector<bool, 32> m_distributed;
55 }; 55 };
56 56
57 inline DistributionPool::DistributionPool(const ContainerNode& parent) 57 inline DistributionPool::DistributionPool(const ContainerNode& parent)
58 { 58 {
59 populateChildren(parent); 59 populateChildren(parent);
60 } 60 }
61 61
62 inline void DistributionPool::clear() 62 inline void DistributionPool::clear()
63 { 63 {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 inline void DistributionPool::detachNonDistributedNodes() 121 inline void DistributionPool::detachNonDistributedNodes()
122 { 122 {
123 for (size_t i = 0; i < m_nodes.size(); ++i) { 123 for (size_t i = 0; i < m_nodes.size(); ++i) {
124 if (m_distributed[i]) 124 if (m_distributed[i])
125 continue; 125 continue;
126 if (m_nodes[i]->layoutObject()) 126 if (m_nodes[i]->layoutObject())
127 m_nodes[i]->lazyReattachIfAttached(); 127 m_nodes[i]->lazyReattachIfAttached();
128 } 128 }
129 } 129 }
130 130
131 PassOwnPtrWillBeRawPtr<ElementShadow> ElementShadow::create() 131 RawPtr<ElementShadow> ElementShadow::create()
132 { 132 {
133 return adoptPtrWillBeNoop(new ElementShadow()); 133 return (new ElementShadow());
134 } 134 }
135 135
136 ElementShadow::ElementShadow() 136 ElementShadow::ElementShadow()
137 : m_needsDistributionRecalc(false) 137 : m_needsDistributionRecalc(false)
138 , m_needsSelectFeatureSet(false) 138 , m_needsSelectFeatureSet(false)
139 { 139 {
140 } 140 }
141 141
142 ElementShadow::~ElementShadow() 142 ElementShadow::~ElementShadow()
143 { 143 {
(...skipping 16 matching lines...) Expand all
160 } else { 160 } else {
161 UseCounter::countDeprecation(shadowHost.document(), UseCounter::Elem entCreateShadowRootMultiple); 161 UseCounter::countDeprecation(shadowHost.document(), UseCounter::Elem entCreateShadowRootMultiple);
162 } 162 }
163 } else if (type == ShadowRootType::Open || type == ShadowRootType::Closed) { 163 } else if (type == ShadowRootType::Open || type == ShadowRootType::Closed) {
164 shadowHost.willAddFirstAuthorShadowRoot(); 164 shadowHost.willAddFirstAuthorShadowRoot();
165 } 165 }
166 166
167 for (ShadowRoot* root = m_shadowRoots.head(); root; root = root->olderShadow Root()) 167 for (ShadowRoot* root = m_shadowRoots.head(); root; root = root->olderShadow Root())
168 root->lazyReattachIfAttached(); 168 root->lazyReattachIfAttached();
169 169
170 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = ShadowRoot::create(shadowHost.do cument(), type); 170 RawPtr<ShadowRoot> shadowRoot = ShadowRoot::create(shadowHost.document(), ty pe);
171 shadowRoot->setParentOrShadowHostNode(&shadowHost); 171 shadowRoot->setParentOrShadowHostNode(&shadowHost);
172 shadowRoot->setParentTreeScope(shadowHost.treeScope()); 172 shadowRoot->setParentTreeScope(shadowHost.treeScope());
173 m_shadowRoots.push(shadowRoot.get()); 173 m_shadowRoots.push(shadowRoot.get());
174 setNeedsDistributionRecalc(); 174 setNeedsDistributionRecalc();
175 175
176 shadowRoot->insertedInto(&shadowHost); 176 shadowRoot->insertedInto(&shadowHost);
177 shadowHost.setChildNeedsStyleRecalc(); 177 shadowHost.setChildNeedsStyleRecalc();
178 shadowHost.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTraci ng::create(StyleChangeReason::Shadow)); 178 shadowHost.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTraci ng::create(StyleChangeReason::Shadow));
179 179
180 InspectorInstrumentation::didPushShadowRoot(&shadowHost, shadowRoot.get()); 180 InspectorInstrumentation::didPushShadowRoot(&shadowHost, shadowRoot.get());
181 181
182 return *shadowRoot; 182 return *shadowRoot;
183 } 183 }
184 184
185 #if !ENABLE(OILPAN) 185 #if !ENABLE(OILPAN)
186 void ElementShadow::removeDetachedShadowRoots() 186 void ElementShadow::removeDetachedShadowRoots()
187 { 187 {
188 // Dont protect this ref count. 188 // Dont protect this ref count.
189 Element* shadowHost = host(); 189 Element* shadowHost = host();
190 ASSERT(shadowHost); 190 ASSERT(shadowHost);
191 191
192 while (RefPtrWillBeRawPtr<ShadowRoot> oldRoot = m_shadowRoots.head()) { 192 while (RawPtr<ShadowRoot> oldRoot = m_shadowRoots.head()) {
193 InspectorInstrumentation::willPopShadowRoot(shadowHost, oldRoot.get()); 193 InspectorInstrumentation::willPopShadowRoot(shadowHost, oldRoot.get());
194 shadowHost->document().removeFocusedElementOfSubtree(oldRoot.get()); 194 shadowHost->document().removeFocusedElementOfSubtree(oldRoot.get());
195 m_shadowRoots.removeHead(); 195 m_shadowRoots.removeHead();
196 oldRoot->setParentOrShadowHostNode(0); 196 oldRoot->setParentOrShadowHostNode(0);
197 oldRoot->setParentTreeScope(shadowHost->document()); 197 oldRoot->setParentTreeScope(shadowHost->document());
198 oldRoot->setPrev(0); 198 oldRoot->setPrev(0);
199 oldRoot->setNext(0); 199 oldRoot->setNext(0);
200 } 200 }
201 } 201 }
202 #endif 202 #endif
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 { 281 {
282 if (isV1()) 282 if (isV1())
283 distributeV1(); 283 distributeV1();
284 else 284 else
285 distributeV0(); 285 distributeV0();
286 } 286 }
287 287
288 void ElementShadow::distributeV0() 288 void ElementShadow::distributeV0()
289 { 289 {
290 host()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing: :create(StyleChangeReason::Shadow)); 290 host()->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing: :create(StyleChangeReason::Shadow));
291 WillBeHeapVector<RawPtrWillBeMember<HTMLShadowElement>, 32> shadowInsertionP oints; 291 HeapVector<Member<HTMLShadowElement>, 32> shadowInsertionPoints;
292 DistributionPool pool(*host()); 292 DistributionPool pool(*host());
293 293
294 for (ShadowRoot* root = &youngestShadowRoot(); root; root = root->olderShado wRoot()) { 294 for (ShadowRoot* root = &youngestShadowRoot(); root; root = root->olderShado wRoot()) {
295 HTMLShadowElement* shadowInsertionPoint = 0; 295 HTMLShadowElement* shadowInsertionPoint = 0;
296 const WillBeHeapVector<RefPtrWillBeMember<InsertionPoint>>& insertionPoi nts = root->descendantInsertionPoints(); 296 const HeapVector<Member<InsertionPoint>>& insertionPoints = root->descen dantInsertionPoints();
297 for (size_t i = 0; i < insertionPoints.size(); ++i) { 297 for (size_t i = 0; i < insertionPoints.size(); ++i) {
298 InsertionPoint* point = insertionPoints[i].get(); 298 InsertionPoint* point = insertionPoints[i].get();
299 if (!point->isActive()) 299 if (!point->isActive())
300 continue; 300 continue;
301 if (isHTMLShadowElement(*point)) { 301 if (isHTMLShadowElement(*point)) {
302 ASSERT(!shadowInsertionPoint); 302 ASSERT(!shadowInsertionPoint);
303 shadowInsertionPoint = toHTMLShadowElement(point); 303 shadowInsertionPoint = toHTMLShadowElement(point);
304 shadowInsertionPoints.append(shadowInsertionPoint); 304 shadowInsertionPoints.append(shadowInsertionPoint);
305 } else { 305 } else {
306 pool.distributeTo(point, this); 306 pool.distributeTo(point, this);
(...skipping 27 matching lines...) Expand all
334 if (!m_slotAssignment) 334 if (!m_slotAssignment)
335 m_slotAssignment = SlotAssignment::create(); 335 m_slotAssignment = SlotAssignment::create();
336 m_slotAssignment->resolveAssignment(youngestShadowRoot()); 336 m_slotAssignment->resolveAssignment(youngestShadowRoot());
337 } 337 }
338 338
339 void ElementShadow::didDistributeNode(const Node* node, InsertionPoint* insertio nPoint) 339 void ElementShadow::didDistributeNode(const Node* node, InsertionPoint* insertio nPoint)
340 { 340 {
341 #if ENABLE(OILPAN) 341 #if ENABLE(OILPAN)
342 NodeToDestinationInsertionPoints::AddResult result = m_nodeToInsertionPoints .add(node, nullptr); 342 NodeToDestinationInsertionPoints::AddResult result = m_nodeToInsertionPoints .add(node, nullptr);
343 if (result.isNewEntry) 343 if (result.isNewEntry)
344 result.storedValue->value = adoptPtrWillBeNoop(new DestinationInsertionP oints()); 344 result.storedValue->value = (new DestinationInsertionPoints());
345 result.storedValue->value->append(insertionPoint); 345 result.storedValue->value->append(insertionPoint);
346 #else 346 #else
347 NodeToDestinationInsertionPoints::AddResult result = m_nodeToInsertionPoints .add(node, DestinationInsertionPoints()); 347 NodeToDestinationInsertionPoints::AddResult result = m_nodeToInsertionPoints .add(node, DestinationInsertionPoints());
348 result.storedValue->value.append(insertionPoint); 348 result.storedValue->value.append(insertionPoint);
349 #endif 349 #endif
350 } 350 }
351 351
352 const SelectRuleFeatureSet& ElementShadow::ensureSelectFeatureSet() 352 const SelectRuleFeatureSet& ElementShadow::ensureSelectFeatureSet()
353 { 353 {
354 if (!m_needsSelectFeatureSet) 354 if (!m_needsSelectFeatureSet)
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 visitor->trace(m_selectFeatures); 401 visitor->trace(m_selectFeatures);
402 // Shadow roots are linked with previous and next pointers which are traced. 402 // Shadow roots are linked with previous and next pointers which are traced.
403 // It is therefore enough to trace one of the shadow roots here and the 403 // It is therefore enough to trace one of the shadow roots here and the
404 // rest will be traced from there. 404 // rest will be traced from there.
405 visitor->trace(m_shadowRoots.head()); 405 visitor->trace(m_shadowRoots.head());
406 visitor->trace(m_slotAssignment); 406 visitor->trace(m_slotAssignment);
407 #endif 407 #endif
408 } 408 }
409 409
410 } // namespace blink 410 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698