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

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

Issue 2905043002: Make DocumentOrderedMap take a const reference for scope (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/TreeScope.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/dom/shadow/SlotAssignment.h" 5 #include "core/dom/shadow/SlotAssignment.h"
6 6
7 #include "core/HTMLNames.h" 7 #include "core/HTMLNames.h"
8 #include "core/dom/ElementTraversal.h" 8 #include "core/dom/ElementTraversal.h"
9 #include "core/dom/Node.h" 9 #include "core/dom/Node.h"
10 #include "core/dom/NodeTraversal.h" 10 #include "core/dom/NodeTraversal.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 if (needs_collect_slots_) 148 if (needs_collect_slots_)
149 CollectSlots(); 149 CollectSlots();
150 return slots_; 150 return slots_;
151 } 151 }
152 152
153 HTMLSlotElement* SlotAssignment::FindSlot(const Node& node) { 153 HTMLSlotElement* SlotAssignment::FindSlot(const Node& node) {
154 return node.IsSlotable() ? FindSlotByName(node.SlotName()) : nullptr; 154 return node.IsSlotable() ? FindSlotByName(node.SlotName()) : nullptr;
155 } 155 }
156 156
157 HTMLSlotElement* SlotAssignment::FindSlotByName(const AtomicString& slot_name) { 157 HTMLSlotElement* SlotAssignment::FindSlotByName(const AtomicString& slot_name) {
158 return slot_map_->GetSlotByName(slot_name, owner_.Get()); 158 return slot_map_->GetSlotByName(slot_name, *owner_);
159 } 159 }
160 160
161 void SlotAssignment::CollectSlots() { 161 void SlotAssignment::CollectSlots() {
162 DCHECK(needs_collect_slots_); 162 DCHECK(needs_collect_slots_);
163 slots_.clear(); 163 slots_.clear();
164 164
165 slots_.ReserveCapacity(slot_count_); 165 slots_.ReserveCapacity(slot_count_);
166 for (HTMLSlotElement& slot : 166 for (HTMLSlotElement& slot :
167 Traversal<HTMLSlotElement>::DescendantsOf(*owner_)) { 167 Traversal<HTMLSlotElement>::DescendantsOf(*owner_)) {
168 slots_.push_back(&slot); 168 slots_.push_back(&slot);
169 } 169 }
170 needs_collect_slots_ = false; 170 needs_collect_slots_ = false;
171 DCHECK_EQ(slots_.size(), slot_count_); 171 DCHECK_EQ(slots_.size(), slot_count_);
172 } 172 }
173 173
174 DEFINE_TRACE(SlotAssignment) { 174 DEFINE_TRACE(SlotAssignment) {
175 visitor->Trace(slots_); 175 visitor->Trace(slots_);
176 visitor->Trace(slot_map_); 176 visitor->Trace(slot_map_);
177 visitor->Trace(owner_); 177 visitor->Trace(owner_);
178 } 178 }
179 179
180 } // namespace blink 180 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/TreeScope.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698