| Index: Source/core/svg/properties/SVGMatrixTearOff.h
|
| diff --git a/Source/core/svg/properties/SVGStaticPropertyWithParentTearOff.h b/Source/core/svg/properties/SVGMatrixTearOff.h
|
| similarity index 53%
|
| rename from Source/core/svg/properties/SVGStaticPropertyWithParentTearOff.h
|
| rename to Source/core/svg/properties/SVGMatrixTearOff.h
|
| index 19c208b89e81208909b9814ca05e2be20c9a0be1..259592589c8df57591708f285a49afdcdb184888 100644
|
| --- a/Source/core/svg/properties/SVGStaticPropertyWithParentTearOff.h
|
| +++ b/Source/core/svg/properties/SVGMatrixTearOff.h
|
| @@ -17,54 +17,52 @@
|
| * Boston, MA 02110-1301, USA.
|
| */
|
|
|
| -#ifndef SVGStaticPropertyWithParentTearOff_h
|
| -#define SVGStaticPropertyWithParentTearOff_h
|
| +#ifndef SVGMatrixTearOff_h
|
| +#define SVGMatrixTearOff_h
|
|
|
| +#include "core/svg/SVGTransform.h"
|
| #include "core/svg/properties/SVGPropertyTearOff.h"
|
|
|
| namespace WebCore {
|
|
|
| -#if COMPILER(MSVC)
|
| -// UpdateMethod is 12 bytes. We have to pack to a size greater than or equal to that to avoid an
|
| -// alignment warning (C4121). 16 is the next-largest size allowed for packing, so we use that.
|
| -#pragma pack(push, 16)
|
| -#endif
|
| -template<typename ParentType, typename PropertyType>
|
| -class SVGStaticPropertyWithParentTearOff : public SVGPropertyTearOff<PropertyType> {
|
| +class SVGMatrixTearOff : public SVGPropertyTearOff<SVGMatrix> {
|
| public:
|
| - typedef SVGStaticPropertyWithParentTearOff<ParentType, PropertyType> Self;
|
| - typedef void (ParentType::*UpdateMethod)();
|
| -
|
| // Used for non-animated POD types that are not associated with a SVGAnimatedProperty object, nor with a XML DOM attribute
|
| // and that contain a parent type that's exposed to the bindings via a SVGStaticPropertyTearOff object
|
| // (for example: SVGTransform::matrix).
|
| - static PassRefPtr<Self> create(SVGProperty* parent, PropertyType& value, UpdateMethod update)
|
| + static PassRefPtr<SVGMatrixTearOff> create(SVGPropertyTearOff<SVGTransform>* parent, SVGMatrix& value)
|
| {
|
| ASSERT(parent);
|
| - return adoptRef(new Self(parent, value, update));
|
| + RefPtr<SVGMatrixTearOff> result = adoptRef(new SVGMatrixTearOff(parent, value));
|
| + parent->addChild(result.get());
|
| + return result.release();
|
| }
|
|
|
| virtual void commitChange()
|
| {
|
| - (static_cast<SVGPropertyTearOff<ParentType>*>(m_parent.get())->propertyReference().*m_update)();
|
| + if (!m_parent)
|
| + return;
|
| +
|
| + m_parent->propertyReference().updateSVGMatrix();
|
| m_parent->commitChange();
|
| }
|
|
|
| + virtual void detachWrapper() OVERRIDE
|
| + {
|
| + SVGPropertyTearOff<SVGMatrix>::detachWrapper();
|
| + m_parent = 0;
|
| + }
|
| +
|
| private:
|
| - SVGStaticPropertyWithParentTearOff(SVGProperty* parent, PropertyType& value, UpdateMethod update)
|
| - : SVGPropertyTearOff<PropertyType>(0, UndefinedRole, value)
|
| - , m_update(update)
|
| + SVGMatrixTearOff(SVGPropertyTearOff<SVGTransform>* parent, SVGMatrix& value)
|
| + : SVGPropertyTearOff<SVGMatrix>(0, UndefinedRole, value)
|
| , m_parent(parent)
|
| {
|
| }
|
|
|
| - UpdateMethod m_update;
|
| - RefPtr<SVGProperty> m_parent;
|
| + SVGPropertyTearOff<SVGTransform>* m_parent;
|
| };
|
| -#if COMPILER(MSVC)
|
| -#pragma pack(pop)
|
| -#endif
|
|
|
| }
|
|
|
| -#endif // SVGStaticPropertyWithParentTearOff_h
|
| +#endif // SVGMatrixTearOff_h
|
|
|