summaryrefslogtreecommitdiff
path: root/Source/WebCore/svg/SVGMarkerElement.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/svg/SVGMarkerElement.h')
-rw-r--r--Source/WebCore/svg/SVGMarkerElement.h74
1 files changed, 38 insertions, 36 deletions
diff --git a/Source/WebCore/svg/SVGMarkerElement.h b/Source/WebCore/svg/SVGMarkerElement.h
index ecf563ee0..c757d1d92 100644
--- a/Source/WebCore/svg/SVGMarkerElement.h
+++ b/Source/WebCore/svg/SVGMarkerElement.h
@@ -18,10 +18,8 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef SVGMarkerElement_h
-#define SVGMarkerElement_h
+#pragma once
-#if ENABLE(SVG)
#include "SVGAnimatedAngle.h"
#include "SVGAnimatedBoolean.h"
#include "SVGAnimatedEnumeration.h"
@@ -43,7 +41,11 @@ enum SVGMarkerUnitsType {
enum SVGMarkerOrientType {
SVGMarkerOrientUnknown = 0,
SVGMarkerOrientAuto,
- SVGMarkerOrientAngle
+ SVGMarkerOrientAngle,
+ SVGMarkerOrientAutoStartReverse,
+
+ // Add new elements before here.
+ SVGMarkerOrientMax
};
template<>
@@ -56,9 +58,9 @@ struct SVGPropertyTraits<SVGMarkerUnitsType> {
case SVGMarkerUnitsUnknown:
return emptyString();
case SVGMarkerUnitsUserSpaceOnUse:
- return "userSpaceOnUse";
+ return ASCIILiteral("userSpaceOnUse");
case SVGMarkerUnitsStrokeWidth:
- return "strokeWidth";
+ return ASCIILiteral("strokeWidth");
}
ASSERT_NOT_REACHED();
@@ -76,21 +78,23 @@ struct SVGPropertyTraits<SVGMarkerUnitsType> {
};
template<>
-struct SVGPropertyTraits<SVGMarkerOrientType> {
- static unsigned highestEnumValue() { return SVGMarkerOrientAngle; }
+inline unsigned SVGIDLEnumLimits<SVGMarkerOrientType>::highestExposedEnumValue() { return SVGMarkerOrientAngle; }
+
+template<> struct SVGPropertyTraits<SVGMarkerOrientType> {
+ static unsigned highestEnumValue() { return SVGMarkerOrientAutoStartReverse; }
// toString is not needed, synchronizeOrientType() handles this on its own.
- static SVGMarkerOrientType fromString(const String& value, SVGAngle& angle)
+ static SVGMarkerOrientType fromString(const String& value, SVGAngleValue& angle)
{
if (value == "auto")
return SVGMarkerOrientAuto;
-
- ExceptionCode ec = 0;
- angle.setValueAsString(value, ec);
- if (!ec)
- return SVGMarkerOrientAngle;
- return SVGMarkerOrientUnknown;
+ if (value == "auto-start-reverse")
+ return SVGMarkerOrientAutoStartReverse;
+ auto setValueResult = angle.setValueAsString(value);
+ if (setValueResult.hasException())
+ return SVGMarkerOrientUnknown;
+ return SVGMarkerOrientAngle;
}
};
@@ -108,32 +112,35 @@ public:
enum {
SVG_MARKER_ORIENT_UNKNOWN = SVGMarkerOrientUnknown,
SVG_MARKER_ORIENT_AUTO = SVGMarkerOrientAuto,
- SVG_MARKER_ORIENT_ANGLE = SVGMarkerOrientAngle
+ SVG_MARKER_ORIENT_ANGLE = SVGMarkerOrientAngle,
+ SVG_MARKER_ORIENT_AUTOSTARTREVERSE = SVGMarkerOrientAutoStartReverse
};
- static PassRefPtr<SVGMarkerElement> create(const QualifiedName&, Document&);
+ static Ref<SVGMarkerElement> create(const QualifiedName&, Document&);
AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;
void setOrientToAuto();
- void setOrientToAngle(const SVGAngle&);
+ void setOrientToAngle(SVGAngle&);
static const SVGPropertyInfo* orientTypePropertyInfo();
private:
SVGMarkerElement(const QualifiedName&, Document&);
- virtual bool needsPendingResourceHandling() const override { return false; }
+ bool needsPendingResourceHandling() const override { return false; }
- bool isSupportedAttribute(const QualifiedName&);
- virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
- virtual void svgAttributeChanged(const QualifiedName&) override;
- virtual void childrenChanged(const ChildChange&) override;
+ static bool isSupportedAttribute(const QualifiedName&);
+ void parseAttribute(const QualifiedName&, const AtomicString&) override;
+ void svgAttributeChanged(const QualifiedName&) override;
+ void childrenChanged(const ChildChange&) override;
- virtual RenderPtr<RenderElement> createElementRenderer(PassRef<RenderStyle>) override;
- virtual bool rendererIsNeeded(const RenderStyle&) override { return true; }
+ RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;
+ bool rendererIsNeeded(const RenderStyle&) override { return true; }
- virtual bool selfHasRelativeLengths() const override;
+ bool selfHasRelativeLengths() const override;
+
+ void setOrient(SVGMarkerOrientType, const SVGAngleValue&);
void synchronizeOrientType();
@@ -147,7 +154,7 @@ private:
DECLARE_ANIMATED_LENGTH(MarkerHeight, markerHeight)
DECLARE_ANIMATED_ENUMERATION(MarkerUnits, markerUnits, SVGMarkerUnitsType)
DECLARE_ANIMATED_ANGLE(OrientAngle, orientAngle)
- DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired)
+ DECLARE_ANIMATED_BOOLEAN_OVERRIDE(ExternalResourcesRequired, externalResourcesRequired)
DECLARE_ANIMATED_RECT(ViewBox, viewBox)
DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio)
END_DECLARE_ANIMATED_PROPERTIES
@@ -155,19 +162,14 @@ private:
public:
// Custom 'orientType' property.
static void synchronizeOrientType(SVGElement* contextElement);
- static PassRefPtr<SVGAnimatedProperty> lookupOrCreateOrientTypeWrapper(SVGElement* contextElement);
- SVGMarkerOrientType& orientType() const { return m_orientType.value; }
+ static Ref<SVGAnimatedProperty> lookupOrCreateOrientTypeWrapper(SVGElement* contextElement);
+ SVGMarkerOrientType& orientType() const;
SVGMarkerOrientType& orientTypeBaseValue() const { return m_orientType.value; }
void setOrientTypeBaseValue(const SVGMarkerOrientType& type) { m_orientType.value = type; }
- PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>> orientTypeAnimated();
+ Ref<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType>> orientTypeAnimated();
private:
mutable SVGSynchronizableAnimatedProperty<SVGMarkerOrientType> m_orientType;
};
-NODE_TYPE_CASTS(SVGMarkerElement)
-
-}
-
-#endif
-#endif
+} // namespace WebCore