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

Unified Diff: Source/core/svg/SVGAngle.cpp

Issue 539833004: [SVG2] Add support for marker orient="auto-start-reverse". (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add dump-render-tree output + fix nit and test Created 6 years, 3 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/SVGAngle.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGAngle.cpp
diff --git a/Source/core/svg/SVGAngle.cpp b/Source/core/svg/SVGAngle.cpp
index 6e9b816819f8db8049f2b6e65674865cb1c1b4a9..b772f01c5513a33bf8485d229d35796fc3f4004d 100644
--- a/Source/core/svg/SVGAngle.cpp
+++ b/Source/core/svg/SVGAngle.cpp
@@ -38,10 +38,16 @@ template<> const SVGEnumerationStringEntries& getStaticStringEntries<SVGMarkerOr
if (entries.isEmpty()) {
entries.append(std::make_pair(SVGMarkerOrientAuto, "auto"));
entries.append(std::make_pair(SVGMarkerOrientAngle, "angle"));
+ entries.append(std::make_pair(SVGMarkerOrientAutoStartReverse, "auto-start-reverse"));
}
return entries;
}
+template<> unsigned short getMaxExposedEnumValue<SVGMarkerOrientType>()
+{
+ return SVGMarkerOrientAngle;
+}
+
SVGMarkerOrientEnumeration::SVGMarkerOrientEnumeration(SVGAngle* angle)
: SVGEnumeration<SVGMarkerOrientType>(SVGMarkerOrientAngle)
, m_angle(angle)
@@ -231,6 +237,11 @@ void SVGAngle::setValueAsString(const String& value, ExceptionState& exceptionSt
m_orientType->setEnumValue(SVGMarkerOrientAuto);
return;
}
+ if (value == "auto-start-reverse") {
+ newValueSpecifiedUnits(SVG_ANGLETYPE_UNSPECIFIED, 0);
+ m_orientType->setEnumValue(SVGMarkerOrientAutoStartReverse);
+ return;
+ }
float valueInSpecifiedUnits = 0;
SVGAngleType unitType = SVG_ANGLETYPE_UNKNOWN;
@@ -373,27 +384,34 @@ void SVGAngle::calculateAnimatedValue(SVGAnimationElement* animationElement, flo
SVGMarkerOrientType toOrientType = toAngle->orientType()->enumValue();
if (fromOrientType != toOrientType) {
- // Animating from eg. auto to 90deg, or auto to 90deg.
+ // Animating from eg. 90deg to auto.
if (fromOrientType == SVGMarkerOrientAngle) {
// Animating from an angle value to eg. 'auto' - this disabled additive as 'auto' is a keyword..
- if (toOrientType == SVGMarkerOrientAuto) {
+ if (toOrientType == SVGMarkerOrientAuto || toOrientType == SVGMarkerOrientAutoStartReverse) {
if (percentage < 0.5f) {
newValueSpecifiedUnits(fromAngle->unitType(), fromAngle->valueInSpecifiedUnits());
return;
}
- orientType()->setEnumValue(SVGMarkerOrientAuto);
+ orientType()->setEnumValue(toOrientType);
return;
}
m_valueInSpecifiedUnits = 0;
orientType()->setEnumValue(SVGMarkerOrientUnknown);
return;
+ } else if (toOrientType == SVGMarkerOrientAuto || toOrientType == SVGMarkerOrientAutoStartReverse) {
+ // Animating from e.g 'auto' to 'auto-start-reverse'
+ if (percentage >= 0.5f) {
+ m_valueInSpecifiedUnits = 0;
+ orientType()->setEnumValue(toOrientType);
+ return;
+ }
}
}
- // From 'auto' to 'auto'.
- if (fromOrientType == SVGMarkerOrientAuto) {
+ // From 'auto' to 'auto', or 'auto-start-reverse' to 'auto-start-reverse'
+ if (fromOrientType == SVGMarkerOrientAuto || fromOrientType == SVGMarkerOrientAutoStartReverse) {
m_valueInSpecifiedUnits = 0;
- orientType()->setEnumValue(SVGMarkerOrientAuto);
+ orientType()->setEnumValue(fromOrientType);
return;
}
@@ -418,7 +436,7 @@ float SVGAngle::calculateDistance(PassRefPtr<SVGPropertyBase> other, SVGElement*
void SVGAngle::orientTypeChanged()
{
- if (orientType()->enumValue() == SVGMarkerOrientAuto) {
+ if (orientType()->enumValue() == SVGMarkerOrientAuto || orientType()->enumValue() == SVGMarkerOrientAutoStartReverse) {
m_unitType = SVG_ANGLETYPE_UNSPECIFIED;
m_valueInSpecifiedUnits = 0;
}
« no previous file with comments | « Source/core/svg/SVGAngle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698