+2011-08-04 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r92419.
+ http://trac.webkit.org/changeset/92419
+ https://bugs.webkit.org/show_bug.cgi?id=65726
+
+ "committed partially to branch" (Requested by thorton on
+ #webkit).
+
+ * platform/chromium-win/svg/hixie/error/013-expected.txt:
+ * platform/gtk/svg/hixie/error/001-expected.txt:
+ * platform/gtk/svg/hixie/error/007-expected.txt:
+ * platform/gtk/svg/hixie/error/013-expected.txt:
+ * platform/gtk/svg/hixie/error/015-expected.txt:
+ * platform/mac/svg/hixie/error/001-expected.txt:
+ * platform/mac/svg/hixie/error/007-expected.txt:
+ * platform/mac/svg/hixie/error/013-expected.txt:
+ * platform/mac/svg/hixie/error/015-expected.txt:
+ * platform/qt/svg/hixie/error/001-expected.txt:
+ * platform/qt/svg/hixie/error/007-expected.txt:
+ * platform/qt/svg/hixie/error/013-expected.txt:
+ * platform/qt/svg/hixie/error/015-expected.txt:
+ * svg/custom/invalid-length-units-expected.txt:
+ * svg/custom/svg-parse-overflow-1-expected.txt:
+ * svg/custom/svg-parse-overflow-2-expected.txt:
+ * svg/custom/svg-parse-overflow-3-expected.txt:
+ * svg/custom/svg-parse-overflow-4-expected.txt:
+ * svg/custom/svg-parse-overflow-5-expected.txt:
+
2011-08-04 Tim Horton <timothy_horton@apple.com>
Reviewed by Nikolas Zimmerman.
-CONSOLE MESSAGE: line 10: Error: Invalid negative value for <svg> attribute width="-100"
+CONSOLE MESSAGE: line 10: Error: A negative value for svg attribute <width> is not allowed
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x105
-CONSOLE MESSAGE: line 3: Error: Invalid value for <circle> attribute r="r"
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
-CONSOLE MESSAGE: line 4: Error: Invalid negative value for <rect> attribute width="-200"
+CONSOLE MESSAGE: line 4: Error: A negative value for rect <width> is not allowed
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
-CONSOLE MESSAGE: line 10: Error: Invalid negative value for <svg> attribute width="-100"
+CONSOLE MESSAGE: line 10: Error: A negative value for svg attribute <width> is not allowed
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x102
-CONSOLE MESSAGE: line 6: Error: Invalid value for <rect> attribute width=" 300"
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 300x200
-CONSOLE MESSAGE: line 3: Error: Invalid value for <circle> attribute r="r"
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
-CONSOLE MESSAGE: line 4: Error: Invalid negative value for <rect> attribute width="-200"
+CONSOLE MESSAGE: line 4: Error: A negative value for rect <width> is not allowed
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
-CONSOLE MESSAGE: line 10: Error: Invalid negative value for <svg> attribute width="-100"
+CONSOLE MESSAGE: line 10: Error: A negative value for svg attribute <width> is not allowed
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x100
-CONSOLE MESSAGE: line 6: Error: Invalid value for <rect> attribute width=" 300"
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 300x200
-CONSOLE MESSAGE: line 3: Error: Invalid value for <circle> attribute r="r"
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
-CONSOLE MESSAGE: line 4: Error: Invalid negative value for <rect> attribute width="-200"
+CONSOLE MESSAGE: line 4: Error: A negative value for rect <width> is not allowed
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
-CONSOLE MESSAGE: line 10: Error: Invalid negative value for <svg> attribute width="-100"
+CONSOLE MESSAGE: line 10: Error: A negative value for svg attribute <width> is not allowed
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x110
-CONSOLE MESSAGE: line 6: Error: Invalid value for <rect> attribute width=" 300"
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 300x200
-CONSOLE MESSAGE: line 9: Error: Invalid value for <rect> attribute x=" "
-CONSOLE MESSAGE: line 9: Error: Invalid value for <rect> attribute x="foo"
-CONSOLE MESSAGE: line 9: Error: Invalid value for <rect> attribute x="10foo"
-CONSOLE MESSAGE: line 9: Error: Invalid value for <rect> attribute x="px"
-CONSOLE MESSAGE: line 9: Error: Invalid value for <rect> attribute x="10px "
-CONSOLE MESSAGE: line 9: Error: Invalid value for <rect> attribute x="10% "
-CONSOLE MESSAGE: line 9: Error: Invalid value for <rect> attribute x="10 % "
-CONSOLE MESSAGE: line 9: Error: Invalid value for <rect> attribute x="10 %"
-CONSOLE MESSAGE: line 9: Error: Invalid value for <rect> attribute x="10 px "
-CONSOLE MESSAGE: line 9: Error: Invalid value for <rect> attribute x="10 px"
Tests handling of invalid SVG length units.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-CONSOLE MESSAGE: line 8: Error: Invalid value for <foreignObject> attribute y="105000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
-CONSOLE MESSAGE: line 8: Error: Invalid value for <rect> attribute height="-105000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
-CONSOLE MESSAGE: line 13: Error: Invalid value for <rect> attribute height="105000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
-CONSOLE MESSAGE: line 8: Error: Invalid value for <foreignObject> attribute y="105.0e50"
-CONSOLE MESSAGE: line 8: Error: Invalid value for <foreignObject> attribute y="105.0e5000000000000000000000000000000000000000000000000000"
+2011-08-04 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r92419.
+ http://trac.webkit.org/changeset/92419
+ https://bugs.webkit.org/show_bug.cgi?id=65726
+
+ "committed partially to branch" (Requested by thorton on
+ #webkit).
+
+ * svg/SVGCircleElement.cpp:
+ (WebCore::SVGCircleElement::parseMappedAttribute):
+ * svg/SVGCursorElement.cpp:
+ (WebCore::SVGCursorElement::parseMappedAttribute):
+ * svg/SVGEllipseElement.cpp:
+ (WebCore::SVGEllipseElement::parseMappedAttribute):
+ * svg/SVGFilterElement.cpp:
+ (WebCore::SVGFilterElement::parseMappedAttribute):
+ * svg/SVGFilterPrimitiveStandardAttributes.cpp:
+ (WebCore::SVGFilterPrimitiveStandardAttributes::parseMappedAttribute):
+ * svg/SVGForeignObjectElement.cpp:
+ (WebCore::SVGForeignObjectElement::parseMappedAttribute):
+ * svg/SVGImageElement.cpp:
+ (WebCore::SVGImageElement::parseMappedAttribute):
+ * svg/SVGLineElement.cpp:
+ (WebCore::SVGLineElement::parseMappedAttribute):
+ * svg/SVGLinearGradientElement.cpp:
+ (WebCore::SVGLinearGradientElement::parseMappedAttribute):
+ * svg/SVGMarkerElement.cpp:
+ (WebCore::SVGMarkerElement::parseMappedAttribute):
+ * svg/SVGMaskElement.cpp:
+ (WebCore::SVGMaskElement::parseMappedAttribute):
+ * svg/SVGPatternElement.cpp:
+ (WebCore::SVGPatternElement::parseMappedAttribute):
+ * svg/SVGRadialGradientElement.cpp:
+ (WebCore::SVGRadialGradientElement::parseMappedAttribute):
+ * svg/SVGRectElement.cpp:
+ (WebCore::SVGRectElement::parseMappedAttribute):
+ * svg/SVGSVGElement.cpp:
+ (WebCore::SVGSVGElement::parseMappedAttribute):
+ * svg/SVGTextContentElement.cpp:
+ (WebCore::SVGTextContentElement::parseMappedAttribute):
+ * svg/SVGTextPathElement.cpp:
+ (WebCore::SVGTextPathElement::parseMappedAttribute):
+ * svg/SVGUseElement.cpp:
+ (WebCore::SVGUseElement::parseMappedAttribute):
+
2011-08-04 Fady Samuel <fsamuel@chromium.org>
Background Does Not Scale Correctly with Page
#include "SVGCircleElement.h"
#include "Attribute.h"
-#include "ExceptionCode.h"
#include "FloatPoint.h"
#include "RenderSVGPath.h"
#include "RenderSVGResource.h"
#include "SVGElementInstance.h"
-#include "SVGException.h"
#include "SVGLength.h"
#include "SVGNames.h"
void SVGCircleElement::parseMappedAttribute(Attribute* attr)
{
- SVGParsingError parseError = NoError;
-
- if (!isSupportedAttribute(attr->name()))
+ if (!isSupportedAttribute(attr->name())) {
SVGStyledTransformableElement::parseMappedAttribute(attr);
- else if (attr->name() == SVGNames::cxAttr)
- setCxBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError));
- else if (attr->name() == SVGNames::cyAttr)
- setCyBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError));
- else if (attr->name() == SVGNames::rAttr)
- setRBaseValue(SVGLength::construct(LengthModeOther, attr->value(), parseError, ForbidNegativeLengths));
- else if (SVGTests::parseMappedAttribute(attr)
- || SVGLangSpace::parseMappedAttribute(attr)
- || SVGExternalResourcesRequired::parseMappedAttribute(attr)) {
- } else
- ASSERT_NOT_REACHED();
-
- reportAttributeParsingError(parseError, attr);
+ return;
+ }
+
+ if (attr->name() == SVGNames::cxAttr) {
+ setCxBaseValue(SVGLength(LengthModeWidth, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::cyAttr) {
+ setCyBaseValue(SVGLength(LengthModeHeight, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::rAttr) {
+ setRBaseValue(SVGLength(LengthModeOther, attr->value()));
+ if (rBaseValue().value(this) < 0.0)
+ document()->accessSVGExtensions()->reportError("A negative value for circle <r> is not allowed");
+ return;
+ }
+
+ if (SVGTests::parseMappedAttribute(attr))
+ return;
+ if (SVGLangSpace::parseMappedAttribute(attr))
+ return;
+ if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
+ return;
+
+ ASSERT_NOT_REACHED();
}
void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName)
void SVGCursorElement::parseMappedAttribute(Attribute* attr)
{
- SVGParsingError parseError = NoError;
-
- if (!isSupportedAttribute(attr->name()))
+ if (!isSupportedAttribute(attr->name())) {
SVGElement::parseMappedAttribute(attr);
- else if (attr->name() == SVGNames::xAttr)
- setXBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError));
- else if (attr->name() == SVGNames::yAttr)
- setYBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError));
- else if (SVGTests::parseMappedAttribute(attr)
- || SVGExternalResourcesRequired::parseMappedAttribute(attr)
- || SVGURIReference::parseMappedAttribute(attr)) {
- } else
- ASSERT_NOT_REACHED();
+ return;
+ }
+
+ if (attr->name() == SVGNames::xAttr) {
+ setXBaseValue(SVGLength(LengthModeWidth, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::yAttr) {
+ setYBaseValue(SVGLength(LengthModeHeight, attr->value()));
+ return;
+ }
- reportAttributeParsingError(parseError, attr);
+ if (SVGTests::parseMappedAttribute(attr))
+ return;
+ if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
+ return;
+ if (SVGURIReference::parseMappedAttribute(attr))
+ return;
+
+ ASSERT_NOT_REACHED();
}
void SVGCursorElement::addClient(SVGElement* element)
void SVGEllipseElement::parseMappedAttribute(Attribute* attr)
{
- SVGParsingError parseError = NoError;
-
- if (!isSupportedAttribute(attr->name()))
+ if (!isSupportedAttribute(attr->name())) {
SVGStyledTransformableElement::parseMappedAttribute(attr);
- else if (attr->name() == SVGNames::cxAttr)
- setCxBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError));
- else if (attr->name() == SVGNames::cyAttr)
- setCyBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError));
- else if (attr->name() == SVGNames::rxAttr)
- setRxBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError, ForbidNegativeLengths));
- else if (attr->name() == SVGNames::ryAttr)
- setRyBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError, ForbidNegativeLengths));
- else if (SVGTests::parseMappedAttribute(attr)
- || SVGLangSpace::parseMappedAttribute(attr)
- || SVGExternalResourcesRequired::parseMappedAttribute(attr)) {
- } else
- ASSERT_NOT_REACHED();
-
- reportAttributeParsingError(parseError, attr);
+ return;
+ }
+
+ if (attr->name() == SVGNames::cxAttr) {
+ setCxBaseValue(SVGLength(LengthModeWidth, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::cyAttr) {
+ setCyBaseValue(SVGLength(LengthModeHeight, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::rxAttr) {
+ setRxBaseValue(SVGLength(LengthModeWidth, attr->value()));
+ if (rxBaseValue().value(this) < 0.0)
+ document()->accessSVGExtensions()->reportError("A negative value for ellipse <rx> is not allowed");
+ return;
+ }
+
+ if (attr->name() == SVGNames::ryAttr) {
+ setRyBaseValue(SVGLength(LengthModeHeight, attr->value()));
+ if (ryBaseValue().value(this) < 0.0)
+ document()->accessSVGExtensions()->reportError("A negative value for ellipse <ry> is not allowed");
+ return;
+ }
+
+ if (SVGTests::parseMappedAttribute(attr))
+ return;
+ if (SVGLangSpace::parseMappedAttribute(attr))
+ return;
+ if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
+ return;
+
+ ASSERT_NOT_REACHED();
}
void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName)
void SVGFilterElement::parseMappedAttribute(Attribute* attr)
{
- SVGParsingError parseError = NoError;
- const AtomicString& value = attr->value();
-
- if (!isSupportedAttribute(attr->name()))
+ if (!isSupportedAttribute(attr->name())) {
SVGStyledElement::parseMappedAttribute(attr);
- else if (attr->name() == SVGNames::filterUnitsAttr) {
+ return;
+ }
+
+ const AtomicString& value = attr->value();
+ if (attr->name() == SVGNames::filterUnitsAttr) {
SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value);
if (propertyValue > 0)
setFilterUnitsBaseValue(propertyValue);
- } else if (attr->name() == SVGNames::primitiveUnitsAttr) {
+ return;
+ }
+
+ if (attr->name() == SVGNames::primitiveUnitsAttr) {
SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value);
if (propertyValue > 0)
setPrimitiveUnitsBaseValue(propertyValue);
- } else if (attr->name() == SVGNames::xAttr)
- setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
- else if (attr->name() == SVGNames::yAttr)
- setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
- else if (attr->name() == SVGNames::widthAttr)
- setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
- else if (attr->name() == SVGNames::heightAttr)
- setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
- else if (attr->name() == SVGNames::filterResAttr) {
+ return;
+ }
+
+ if (attr->name() == SVGNames::xAttr) {
+ setXBaseValue(SVGLength(LengthModeWidth, value));
+ return;
+ }
+
+ if (attr->name() == SVGNames::yAttr) {
+ setYBaseValue(SVGLength(LengthModeHeight, value));
+ return;
+ }
+
+ if (attr->name() == SVGNames::widthAttr) {
+ setWidthBaseValue(SVGLength(LengthModeWidth, value));
+ return;
+ }
+
+ if (attr->name() == SVGNames::heightAttr) {
+ setHeightBaseValue(SVGLength(LengthModeHeight, value));
+ return;
+ }
+
+ if (attr->name() == SVGNames::filterResAttr) {
float x, y;
if (parseNumberOptionalNumber(value, x, y)) {
setFilterResXBaseValue(x);
setFilterResYBaseValue(y);
}
- } else if (SVGURIReference::parseMappedAttribute(attr)
- || SVGLangSpace::parseMappedAttribute(attr)
- || SVGExternalResourcesRequired::parseMappedAttribute(attr)) {
- } else
- ASSERT_NOT_REACHED();
+ return;
+ }
+
+ if (SVGURIReference::parseMappedAttribute(attr))
+ return;
+ if (SVGLangSpace::parseMappedAttribute(attr))
+ return;
+ if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
+ return;
- reportAttributeParsingError(parseError, attr);
+ ASSERT_NOT_REACHED();
}
void SVGFilterElement::svgAttributeChanged(const QualifiedName& attrName)
void SVGFilterPrimitiveStandardAttributes::parseMappedAttribute(Attribute* attr)
{
- SVGParsingError parseError = NoError;
+ if (!isSupportedAttribute(attr->name())) {
+ SVGStyledElement::parseMappedAttribute(attr);
+ return;
+ }
+
const AtomicString& value = attr->value();
+ if (attr->name() == SVGNames::xAttr) {
+ setXBaseValue(SVGLength(LengthModeWidth, value));
+ return;
+ }
- if (!isSupportedAttribute(attr->name()))
- SVGStyledElement::parseMappedAttribute(attr);
- else if (attr->name() == SVGNames::xAttr)
- setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
- else if (attr->name() == SVGNames::yAttr)
- setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
- else if (attr->name() == SVGNames::widthAttr)
- setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
- else if (attr->name() == SVGNames::heightAttr)
- setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
- else if (attr->name() == SVGNames::resultAttr)
+ if (attr->name() == SVGNames::yAttr) {
+ setYBaseValue(SVGLength(LengthModeHeight, value));
+ return;
+ }
+
+ if (attr->name() == SVGNames::widthAttr) {
+ setWidthBaseValue(SVGLength(LengthModeWidth, value));
+ return;
+ }
+
+ if (attr->name() == SVGNames::heightAttr) {
+ setHeightBaseValue(SVGLength(LengthModeHeight, value));
+ return;
+ }
+
+ if (attr->name() == SVGNames::resultAttr) {
setResultBaseValue(value);
- else
- ASSERT_NOT_REACHED();
+ return;
+ }
- reportAttributeParsingError(parseError, attr);
+ ASSERT_NOT_REACHED();
}
bool SVGFilterPrimitiveStandardAttributes::setFilterEffectAttribute(FilterEffect*, const QualifiedName&)
void SVGForeignObjectElement::parseMappedAttribute(Attribute* attr)
{
- SVGParsingError parseError = NoError;
+ if (!isSupportedAttribute(attr->name())) {
+ SVGStyledTransformableElement::parseMappedAttribute(attr);
+ return;
+ }
+
const AtomicString& value = attr->value();
+ if (attr->name() == SVGNames::xAttr) {
+ setXBaseValue(SVGLength(LengthModeWidth, value));
+ return;
+ }
- if (!isSupportedAttribute(attr->name()))
- SVGStyledTransformableElement::parseMappedAttribute(attr);
- else if (attr->name() == SVGNames::xAttr)
- setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
- else if (attr->name() == SVGNames::yAttr)
- setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
- else if (attr->name() == SVGNames::widthAttr)
- setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
- else if (attr->name() == SVGNames::heightAttr)
- setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
- else if (SVGTests::parseMappedAttribute(attr)
- || SVGLangSpace::parseMappedAttribute(attr)
- || SVGExternalResourcesRequired::parseMappedAttribute(attr)) {
- } else
- ASSERT_NOT_REACHED();
-
- reportAttributeParsingError(parseError, attr);
+ if (attr->name() == SVGNames::yAttr) {
+ setYBaseValue(SVGLength(LengthModeHeight, value));
+ return;
+ }
+
+ if (attr->name() == SVGNames::widthAttr) {
+ setWidthBaseValue(SVGLength(LengthModeWidth, value));
+ return;
+ }
+
+ if (attr->name() == SVGNames::heightAttr) {
+ setHeightBaseValue(SVGLength(LengthModeHeight, value));
+ return;
+ }
+
+ if (SVGTests::parseMappedAttribute(attr))
+ return;
+ if (SVGLangSpace::parseMappedAttribute(attr))
+ return;
+ if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
+ return;
+
+ ASSERT_NOT_REACHED();
}
void SVGForeignObjectElement::svgAttributeChanged(const QualifiedName& attrName)
void SVGImageElement::parseMappedAttribute(Attribute* attr)
{
- SVGParsingError parseError = NoError;
-
- if (!isSupportedAttribute(attr->name()))
+ if (!isSupportedAttribute(attr->name())) {
SVGStyledTransformableElement::parseMappedAttribute(attr);
- else if (attr->name() == SVGNames::xAttr)
- setXBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError));
- else if (attr->name() == SVGNames::yAttr)
- setYBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError));
- else if (attr->name() == SVGNames::preserveAspectRatioAttr)
+ return;
+ }
+
+ if (attr->name() == SVGNames::xAttr) {
+ setXBaseValue(SVGLength(LengthModeWidth, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::yAttr) {
+ setYBaseValue(SVGLength(LengthModeHeight, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::preserveAspectRatioAttr) {
SVGPreserveAspectRatio::parsePreserveAspectRatio(this, attr->value());
- else if (attr->name() == SVGNames::widthAttr) {
- setWidthBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError, ForbidNegativeLengths));
+ return;
+ }
+
+ if (attr->name() == SVGNames::widthAttr) {
+ setWidthBaseValue(SVGLength(LengthModeWidth, attr->value()));
addCSSProperty(attr, CSSPropertyWidth, attr->value());
- } else if (attr->name() == SVGNames::heightAttr) {
- setHeightBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError, ForbidNegativeLengths));
+ if (widthBaseValue().value(this) < 0.0)
+ document()->accessSVGExtensions()->reportError("A negative value for image attribute <width> is not allowed");
+ return;
+ }
+
+ if (attr->name() == SVGNames::heightAttr) {
+ setHeightBaseValue(SVGLength(LengthModeHeight, attr->value()));
addCSSProperty(attr, CSSPropertyHeight, attr->value());
- } else if (SVGTests::parseMappedAttribute(attr)
- || SVGLangSpace::parseMappedAttribute(attr)
- || SVGExternalResourcesRequired::parseMappedAttribute(attr)
- || SVGURIReference::parseMappedAttribute(attr)) {
- } else
- ASSERT_NOT_REACHED();
-
- reportAttributeParsingError(parseError, attr);
+ if (heightBaseValue().value(this) < 0.0)
+ document()->accessSVGExtensions()->reportError("A negative value for image attribute <height> is not allowed");
+ return;
+ }
+
+ if (SVGTests::parseMappedAttribute(attr))
+ return;
+ if (SVGLangSpace::parseMappedAttribute(attr))
+ return;
+ if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
+ return;
+ if (SVGURIReference::parseMappedAttribute(attr))
+ return;
+
+ ASSERT_NOT_REACHED();
}
void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName)
void SVGLineElement::parseMappedAttribute(Attribute* attr)
{
- SVGParsingError parseError = NoError;
-
- if (!isSupportedAttribute(attr->name()))
+ if (!isSupportedAttribute(attr->name())) {
SVGStyledTransformableElement::parseMappedAttribute(attr);
- else if (attr->name() == SVGNames::x1Attr)
- setX1BaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError));
- else if (attr->name() == SVGNames::y1Attr)
- setY1BaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError));
- else if (attr->name() == SVGNames::x2Attr)
- setX2BaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError));
- else if (attr->name() == SVGNames::y2Attr)
- setY2BaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError));
- else if (SVGTests::parseMappedAttribute(attr)
- || SVGLangSpace::parseMappedAttribute(attr)
- || SVGExternalResourcesRequired::parseMappedAttribute(attr)) {
- } else
- ASSERT_NOT_REACHED();
-
- reportAttributeParsingError(parseError, attr);
+ return;
+ }
+
+ if (attr->name() == SVGNames::x1Attr) {
+ setX1BaseValue(SVGLength(LengthModeWidth, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::y1Attr) {
+ setY1BaseValue(SVGLength(LengthModeHeight, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::x2Attr) {
+ setX2BaseValue(SVGLength(LengthModeWidth, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::y2Attr) {
+ setY2BaseValue(SVGLength(LengthModeHeight, attr->value()));
+ return;
+ }
+
+ if (SVGTests::parseMappedAttribute(attr))
+ return;
+ if (SVGLangSpace::parseMappedAttribute(attr))
+ return;
+ if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
+ return;
+
+ ASSERT_NOT_REACHED();
}
void SVGLineElement::svgAttributeChanged(const QualifiedName& attrName)
void SVGLinearGradientElement::parseMappedAttribute(Attribute* attr)
{
- SVGParsingError parseError = NoError;
-
- if (!isSupportedAttribute(attr->name()))
+ if (!isSupportedAttribute(attr->name())) {
SVGGradientElement::parseMappedAttribute(attr);
- else if (attr->name() == SVGNames::x1Attr)
- setX1BaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError));
- else if (attr->name() == SVGNames::y1Attr)
- setY1BaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError));
- else if (attr->name() == SVGNames::x2Attr)
- setX2BaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError));
- else if (attr->name() == SVGNames::y2Attr)
- setY2BaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError));
- else
- ASSERT_NOT_REACHED();
-
- reportAttributeParsingError(parseError, attr);
+ return;
+ }
+
+ if (attr->name() == SVGNames::x1Attr) {
+ setX1BaseValue(SVGLength(LengthModeWidth, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::y1Attr) {
+ setY1BaseValue(SVGLength(LengthModeHeight, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::x2Attr) {
+ setX2BaseValue(SVGLength(LengthModeWidth, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::y2Attr) {
+ setY2BaseValue(SVGLength(LengthModeHeight, attr->value()));
+ return;
+ }
+
+ ASSERT_NOT_REACHED();
}
void SVGLinearGradientElement::svgAttributeChanged(const QualifiedName& attrName)
void SVGMarkerElement::parseMappedAttribute(Attribute* attr)
{
- SVGParsingError parseError = NoError;
- const AtomicString& value = attr->value();
-
- if (!isSupportedAttribute(attr->name()))
+ if (!isSupportedAttribute(attr->name())) {
SVGStyledElement::parseMappedAttribute(attr);
- else if (attr->name() == SVGNames::markerUnitsAttr) {
+ return;
+ }
+
+ const AtomicString& value = attr->value();
+ if (attr->name() == SVGNames::markerUnitsAttr) {
SVGMarkerUnitsType propertyValue = SVGPropertyTraits<SVGMarkerUnitsType>::fromString(value);
if (propertyValue > 0)
setMarkerUnitsBaseValue(propertyValue);
- } else if (attr->name() == SVGNames::refXAttr)
- setRefXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
- else if (attr->name() == SVGNames::refYAttr)
- setRefYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
- else if (attr->name() == SVGNames::markerWidthAttr)
- setMarkerWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
- else if (attr->name() == SVGNames::markerHeightAttr)
- setMarkerHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError));
- else if (attr->name() == SVGNames::orientAttr) {
+ return;
+ }
+
+ if (attr->name() == SVGNames::refXAttr) {
+ setRefXBaseValue(SVGLength(LengthModeWidth, value));
+ return;
+ }
+
+ if (attr->name() == SVGNames::refYAttr) {
+ setRefYBaseValue(SVGLength(LengthModeHeight, value));
+ return;
+ }
+
+ if (attr->name() == SVGNames::markerWidthAttr) {
+ setMarkerWidthBaseValue(SVGLength(LengthModeWidth, value));
+ return;
+ }
+
+ if (attr->name() == SVGNames::markerHeightAttr) {
+ setMarkerHeightBaseValue(SVGLength(LengthModeHeight, value));
+ return;
+ }
+
+ if (attr->name() == SVGNames::orientAttr) {
SVGAngle angle;
SVGMarkerOrientType orientType = SVGPropertyTraits<SVGMarkerOrientType>::fromString(value, angle);
if (orientType > 0)
setOrientTypeBaseValue(orientType);
if (orientType == SVGMarkerOrientAngle)
setOrientAngleBaseValue(angle);
- } else if (SVGLangSpace::parseMappedAttribute(attr)
- || SVGExternalResourcesRequired::parseMappedAttribute(attr)
- || SVGFitToViewBox::parseMappedAttribute(document(), attr)) {
- } else
- ASSERT_NOT_REACHED();
+ return;
+ }
+
+ if (SVGLangSpace::parseMappedAttribute(attr))
+ return;
+ if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
+ return;
+ if (SVGFitToViewBox::parseMappedAttribute(document(), attr))
+ return;
- reportAttributeParsingError(parseError, attr);
+ ASSERT_NOT_REACHED();
}
void SVGMarkerElement::svgAttributeChanged(const QualifiedName& attrName)
void SVGMaskElement::parseMappedAttribute(Attribute* attr)
{
- SVGParsingError parseError = NoError;
-
- if (!isSupportedAttribute(attr->name()))
+ if (!isSupportedAttribute(attr->name())) {
SVGStyledElement::parseMappedAttribute(attr);
- else if (attr->name() == SVGNames::maskUnitsAttr) {
+ return;
+ }
+
+ if (attr->name() == SVGNames::maskUnitsAttr) {
SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(attr->value());
if (propertyValue > 0)
setMaskUnitsBaseValue(propertyValue);
return;
- } else if (attr->name() == SVGNames::maskContentUnitsAttr) {
+ }
+
+ if (attr->name() == SVGNames::maskContentUnitsAttr) {
SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(attr->value());
if (propertyValue > 0)
setMaskContentUnitsBaseValue(propertyValue);
return;
- } else if (attr->name() == SVGNames::xAttr)
- setXBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError));
- else if (attr->name() == SVGNames::yAttr)
- setYBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError));
- else if (attr->name() == SVGNames::widthAttr)
- setWidthBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError));
- else if (attr->name() == SVGNames::heightAttr)
- setHeightBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError));
- else if (SVGTests::parseMappedAttribute(attr)
- || SVGLangSpace::parseMappedAttribute(attr)
- || SVGExternalResourcesRequired::parseMappedAttribute(attr)) {
- } else
- ASSERT_NOT_REACHED();
-
- reportAttributeParsingError(parseError, attr);
+ }
+
+ if (attr->name() == SVGNames::xAttr) {
+ setXBaseValue(SVGLength(LengthModeWidth, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::yAttr) {
+ setYBaseValue(SVGLength(LengthModeHeight, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::widthAttr) {
+ setWidthBaseValue(SVGLength(LengthModeWidth, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::heightAttr) {
+ setHeightBaseValue(SVGLength(LengthModeHeight, attr->value()));
+ return;
+ }
+
+ if (SVGTests::parseMappedAttribute(attr))
+ return;
+ if (SVGLangSpace::parseMappedAttribute(attr))
+ return;
+ if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
+ return;
+
+ ASSERT_NOT_REACHED();
}
void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName)
void SVGPatternElement::parseMappedAttribute(Attribute* attr)
{
- SVGParsingError parseError = NoError;
-
- if (!isSupportedAttribute(attr->name()))
+ if (!isSupportedAttribute(attr->name())) {
SVGStyledElement::parseMappedAttribute(attr);
- else if (attr->name() == SVGNames::patternUnitsAttr) {
+ return;
+ }
+
+ if (attr->name() == SVGNames::patternUnitsAttr) {
SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(attr->value());
if (propertyValue > 0)
setPatternUnitsBaseValue(propertyValue);
return;
- } else if (attr->name() == SVGNames::patternContentUnitsAttr) {
+ }
+
+ if (attr->name() == SVGNames::patternContentUnitsAttr) {
SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(attr->value());
if (propertyValue > 0)
setPatternContentUnitsBaseValue(propertyValue);
return;
- } else if (attr->name() == SVGNames::patternTransformAttr) {
+ }
+
+ if (attr->name() == SVGNames::patternTransformAttr) {
SVGTransformList newList;
if (!SVGTransformable::parseTransformAttribute(newList, attr->value()))
newList.clear();
detachAnimatedPatternTransformListWrappers(newList.size());
setPatternTransformBaseValue(newList);
return;
- } else if (attr->name() == SVGNames::xAttr)
- setXBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError));
- else if (attr->name() == SVGNames::yAttr)
- setYBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError));
- else if (attr->name() == SVGNames::widthAttr)
- setWidthBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError, ForbidNegativeLengths));
- else if (attr->name() == SVGNames::heightAttr)
- setHeightBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError, ForbidNegativeLengths));
- else if (SVGURIReference::parseMappedAttribute(attr)
- || SVGTests::parseMappedAttribute(attr)
- || SVGLangSpace::parseMappedAttribute(attr)
- || SVGExternalResourcesRequired::parseMappedAttribute(attr)
- || SVGFitToViewBox::parseMappedAttribute(document(), attr)) {
- } else
- ASSERT_NOT_REACHED();
-
- reportAttributeParsingError(parseError, attr);
+ }
+
+ if (attr->name() == SVGNames::xAttr) {
+ setXBaseValue(SVGLength(LengthModeWidth, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::yAttr) {
+ setYBaseValue(SVGLength(LengthModeHeight, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::widthAttr) {
+ setWidthBaseValue(SVGLength(LengthModeWidth, attr->value()));
+ if (widthBaseValue().value(this) < 0)
+ document()->accessSVGExtensions()->reportError("A negative value for pattern attribute <width> is not allowed");
+ return;
+ }
+
+ if (attr->name() == SVGNames::heightAttr) {
+ setHeightBaseValue(SVGLength(LengthModeHeight, attr->value()));
+ if (heightBaseValue().value(this) < 0)
+ document()->accessSVGExtensions()->reportError("A negative value for pattern attribute <height> is not allowed");
+ return;
+ }
+
+ if (SVGURIReference::parseMappedAttribute(attr))
+ return;
+ if (SVGTests::parseMappedAttribute(attr))
+ return;
+ if (SVGLangSpace::parseMappedAttribute(attr))
+ return;
+ if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
+ return;
+ if (SVGFitToViewBox::parseMappedAttribute(document(), attr))
+ return;
+
+ ASSERT_NOT_REACHED();
}
void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName)
void SVGRadialGradientElement::parseMappedAttribute(Attribute* attr)
{
- SVGParsingError parseError = NoError;
-
- if (!isSupportedAttribute(attr->name()))
+ if (!isSupportedAttribute(attr->name())) {
SVGGradientElement::parseMappedAttribute(attr);
- else if (attr->name() == SVGNames::cxAttr)
- setCxBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError));
- else if (attr->name() == SVGNames::cyAttr)
- setCyBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError));
- else if (attr->name() == SVGNames::rAttr)
- setRBaseValue(SVGLength::construct(LengthModeOther, attr->value(), parseError, ForbidNegativeLengths));
- else if (attr->name() == SVGNames::fxAttr)
- setFxBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError));
- else if (attr->name() == SVGNames::fyAttr)
- setFyBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError));
- else
- ASSERT_NOT_REACHED();
-
- reportAttributeParsingError(parseError, attr);
+ return;
+ }
+
+ if (attr->name() == SVGNames::cxAttr) {
+ setCxBaseValue(SVGLength(LengthModeWidth, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::cyAttr) {
+ setCyBaseValue(SVGLength(LengthModeHeight, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::rAttr) {
+ setRBaseValue(SVGLength(LengthModeOther, attr->value()));
+ if (rBaseValue().value(this) < 0)
+ document()->accessSVGExtensions()->reportError("A negative value for radial gradient radius <r> is not allowed");
+ return;
+ }
+
+ if (attr->name() == SVGNames::fxAttr) {
+ setFxBaseValue(SVGLength(LengthModeWidth, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::fyAttr) {
+ setFyBaseValue(SVGLength(LengthModeHeight, attr->value()));
+ return;
+ }
+
+ ASSERT_NOT_REACHED();
}
void SVGRadialGradientElement::svgAttributeChanged(const QualifiedName& attrName)
void SVGRectElement::parseMappedAttribute(Attribute* attr)
{
- SVGParsingError parseError = NoError;
-
- if (!isSupportedAttribute(attr->name()))
+ if (!isSupportedAttribute(attr->name())) {
SVGStyledTransformableElement::parseMappedAttribute(attr);
- else if (attr->name() == SVGNames::xAttr)
- setXBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError));
- else if (attr->name() == SVGNames::yAttr)
- setYBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError));
- else if (attr->name() == SVGNames::rxAttr)
- setRxBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError, ForbidNegativeLengths));
- else if (attr->name() == SVGNames::ryAttr)
- setRyBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError, ForbidNegativeLengths));
- else if (attr->name() == SVGNames::widthAttr)
- setWidthBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError, ForbidNegativeLengths));
- else if (attr->name() == SVGNames::heightAttr)
- setHeightBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError, ForbidNegativeLengths));
- else if (SVGTests::parseMappedAttribute(attr)
- || SVGLangSpace::parseMappedAttribute(attr)
- || SVGExternalResourcesRequired::parseMappedAttribute(attr)) {
- } else
- ASSERT_NOT_REACHED();
-
- reportAttributeParsingError(parseError, attr);
+ return;
+ }
+
+ if (attr->name() == SVGNames::xAttr) {
+ setXBaseValue(SVGLength(LengthModeWidth, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::yAttr) {
+ setYBaseValue(SVGLength(LengthModeHeight, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::rxAttr) {
+ setRxBaseValue(SVGLength(LengthModeWidth, attr->value()));
+ if (rxBaseValue().value(this) < 0)
+ document()->accessSVGExtensions()->reportError("A negative value for rect <rx> is not allowed");
+ return;
+ }
+
+ if (attr->name() == SVGNames::ryAttr) {
+ setRyBaseValue(SVGLength(LengthModeHeight, attr->value()));
+ if (ryBaseValue().value(this) < 0)
+ document()->accessSVGExtensions()->reportError("A negative value for rect <ry> is not allowed");
+ return;
+ }
+
+ if (attr->name() == SVGNames::widthAttr) {
+ setWidthBaseValue(SVGLength(LengthModeWidth, attr->value()));
+ if (widthBaseValue().value(this) < 0)
+ document()->accessSVGExtensions()->reportError("A negative value for rect <width> is not allowed");
+ return;
+ }
+
+ if (attr->name() == SVGNames::heightAttr) {
+ setHeightBaseValue(SVGLength(LengthModeHeight, attr->value()));
+ if (heightBaseValue().value(this) < 0)
+ document()->accessSVGExtensions()->reportError("A negative value for rect <height> is not allowed");
+ return;
+ }
+
+ if (SVGTests::parseMappedAttribute(attr))
+ return;
+ if (SVGLangSpace::parseMappedAttribute(attr))
+ return;
+ if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
+ return;
+
+ ASSERT_NOT_REACHED();
}
void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName)
void SVGSVGElement::parseMappedAttribute(Attribute* attr)
{
- SVGParsingError parseError = NoError;
-
if (!nearestViewportElement()) {
bool setListener = true;
else if (attr->name() == HTMLNames::onerrorAttr)
document()->setWindowAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(document()->frame(), attr));
else if (attr->name() == SVGNames::xAttr)
- setXBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError));
+ setXBaseValue(SVGLength(LengthModeWidth, attr->value()));
else if (attr->name() == SVGNames::yAttr)
- setYBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError));
+ setYBaseValue(SVGLength(LengthModeHeight, attr->value()));
else if (attr->name() == SVGNames::widthAttr) {
- setWidthBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError, ForbidNegativeLengths));
+ setWidthBaseValue(SVGLength(LengthModeWidth, attr->value()));
addCSSProperty(attr, CSSPropertyWidth, attr->value());
+ if (widthBaseValue().value(this) < 0.0)
+ document()->accessSVGExtensions()->reportError("A negative value for svg attribute <width> is not allowed");
} else if (attr->name() == SVGNames::heightAttr) {
- setHeightBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError, ForbidNegativeLengths));
+ setHeightBaseValue(SVGLength(LengthModeHeight, attr->value()));
addCSSProperty(attr, CSSPropertyHeight, attr->value());
- } else if (SVGTests::parseMappedAttribute(attr)
- || SVGLangSpace::parseMappedAttribute(attr)
- || SVGExternalResourcesRequired::parseMappedAttribute(attr)
- || SVGFitToViewBox::parseMappedAttribute(document(), attr)
- || SVGZoomAndPan::parseMappedAttribute(attr)) {
- } else
- SVGStyledLocatableElement::parseMappedAttribute(attr);
+ if (heightBaseValue().value(this) < 0.0)
+ document()->accessSVGExtensions()->reportError("A negative value for svg attribute <height> is not allowed");
+ } else {
+ if (SVGTests::parseMappedAttribute(attr))
+ return;
+ if (SVGLangSpace::parseMappedAttribute(attr))
+ return;
+ if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
+ return;
+ if (SVGFitToViewBox::parseMappedAttribute(document(), attr))
+ return;
+ if (SVGZoomAndPan::parseMappedAttribute(attr))
+ return;
- reportAttributeParsingError(parseError, attr);
+ SVGStyledLocatableElement::parseMappedAttribute(attr);
+ }
}
// This hack will not handle the case where we're setting a width/height
void SVGTextContentElement::parseMappedAttribute(Attribute* attr)
{
- SVGParsingError parseError = NoError;
-
- if (!isSupportedAttribute(attr->name()))
+ if (!isSupportedAttribute(attr->name())) {
SVGStyledElement::parseMappedAttribute(attr);
- else if (attr->name() == SVGNames::lengthAdjustAttr) {
+ return;
+ }
+
+ if (attr->name() == SVGNames::lengthAdjustAttr) {
SVGLengthAdjustType propertyValue = SVGPropertyTraits<SVGLengthAdjustType>::fromString(attr->value());
if (propertyValue > 0)
setLengthAdjustBaseValue(propertyValue);
- } else if (attr->name() == SVGNames::textLengthAttr) {
- m_textLength.value = SVGLength::construct(LengthModeOther, attr->value(), parseError, ForbidNegativeLengths);
- } else if (SVGTests::parseMappedAttribute(attr)
- || SVGExternalResourcesRequired::parseMappedAttribute(attr)) {
- } else if (SVGLangSpace::parseMappedAttribute(attr)) {
+ return;
+ }
+
+ if (attr->name() == SVGNames::textLengthAttr) {
+ m_textLength.value = SVGLength(LengthModeOther, attr->value());
+ if (m_textLength.value.value(this) < 0)
+ document()->accessSVGExtensions()->reportError("A negative value for text attribute <textLength> is not allowed");
+ return;
+ }
+
+ if (SVGTests::parseMappedAttribute(attr))
+ return;
+
+ if (SVGLangSpace::parseMappedAttribute(attr)) {
if (attr->name().matches(XMLNames::spaceAttr)) {
DEFINE_STATIC_LOCAL(const AtomicString, preserveString, ("preserve"));
else
addCSSProperty(attr, CSSPropertyWhiteSpace, CSSValueNowrap);
}
- } else
- ASSERT_NOT_REACHED();
+ return;
+ }
+
+ if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
+ return;
- reportAttributeParsingError(parseError, attr);
+ ASSERT_NOT_REACHED();
}
void SVGTextContentElement::svgAttributeChanged(const QualifiedName& attrName)
void SVGTextPathElement::parseMappedAttribute(Attribute* attr)
{
- SVGParsingError parseError = NoError;
+ if (!isSupportedAttribute(attr->name())) {
+ SVGTextContentElement::parseMappedAttribute(attr);
+ return;
+ }
+
const AtomicString& value = attr->value();
+ if (attr->name() == SVGNames::startOffsetAttr) {
+ setStartOffsetBaseValue(SVGLength(LengthModeOther, value));
+ return;
+ }
- if (!isSupportedAttribute(attr->name()))
- SVGTextContentElement::parseMappedAttribute(attr);
- else if (attr->name() == SVGNames::startOffsetAttr)
- setStartOffsetBaseValue(SVGLength::construct(LengthModeOther, value, parseError));
- else if (attr->name() == SVGNames::methodAttr) {
+ if (attr->name() == SVGNames::methodAttr) {
SVGTextPathMethodType propertyValue = SVGPropertyTraits<SVGTextPathMethodType>::fromString(value);
if (propertyValue > 0)
setMethodBaseValue(propertyValue);
- } else if (attr->name() == SVGNames::spacingAttr) {
+ return;
+ }
+
+ if (attr->name() == SVGNames::spacingAttr) {
SVGTextPathSpacingType propertyValue = SVGPropertyTraits<SVGTextPathSpacingType>::fromString(value);
if (propertyValue > 0)
setSpacingBaseValue(propertyValue);
- } else if (SVGURIReference::parseMappedAttribute(attr)) {
- } else
- ASSERT_NOT_REACHED();
+ return;
+ }
+
+ if (SVGURIReference::parseMappedAttribute(attr))
+ return;
- reportAttributeParsingError(parseError, attr);
+ ASSERT_NOT_REACHED();
}
void SVGTextPathElement::svgAttributeChanged(const QualifiedName& attrName)
void SVGUseElement::parseMappedAttribute(Attribute* attr)
{
- SVGParsingError parseError = NoError;
-
- if (!isSupportedAttribute(attr->name()))
+ if (!isSupportedAttribute(attr->name())) {
SVGStyledTransformableElement::parseMappedAttribute(attr);
- else if (attr->name() == SVGNames::xAttr)
- setXBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError));
- else if (attr->name() == SVGNames::yAttr)
- setYBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError));
- else if (attr->name() == SVGNames::widthAttr)
- setWidthBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError, ForbidNegativeLengths));
- else if (attr->name() == SVGNames::heightAttr)
- setHeightBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError, ForbidNegativeLengths));
- else if (SVGTests::parseMappedAttribute(attr)
- || SVGLangSpace::parseMappedAttribute(attr)
- || SVGExternalResourcesRequired::parseMappedAttribute(attr)
- || SVGURIReference::parseMappedAttribute(attr)) {
- } else
- ASSERT_NOT_REACHED();
+ return;
+ }
+
+ if (attr->name() == SVGNames::xAttr) {
+ setXBaseValue(SVGLength(LengthModeWidth, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::yAttr) {
+ setYBaseValue(SVGLength(LengthModeHeight, attr->value()));
+ return;
+ }
+
+ if (attr->name() == SVGNames::widthAttr) {
+ setWidthBaseValue(SVGLength(LengthModeWidth, attr->value()));
+ if (widthBaseValue().value(this) < 0)
+ document()->accessSVGExtensions()->reportError("A negative value for use attribute <width> is not allowed");
+ return;
+ }
+
+ if (attr->name() == SVGNames::heightAttr) {
+ setHeightBaseValue(SVGLength(LengthModeHeight, attr->value()));
+ if (heightBaseValue().value(this) < 0)
+ document()->accessSVGExtensions()->reportError("A negative value for use attribute <height> is not allowed");
+ return;
+ }
- reportAttributeParsingError(parseError, attr);
+ if (SVGTests::parseMappedAttribute(attr))
+ return;
+ if (SVGLangSpace::parseMappedAttribute(attr))
+ return;
+ if (SVGExternalResourcesRequired::parseMappedAttribute(attr))
+ return;
+ if (SVGURIReference::parseMappedAttribute(attr))
+ return;
+
+ ASSERT_NOT_REACHED();
}
static inline bool isWellFormedDocument(Document* document)