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

Unified Diff: Source/core/svg/SVGFitToViewBox.cpp

Issue 664433002: [SVG] Move negative viewBox width/height reporting to SVGAnimatedViewBoxRect (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: || Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/svg/SVGFitToViewBox.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « Source/core/svg/SVGFitToViewBox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698