diff options
Diffstat (limited to 'Source/WebCore/svg/SVGViewSpec.h')
-rw-r--r-- | Source/WebCore/svg/SVGViewSpec.h | 69 |
1 files changed, 24 insertions, 45 deletions
diff --git a/Source/WebCore/svg/SVGViewSpec.h b/Source/WebCore/svg/SVGViewSpec.h index f8634afd6..9fb5d42be 100644 --- a/Source/WebCore/svg/SVGViewSpec.h +++ b/Source/WebCore/svg/SVGViewSpec.h @@ -17,75 +17,58 @@ * Boston, MA 02110-1301, USA. */ -#ifndef SVGViewSpec_h -#define SVGViewSpec_h +#pragma once -#if ENABLE(SVG) #include "SVGAnimatedPreserveAspectRatio.h" #include "SVGAnimatedRect.h" #include "SVGFitToViewBox.h" -#include "SVGTransformList.h" +#include "SVGTransformListValues.h" #include "SVGZoomAndPan.h" namespace WebCore { class SVGElement; -class SVGTransformListPropertyTearOff; +class SVGTransformList; -class SVGViewSpec : public RefCounted<SVGViewSpec> - , public SVGZoomAndPan - , public SVGFitToViewBox { +class SVGViewSpec final : public RefCounted<SVGViewSpec>, public SVGZoomAndPan, public SVGFitToViewBox { public: - virtual ~SVGViewSpec() { } - - using RefCounted<SVGViewSpec>::ref; - using RefCounted<SVGViewSpec>::deref; - - static PassRefPtr<SVGViewSpec> create(SVGElement* contextElement) + static Ref<SVGViewSpec> create(SVGElement& contextElement) { - return adoptRef(new SVGViewSpec(contextElement)); + return adoptRef(*new SVGViewSpec(contextElement)); } bool parseViewSpec(const String&); void reset(); SVGElement* viewTarget() const; - String viewBoxString() const; - - String preserveAspectRatioString() const; - void setTransformString(const String&); String transformString() const; - - void setViewTargetString(const String& string) { m_viewTargetString = string; } - String viewTargetString() const { return m_viewTargetString; } + String viewBoxString() const; + String preserveAspectRatioString() const; + const String& viewTargetString() const { return m_viewTargetString; } SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; } - void setZoomAndPan(unsigned short zoomAndPan) { setZoomAndPanBaseValue(zoomAndPan); } - void setZoomAndPan(unsigned short, ExceptionCode&); + ExceptionOr<void> setZoomAndPan(unsigned short); void setZoomAndPanBaseValue(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan::parseFromNumber(zoomAndPan); } - SVGElement* contextElement() const { return m_contextElement; } - void resetContextElement() { m_contextElement = 0; } + void resetContextElement() { m_contextElement = nullptr; } // Custom non-animated 'transform' property. - SVGTransformListPropertyTearOff* transform(); - SVGTransformList transformBaseValue() const { return m_transform; } + RefPtr<SVGTransformList> transform(); + SVGTransformListValues transformBaseValue() const { return m_transform; } // Custom animated 'viewBox' property. - PassRefPtr<SVGAnimatedRect> viewBoxAnimated(); + RefPtr<SVGAnimatedRect> viewBoxAnimated(); FloatRect& viewBox() { return m_viewBox; } - FloatRect viewBoxBaseValue() const { return m_viewBox; } void setViewBoxBaseValue(const FloatRect& viewBox) { m_viewBox = viewBox; } // Custom animated 'preserveAspectRatio' property. - PassRefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated(); - SVGPreserveAspectRatio& preserveAspectRatio() { return m_preserveAspectRatio; } - SVGPreserveAspectRatio preserveAspectRatioBaseValue() const { return m_preserveAspectRatio; } - void setPreserveAspectRatioBaseValue(const SVGPreserveAspectRatio& preserveAspectRatio) { m_preserveAspectRatio = preserveAspectRatio; } + RefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatioAnimated(); + SVGPreserveAspectRatioValue& preserveAspectRatio() { return m_preserveAspectRatio; } + void setPreserveAspectRatioBaseValue(const SVGPreserveAspectRatioValue& preserveAspectRatio) { m_preserveAspectRatio = preserveAspectRatio; } private: - SVGViewSpec(SVGElement*); + explicit SVGViewSpec(SVGElement&); static const SVGPropertyInfo* transformPropertyInfo(); static const SVGPropertyInfo* viewBoxPropertyInfo(); @@ -95,20 +78,16 @@ private: static const AtomicString& viewBoxIdentifier(); static const AtomicString& preserveAspectRatioIdentifier(); - static PassRefPtr<SVGAnimatedProperty> lookupOrCreateTransformWrapper(SVGViewSpec* contextElement); - static PassRefPtr<SVGAnimatedProperty> lookupOrCreateViewBoxWrapper(SVGViewSpec* contextElement); - static PassRefPtr<SVGAnimatedProperty> lookupOrCreatePreserveAspectRatioWrapper(SVGViewSpec* contextElement); + static Ref<SVGAnimatedProperty> lookupOrCreateTransformWrapper(SVGViewSpec* contextElement); + static Ref<SVGAnimatedProperty> lookupOrCreateViewBoxWrapper(SVGViewSpec* contextElement); + static Ref<SVGAnimatedProperty> lookupOrCreatePreserveAspectRatioWrapper(SVGViewSpec* contextElement); SVGElement* m_contextElement; - SVGZoomAndPanType m_zoomAndPan; - - SVGTransformList m_transform; + SVGZoomAndPanType m_zoomAndPan { SVGZoomAndPanMagnify }; + SVGTransformListValues m_transform; FloatRect m_viewBox; - SVGPreserveAspectRatio m_preserveAspectRatio; + SVGPreserveAspectRatioValue m_preserveAspectRatio; String m_viewTargetString; }; } // namespace WebCore - -#endif // ENABLE(SVG) -#endif |