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

Side by Side Diff: Source/core/svg/SVGSVGElement.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/rendering/RenderNamedFlowThread.cpp ('k') | Source/core/svg/SVGUseElement.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) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org>
4 * Copyright (C) 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2007 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 } 329 }
330 330
331 void SVGSVGElement::forceRedraw() 331 void SVGSVGElement::forceRedraw()
332 { 332 {
333 // FIXME: Implement me (see bug 11275) 333 // FIXME: Implement me (see bug 11275)
334 } 334 }
335 335
336 PassRefPtr<NodeList> SVGSVGElement::collectIntersectionOrEnclosureList(const SVG Rect& rect, SVGElement* referenceElement, CollectIntersectionOrEnclosure collect ) const 336 PassRefPtr<NodeList> SVGSVGElement::collectIntersectionOrEnclosureList(const SVG Rect& rect, SVGElement* referenceElement, CollectIntersectionOrEnclosure collect ) const
337 { 337 {
338 Vector<RefPtr<Node> > nodes; 338 Vector<RefPtr<Node> > nodes;
339 Element* element = ElementTraversal::next(referenceElement ? referenceElemen t : this); 339 Element* element = ElementTraversal::next(*(referenceElement ? referenceElem ent : this));
340 while (element) { 340 while (element) {
341 if (element->isSVGElement()) { 341 if (element->isSVGElement()) {
342 SVGElement* svgElement = toSVGElement(element); 342 SVGElement* svgElement = toSVGElement(element);
343 if (collect == CollectIntersectionList) { 343 if (collect == CollectIntersectionList) {
344 if (checkIntersection(svgElement, rect)) 344 if (checkIntersection(svgElement, rect))
345 nodes.append(element); 345 nodes.append(element);
346 } else { 346 } else {
347 if (checkEnclosure(svgElement, rect)) 347 if (checkEnclosure(svgElement, rect))
348 nodes.append(element); 348 nodes.append(element);
349 } 349 }
350 } 350 }
351 351
352 element = ElementTraversal::next(element, referenceElement ? referenceEl ement : this); 352 element = ElementTraversal::next(*element, referenceElement ? referenceE lement : this);
353 } 353 }
354 return StaticNodeList::adopt(nodes); 354 return StaticNodeList::adopt(nodes);
355 } 355 }
356 356
357 PassRefPtr<NodeList> SVGSVGElement::getIntersectionList(const SVGRect& rect, SVG Element* referenceElement) const 357 PassRefPtr<NodeList> SVGSVGElement::getIntersectionList(const SVGRect& rect, SVG Element* referenceElement) const
358 { 358 {
359 return collectIntersectionOrEnclosureList(rect, referenceElement, CollectInt ersectionList); 359 return collectIntersectionOrEnclosureList(rect, referenceElement, CollectInt ersectionList);
360 } 360 }
361 361
362 PassRefPtr<NodeList> SVGSVGElement::getEnclosureList(const SVGRect& rect, SVGEle ment* referenceElement) const 362 PassRefPtr<NodeList> SVGSVGElement::getEnclosureList(const SVGRect& rect, SVGEle ment* referenceElement) const
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 // getElementById on SVGSVGElement is restricted to only the child subtree defin ed by the <svg> element. 767 // getElementById on SVGSVGElement is restricted to only the child subtree defin ed by the <svg> element.
768 // See http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGSVGElement 768 // See http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGSVGElement
769 Element* SVGSVGElement::getElementById(const AtomicString& id) const 769 Element* SVGSVGElement::getElementById(const AtomicString& id) const
770 { 770 {
771 Element* element = treeScope().getElementById(id); 771 Element* element = treeScope().getElementById(id);
772 if (element && element->isDescendantOf(this)) 772 if (element && element->isDescendantOf(this))
773 return element; 773 return element;
774 774
775 // Fall back to traversing our subtree. Duplicate ids are allowed, the first found will 775 // Fall back to traversing our subtree. Duplicate ids are allowed, the first found will
776 // be returned. 776 // be returned.
777 for (Node* node = firstChild(); node; node = NodeTraversal::next(node, this) ) { 777 for (Node* node = firstChild(); node; node = NodeTraversal::next(*node, this )) {
778 if (!node->isElementNode()) 778 if (!node->isElementNode())
779 continue; 779 continue;
780 780
781 Element* element = toElement(node); 781 Element* element = toElement(node);
782 if (element->getIdAttribute() == id) 782 if (element->getIdAttribute() == id)
783 return element; 783 return element;
784 } 784 }
785 return 0; 785 return 0;
786 } 786 }
787 787
788 } 788 }
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderNamedFlowThread.cpp ('k') | Source/core/svg/SVGUseElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698