#ifndef SVGMarkerElement_h
#define SVGMarkerElement_h
-#include "bindings/v8/ExceptionState.h"
+#include "bindings/core/v8/ExceptionState.h"
#include "core/svg/SVGAnimatedAngle.h"
#include "core/svg/SVGAnimatedBoolean.h"
#include "core/svg/SVGAnimatedEnumeration.h"
#include "core/svg/SVGElement.h"
#include "core/svg/SVGFitToViewBox.h"
-namespace WebCore {
+namespace blink {
enum SVGMarkerUnitsType {
SVGMarkerUnitsUnknown = 0,
SVGMarkerUnitsUserSpaceOnUse,
SVGMarkerUnitsStrokeWidth
};
+template<> const SVGEnumerationStringEntries& getStaticStringEntries<SVGMarkerUnitsType>();
-enum SVGMarkerOrientType {
- SVGMarkerOrientUnknown = 0,
- SVGMarkerOrientAuto,
- SVGMarkerOrientAngle
-};
-
-template<>
-struct SVGPropertyTraits<SVGMarkerUnitsType> {
- static unsigned highestEnumValue() { return SVGMarkerUnitsStrokeWidth; }
-
- static String toString(SVGMarkerUnitsType type)
- {
- switch (type) {
- case SVGMarkerUnitsUnknown:
- return emptyString();
- case SVGMarkerUnitsUserSpaceOnUse:
- return "userSpaceOnUse";
- case SVGMarkerUnitsStrokeWidth:
- return "strokeWidth";
- }
-
- ASSERT_NOT_REACHED();
- return emptyString();
- }
-
- static SVGMarkerUnitsType fromString(const String& value)
- {
- if (value == "userSpaceOnUse")
- return SVGMarkerUnitsUserSpaceOnUse;
- if (value == "strokeWidth")
- return SVGMarkerUnitsStrokeWidth;
- return SVGMarkerUnitsUnknown;
- }
-};
-
-template<>
-struct SVGPropertyTraits<SVGMarkerOrientType> {
- static unsigned highestEnumValue() { return SVGMarkerOrientAngle; }
-
- // toString is not needed, synchronizeOrientType() handles this on its own.
-
- static SVGMarkerOrientType fromString(const String& value, SVGAngle& angle)
- {
- if (value == "auto")
- return SVGMarkerOrientAuto;
-
- TrackExceptionState exceptionState;
- angle.setValueAsString(value, exceptionState);
- if (!exceptionState.hadException())
- return SVGMarkerOrientAngle;
- return SVGMarkerOrientUnknown;
- }
-};
-
-class SVGMarkerElement FINAL : public SVGElement,
+class SVGMarkerElement final : public SVGElement,
public SVGFitToViewBox {
+ DEFINE_WRAPPERTYPEINFO();
public:
// Forward declare enumerations in the W3C naming scheme, for IDL generation.
enum {
SVG_MARKER_ORIENT_ANGLE = SVGMarkerOrientAngle
};
- static PassRefPtr<SVGMarkerElement> create(Document&);
+ DECLARE_NODE_FACTORY(SVGMarkerElement);
AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;
void setOrientToAuto();
- void setOrientToAngle(const SVGAngle&);
-
- static const SVGPropertyInfo* orientTypePropertyInfo();
+ void setOrientToAngle(PassRefPtr<SVGAngleTearOff>);
SVGAnimatedLength* refX() const { return m_refX.get(); }
SVGAnimatedLength* refY() const { return m_refY.get(); }
SVGAnimatedLength* markerWidth() const { return m_markerWidth.get(); }
SVGAnimatedLength* markerHeight() const { return m_markerHeight.get(); }
-
- // Custom 'orientType' property.
- static void synchronizeOrientType(SVGElement* contextElement);
- static PassRefPtr<SVGAnimatedProperty> lookupOrCreateOrientTypeWrapper(SVGElement* contextElement);
- SVGMarkerOrientType& orientTypeCurrentValue() const { return m_orientType.value; }
- SVGMarkerOrientType& orientTypeBaseValue() const { return m_orientType.value; }
- void setOrientTypeBaseValue(const SVGMarkerOrientType& type) { m_orientType.value = type; }
- PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType> > orientType();
+ SVGAnimatedEnumeration<SVGMarkerUnitsType>* markerUnits() { return m_markerUnits.get(); }
+ SVGAnimatedAngle* orientAngle() { return m_orientAngle.get(); }
+ SVGAnimatedEnumeration<SVGMarkerOrientType>* orientType() { return m_orientAngle->orientType(); }
private:
explicit SVGMarkerElement(Document&);
- virtual bool needsPendingResourceHandling() const OVERRIDE { return false; }
+ virtual 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(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0) OVERRIDE;
+ virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
+ virtual void svgAttributeChanged(const QualifiedName&) override;
+ virtual void childrenChanged(const ChildrenChange&) override;
- virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE;
- virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return true; }
+ virtual RenderObject* createRenderer(RenderStyle*) override;
+ virtual bool rendererIsNeeded(const RenderStyle&) override { return true; }
- virtual bool selfHasRelativeLengths() const OVERRIDE;
-
- void synchronizeOrientType();
-
- static const AtomicString& orientTypeIdentifier();
- static const AtomicString& orientAngleIdentifier();
+ virtual bool selfHasRelativeLengths() const override;
RefPtr<SVGAnimatedLength> m_refX;
RefPtr<SVGAnimatedLength> m_refY;
RefPtr<SVGAnimatedLength> m_markerWidth;
RefPtr<SVGAnimatedLength> m_markerHeight;
- mutable SVGSynchronizableAnimatedProperty<SVGMarkerOrientType> m_orientType;
- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGMarkerElement)
- DECLARE_ANIMATED_ENUMERATION(MarkerUnits, markerUnits, SVGMarkerUnitsType)
- DECLARE_ANIMATED_ANGLE(OrientAngle, orientAngle)
- END_DECLARE_ANIMATED_PROPERTIES
+ RefPtr<SVGAnimatedAngle> m_orientAngle;
+ RefPtr<SVGAnimatedEnumeration<SVGMarkerUnitsType> > m_markerUnits;
};
-DEFINE_NODE_TYPE_CASTS(SVGMarkerElement, hasTagName(SVGNames::markerTag));
-
-}
+} // namespace blink
-#endif
+#endif // SVGMarkerElement_h