Chromium Code Reviews| Index: Source/core/svg/SVGFitToViewBox.h |
| diff --git a/Source/core/svg/SVGFitToViewBox.h b/Source/core/svg/SVGFitToViewBox.h |
| index ba8ca3cf8faf8452eb94add6f4328fcd3fd2dce2..c9633fefcddb5ddbbb70e791854f30531e6c0713 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) { // check that width is positive |
| + target->document().accessSVGExtensions()->reportError("A negative value for ViewBox width is not allowed"); |
| + target->viewBox()->baseValue()->setInvalid(); |
| + return true; |
|
pdr.
2014/01/16 03:25:47
Should these return false instead of true?
kouhei (in TOK)
2014/01/16 03:42:27
This is tricky, but these must return true. This f
|
| + } |
| + if (target->viewBox()->baseValue()->height() < 0.0f) { // check that height is positive |
| + 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 |