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

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

Issue 303263008: [SVG2] Add support for the 'turn' unit in <angle>. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: hide the internals of SVGAngle Created 6 years, 6 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
Index: Source/core/svg/SVGAngleTearOff.h
diff --git a/Source/core/svg/SVGAngleTearOff.h b/Source/core/svg/SVGAngleTearOff.h
index 8d6d52084b908acc61113efec7c7ae437ba1a538..bec02c1bf3ecbb00d5082c3ac42e8cb28712fd84 100644
--- a/Source/core/svg/SVGAngleTearOff.h
+++ b/Source/core/svg/SVGAngleTearOff.h
@@ -54,7 +54,7 @@ public:
virtual ~SVGAngleTearOff();
- unsigned short unitType() { return target()->unitType(); }
+ unsigned short unitType() { return isValidAngle() ? target()->unitType() : SVGAngle::SVG_ANGLETYPE_UNKNOWN; }
void setValue(float, ExceptionState&);
float value() { return target()->value(); }
@@ -65,9 +65,11 @@ public:
void newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits, ExceptionState&);
void convertToSpecifiedUnits(unsigned short unitType, ExceptionState&);
- String valueAsString() { return target()->valueAsString(); }
+ String valueAsString() { return isValidAngle() ? target()->valueAsString() : String::number(0); }
krit 2014/06/10 11:45:48 Exposing more unit types is one thing. Do we need
Erik Dahlström (inactive) 2014/06/10 16:57:42 Not necessarily, only if we want to preserve exist
void setValueAsString(const String&, ExceptionState&);
+ bool isValidAngle() { return target()->unitType() <= SVGAngle::SVG_ANGLETYPE_GRAD; }
fs 2014/06/10 11:13:30 Nit: isValidAngleType / isValidAngleUnit ? (Could
Erik Dahlström (inactive) 2014/06/10 16:57:42 Private yes, const no, the target() method is non-
fs 2014/06/11 07:29:07 Ok.
+
private:
SVGAngleTearOff(PassRefPtr<SVGAngle>, SVGElement*, PropertyIsAnimValType, const QualifiedName&);
};

Powered by Google App Engine
This is Rietveld 408576698