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

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

Issue 1481123002: Use SVGLength's wrapped CSSPrimitiveValue for pres.attr. style (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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, 2008, 2009 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Rob Buis <buis@kde.org>
4 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> 4 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 { 86 {
87 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr 87 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr
88 || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) 88 || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr)
89 return true; 89 return true;
90 return SVGGraphicsElement::isPresentationAttributeWithSVGDOM(attrName); 90 return SVGGraphicsElement::isPresentationAttributeWithSVGDOM(attrName);
91 } 91 }
92 92
93 void SVGImageElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style) 93 void SVGImageElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style)
94 { 94 {
95 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute (name); 95 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute (name);
96
97 if (property == m_width) 96 if (property == m_width)
98 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyWidth , *m_width->currentValue()); 97 addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, m_width ->currentValue()->asCSSPrimitiveValue());
99 else if (property == m_height) 98 else if (property == m_height)
100 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyHeigh t, *m_height->currentValue()); 99 addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, m_heig ht->currentValue()->asCSSPrimitiveValue());
101 else if (property == m_x) 100 else if (property == m_x)
102 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m _x->currentValue()); 101 addPropertyToPresentationAttributeStyle(style, CSSPropertyX, m_x->curren tValue()->asCSSPrimitiveValue());
103 else if (property == m_y) 102 else if (property == m_y)
104 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m _y->currentValue()); 103 addPropertyToPresentationAttributeStyle(style, CSSPropertyY, m_y->curren tValue()->asCSSPrimitiveValue());
105 else 104 else
106 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st yle); 105 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st yle);
107 } 106 }
108 107
109 void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName) 108 void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName)
110 { 109 {
111 bool isLengthAttribute = attrName == SVGNames::xAttr 110 bool isLengthAttribute = attrName == SVGNames::xAttr
112 || attrName == SVGNames::yAttr 111 || attrName == SVGNames::yAttr
113 || attrName == SVGNames::widthAttr 112 || attrName == SVGNames::widthAttr
114 || attrName == SVGNames::heightAttr; 113 || attrName == SVGNames::heightAttr;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 return AtomicString(hrefString()); 202 return AtomicString(hrefString());
204 } 203 }
205 204
206 void SVGImageElement::didMoveToNewDocument(Document& oldDocument) 205 void SVGImageElement::didMoveToNewDocument(Document& oldDocument)
207 { 206 {
208 imageLoader().elementDidMoveToNewDocument(); 207 imageLoader().elementDidMoveToNewDocument();
209 SVGGraphicsElement::didMoveToNewDocument(oldDocument); 208 SVGGraphicsElement::didMoveToNewDocument(oldDocument);
210 } 209 }
211 210
212 } // namespace blink 211 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGForeignObjectElement.cpp ('k') | third_party/WebKit/Source/core/svg/SVGLength.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698