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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLSlotElement.cpp

Issue 1872303002: Simplify slot assignments (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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 { 144 {
145 const auto& it = m_distributedIndices.find(&node); 145 const auto& it = m_distributedIndices.find(&node);
146 if (it == m_distributedIndices.end()) 146 if (it == m_distributedIndices.end())
147 return nullptr; 147 return nullptr;
148 size_t index = it->value; 148 size_t index = it->value;
149 if (index == 0) 149 if (index == 0)
150 return nullptr; 150 return nullptr;
151 return m_distributedNodes[index - 1].get(); 151 return m_distributedNodes[index - 1].get();
152 } 152 }
153 153
154 AtomicString HTMLSlotElement::name() const
155 {
156 return normalizeSlotName(fastGetAttribute(HTMLNames::nameAttr));
157 }
158
154 void HTMLSlotElement::attach(const AttachContext& context) 159 void HTMLSlotElement::attach(const AttachContext& context)
155 { 160 {
156 for (auto& node : m_distributedNodes) { 161 for (auto& node : m_distributedNodes) {
157 if (node->needsAttach()) 162 if (node->needsAttach())
158 node->attach(context); 163 node->attach(context);
159 } 164 }
160 165
161 HTMLElement::attach(context); 166 HTMLElement::attach(context);
162 } 167 }
163 168
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 DEFINE_TRACE(HTMLSlotElement) 292 DEFINE_TRACE(HTMLSlotElement)
288 { 293 {
289 visitor->trace(m_assignedNodes); 294 visitor->trace(m_assignedNodes);
290 visitor->trace(m_distributedNodes); 295 visitor->trace(m_distributedNodes);
291 visitor->trace(m_distributedIndices); 296 visitor->trace(m_distributedIndices);
292 visitor->trace(m_oldDistributedNodes); 297 visitor->trace(m_oldDistributedNodes);
293 HTMLElement::trace(visitor); 298 HTMLElement::trace(visitor);
294 } 299 }
295 300
296 } // namespace blink 301 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698