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

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: cleanup 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
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 void SVGUseElement::collectStyleForPresentationAttribute(const QualifiedName& na me, const AtomicString& value, MutableStylePropertySet* style)
193 {
194 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute (name);
195 if (property == m_x)
196 addPropertyToPresentationAttributeStyle(style, CSSPropertyX, m_x->curren tValue()->valueInSpecifiedUnits(), m_x->currentValue()->cssUnitTypeQuirk());
197 else if (property == m_y)
198 addPropertyToPresentationAttributeStyle(style, CSSPropertyY, m_y->curren tValue()->valueInSpecifiedUnits(), m_y->currentValue()->cssUnitTypeQuirk());
199 else
200 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st yle);
201 }
202
185 void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName) 203 void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName)
186 { 204 {
187 if (!isSupportedAttribute(attrName)) { 205 if (!isSupportedAttribute(attrName)) {
188 SVGGraphicsElement::svgAttributeChanged(attrName); 206 SVGGraphicsElement::svgAttributeChanged(attrName);
189 return; 207 return;
190 } 208 }
191 209
192 SVGElement::InvalidationGuard invalidationGuard(this); 210 SVGElement::InvalidationGuard invalidationGuard(this);
193 211
212 if (attrName == SVGNames::xAttr
213 || attrName == SVGNames::yAttr) {
214 invalidateSVGPresentationAttributeStyle();
215 setNeedsStyleRecalc(LocalStyleChange,
216 StyleChangeReasonForTracing::fromAttribute(attrName));
217 }
218
194 RenderObject* renderer = this->renderer(); 219 RenderObject* renderer = this->renderer();
195 if (attrName == SVGNames::xAttr 220 if (attrName == SVGNames::xAttr
196 || attrName == SVGNames::yAttr 221 || attrName == SVGNames::yAttr
197 || attrName == SVGNames::widthAttr 222 || attrName == SVGNames::widthAttr
198 || attrName == SVGNames::heightAttr) { 223 || attrName == SVGNames::heightAttr) {
199 updateRelativeLengthsInformation(); 224 updateRelativeLengthsInformation();
200 if (m_targetElementInstance) { 225 if (m_targetElementInstance) {
201 ASSERT(m_targetElementInstance->correspondingElement()); 226 ASSERT(m_targetElementInstance->correspondingElement());
202 transferUseWidthAndHeightIfNeeded(*this, m_targetElementInstance.get (), *m_targetElementInstance->correspondingElement()); 227 transferUseWidthAndHeightIfNeeded(*this, m_targetElementInstance.get (), *m_targetElementInstance->correspondingElement());
203 } 228 }
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 780
756 if (m_resource) 781 if (m_resource)
757 m_resource->removeClient(this); 782 m_resource->removeClient(this);
758 783
759 m_resource = resource; 784 m_resource = resource;
760 if (m_resource) 785 if (m_resource)
761 m_resource->addClient(this); 786 m_resource->addClient(this);
762 } 787 }
763 788
764 } 789 }
OLDNEW
« Source/core/svg/SVGUseElement.h ('K') | « Source/core/svg/SVGUseElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698