diff options
Diffstat (limited to 'Source/WebCore/svg/properties/SVGStaticPropertyTearOff.h')
-rw-r--r-- | Source/WebCore/svg/properties/SVGStaticPropertyTearOff.h | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/Source/WebCore/svg/properties/SVGStaticPropertyTearOff.h b/Source/WebCore/svg/properties/SVGStaticPropertyTearOff.h index 962c1679d..5e2ca09a0 100644 --- a/Source/WebCore/svg/properties/SVGStaticPropertyTearOff.h +++ b/Source/WebCore/svg/properties/SVGStaticPropertyTearOff.h @@ -17,11 +17,7 @@ * Boston, MA 02110-1301, USA. */ -#ifndef SVGStaticPropertyTearOff_h -#define SVGStaticPropertyTearOff_h - -#if ENABLE(SVG) -#include "SVGPropertyTearOff.h" +#pragma once namespace WebCore { @@ -30,26 +26,28 @@ namespace WebCore { // alignment warning (C4121). 16 is the next-largest size allowed for packing, so we use that. #pragma pack(push, 16) #endif -template<typename ContextElement, typename PropertyType> -class SVGStaticPropertyTearOff : public SVGPropertyTearOff<PropertyType> { +template<typename ContextElement, typename PropertyTearOff> +class SVGStaticPropertyTearOff final : public PropertyTearOff { public: - typedef SVGStaticPropertyTearOff<ContextElement, PropertyType> Self; + using Self = SVGStaticPropertyTearOff<ContextElement, PropertyTearOff>; + using PropertyType = typename PropertyTearOff::PropertyType; + typedef void (ContextElement::*UpdateMethod)(); // Used for non-animated POD types that are not associated with a SVGAnimatedProperty object, nor with a XML DOM attribute // (for example: SVGSVGElement::currentTranslate). - static PassRefPtr<Self> create(ContextElement& contextElement, PropertyType& value, UpdateMethod update) + static Ref<Self> create(ContextElement& contextElement, PropertyType& value, UpdateMethod update) { - return adoptRef(new Self(&contextElement, value, update)); + return adoptRef(*new Self(contextElement, value, update)); } - virtual void commitChange() { (m_contextElement.get()->*m_update)(); } + void commitChange() final { (m_contextElement.get()->*m_update)(); } private: - SVGStaticPropertyTearOff(ContextElement* contextElement, PropertyType& value, UpdateMethod update) - : SVGPropertyTearOff<PropertyType>(0, UndefinedRole, value) + SVGStaticPropertyTearOff(ContextElement& contextElement, PropertyType& value, UpdateMethod update) + : PropertyTearOff(UndefinedRole, value) , m_update(update) - , m_contextElement(contextElement) + , m_contextElement(&contextElement) { } @@ -60,7 +58,4 @@ private: #pragma pack(pop) #endif -} - -#endif // ENABLE(SVG) -#endif // SVGStaticPropertyTearOff_h +} // namespace WebCore |