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

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

Issue 1578363007: Re-instate geometry sharing optimization for 'd' on <use>'d <path>s (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGPathElement.h ('k') | no next file » | 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, 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 markForLayoutAndParentResourceInvalidation(layoutObject()); 145 markForLayoutAndParentResourceInvalidation(layoutObject());
146 return; 146 return;
147 } 147 }
148 148
149 SVGGeometryElement::svgAttributeChanged(attrName); 149 SVGGeometryElement::svgAttributeChanged(attrName);
150 } 150 }
151 151
152 void SVGPathElement::collectStyleForPresentationAttribute(const QualifiedName& n ame, const AtomicString& value, MutableStylePropertySet* style) 152 void SVGPathElement::collectStyleForPresentationAttribute(const QualifiedName& n ame, const AtomicString& value, MutableStylePropertySet* style)
153 { 153 {
154 SVGAnimatedPropertyBase* property = propertyFromAttribute(name); 154 SVGAnimatedPropertyBase* property = propertyFromAttribute(name);
155 if (property == m_path) 155 if (property == m_path) {
156 addPropertyToPresentationAttributeStyle(style, CSSPropertyD, m_path->cur rentValue()->pathValue()); 156 SVGAnimatedPath* path = this->path();
157 else 157 // If this is a <use> instance, return the referenced path to maximize g eometry sharing.
158 SVGGeometryElement::collectStyleForPresentationAttribute(name, value, st yle); 158 if (const SVGElement* element = correspondingElement())
159 path = toSVGPathElement(element)->path();
160 addPropertyToPresentationAttributeStyle(style, CSSPropertyD, path->curre ntValue()->pathValue());
161 return;
162 }
163 SVGGeometryElement::collectStyleForPresentationAttribute(name, value, style) ;
159 } 164 }
160 165
161 void SVGPathElement::invalidateMPathDependencies() 166 void SVGPathElement::invalidateMPathDependencies()
162 { 167 {
163 // <mpath> can only reference <path> but this dependency is not handled in 168 // <mpath> can only reference <path> but this dependency is not handled in
164 // markForLayoutAndParentResourceInvalidation so we update any mpath depende ncies manually. 169 // markForLayoutAndParentResourceInvalidation so we update any mpath depende ncies manually.
165 if (SVGElementSet* dependencies = setOfIncomingReferences()) { 170 if (SVGElementSet* dependencies = setOfIncomingReferences()) {
166 for (SVGElement* element : *dependencies) { 171 for (SVGElement* element : *dependencies) {
167 if (isSVGMPathElement(*element)) 172 if (isSVGMPathElement(*element))
168 toSVGMPathElement(element)->targetPathChanged(); 173 toSVGMPathElement(element)->targetPathChanged();
169 } 174 }
170 } 175 }
171 } 176 }
172 177
173 Node::InsertionNotificationRequest SVGPathElement::insertedInto(ContainerNode* r ootParent) 178 Node::InsertionNotificationRequest SVGPathElement::insertedInto(ContainerNode* r ootParent)
174 { 179 {
175 SVGGeometryElement::insertedInto(rootParent); 180 SVGGeometryElement::insertedInto(rootParent);
176 invalidateMPathDependencies(); 181 invalidateMPathDependencies();
177 return InsertionDone; 182 return InsertionDone;
178 } 183 }
179 184
180 void SVGPathElement::removedFrom(ContainerNode* rootParent) 185 void SVGPathElement::removedFrom(ContainerNode* rootParent)
181 { 186 {
182 SVGGeometryElement::removedFrom(rootParent); 187 SVGGeometryElement::removedFrom(rootParent);
183 invalidateMPathDependencies(); 188 invalidateMPathDependencies();
184 } 189 }
185 190
186 } // namespace blink 191 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGPathElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698