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

Unified Diff: third_party/WebKit/Source/core/svg/SVGElement.cpp

Issue 1932523003: Introduce NodeTraversal::ancestorsOf() and inclusiveAncestors() for range-based for loop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-04-28T18:38:12 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/svg/SVGElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGElement.cpp b/third_party/WebKit/Source/core/svg/SVGElement.cpp
index 2b6a5e09bd977ceacdf1460474e70bcbe320114c..984539f47bcc5bd9cb86ce58dddaacd2e0207bfc 100644
--- a/third_party/WebKit/Source/core/svg/SVGElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGElement.cpp
@@ -411,21 +411,23 @@ void SVGElement::updateRelativeLengthsInformation(bool clientHasRelativeLengths,
// An element wants to notify us that its own relative lengths state changed.
// Register it in the relative length map, and register us in the parent relative length map.
// Register the parent in the grandparents map, etc. Repeat procedure until the root of the SVG tree.
- for (ContainerNode* currentNode = this; currentNode && currentNode->isSVGElement(); currentNode = currentNode->parentNode()) {
- SVGElement* currentElement = toSVGElement(currentNode);
- ASSERT(!currentElement->m_inRelativeLengthClientsInvalidation);
+ for (Node& currentNode : NodeTraversal::inclusiveAncestorsOf(*this)) {
+ if (!currentNode.isSVGElement())
+ break;
+ SVGElement& currentElement = toSVGElement(currentNode);
+ ASSERT(!currentElement.m_inRelativeLengthClientsInvalidation);
- bool hadRelativeLengths = currentElement->hasRelativeLengths();
+ bool hadRelativeLengths = currentElement.hasRelativeLengths();
if (clientHasRelativeLengths)
- currentElement->m_elementsWithRelativeLengths.add(clientElement);
+ currentElement.m_elementsWithRelativeLengths.add(clientElement);
else
- currentElement->m_elementsWithRelativeLengths.remove(clientElement);
+ currentElement.m_elementsWithRelativeLengths.remove(clientElement);
// If the relative length state hasn't changed, we can stop propagating the notification.
- if (hadRelativeLengths == currentElement->hasRelativeLengths())
+ if (hadRelativeLengths == currentElement.hasRelativeLengths())
return;
- clientElement = currentElement;
+ clientElement = &currentElement;
clientHasRelativeLengths = clientElement->hasRelativeLengths();
}

Powered by Google App Engine
This is Rietveld 408576698