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

Side by Side 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, 7 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) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org> 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org>
3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
4 * Copyright (C) 2008 Apple Inc. All rights reserved. 4 * Copyright (C) 2008 Apple Inc. All rights reserved.
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 { 404 {
405 ASSERT(clientElement); 405 ASSERT(clientElement);
406 406
407 // If we're not yet in a document, this function will be called again from i nsertedInto(). Do nothing now. 407 // If we're not yet in a document, this function will be called again from i nsertedInto(). Do nothing now.
408 if (!inShadowIncludingDocument()) 408 if (!inShadowIncludingDocument())
409 return; 409 return;
410 410
411 // An element wants to notify us that its own relative lengths state changed . 411 // An element wants to notify us that its own relative lengths state changed .
412 // Register it in the relative length map, and register us in the parent rel ative length map. 412 // Register it in the relative length map, and register us in the parent rel ative length map.
413 // Register the parent in the grandparents map, etc. Repeat procedure until the root of the SVG tree. 413 // Register the parent in the grandparents map, etc. Repeat procedure until the root of the SVG tree.
414 for (ContainerNode* currentNode = this; currentNode && currentNode->isSVGEle ment(); currentNode = currentNode->parentNode()) { 414 for (Node& currentNode : NodeTraversal::inclusiveAncestorsOf(*this)) {
415 SVGElement* currentElement = toSVGElement(currentNode); 415 if (!currentNode.isSVGElement())
416 ASSERT(!currentElement->m_inRelativeLengthClientsInvalidation); 416 break;
417 SVGElement& currentElement = toSVGElement(currentNode);
418 ASSERT(!currentElement.m_inRelativeLengthClientsInvalidation);
417 419
418 bool hadRelativeLengths = currentElement->hasRelativeLengths(); 420 bool hadRelativeLengths = currentElement.hasRelativeLengths();
419 if (clientHasRelativeLengths) 421 if (clientHasRelativeLengths)
420 currentElement->m_elementsWithRelativeLengths.add(clientElement); 422 currentElement.m_elementsWithRelativeLengths.add(clientElement);
421 else 423 else
422 currentElement->m_elementsWithRelativeLengths.remove(clientElement); 424 currentElement.m_elementsWithRelativeLengths.remove(clientElement);
423 425
424 // If the relative length state hasn't changed, we can stop propagating the notification. 426 // If the relative length state hasn't changed, we can stop propagating the notification.
425 if (hadRelativeLengths == currentElement->hasRelativeLengths()) 427 if (hadRelativeLengths == currentElement.hasRelativeLengths())
426 return; 428 return;
427 429
428 clientElement = currentElement; 430 clientElement = &currentElement;
429 clientHasRelativeLengths = clientElement->hasRelativeLengths(); 431 clientHasRelativeLengths = clientElement->hasRelativeLengths();
430 } 432 }
431 433
432 // Register root SVG elements for top level viewport change notifications. 434 // Register root SVG elements for top level viewport change notifications.
433 if (isSVGSVGElement(*clientElement)) { 435 if (isSVGSVGElement(*clientElement)) {
434 SVGDocumentExtensions& svgExtensions = accessDocumentSVGExtensions(); 436 SVGDocumentExtensions& svgExtensions = accessDocumentSVGExtensions();
435 if (clientElement->hasRelativeLengths()) 437 if (clientElement->hasRelativeLengths())
436 svgExtensions.addSVGRootWithRelativeLengthDescendents(toSVGSVGElemen t(clientElement)); 438 svgExtensions.addSVGRootWithRelativeLengthDescendents(toSVGSVGElemen t(clientElement));
437 else 439 else
438 svgExtensions.removeSVGRootWithRelativeLengthDescendents(toSVGSVGEle ment(clientElement)); 440 svgExtensions.removeSVGRootWithRelativeLengthDescendents(toSVGSVGEle ment(clientElement));
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 Element::trace(visitor); 1178 Element::trace(visitor);
1177 } 1179 }
1178 1180
1179 const AtomicString& SVGElement::eventParameterName() 1181 const AtomicString& SVGElement::eventParameterName()
1180 { 1182 {
1181 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); 1183 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt"));
1182 return evtString; 1184 return evtString;
1183 } 1185 }
1184 1186
1185 } // namespace blink 1187 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698