Index: Source/core/svg/SVGFitToViewBox.cpp |
diff --git a/Source/core/svg/SVGFitToViewBox.cpp b/Source/core/svg/SVGFitToViewBox.cpp |
index 53ecdd16f24418966082a380b4ee7d41a149045e..7a3edef5632011c637a599bdb011499d330f8825 100644 |
--- a/Source/core/svg/SVGFitToViewBox.cpp |
+++ b/Source/core/svg/SVGFitToViewBox.cpp |
@@ -33,8 +33,41 @@ |
namespace blink { |
+class SVGAnimatedViewBoxRect : public SVGAnimatedRect { |
+public: |
+ static PassRefPtr<SVGAnimatedRect> create(SVGElement* contextElement) |
+ { |
+ return adoptRef(new SVGAnimatedViewBoxRect(contextElement)); |
+ } |
+ |
+ void setBaseValueAsString(const String&, SVGParsingError&) override; |
+ |
+protected: |
+ SVGAnimatedViewBoxRect(SVGElement* contextElement) |
+ : SVGAnimatedRect(contextElement, SVGNames::viewBoxAttr) |
+ { |
+ } |
+}; |
+ |
+void SVGAnimatedViewBoxRect::setBaseValueAsString(const String& value, SVGParsingError& parseError) |
+{ |
+ TrackExceptionState es; |
+ |
+ baseValue()->setValueAsString(value, es); |
+ |
+ if (es.hadException()) { |
+ parseError = ParsingAttributeFailedError; |
+ return; |
+ } |
+ |
+ if (baseValue()->width() < 0 || baseValue()->height() < 0) { |
+ parseError = NegativeValueForbiddenError; |
+ baseValue()->setInvalid(); |
+ } |
+} |
+ |
SVGFitToViewBox::SVGFitToViewBox(SVGElement* element, PropertyMapPolicy propertyMapPolicy) |
- : m_viewBox(SVGAnimatedRect::create(element, SVGNames::viewBoxAttr)) |
+ : m_viewBox(SVGAnimatedViewBoxRect::create(element)) |
, m_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create(element, SVGNames::preserveAspectRatioAttr, SVGPreserveAspectRatio::create())) |
{ |
ASSERT(element); |