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

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

Issue 262093007: Tighten error checking from SVGLength parsing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update expected file Created 6 years, 7 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) 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 { 89 {
90 if (name == SVGNames::widthAttr || name == SVGNames::heightAttr) 90 if (name == SVGNames::widthAttr || name == SVGNames::heightAttr)
91 return true; 91 return true;
92 return SVGGraphicsElement::isPresentationAttribute(name); 92 return SVGGraphicsElement::isPresentationAttribute(name);
93 } 93 }
94 94
95 void SVGForeignObjectElement::collectStyleForPresentationAttribute(const Qualifi edName& name, const AtomicString& value, MutableStylePropertySet* style) 95 void SVGForeignObjectElement::collectStyleForPresentationAttribute(const Qualifi edName& name, const AtomicString& value, MutableStylePropertySet* style)
96 { 96 {
97 if (name == SVGNames::widthAttr || name == SVGNames::heightAttr) { 97 if (name == SVGNames::widthAttr || name == SVGNames::heightAttr) {
98 RefPtr<SVGLength> length = SVGLength::create(LengthModeOther); 98 RefPtr<SVGLength> length = SVGLength::create(LengthModeOther);
99 length->setValueAsString(value, IGNORE_EXCEPTION); 99 TrackExceptionState exceptionState;
100 if (length->unitType() != LengthTypeUnknown) { 100 length->setValueAsString(value, exceptionState);
101 if (!exceptionState.hadException()) {
101 if (name == SVGNames::widthAttr) 102 if (name == SVGNames::widthAttr)
102 addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, length->valueAsString()); 103 addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, value);
103 else if (name == SVGNames::heightAttr) 104 else if (name == SVGNames::heightAttr)
104 addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight , length->valueAsString()); 105 addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight , value);
105 } 106 }
106 } else { 107 } else {
107 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st yle); 108 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st yle);
108 } 109 }
109 } 110 }
110 111
111 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName) 112 void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName)
112 { 113 {
113 if (!isSupportedAttribute(attrName)) { 114 if (!isSupportedAttribute(attrName)) {
114 SVGGraphicsElement::svgAttributeChanged(attrName); 115 SVGGraphicsElement::svgAttributeChanged(attrName);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 160
160 bool SVGForeignObjectElement::selfHasRelativeLengths() const 161 bool SVGForeignObjectElement::selfHasRelativeLengths() const
161 { 162 {
162 return m_x->currentValue()->isRelative() 163 return m_x->currentValue()->isRelative()
163 || m_y->currentValue()->isRelative() 164 || m_y->currentValue()->isRelative()
164 || m_width->currentValue()->isRelative() 165 || m_width->currentValue()->isRelative()
165 || m_height->currentValue()->isRelative(); 166 || m_height->currentValue()->isRelative();
166 } 167 }
167 168
168 } 169 }
OLDNEW
« no previous file with comments | « LayoutTests/svg/custom/disallow-non-lengths-in-attrs-expected.txt ('k') | Source/core/svg/SVGSVGElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698