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

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

Issue 132233010: [SVG] SVGAnimatedRect migration to new SVG property impl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebsaed Created 6 years, 11 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/SVGElement.h ('k') | Source/core/svg/SVGFitToViewBox.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGFitToViewBox.h
diff --git a/Source/core/svg/SVGFitToViewBox.h b/Source/core/svg/SVGFitToViewBox.h
index ba8ca3cf8faf8452eb94add6f4328fcd3fd2dce2..f56a5724fea0b2b7e73553c57934f8e2694986ca 100644
--- a/Source/core/svg/SVGFitToViewBox.h
+++ b/Source/core/svg/SVGFitToViewBox.h
@@ -23,6 +23,8 @@
#include "SVGNames.h"
#include "core/dom/QualifiedName.h"
+#include "core/svg/SVGDocumentExtensions.h"
+#include "core/svg/SVGParsingError.h"
#include "core/svg/SVGPreserveAspectRatio.h"
#include "core/svg/SVGRect.h"
#include "wtf/HashSet.h"
@@ -44,12 +46,19 @@ public:
{
ASSERT(target);
if (name == SVGNames::viewBoxAttr) {
- FloatRect viewBox;
- bool valueIsValid = !value.isNull() && parseViewBox(&target->document(), value, viewBox);
- if (valueIsValid)
- target->setViewBoxBaseValue(viewBox);
- else
- target->setViewBoxBaseValue(SVGRect(SVGRect::InvalidSVGRectTag()));
+ SVGParsingError parseError = NoError;
+ target->viewBox()->setBaseValueAsString(value, parseError);
+ target->reportAttributeParsingError(parseError, name, value);
+ if (target->viewBox()->baseValue()->width() < 0.0f) {
+ target->document().accessSVGExtensions()->reportError("A negative value for ViewBox width is not allowed");
+ target->viewBox()->baseValue()->setInvalid();
+ return true;
+ }
+ if (target->viewBox()->baseValue()->height() < 0.0f) {
+ target->document().accessSVGExtensions()->reportError("A negative value for ViewBox height is not allowed");
+ target->viewBox()->baseValue()->setInvalid();
+ return true;
+ }
return true;
}
@@ -62,12 +71,6 @@ public:
return false;
}
-
- static bool parseViewBox(Document*, const LChar*& start, const LChar* end, FloatRect& viewBox, bool validate = true);
- static bool parseViewBox(Document*, const UChar*& start, const UChar* end, FloatRect& viewBox, bool validate = true);
-
-private:
- static bool parseViewBox(Document*, const String&, FloatRect&);
};
} // namespace WebCore
« no previous file with comments | « Source/core/svg/SVGElement.h ('k') | Source/core/svg/SVGFitToViewBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698