Title: [192787] trunk/Source/WebCore
Revision
192787
Author
[email protected]
Date
2015-11-29 10:47:08 -0800 (Sun, 29 Nov 2015)

Log Message

Use SVGTransform::SVGTransformType instead of an unsigned short
https://bugs.webkit.org/show_bug.cgi?id=151637

Reviewed by Brady Eidson.

Make 'type' more strongly typed.

* svg/SVGTransformable.cpp:
(WebCore::SVGTransformable::parseTransformValue):
(WebCore::parseAndSkipType):
(WebCore::SVGTransformable::parseTransformType):
(WebCore::SVGTransformable::parseTransformAttribute):
* svg/SVGTransformable.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (192786 => 192787)


--- trunk/Source/WebCore/ChangeLog	2015-11-28 21:30:06 UTC (rev 192786)
+++ trunk/Source/WebCore/ChangeLog	2015-11-29 18:47:08 UTC (rev 192787)
@@ -1,3 +1,19 @@
+2015-11-29  Simon Fraser  <[email protected]>
+
+        Use SVGTransform::SVGTransformType instead of an unsigned short
+        https://bugs.webkit.org/show_bug.cgi?id=151637
+
+        Reviewed by Brady Eidson.
+
+        Make 'type' more strongly typed.
+
+        * svg/SVGTransformable.cpp:
+        (WebCore::SVGTransformable::parseTransformValue):
+        (WebCore::parseAndSkipType):
+        (WebCore::SVGTransformable::parseTransformType):
+        (WebCore::SVGTransformable::parseTransformAttribute):
+        * svg/SVGTransformable.h:
+
 2015-11-27  Brady Eidson  <[email protected]>
 
         Modern IDB: Class-ify IDBGetResult making it impossible to get the data members wrong.

Modified: trunk/Source/WebCore/svg/SVGTransformable.cpp (192786 => 192787)


--- trunk/Source/WebCore/svg/SVGTransformable.cpp	2015-11-28 21:30:06 UTC (rev 192786)
+++ trunk/Source/WebCore/svg/SVGTransformable.cpp	2015-11-29 18:47:08 UTC (rev 192787)
@@ -93,7 +93,7 @@
 {
 }
 
-bool SVGTransformable::parseTransformValue(unsigned type, const UChar*& ptr, const UChar* end, SVGTransform& transform)
+bool SVGTransformable::parseTransformValue(SVGTransform::SVGTransformType type, const UChar*& ptr, const UChar* end, SVGTransform& transform)
 {
     if (type == SVGTransform::SVG_TRANSFORM_UNKNOWN)
         return false;
@@ -104,6 +104,9 @@
         return false;
 
     switch (type) {
+    case SVGTransform::SVG_TRANSFORM_UNKNOWN:
+        ASSERT_NOT_REACHED();
+        break;
     case SVGTransform::SVG_TRANSFORM_SKEWX:
         transform.setSkewX(values[0]);
         break;
@@ -143,7 +146,7 @@
 static const UChar rotateDesc[] =  {'r', 'o', 't', 'a', 't', 'e'};
 static const UChar matrixDesc[] =  {'m', 'a', 't', 'r', 'i', 'x'};
 
-static inline bool parseAndSkipType(const UChar*& currTransform, const UChar* end, unsigned short& type)
+static inline bool parseAndSkipType(const UChar*& currTransform, const UChar* end, SVGTransform::SVGTransformType& type)
 {
     if (currTransform >= end)
         return false;
@@ -171,7 +174,7 @@
 
 SVGTransform::SVGTransformType SVGTransformable::parseTransformType(const String& typeString)
 {
-    unsigned short type = SVGTransform::SVG_TRANSFORM_UNKNOWN;
+    SVGTransform::SVGTransformType type = SVGTransform::SVG_TRANSFORM_UNKNOWN;
     auto upconvertedCharacters = StringView(typeString).upconvertedCharacters();
     const UChar* characters = upconvertedCharacters;
     parseAndSkipType(characters, characters + typeString.length(), type);
@@ -186,7 +189,7 @@
     bool delimParsed = false;
     while (currTransform < end) {
         delimParsed = false;
-        unsigned short type = SVGTransform::SVG_TRANSFORM_UNKNOWN;
+        SVGTransform::SVGTransformType type = SVGTransform::SVG_TRANSFORM_UNKNOWN;
         skipOptionalSVGSpaces(currTransform, end);
 
         if (!parseAndSkipType(currTransform, end, type))

Modified: trunk/Source/WebCore/svg/SVGTransformable.h (192786 => 192787)


--- trunk/Source/WebCore/svg/SVGTransformable.h	2015-11-28 21:30:06 UTC (rev 192786)
+++ trunk/Source/WebCore/svg/SVGTransformable.h	2015-11-29 18:47:08 UTC (rev 192787)
@@ -40,7 +40,7 @@
     virtual ~SVGTransformable();
 
     static bool parseTransformAttribute(SVGTransformList&, const UChar*& ptr, const UChar* end, TransformParsingMode mode = ClearList);
-    static bool parseTransformValue(unsigned type, const UChar*& ptr, const UChar* end, SVGTransform&);
+    static bool parseTransformValue(SVGTransform::SVGTransformType, const UChar*& ptr, const UChar* end, SVGTransform&);
     static SVGTransform::SVGTransformType parseTransformType(const String&);
 
     virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const override { return animatedLocalTransform(); }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to