+2015-11-29 Simon Fraser <simon.fraser@apple.com>
+
+ 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 <beidson@apple.com>
Modern IDB: Class-ify IDBGetResult making it impossible to get the data members wrong.
{
}
-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;
return false;
switch (type) {
+ case SVGTransform::SVG_TRANSFORM_UNKNOWN:
+ ASSERT_NOT_REACHED();
+ break;
case SVGTransform::SVG_TRANSFORM_SKEWX:
transform.setSkewX(values[0]);
break;
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;
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);
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))
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(); }