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

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

Issue 933663002: Make use of new method for setting lengths in presentation style. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 | « no previous file | Source/core/svg/SVGImageElement.cpp » ('j') | Source/core/svg/SVGSVGElement.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Apple Inc. All rights reserved. 2 * Copyright (C) 2006 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2008 Nikolas Zimmermann <zimmermann@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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 { 84 {
85 if (attrName == SVGNames::xAttr || attrName== SVGNames::yAttr 85 if (attrName == SVGNames::xAttr || attrName== SVGNames::yAttr
86 || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) 86 || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr)
87 return true; 87 return true;
88 return SVGGraphicsElement::isPresentationAttributeWithSVGDOM(attrName); 88 return SVGGraphicsElement::isPresentationAttributeWithSVGDOM(attrName);
89 } 89 }
90 90
91 void SVGForeignObjectElement::collectStyleForPresentationAttribute(const Qualifi edName& name, const AtomicString& value, MutableStylePropertySet* style) 91 void SVGForeignObjectElement::collectStyleForPresentationAttribute(const Qualifi edName& name, const AtomicString& value, MutableStylePropertySet* style)
92 { 92 {
93 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute (name); 93 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute (name);
94 if (property == m_width || property == m_height) { 94 if (property == m_width)
95 RefPtrWillBeRawPtr<SVGLength> length = SVGLength::create(LengthModeOther ); 95 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyWidth , *m_width->currentValue());
96 TrackExceptionState exceptionState; 96 else if (property == m_height)
97 length->setValueAsString(value, exceptionState); 97 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyHeigh t, *m_height->currentValue());
98 if (!exceptionState.hadException()) { 98 else if (property == m_x)
99 if (property == m_width)
100 addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, value);
101 else if (property == m_height)
102 addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight , value);
103 }
104 } else if (property == m_x) {
105 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m _x->currentValue()); 99 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m _x->currentValue());
106 } else if (property == m_y) { 100 else if (property == m_y)
107 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m _y->currentValue()); 101 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m _y->currentValue());
108 } else { 102 else
109 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st yle); 103 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st yle);
110 }
111 } 104 }
112 105
113 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName) 106 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName)
114 { 107 {
115 if (!isSupportedAttribute(attrName)) { 108 if (!isSupportedAttribute(attrName)) {
116 SVGGraphicsElement::svgAttributeChanged(attrName); 109 SVGGraphicsElement::svgAttributeChanged(attrName);
117 return; 110 return;
118 } 111 }
119 112
120 SVGElement::InvalidationGuard invalidationGuard(this); 113 SVGElement::InvalidationGuard invalidationGuard(this);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 152
160 bool SVGForeignObjectElement::selfHasRelativeLengths() const 153 bool SVGForeignObjectElement::selfHasRelativeLengths() const
161 { 154 {
162 return m_x->currentValue()->isRelative() 155 return m_x->currentValue()->isRelative()
163 || m_y->currentValue()->isRelative() 156 || m_y->currentValue()->isRelative()
164 || m_width->currentValue()->isRelative() 157 || m_width->currentValue()->isRelative()
165 || m_height->currentValue()->isRelative(); 158 || m_height->currentValue()->isRelative();
166 } 159 }
167 160
168 } // namespace blink 161 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/svg/SVGImageElement.cpp » ('j') | Source/core/svg/SVGSVGElement.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698