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

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

Issue 2485663002: Store CSSPropertyID in SVGAnimatedPropertyBase (Closed)
Patch Set: Add missing case Created 4 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, 2007, 2008 Nikolas Zimmermann 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann
3 * <zimmermann@kde.org> 3 * <zimmermann@kde.org>
4 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
5 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
6 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 6 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
7 * Copyright (C) 2012 University of Szeged 7 * Copyright (C) 2012 University of Szeged
8 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> 8 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org>
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "core/xml/parser/XMLDocumentParser.h" 46 #include "core/xml/parser/XMLDocumentParser.h"
47 #include "wtf/Vector.h" 47 #include "wtf/Vector.h"
48 48
49 namespace blink { 49 namespace blink {
50 50
51 inline SVGUseElement::SVGUseElement(Document& document) 51 inline SVGUseElement::SVGUseElement(Document& document)
52 : SVGGraphicsElement(SVGNames::useTag, document), 52 : SVGGraphicsElement(SVGNames::useTag, document),
53 SVGURIReference(this), 53 SVGURIReference(this),
54 m_x(SVGAnimatedLength::create(this, 54 m_x(SVGAnimatedLength::create(this,
55 SVGNames::xAttr, 55 SVGNames::xAttr,
56 SVGLength::create(SVGLengthMode::Width))), 56 SVGLength::create(SVGLengthMode::Width),
57 CSSPropertyX)),
57 m_y(SVGAnimatedLength::create(this, 58 m_y(SVGAnimatedLength::create(this,
58 SVGNames::yAttr, 59 SVGNames::yAttr,
59 SVGLength::create(SVGLengthMode::Height))), 60 SVGLength::create(SVGLengthMode::Height),
61 CSSPropertyY)),
60 m_width( 62 m_width(
61 SVGAnimatedLength::create(this, 63 SVGAnimatedLength::create(this,
62 SVGNames::widthAttr, 64 SVGNames::widthAttr,
63 SVGLength::create(SVGLengthMode::Width))), 65 SVGLength::create(SVGLengthMode::Width))),
64 m_height( 66 m_height(
65 SVGAnimatedLength::create(this, 67 SVGAnimatedLength::create(this,
66 SVGNames::heightAttr, 68 SVGNames::heightAttr,
67 SVGLength::create(SVGLengthMode::Height))), 69 SVGLength::create(SVGLengthMode::Height))),
68 m_elementIdentifierIsLocal(true), 70 m_elementIdentifierIsLocal(true),
69 m_haveFiredLoadEvent(false), 71 m_haveFiredLoadEvent(false),
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 ? AtomicString(use.width()->currentValue()->valueAsString()) 167 ? AtomicString(use.width()->currentValue()->valueAsString())
166 : originalElement.getAttribute(SVGNames::widthAttr)); 168 : originalElement.getAttribute(SVGNames::widthAttr));
167 shadowElement.setAttribute( 169 shadowElement.setAttribute(
168 SVGNames::heightAttr, 170 SVGNames::heightAttr,
169 use.height()->isSpecified() 171 use.height()->isSpecified()
170 ? AtomicString(use.height()->currentValue()->valueAsString()) 172 ? AtomicString(use.height()->currentValue()->valueAsString())
171 : originalElement.getAttribute(SVGNames::heightAttr)); 173 : originalElement.getAttribute(SVGNames::heightAttr));
172 } 174 }
173 } 175 }
174 176
175 bool SVGUseElement::isPresentationAttribute(
176 const QualifiedName& attrName) const {
177 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr)
178 return true;
179 return SVGGraphicsElement::isPresentationAttribute(attrName);
180 }
181
182 bool SVGUseElement::isPresentationAttributeWithSVGDOM(
183 const QualifiedName& attrName) const {
184 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr)
185 return true;
186 return SVGGraphicsElement::isPresentationAttributeWithSVGDOM(attrName);
187 }
188
189 void SVGUseElement::collectStyleForPresentationAttribute( 177 void SVGUseElement::collectStyleForPresentationAttribute(
190 const QualifiedName& name, 178 const QualifiedName& name,
191 const AtomicString& value, 179 const AtomicString& value,
192 MutableStylePropertySet* style) { 180 MutableStylePropertySet* style) {
193 SVGAnimatedPropertyBase* property = propertyFromAttribute(name); 181 SVGAnimatedPropertyBase* property = propertyFromAttribute(name);
194 if (property == m_x) 182 if (property == m_x)
195 addPropertyToPresentationAttributeStyle( 183 addPropertyToPresentationAttributeStyle(
196 style, CSSPropertyX, m_x->currentValue()->asCSSPrimitiveValue()); 184 style, CSSPropertyX, m_x->currentValue()->asCSSPrimitiveValue());
197 else if (property == m_y) 185 else if (property == m_y)
198 addPropertyToPresentationAttributeStyle( 186 addPropertyToPresentationAttributeStyle(
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 729
742 if (m_resource) 730 if (m_resource)
743 m_resource->removeClient(this); 731 m_resource->removeClient(this);
744 732
745 m_resource = resource; 733 m_resource = resource;
746 if (m_resource) 734 if (m_resource)
747 m_resource->addClient(this); 735 m_resource->addClient(this);
748 } 736 }
749 737
750 } // namespace blink 738 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698