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

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

Issue 896773002: [svg2] Make 'x' and 'y' presentation attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 years, 10 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 | « Source/core/svg/SVGUseElement.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, 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, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
6 * Copyright (C) 2012 University of Szeged 6 * Copyright (C) 2012 University of Szeged
7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> 7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org>
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 shadowElement->setAttribute(SVGNames::widthAttr, AtomicString(use.wi dth()->currentValue()->valueAsString())); 175 shadowElement->setAttribute(SVGNames::widthAttr, AtomicString(use.wi dth()->currentValue()->valueAsString()));
176 else 176 else
177 shadowElement->setAttribute(SVGNames::widthAttr, originalElement.get Attribute(SVGNames::widthAttr)); 177 shadowElement->setAttribute(SVGNames::widthAttr, originalElement.get Attribute(SVGNames::widthAttr));
178 if (use.height()->isSpecified()) 178 if (use.height()->isSpecified())
179 shadowElement->setAttribute(SVGNames::heightAttr, AtomicString(use.h eight()->currentValue()->valueAsString())); 179 shadowElement->setAttribute(SVGNames::heightAttr, AtomicString(use.h eight()->currentValue()->valueAsString()));
180 else 180 else
181 shadowElement->setAttribute(SVGNames::heightAttr, originalElement.ge tAttribute(SVGNames::heightAttr)); 181 shadowElement->setAttribute(SVGNames::heightAttr, originalElement.ge tAttribute(SVGNames::heightAttr));
182 } 182 }
183 } 183 }
184 184
185 bool SVGUseElement::isPresentationAttribute(const QualifiedName& attrName) const
186 {
187 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr)
188 return true;
189 return SVGGraphicsElement::isPresentationAttribute(attrName);
190 }
191
192 bool SVGUseElement::isPresentationAttributeWithSVGDOM(const QualifiedName& attrN ame) const
193 {
194 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr)
195 return true;
196 return SVGGraphicsElement::isPresentationAttributeWithSVGDOM(attrName);
197 }
198
199 void SVGUseElement::collectStyleForPresentationAttribute(const QualifiedName& na me, const AtomicString& value, MutableStylePropertySet* style)
200 {
201 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute (name);
202 if (property == m_x)
203 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m _x->currentValue());
204 else if (property == m_y)
205 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m _y->currentValue());
206 else
207 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st yle);
208 }
209
185 void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName) 210 void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName)
186 { 211 {
187 if (!isSupportedAttribute(attrName)) { 212 if (!isSupportedAttribute(attrName)) {
188 SVGGraphicsElement::svgAttributeChanged(attrName); 213 SVGGraphicsElement::svgAttributeChanged(attrName);
189 return; 214 return;
190 } 215 }
191 216
192 SVGElement::InvalidationGuard invalidationGuard(this); 217 SVGElement::InvalidationGuard invalidationGuard(this);
193 218
219 if (attrName == SVGNames::xAttr
220 || attrName == SVGNames::yAttr) {
221 invalidateSVGPresentationAttributeStyle();
222 setNeedsStyleRecalc(LocalStyleChange,
223 StyleChangeReasonForTracing::fromAttribute(attrName));
224 }
225
194 LayoutObject* renderer = this->renderer(); 226 LayoutObject* renderer = this->renderer();
195 if (attrName == SVGNames::xAttr 227 if (attrName == SVGNames::xAttr
196 || attrName == SVGNames::yAttr 228 || attrName == SVGNames::yAttr
197 || attrName == SVGNames::widthAttr 229 || attrName == SVGNames::widthAttr
198 || attrName == SVGNames::heightAttr) { 230 || attrName == SVGNames::heightAttr) {
199 updateRelativeLengthsInformation(); 231 updateRelativeLengthsInformation();
200 if (m_targetElementInstance) { 232 if (m_targetElementInstance) {
201 ASSERT(m_targetElementInstance->correspondingElement()); 233 ASSERT(m_targetElementInstance->correspondingElement());
202 transferUseWidthAndHeightIfNeeded(*this, m_targetElementInstance.get (), *m_targetElementInstance->correspondingElement()); 234 transferUseWidthAndHeightIfNeeded(*this, m_targetElementInstance.get (), *m_targetElementInstance->correspondingElement());
203 } 235 }
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 787
756 if (m_resource) 788 if (m_resource)
757 m_resource->removeClient(this); 789 m_resource->removeClient(this);
758 790
759 m_resource = resource; 791 m_resource = resource;
760 if (m_resource) 792 if (m_resource)
761 m_resource->addClient(this); 793 m_resource->addClient(this);
762 } 794 }
763 795
764 } 796 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGUseElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698