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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGPathElement.cpp

Issue 1425913004: [SVG] Shared <use> path geometry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 { 65 {
66 visitor->trace(m_pathLength); 66 visitor->trace(m_pathLength);
67 visitor->trace(m_path); 67 visitor->trace(m_path);
68 SVGGeometryElement::trace(visitor); 68 SVGGeometryElement::trace(visitor);
69 } 69 }
70 70
71 DEFINE_NODE_FACTORY(SVGPathElement) 71 DEFINE_NODE_FACTORY(SVGPathElement)
72 72
73 Path SVGPathElement::asPath() const 73 Path SVGPathElement::asPath() const
74 { 74 {
75 Path path; 75 // If this is a <use> instance, return the referenced path to maximize geome try sharing.
76 buildPathFromByteStream(pathByteStream(), path); 76 if (const SVGElement* element = correspondingElement())
77 return path; 77 return toSVGPathElement(element)->asPath();
78
79 return m_path->currentValue()->path();
78 } 80 }
79 81
80 float SVGPathElement::getTotalLength() 82 float SVGPathElement::getTotalLength()
81 { 83 {
82 return getTotalLengthOfSVGPathByteStream(pathByteStream()); 84 return getTotalLengthOfSVGPathByteStream(pathByteStream());
83 } 85 }
84 86
85 PassRefPtrWillBeRawPtr<SVGPointTearOff> SVGPathElement::getPointAtLength(float l ength) 87 PassRefPtrWillBeRawPtr<SVGPointTearOff> SVGPathElement::getPointAtLength(float l ength)
86 { 88 {
87 FloatPoint point = getPointAtLengthOfSVGPathByteStream(pathByteStream(), len gth); 89 FloatPoint point = getPointAtLengthOfSVGPathByteStream(pathByteStream(), len gth);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 return InsertionDone; 137 return InsertionDone;
136 } 138 }
137 139
138 void SVGPathElement::removedFrom(ContainerNode* rootParent) 140 void SVGPathElement::removedFrom(ContainerNode* rootParent)
139 { 141 {
140 SVGGeometryElement::removedFrom(rootParent); 142 SVGGeometryElement::removedFrom(rootParent);
141 invalidateMPathDependencies(); 143 invalidateMPathDependencies();
142 } 144 }
143 145
144 } // namespace blink 146 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698