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

Side by Side Diff: Source/core/svg/SVGSVGElement.cpp

Issue 191963002: Use new Traversal<SVG*Element> API more in SVG code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGPolyElement.h ('k') | Source/core/svg/SVGTextContentElement.h » ('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 * Copyright (C) 2014 Google, Inc. 5 * Copyright (C) 2014 Google, Inc.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 namespace WebCore { 65 namespace WebCore {
66 66
67 inline SVGSVGElement::SVGSVGElement(Document& doc) 67 inline SVGSVGElement::SVGSVGElement(Document& doc)
68 : SVGGraphicsElement(SVGNames::svgTag, doc) 68 : SVGGraphicsElement(SVGNames::svgTag, doc)
69 , SVGFitToViewBox(this) 69 , SVGFitToViewBox(this)
70 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len gthModeWidth))) 70 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len gthModeWidth)))
71 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len gthModeHeight))) 71 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len gthModeHeight)))
72 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr eate(LengthModeWidth))) 72 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr eate(LengthModeWidth)))
73 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength:: create(LengthModeHeight))) 73 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength:: create(LengthModeHeight)))
74 , m_useCurrentView(false) 74 , m_useCurrentView(false)
75 , m_timeContainer(SMILTimeContainer::create(this)) 75 , m_timeContainer(SMILTimeContainer::create(*this))
76 , m_translation(SVGPoint::create()) 76 , m_translation(SVGPoint::create())
77 { 77 {
78 ScriptWrappable::init(this); 78 ScriptWrappable::init(this);
79 79
80 m_width->setDefaultValueAsString("100%"); 80 m_width->setDefaultValueAsString("100%");
81 m_height->setDefaultValueAsString("100%"); 81 m_height->setDefaultValueAsString("100%");
82 82
83 addToPropertyMap(m_x); 83 addToPropertyMap(m_x);
84 addToPropertyMap(m_y); 84 addToPropertyMap(m_y);
85 addToPropertyMap(m_width); 85 addToPropertyMap(m_width);
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 if (referenceElement) { 382 if (referenceElement) {
383 // Only the common subtree needs to be traversed. 383 // Only the common subtree needs to be traversed.
384 if (contains(referenceElement)) { 384 if (contains(referenceElement)) {
385 root = referenceElement; 385 root = referenceElement;
386 } else if (!isDescendantOf(referenceElement)) { 386 } else if (!isDescendantOf(referenceElement)) {
387 // No common subtree. 387 // No common subtree.
388 return StaticNodeList::adopt(nodes); 388 return StaticNodeList::adopt(nodes);
389 } 389 }
390 } 390 }
391 391
392 for (Element* element = ElementTraversal::firstWithin(*root); element; 392 for (SVGGraphicsElement* element = Traversal<SVGGraphicsElement>::firstWithi n(*root); element;
393 element = ElementTraversal::next(*element, root)) { 393 element = Traversal<SVGGraphicsElement>::next(*element, root)) {
394 394 if (checkIntersectionOrEnclosure(*element, rect, mode))
395 if (!WebCore::isSVGGraphicsElement(*element))
396 continue;
397
398 SVGElement* svgElement = toSVGElement(element);
399 if (checkIntersectionOrEnclosure(*svgElement, rect, mode))
400 nodes.append(element); 395 nodes.append(element);
401 } 396 }
402 397
403 return StaticNodeList::adopt(nodes); 398 return StaticNodeList::adopt(nodes);
404 } 399 }
405 400
406 PassRefPtr<NodeList> SVGSVGElement::getIntersectionList(PassRefPtr<SVGRectTearOf f> rect, SVGElement* referenceElement) const 401 PassRefPtr<NodeList> SVGSVGElement::getIntersectionList(PassRefPtr<SVGRectTearOf f> rect, SVGElement* referenceElement) const
407 { 402 {
408 document().updateLayoutIgnorePendingStylesheets(); 403 document().updateLayoutIgnorePendingStylesheets();
409 404
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 Vector<Element*>::const_iterator end = elements.end(); 834 Vector<Element*>::const_iterator end = elements.end();
840 for (Vector<Element*>::const_iterator it = elements.begin(); it != end; ++it ) { 835 for (Vector<Element*>::const_iterator it = elements.begin(); it != end; ++it ) {
841 if ((*it)->isDescendantOf(this)) 836 if ((*it)->isDescendantOf(this))
842 return *it; 837 return *it;
843 } 838 }
844 839
845 return 0; 840 return 0;
846 } 841 }
847 842
848 } 843 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGPolyElement.h ('k') | Source/core/svg/SVGTextContentElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698