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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLSlotElement.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, 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) 2015 Google Inc. All rights reserved. 2 * Copyright (C) 2015 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 inline HTMLSlotElement::HTMLSlotElement(Document& document) 46 inline HTMLSlotElement::HTMLSlotElement(Document& document)
47 : HTMLElement(slotTag, document) 47 : HTMLElement(slotTag, document)
48 , m_distributionState(DistributionDone) 48 , m_distributionState(DistributionDone)
49 { 49 {
50 setHasCustomStyleCallbacks(); 50 setHasCustomStyleCallbacks();
51 } 51 }
52 52
53 DEFINE_NODE_FACTORY(HTMLSlotElement); 53 DEFINE_NODE_FACTORY(HTMLSlotElement);
54 54
55 const WillBeHeapVector<RefPtrWillBeMember<Node>> HTMLSlotElement::getAssignedNod esForBinding(const AssignedNodesOptions& options) 55 const HeapVector<Member<Node>> HTMLSlotElement::getAssignedNodesForBinding(const AssignedNodesOptions& options)
56 { 56 {
57 updateDistribution(); 57 updateDistribution();
58 if (options.hasFlatten() && options.flatten()) 58 if (options.hasFlatten() && options.flatten())
59 return getDistributedNodes(); 59 return getDistributedNodes();
60 return m_assignedNodes; 60 return m_assignedNodes;
61 } 61 }
62 62
63 const WillBeHeapVector<RefPtrWillBeMember<Node>>& HTMLSlotElement::getDistribute dNodes() 63 const HeapVector<Member<Node>>& HTMLSlotElement::getDistributedNodes()
64 { 64 {
65 ASSERT(!needsDistributionRecalc()); 65 ASSERT(!needsDistributionRecalc());
66 if (isInShadowTree()) 66 if (isInShadowTree())
67 return m_distributedNodes; 67 return m_distributedNodes;
68 68
69 // A slot is unlikely to be used outside of a shadow tree. 69 // A slot is unlikely to be used outside of a shadow tree.
70 // We do not need to optimize this case in most cases. 70 // We do not need to optimize this case in most cases.
71 // TODO(hayato): If this path causes a performance issue, we should move 71 // TODO(hayato): If this path causes a performance issue, we should move
72 // ShadowRootRaraDate::m_descendantSlots into TreeScopreRareData-ish and 72 // ShadowRootRaraDate::m_descendantSlots into TreeScopreRareData-ish and
73 // update the distribution code so it considers a document tree too. 73 // update the distribution code so it considers a document tree too.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 m_distributedIndices.clear(); 117 m_distributedIndices.clear();
118 } 118 }
119 119
120 bool HTMLSlotElement::hasSlotChangeEventListener() 120 bool HTMLSlotElement::hasSlotChangeEventListener()
121 { 121 {
122 return eventTargetData() && eventTargetData()->eventListenerMap.find(EventTy peNames::slotchange); 122 return eventTargetData() && eventTargetData()->eventListenerMap.find(EventTy peNames::slotchange);
123 } 123 }
124 124
125 void HTMLSlotElement::dispatchSlotChangeEvent() 125 void HTMLSlotElement::dispatchSlotChangeEvent()
126 { 126 {
127 RefPtrWillBeRawPtr<Event> event = Event::create(EventTypeNames::slotchange); 127 RawPtr<Event> event = Event::create(EventTypeNames::slotchange);
128 event->setTarget(this); 128 event->setTarget(this);
129 dispatchScopedEvent(event); 129 dispatchScopedEvent(event);
130 } 130 }
131 131
132 Node* HTMLSlotElement::distributedNodeNextTo(const Node& node) const 132 Node* HTMLSlotElement::distributedNodeNextTo(const Node& node) const
133 { 133 {
134 const auto& it = m_distributedIndices.find(&node); 134 const auto& it = m_distributedIndices.find(&node);
135 if (it == m_distributedIndices.end()) 135 if (it == m_distributedIndices.end())
136 return nullptr; 136 return nullptr;
137 size_t index = it->value; 137 size_t index = it->value;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 ASSERT(m_distributionState == DistributionOnGoing); 262 ASSERT(m_distributionState == DistributionOnGoing);
263 m_distributionState = DistributionDone; 263 m_distributionState = DistributionDone;
264 if (isChildOfV1ShadowHost()) { 264 if (isChildOfV1ShadowHost()) {
265 ElementShadow* shadow = parentElementShadow(); 265 ElementShadow* shadow = parentElementShadow();
266 ASSERT(shadow); 266 ASSERT(shadow);
267 if (!shadow->needsDistributionRecalc() && distributionChanged()) 267 if (!shadow->needsDistributionRecalc() && distributionChanged())
268 shadow->setNeedsDistributionRecalc(); 268 shadow->setNeedsDistributionRecalc();
269 } 269 }
270 if (hasSlotChangeEventListener() && distributionChanged()) { 270 if (hasSlotChangeEventListener() && distributionChanged()) {
271 // TODO(hayato): Do not enqueue a slotchange event for the same slot twi ce in the microtask queue 271 // TODO(hayato): Do not enqueue a slotchange event for the same slot twi ce in the microtask queue
272 Microtask::enqueueMicrotask(WTF::bind(&HTMLSlotElement::dispatchSlotChan geEvent, PassRefPtrWillBeRawPtr<HTMLSlotElement>(this))); 272 Microtask::enqueueMicrotask(WTF::bind(&HTMLSlotElement::dispatchSlotChan geEvent, RawPtr<HTMLSlotElement>(this)));
273 } 273 }
274 } 274 }
275 275
276 void HTMLSlotElement::clearDistribution() 276 void HTMLSlotElement::clearDistribution()
277 { 277 {
278 willUpdateDistribution(); 278 willUpdateDistribution();
279 didUpdateDistribution(); 279 didUpdateDistribution();
280 } 280 }
281 281
282 DEFINE_TRACE(HTMLSlotElement) 282 DEFINE_TRACE(HTMLSlotElement)
283 { 283 {
284 #if ENABLE(OILPAN) 284 #if ENABLE(OILPAN)
285 visitor->trace(m_assignedNodes); 285 visitor->trace(m_assignedNodes);
286 visitor->trace(m_distributedNodes); 286 visitor->trace(m_distributedNodes);
287 visitor->trace(m_distributedIndices); 287 visitor->trace(m_distributedIndices);
288 visitor->trace(m_oldDistributedNodes); 288 visitor->trace(m_oldDistributedNodes);
289 #endif 289 #endif
290 HTMLElement::trace(visitor); 290 HTMLElement::trace(visitor);
291 } 291 }
292 292
293 } // namespace blink 293 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLSlotElement.h ('k') | third_party/WebKit/Source/core/html/HTMLSourceElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698