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

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

Issue 67473002: Have ElementTraversal / NodeTraversal's next() methods take a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase on master Created 7 years, 1 month 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 | « Source/core/dom/VisitedLinkState.cpp ('k') | Source/core/dom/shadow/ShadowRoot.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 Node::AttachContext childrenContext(context); 196 Node::AttachContext childrenContext(context);
197 childrenContext.resolvedStyle = 0; 197 childrenContext.resolvedStyle = 0;
198 198
199 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root()) 199 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root())
200 root->detach(childrenContext); 200 root->detach(childrenContext);
201 } 201 }
202 202
203 void ElementShadow::removeAllEventListeners() 203 void ElementShadow::removeAllEventListeners()
204 { 204 {
205 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root()) { 205 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root()) {
206 for (Node* node = root; node; node = NodeTraversal::next(node)) 206 for (Node* node = root; node; node = NodeTraversal::next(*node))
207 node->removeAllEventListeners(); 207 node->removeAllEventListeners();
208 } 208 }
209 } 209 }
210 210
211 void ElementShadow::setNeedsDistributionRecalc() 211 void ElementShadow::setNeedsDistributionRecalc()
212 { 212 {
213 if (m_needsDistributionRecalc) 213 if (m_needsDistributionRecalc)
214 return; 214 return;
215 m_needsDistributionRecalc = true; 215 m_needsDistributionRecalc = true;
216 host()->markAncestorsWithChildNeedsDistributionRecalc(); 216 host()->markAncestorsWithChildNeedsDistributionRecalc();
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 collectSelectFeatureSetFrom(root); 334 collectSelectFeatureSetFrom(root);
335 m_needsSelectFeatureSet = false; 335 m_needsSelectFeatureSet = false;
336 return m_selectFeatures; 336 return m_selectFeatures;
337 } 337 }
338 338
339 void ElementShadow::collectSelectFeatureSetFrom(ShadowRoot* root) 339 void ElementShadow::collectSelectFeatureSetFrom(ShadowRoot* root)
340 { 340 {
341 if (!root->containsShadowRoots() && !root->containsContentElements()) 341 if (!root->containsShadowRoots() && !root->containsContentElements())
342 return; 342 return;
343 343
344 for (Element* element = ElementTraversal::firstWithin(root); element; elemen t = ElementTraversal::next(element, root)) { 344 for (Element* element = ElementTraversal::firstWithin(root); element; elemen t = ElementTraversal::next(*element, root)) {
345 if (ElementShadow* shadow = element->shadow()) 345 if (ElementShadow* shadow = element->shadow())
346 m_selectFeatures.add(shadow->ensureSelectFeatureSet()); 346 m_selectFeatures.add(shadow->ensureSelectFeatureSet());
347 if (!isHTMLContentElement(element)) 347 if (!isHTMLContentElement(element))
348 continue; 348 continue;
349 const CSSSelectorList& list = toHTMLContentElement(element)->selectorLis t(); 349 const CSSSelectorList& list = toHTMLContentElement(element)->selectorLis t();
350 for (const CSSSelector* selector = list.first(); selector; selector = CS SSelectorList::next(selector)) { 350 for (const CSSSelector* selector = list.first(); selector; selector = CS SSelectorList::next(selector)) {
351 for (const CSSSelector* component = selector; component; component = component->tagHistory()) 351 for (const CSSSelector* component = selector; component; component = component->tagHistory())
352 m_selectFeatures.collectFeaturesFromSelector(component); 352 m_selectFeatures.collectFeaturesFromSelector(component);
353 } 353 }
354 } 354 }
(...skipping 17 matching lines...) Expand all
372 372
373 void ElementShadow::clearDistribution() 373 void ElementShadow::clearDistribution()
374 { 374 {
375 m_nodeToInsertionPoints.clear(); 375 m_nodeToInsertionPoints.clear();
376 376
377 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root()) 377 for (ShadowRoot* root = youngestShadowRoot(); root; root = root->olderShadow Root())
378 root->setShadowInsertionPointOfYoungerShadowRoot(0); 378 root->setShadowInsertionPointOfYoungerShadowRoot(0);
379 } 379 }
380 380
381 } // namespace 381 } // namespace
OLDNEW
« no previous file with comments | « Source/core/dom/VisitedLinkState.cpp ('k') | Source/core/dom/shadow/ShadowRoot.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698