Source/WebCore/ChangeLog

 12019-10-01 Said Abou-Hallawa <sabouhallawa@apple.com>
 2
 3 Replace SVGProperty/SVGPropertyOwner by DOMLiveProperty/DOMLivePropertyObserver
 4 https://bugs.webkit.org/show_bug.cgi?id=201782
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 This is a step towards replacing SVGPoint by DOMPoint.
 9
 10 -- Add a new class, named DOMLiveProperty. Its job is to communicate the
 11 changes in this object to its observer. This is replacing SVGProperty.
 12 DOMPoint will be made in a super of it also in a following patch.
 13
 14 -- Add a new class, named DOMLivePropertyObserver and make it the base
 15 class of DOMLiveProperty observers. Currently the following class are
 16 made super classes of DOMLivePropertyObserver:
 17 1. SVGElement: This observes the changes in all the SVG properties.
 18 2. SVGAnimatedProperty: This observes the changes in its baseVal.
 19 3. SVGPropertyList: This observes the changes in the items.
 20 4. SVGTransform: This observes the changes in the underlying SVGMatrix.
 21
 22 * Headers.cmake:
 23 * WebCore.xcodeproj/project.pbxproj:
 24 * dom/DOMLiveProperty.h: Added.
 25 (WebCore::DOMLiveProperty::isAttached const):
 26 (WebCore::DOMLiveProperty::observer const):
 27 (WebCore::DOMLiveProperty::attach):
 28 (WebCore::DOMLiveProperty::detach):
 29 (WebCore::DOMLiveProperty::svgContextElement const):
 30 (WebCore::DOMLiveProperty::isReadOnly const):
 31 (WebCore::DOMLiveProperty::commitChange):
 32 (WebCore::DOMLiveProperty::valueAsString const):
 33 (WebCore::DOMLiveProperty::DOMLiveProperty):
 34 * dom/DOMLivePropertyObserver.h: Added.
 35 (WebCore::DOMLivePropertyObserver::observer const):
 36 (WebCore::DOMLivePropertyObserver::propertySVGContextElement const):
 37 (WebCore::DOMLivePropertyObserver::isPropertyReadOnly const):
 38 (WebCore::DOMLivePropertyObserver::commitPropertyChange):
 39 * svg/SVGAngle.h:
 40 (WebCore::SVGAngle::create):
 41 * svg/SVGElement.cpp:
 42 (WebCore::SVGElement::commitPropertyChange):
 43 * svg/SVGElement.h:
 44 * svg/SVGLength.h:
 45 (WebCore::SVGLength::create):
 46 (WebCore::SVGLength::valueForBindings):
 47 (WebCore::SVGLength::setValueForBindings):
 48 (WebCore::SVGLength::convertToSpecifiedUnits):
 49 * svg/SVGLengthList.h:
 50 (WebCore::SVGLengthList::create):
 51 (WebCore::SVGLengthList::SVGLengthList):
 52 * svg/SVGMatrix.h:
 53 (WebCore::SVGMatrix::create):
 54 * svg/SVGNumber.h:
 55 (WebCore::SVGNumber::create):
 56 * svg/SVGNumberList.h:
 57 (WebCore::SVGNumberList::create):
 58 * svg/SVGPathSeg.h:
 59 * svg/SVGPathSegList.h:
 60 * svg/SVGPointList.h:
 61 (WebCore::SVGPointList::create):
 62 * svg/SVGPreserveAspectRatio.h:
 63 (WebCore::SVGPreserveAspectRatio::create):
 64 * svg/SVGRect.h:
 65 (WebCore::SVGRect::create):
 66 * svg/SVGStringList.h:
 67 * svg/SVGTransform.h:
 68 * svg/SVGTransformList.h:
 69 * svg/properties/SVGAnimatedProperty.cpp:
 70 (WebCore::SVGAnimatedProperty::observer const):
 71 (WebCore::SVGAnimatedProperty::commitPropertyChange):
 72 (WebCore::SVGAnimatedProperty::owner const): Deleted.
 73 * svg/properties/SVGAnimatedProperty.h:
 74 (WebCore::SVGAnimatedProperty::valueAsString const):
 75 * svg/properties/SVGAnimatedPropertyList.h:
 76 * svg/properties/SVGAnimatedPropertyPairAccessorImpl.h:
 77 * svg/properties/SVGAnimatedValueProperty.h:
 78 * svg/properties/SVGList.h:
 79 * svg/properties/SVGMemberAccessor.h:
 80 (WebCore::SVGMemberAccessor::matches const):
 81 * svg/properties/SVGPointerMemberAccessor.h:
 82 * svg/properties/SVGPrimitivePropertyAnimator.h:
 83 (WebCore::SVGPrimitivePropertyAnimator::create):
 84 (WebCore::SVGPrimitivePropertyAnimator::SVGPrimitivePropertyAnimator):
 85 * svg/properties/SVGProperty.h: Removed.
 86 * svg/properties/SVGPropertyAccessor.h:
 87 * svg/properties/SVGPropertyAnimatorFactory.h:
 88 (WebCore::SVGPropertyAnimatorFactory::createColorAnimator):
 89 (WebCore::SVGPropertyAnimatorFactory::createLengthAnimator):
 90 (WebCore::SVGPropertyAnimatorFactory::createLengthListAnimator):
 91 (WebCore::SVGPropertyAnimatorFactory::createNumberAnimator):
 92 (WebCore::SVGPropertyAnimatorFactory::createStringAnimator):
 93 * svg/properties/SVGPropertyList.h:
 94 (WebCore::SVGPropertyList::SVGPropertyList):
 95 * svg/properties/SVGPropertyOwner.h: Removed.
 96 * svg/properties/SVGPropertyOwnerRegistry.h:
 97 * svg/properties/SVGPropertyRegistry.h:
 98 * svg/properties/SVGSharedPrimitiveProperty.h:
 99 * svg/properties/SVGValueProperty.h:
 100 (WebCore::SVGValueProperty::SVGValueProperty):
 101 * svg/properties/SVGValuePropertyAnimator.h:
 102 (WebCore::SVGValuePropertyAnimator::SVGValuePropertyAnimator):
 103 * svg/properties/SVGValuePropertyAnimatorImpl.h:
 104 * svg/properties/SVGValuePropertyList.h:
 105 (WebCore::SVGValuePropertyList::SVGValuePropertyList):
 106 * svg/properties/SVGValuePropertyListAnimator.h:
 107 (WebCore::SVGValuePropertyListAnimator::SVGValuePropertyListAnimator):
 108 * svg/properties/SVGValuePropertyListAnimatorImpl.h:
 109
11102019-10-01 Said Abou-Hallawa <sabouhallawa@apple.com>
2111
3112 Remove SVGPropertyState from SVGProperty

Source/WebCore/Headers.cmake

@@set(WebCore_PRIVATE_FRAMEWORK_HEADERS
360360 dom/DOMException.h
361361 dom/DOMHighResTimeStamp.h
362362 dom/DOMImplementation.h
 363 dom/DOMLiveProperty.h
 364 dom/DOMLivePropertyObserver.h
363365 dom/DOMPasteAccess.h
364366 dom/DOMRect.h
365367 dom/DOMRectInit.h

@@set(WebCore_PRIVATE_FRAMEWORK_HEADERS
13891391
13901392 svg/properties/SVGList.h
13911393 svg/properties/SVGPrimitiveList.h
1392  svg/properties/SVGProperty.h
1393  svg/properties/SVGPropertyOwner.h
13941394 svg/properties/SVGPropertyTraits.h
13951395
13961396 testing/MockGamepad.h

Source/WebCore/WebCore.xcodeproj/project.pbxproj

20852085 71EFCEDC202B38A900D7C411 /* AnimationEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = 71EFCED7202B388D00D7C411 /* AnimationEffect.h */; settings = {ATTRIBUTES = (Private, ); }; };
20862086 72144331223EC85400F12FF7 /* (null) in Headers */ = {isa = PBXBuildFile; settings = {ATTRIBUTES = (Private, ); }; };
20872087 72144332223EC85F00F12FF7 /* (null) in Headers */ = {isa = PBXBuildFile; settings = {ATTRIBUTES = (Private, ); }; };
2088  72144333223EC8B000F12FF7 /* SVGProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 55EE5363223B2A2400FBA944 /* SVGProperty.h */; settings = {ATTRIBUTES = (Private, ); }; };
2089  72144334223EC91600F12FF7 /* SVGPropertyOwner.h in Headers */ = {isa = PBXBuildFile; fileRef = 55EE5360223B2A2100FBA944 /* SVGPropertyOwner.h */; settings = {ATTRIBUTES = (Private, ); }; };
20902088 72283F0E230B268C00F5D828 /* ImagePaintingOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 72C18A3F230B04B7006847C7 /* ImagePaintingOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
20912089 724ED3321A3A8B2300F5F13C /* JSEXTBlendMinMax.h in Headers */ = {isa = PBXBuildFile; fileRef = 724ED3301A3A8B2300F5F13C /* JSEXTBlendMinMax.h */; };
20922090 724EE5501DC80D7F00A91FFB /* ActivityState.h in Headers */ = {isa = PBXBuildFile; fileRef = 724EE54E1DC7F25B00A91FFB /* ActivityState.h */; settings = {ATTRIBUTES = (Private, ); }; };
20932091 724EE5511DC80D8400A91FFB /* ActivityStateChangeObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 724EE54F1DC7F25B00A91FFB /* ActivityStateChangeObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
 2092 728315C1234440150007D277 /* DOMLiveProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 728315C0234422920007D277 /* DOMLiveProperty.h */; settings = {ATTRIBUTES = (Private, ); }; };
 2093 728315C2234440220007D277 /* DOMLivePropertyObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 728315BE234422910007D277 /* DOMLivePropertyObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
20942094 7553CFE8108F473F00EA281E /* TimelineRecordFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 7553CFE6108F473F00EA281E /* TimelineRecordFactory.h */; };
20952095 75793E840D0CE0B3007FC0AC /* MessageEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 75793E810D0CE0B3007FC0AC /* MessageEvent.h */; };
20962096 75793EC90D0CE72D007FC0AC /* JSMessageEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 75793EC70D0CE72D007FC0AC /* JSMessageEvent.h */; };

85658565 55EE535D223B2A0D00FBA944 /* SVGAnimatedPropertyPairAccessorImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyPairAccessorImpl.h; sourceTree = "<group>"; };
85668566 55EE535E223B2A0E00FBA944 /* SVGAnimationAdditiveValueFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimationAdditiveValueFunction.h; sourceTree = "<group>"; };
85678567 55EE535F223B2A0F00FBA944 /* SVGAnimatedPropertyPairAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedPropertyPairAnimator.h; sourceTree = "<group>"; };
8568  55EE5360223B2A2100FBA944 /* SVGPropertyOwner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPropertyOwner.h; sourceTree = "<group>"; };
85698568 55EE5361223B2A2200FBA944 /* SVGAttributeAnimator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGAttributeAnimator.cpp; sourceTree = "<group>"; };
85708569 55EE5362223B2A2300FBA944 /* SVGAnimatedProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedProperty.h; sourceTree = "<group>"; };
8571  55EE5363223B2A2400FBA944 /* SVGProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGProperty.h; sourceTree = "<group>"; };
85728570 55EE5364223B2A2400FBA944 /* SVGAttributeAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAttributeAnimator.h; sourceTree = "<group>"; };
85738571 55FA7FFA2110ECD7005AEFE7 /* SVGZoomAndPanType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGZoomAndPanType.h; sourceTree = "<group>"; };
85748572 570440571E53851600356601 /* CryptoAlgorithmAES_CFBMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmAES_CFBMac.cpp; sourceTree = "<group>"; };

94499447 727AFED11A2EA6A0000442E8 /* EXTsRGB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EXTsRGB.cpp; sourceTree = "<group>"; };
94509448 727AFED21A2EA6A0000442E8 /* EXTsRGB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EXTsRGB.h; sourceTree = "<group>"; };
94519449 727AFED31A2EA6A0000442E8 /* EXTsRGB.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EXTsRGB.idl; sourceTree = "<group>"; };
 9450 728315BE234422910007D277 /* DOMLivePropertyObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMLivePropertyObserver.h; sourceTree = "<group>"; };
 9451 728315C0234422920007D277 /* DOMLiveProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMLiveProperty.h; sourceTree = "<group>"; };
94529452 72C18A3F230B04B7006847C7 /* ImagePaintingOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImagePaintingOptions.h; sourceTree = "<group>"; };
94539453 72E417611A2E8D2F004C562A /* JSEXTsRGB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEXTsRGB.cpp; sourceTree = "<group>"; };
94549454 72E417621A2E8D2F004C562A /* JSEXTsRGB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEXTsRGB.h; sourceTree = "<group>"; };

1616316163 55DCC5252240749E00C26E32 /* SVGPrimitiveList.h */,
1616416164 7266F0152241C09800833975 /* SVGPrimitivePropertyAnimator.h */,
1616516165 7266F0142241BFB200833975 /* SVGPrimitivePropertyAnimatorImpl.h */,
16166  55EE5363223B2A2400FBA944 /* SVGProperty.h */,
1616716166 55DCC526224074FA00C26E32 /* SVGPropertyAccessor.h */,
1616816167 55DCC5272240750B00C26E32 /* SVGPropertyAccessorImpl.h */,
1616916168 7266F0162241C0FE00833975 /* SVGPropertyAnimator.h */,
1617016169 7266F0132241BCE200833975 /* SVGPropertyAnimatorFactory.h */,
1617116170 7266F0272243109200833975 /* SVGPropertyList.h */,
16172  55EE5360223B2A2100FBA944 /* SVGPropertyOwner.h */,
1617316171 55BE025C223B29C30032F08A /* SVGPropertyOwnerRegistry.h */,
1617416172 55BE0257223B29C00032F08A /* SVGPropertyRegistry.h */,
1617516173 088A0E03126EF1DB00978F7A /* SVGPropertyTraits.h */,

2755927557 A8185F3609765765005826D9 /* DOMImplementation.cpp */,
2756027558 A8185F3309765765005826D9 /* DOMImplementation.h */,
2756127559 93EEC1E909C2877700C515D1 /* DOMImplementation.idl */,
 27560 728315C0234422920007D277 /* DOMLiveProperty.h */,
 27561 728315BE234422910007D277 /* DOMLivePropertyObserver.h */,
2756227562 F4B422C2220C0000009E1E7D /* DOMPasteAccess.h */,
2756327563 0F4966991DB408C100A274BB /* DOMPoint.h */,
2756427564 0F49669A1DB408C100A274BB /* DOMPoint.idl */,

2915329153 E3A776671DC85D2800B690D8 /* DOMJITIDLConvert.h in Headers */,
2915429154 E3A776681DC85D2800B690D8 /* DOMJITIDLType.h in Headers */,
2915529155 E35802B61DC8435D00A9773C /* DOMJITIDLTypeFilter.h in Headers */,
 29156 728315C1234440150007D277 /* DOMLiveProperty.h in Headers */,
 29157 728315C2234440220007D277 /* DOMLivePropertyObserver.h in Headers */,
2915629158 836ACECA1ECA9569004BD012 /* DOMMatrix.h in Headers */,
2915729159 7CBBBCC71F560581005EFAAC /* DOMMatrix2DInit.h in Headers */,
2915829160 836ACECB1ECA956D004BD012 /* DOMMatrixInit.h in Headers */,

3197631978 B2227A940D00BF220071B782 /* SVGPolylineElement.h in Headers */,
3197731979 B2227A970D00BF220071B782 /* SVGPreserveAspectRatio.h in Headers */,
3197831980 55DCC52822407B2000C26E32 /* SVGPrimitiveList.h in Headers */,
31979  72144333223EC8B000F12FF7 /* SVGProperty.h in Headers */,
31980  72144334223EC91600F12FF7 /* SVGPropertyOwner.h in Headers */,
3198131981 088A0E0C126EF1DB00978F7A /* SVGPropertyTraits.h in Headers */,
3198231982 B2227A9A0D00BF220071B782 /* SVGRadialGradientElement.h in Headers */,
3198331983 08EDE19F12A50B8E00B95797 /* SVGRect.h in Headers */,

Source/WebCore/dom/DOMLiveProperty.h

 1/*
 2* Copyright (C) 2019 Apple Inc. All rights reserved.
 3*
 4* Redistribution and use in source and binary forms, with or without
 5* modification, are permitted provided that the following conditions
 6* are met:
 7* 1. Redistributions of source code must retain the above copyright
 8* notice, this list of conditions and the following disclaimer.
 9* 2. Redistributions in binary form must reproduce the above copyright
 10* notice, this list of conditions and the following disclaimer in the
 11* documentation and/or other materials provided with the distribution.
 12*
 13* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 14* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
 17* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 23* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24*/
125
 26#pragma once
 27
 28#include "DOMLivePropertyObserver.h"
 29#include <wtf/RefCounted.h>
 30#include <wtf/text/WTFString.h>
 31
 32namespace WebCore {
 33
 34class DOMLiveProperty : public RefCounted<DOMLiveProperty> {
 35public:
 36 virtual ~DOMLiveProperty() = default;
 37
 38 // Managing the relationship with the observer.
 39 bool isAttached() const { return m_observer; }
 40 DOMLivePropertyObserver* observer() const { return m_observer; }
 41
 42 void attach(DOMLivePropertyObserver* observer)
 43 {
 44 ASSERT(!m_observer);
 45 m_observer = observer;
 46 }
 47
 48 void detach()
 49 {
 50 m_observer = nullptr;
 51 }
 52
 53 // Traverse the observers chain till an Element observer is reached.
 54 const SVGElement* svgContextElement() const
 55 {
 56 if (!m_observer)
 57 return nullptr;
 58 return m_observer->propertySVGContextElement();
 59 }
 60
 61 bool isReadOnly() const
 62 {
 63 return m_observer && m_observer->isPropertyReadOnly(*this);
 64 }
 65
 66 // Commit the live property changes via the observers chain.
 67 void commitChange()
 68 {
 69 if (!m_observer)
 70 return;
 71 m_observer->commitPropertyChange(this);
 72 }
 73
 74 virtual String valueAsString() const { return emptyString(); }
 75
 76protected:
 77 DOMLiveProperty(DOMLivePropertyObserver* observer = nullptr)
 78 : m_observer(observer)
 79 {
 80 }
 81
 82 DOMLivePropertyObserver* m_observer { nullptr };
 83};
 84
 85} // namespace WebCore

Source/WebCore/dom/DOMLivePropertyObserver.h

 1/*
 2* Copyright (C) 2019 Apple Inc. All rights reserved.
 3*
 4* Redistribution and use in source and binary forms, with or without
 5* modification, are permitted provided that the following conditions
 6* are met:
 7* 1. Redistributions of source code must retain the above copyright
 8* notice, this list of conditions and the following disclaimer.
 9* 2. Redistributions in binary form must reproduce the above copyright
 10* notice, this list of conditions and the following disclaimer in the
 11* documentation and/or other materials provided with the distribution.
 12*
 13* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 14* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 15* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 16* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
 17* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 18* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 19* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 20* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 21* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 22* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 23* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 24*/
125
 26#pragma once
 27
 28namespace WebCore {
 29
 30class DOMLiveProperty;
 31class SVGElement;
 32
 33class DOMLivePropertyObserver {
 34public:
 35 virtual ~DOMLivePropertyObserver() = default;
 36
 37 // The observer itself may have an observer.
 38 virtual DOMLivePropertyObserver* observer() const { return nullptr; }
 39
 40 // Traverse the observers chain till an Element observer is reached.
 41 virtual const SVGElement* propertySVGContextElement() const
 42 {
 43 if (!observer())
 44 return nullptr;
 45 return observer()->propertySVGContextElement();
 46 }
 47
 48 virtual bool isPropertyReadOnly(const DOMLiveProperty& property) const
 49 {
 50 return observer() && observer()->isPropertyReadOnly(property);
 51 }
 52
 53 // Commit the live property changes via the observers chain.
 54 virtual void commitPropertyChange(DOMLiveProperty* property)
 55 {
 56 if (!observer())
 57 return;
 58 observer()->commitPropertyChange(property);
 59 }
 60
 61protected:
 62 DOMLivePropertyObserver() = default;
 63};
 64
 65} // namespace WebCore

Source/WebCore/svg/SVGAngle.h

@@public:
4141 return adoptRef(*new SVGAngle(value));
4242 }
4343
44  static Ref<SVGAngle> create(SVGPropertyOwner* owner, const SVGAngleValue& value = { })
 44 static Ref<SVGAngle> create(DOMLivePropertyObserver* observer, const SVGAngleValue& value = { })
4545 {
46  return adoptRef(*new SVGAngle(owner, value));
 46 return adoptRef(*new SVGAngle(observer, value));
4747 }
4848
4949 template<typename T>

Source/WebCore/svg/SVGElement.cpp

@@void SVGElement::synchronizeAllAnimatedSVGAttribute(SVGElement& svgElement)
565565 svgElement.synchronizeAllAttributes();
566566}
567567
568 void SVGElement::commitPropertyChange(SVGProperty* property)
 568void SVGElement::commitPropertyChange(DOMLiveProperty* property)
569569{
570570 QualifiedName attributeName = propertyRegistry().propertyAttributeName(*property);
571571 ASSERT(attributeName != nullQName());

Source/WebCore/svg/SVGElement.h

@@class SVGUseElement;
4747
4848void mapAttributeToCSSProperty(HashMap<AtomStringImpl*, CSSPropertyID>* propertyNameToIdMap, const QualifiedName& attrName);
4949
50 class SVGElement : public StyledElement, public SVGLangSpace, public SVGPropertyOwner {
 50class SVGElement : public StyledElement, public SVGLangSpace, public DOMLivePropertyObserver {
5151 WTF_MAKE_ISO_ALLOCATED(SVGElement);
5252public:
5353 bool isOutermostSVGSVGElement() const;

@@public:
136136 void synchronizeAllAttributes();
137137 static void synchronizeAllAnimatedSVGAttribute(SVGElement&);
138138
139  void commitPropertyChange(SVGProperty*) override;
 139 void commitPropertyChange(DOMLiveProperty*) override;
140140 void commitPropertyChange(SVGAnimatedProperty&);
141141
142  const SVGElement* propertyContextElement() const override { return this; }
 142 const SVGElement* propertySVGContextElement() const override { return this; }
143143 SVGPropertyAnimatorFactory& propertyAnimatorFactory() { return *m_propertyAnimatorFactory; }
144144 RefPtr<SVGAttributeAnimator> createAnimator(const QualifiedName&, AnimationMode, CalcMode, bool isAccumulated, bool isAdditive);
145145 void animatorWillBeDeleted(const QualifiedName&);

Source/WebCore/svg/SVGLength.h

@@public:
6262 return adoptRef(*new SVGLength(value));
6363 }
6464
65  static Ref<SVGLength> create(SVGPropertyOwner* owner, const SVGLengthValue& value = { })
 65 static Ref<SVGLength> create(DOMLivePropertyObserver* observer, const SVGLengthValue& value = { })
6666 {
67  return adoptRef(*new SVGLength(owner, value));
 67 return adoptRef(*new SVGLength(observer, value));
6868 }
6969
7070 template<typename T>

@@public:
8787
8888 ExceptionOr<float> valueForBindings()
8989 {
90  return m_value.valueForBindings(SVGLengthContext { contextElement() });
 90 return m_value.valueForBindings(SVGLengthContext { svgContextElement() });
9191 }
9292
9393 ExceptionOr<void> setValueForBindings(float value)

@@public:
9595 if (isReadOnly())
9696 return Exception { NoModificationAllowedError };
9797
98  auto result = m_value.setValue(SVGLengthContext { contextElement() }, value);
 98 auto result = m_value.setValue(SVGLengthContext { svgContextElement() }, value);
9999 if (result.hasException())
100100 return result;
101101

@@public:
152152 if (unitType == SVG_LENGTHTYPE_UNKNOWN || unitType > SVG_LENGTHTYPE_PC)
153153 return Exception { NotSupportedError };
154154
155  auto result = m_value.convertToSpecifiedUnits(SVGLengthContext { contextElement() }, static_cast<SVGLengthType>(unitType));
 155 auto result = m_value.convertToSpecifiedUnits(SVGLengthContext { svgContextElement() }, static_cast<SVGLengthType>(unitType));
156156 if (result.hasException())
157157 return result;
158158

Source/WebCore/svg/SVGLengthList.h

@@public:
4040 return adoptRef(*new SVGLengthList(lengthMode));
4141 }
4242
43  static Ref<SVGLengthList> create(SVGPropertyOwner* owner, SVGLengthMode lengthMode)
 43 static Ref<SVGLengthList> create(DOMLivePropertyObserver* observer, SVGLengthMode lengthMode)
4444 {
45  return adoptRef(*new SVGLengthList(owner, lengthMode));
 45 return adoptRef(*new SVGLengthList(observer, lengthMode));
4646 }
4747
4848 static Ref<SVGLengthList> create(const SVGLengthList& other)

@@private:
9898 {
9999 }
100100
101  SVGLengthList(SVGPropertyOwner* owner, SVGLengthMode lengthMode)
102  : Base(owner)
 101 SVGLengthList(DOMLivePropertyObserver* observer, SVGLengthMode lengthMode)
 102 : Base(observer)
103103 , m_lengthMode(lengthMode)
104104 {
105105 }

Source/WebCore/svg/SVGMatrix.h

@@public:
4242 return adoptRef(*new SVGMatrix(value));
4343 }
4444
45  static Ref<SVGMatrix> create(SVGPropertyOwner* owner, const AffineTransform& value = { })
 45 static Ref<SVGMatrix> create(DOMLivePropertyObserver* observer, const AffineTransform& value = { })
4646 {
47  return adoptRef(*new SVGMatrix(owner, value));
 47 return adoptRef(*new SVGMatrix(observer, value));
4848 }
4949
5050 template<typename T>

Source/WebCore/svg/SVGNumber.h

@@public:
4040 return adoptRef(*new SVGNumber(value));
4141 }
4242
43  static Ref<SVGNumber> create(SVGPropertyOwner* owner, float value = 0)
 43 static Ref<SVGNumber> create(DOMLivePropertyObserver* observer, float value = 0)
4444 {
45  return adoptRef(*new SVGNumber(owner, value));
 45 return adoptRef(*new SVGNumber(observer, value));
4646 }
4747
4848 template<typename T>

Source/WebCore/svg/SVGNumberList.h

@@public:
4040 return adoptRef(*new SVGNumberList());
4141 }
4242
43  static Ref<SVGNumberList> create(SVGPropertyOwner* owner)
 43 static Ref<SVGNumberList> create(DOMLivePropertyObserver* observer)
4444 {
45  return adoptRef(*new SVGNumberList(owner));
 45 return adoptRef(*new SVGNumberList(observer));
4646 }
4747
4848 static Ref<SVGNumberList> create(const SVGNumberList& other)

Source/WebCore/svg/SVGPathSeg.h

2121
2222#pragma once
2323
24 #include "SVGProperty.h"
 24#include "DOMLiveProperty.h"
2525#include <wtf/text/WTFString.h>
2626
2727namespace WebCore {

@@enum SVGPathSegType {
4949 PathSegCurveToQuadraticSmoothRel = 19
5050};
5151
52 class SVGPathSeg : public SVGProperty {
 52class SVGPathSeg : public DOMLiveProperty {
5353public:
5454 virtual ~SVGPathSeg() = default;
5555

@@public:
8282 virtual Ref<SVGPathSeg> clone() const = 0;
8383
8484protected:
85  using SVGProperty::SVGProperty;
 85 using DOMLiveProperty::DOMLiveProperty;
8686};
8787
8888} // namespace WebCore

Source/WebCore/svg/SVGPathSegList.h

@@class SVGPathSegList final : public SVGPropertyList<SVGPathSeg> {
3636 using Base::Base;
3737
3838public:
39  static Ref<SVGPathSegList> create(SVGPropertyOwner* owner)
 39 static Ref<SVGPathSegList> create(DOMLivePropertyObserver* observer)
4040 {
41  return adoptRef(*new SVGPathSegList(owner));
 41 return adoptRef(*new SVGPathSegList(observer));
4242 }
4343
4444 static Ref<SVGPathSegList> create(const SVGPathSegList& other)

@@public:
160160
161161private:
162162 SVGPathSegList(const SVGPathSegList& other)
163  : Base(other.owner())
 163 : Base(other.observer())
164164 , m_pathByteStream(other.pathByteStream())
165165 {
166166 }

@@private:
172172 }
173173
174174 // Called when changing an item in the list.
175  void commitPropertyChange(SVGProperty* property) override
 175 void commitPropertyChange(DOMLiveProperty* property) override
176176 {
177177 itemsWillChange();
178178 Base::commitPropertyChange(property);

Source/WebCore/svg/SVGPointList.h

@@public:
4040 return adoptRef(*new SVGPointList());
4141 }
4242
43  static Ref<SVGPointList> create(SVGPropertyOwner* owner)
 43 static Ref<SVGPointList> create(DOMLivePropertyObserver* observer)
4444 {
45  return adoptRef(*new SVGPointList(owner));
 45 return adoptRef(*new SVGPointList(observer));
4646 }
4747
4848 static Ref<SVGPointList> create(const SVGPointList& other)

Source/WebCore/svg/SVGPreserveAspectRatio.h

@@class SVGPreserveAspectRatio : public SVGValueProperty<SVGPreserveAspectRatioVal
3636 using Base::m_value;
3737
3838public:
39  static Ref<SVGPreserveAspectRatio> create(SVGPropertyOwner* owner, const SVGPreserveAspectRatioValue& value = { })
 39 static Ref<SVGPreserveAspectRatio> create(DOMLivePropertyObserver* observer, const SVGPreserveAspectRatioValue& value = { })
4040 {
41  return adoptRef(*new SVGPreserveAspectRatio(owner, value));
 41 return adoptRef(*new SVGPreserveAspectRatio(observer, value));
4242 }
4343
4444 template<typename T>

Source/WebCore/svg/SVGRect.h

@@public:
3636 return adoptRef(*new SVGRect(value));
3737 }
3838
39  static Ref<SVGRect> create(SVGPropertyOwner* owner, const FloatRect& value = { })
 39 static Ref<SVGRect> create(DOMLivePropertyObserver* observer, const FloatRect& value = { })
4040 {
41  return adoptRef(*new SVGRect(owner, value));
 41 return adoptRef(*new SVGRect(observer, value));
4242 }
4343
4444 template<typename T>

Source/WebCore/svg/SVGStringList.h

@@class SVGStringList final : public SVGPrimitiveList<String> {
3737 using Base::m_items;
3838
3939public:
40  static Ref<SVGStringList> create(SVGPropertyOwner* owner)
 40 static Ref<SVGStringList> create(DOMLivePropertyObserver* observer)
4141 {
42  return adoptRef(*new SVGStringList(owner));
 42 return adoptRef(*new SVGStringList(observer));
4343 }
4444
4545 void reset(const String& string)

Source/WebCore/svg/SVGTransform.h

3131
3232namespace WebCore {
3333
34 class SVGTransform : public SVGValueProperty<SVGTransformValue>, public SVGPropertyOwner {
 34class SVGTransform : public SVGValueProperty<SVGTransformValue>, public DOMLivePropertyObserver {
3535public:
3636 static Ref<SVGTransform> create(SVGTransformValue::SVGTransformType type)
3737 {

@@private:
138138 {
139139 }
140140
141  SVGPropertyOwner* owner() const override { return m_owner; }
 141 DOMLivePropertyObserver* observer() const override { return m_observer; }
142142
143  void commitPropertyChange(SVGProperty* property) override
 143 void commitPropertyChange(DOMLiveProperty* property) override
144144 {
145145 ASSERT_UNUSED(property, property == m_value.matrix().ptr());
146  if (owner())
147  owner()->commitPropertyChange(this);
 146 if (observer())
 147 observer()->commitPropertyChange(this);
148148 m_value.matrixDidChange();
149149 }
150150

Source/WebCore/svg/SVGTransformList.h

@@public:
3838 return adoptRef(*new SVGTransformList());
3939 }
4040
41  static Ref<SVGTransformList> create(SVGPropertyOwner* owner)
 41 static Ref<SVGTransformList> create(DOMLivePropertyObserver* observer)
4242 {
43  return adoptRef(*new SVGTransformList(owner));
 43 return adoptRef(*new SVGTransformList(observer));
4444 }
4545
4646 static Ref<SVGTransformList> create(const SVGTransformList& other)

Source/WebCore/svg/properties/SVGAnimatedProperty.cpp

3030
3131namespace WebCore {
3232
33 SVGPropertyOwner* SVGAnimatedProperty::owner() const
 33DOMLivePropertyObserver* SVGAnimatedProperty::observer() const
3434{
3535 return m_contextElement;
3636}
3737
38 void SVGAnimatedProperty::commitPropertyChange(SVGProperty*)
 38void SVGAnimatedProperty::commitPropertyChange(DOMLiveProperty*)
3939{
4040 if (!m_contextElement)
4141 return;

Source/WebCore/svg/properties/SVGAnimatedProperty.h

2525
2626#pragma once
2727
28 #include "SVGPropertyOwner.h"
 28#include "DOMLivePropertyObserver.h"
2929#include <wtf/Optional.h>
3030#include <wtf/RefCounted.h>
3131#include <wtf/text/WTFString.h>

@@namespace WebCore {
3434
3535class SVGElement;
3636
37 class SVGAnimatedProperty : public RefCounted<SVGAnimatedProperty>, public SVGPropertyOwner {
 37class SVGAnimatedProperty : public RefCounted<SVGAnimatedProperty>, public DOMLivePropertyObserver {
3838public:
3939 virtual ~SVGAnimatedProperty() = default;
4040

@@protected:
6464 {
6565 }
6666
67  SVGPropertyOwner* owner() const override;
68  void commitPropertyChange(SVGProperty*) override;
 67 DOMLivePropertyObserver* observer() const override;
 68 void commitPropertyChange(DOMLiveProperty*) override;
6969
7070 SVGElement* m_contextElement { nullptr };
7171 bool m_isAnimating { false };

Source/WebCore/svg/properties/SVGAnimatedPropertyList.h

@@protected:
126126 return m_animVal;
127127 }
128128
129  bool isPropertyReadOnly(const SVGProperty& property) const override
 129 bool isPropertyReadOnly(const DOMLiveProperty& property) const override
130130 {
131131 return m_animVal == &property;
132132 }
133133
134134 // Called when m_baseVal changes or an item in m_baseVal changes.
135  void commitPropertyChange(SVGProperty* property) override
 135 void commitPropertyChange(DOMLiveProperty* property) override
136136 {
137137 if (m_animVal)
138138 *m_animVal = m_baseVal;

Source/WebCore/svg/properties/SVGAnimatedValueProperty.h

@@protected:
140140 return m_animVal;
141141 }
142142
143  bool isPropertyReadOnly(const SVGProperty& property) const override
 143 bool isPropertyReadOnly(const DOMLiveProperty& property) const override
144144 {
145145 return m_animVal == &property;
146146 }
147147
148148 // Called when m_baseVal changes.
149  void commitPropertyChange(SVGProperty* property) override
 149 void commitPropertyChange(DOMLiveProperty* property) override
150150 {
151151 if (m_animVal)
152152 m_animVal->setValue(m_baseVal->value());

Source/WebCore/svg/properties/SVGList.h

2525
2626#pragma once
2727
 28#include "DOMLiveProperty.h"
2829#include "ExceptionOr.h"
29 #include "SVGProperty.h"
3030
3131namespace WebCore {
3232
3333template<typename ItemType>
34 class SVGList : public SVGProperty {
 34class SVGList : public DOMLiveProperty {
3535public:
3636 unsigned length() const { return numberOfItems(); }
3737

@@public:
150150 }
151151
152152protected:
153  using SVGProperty::SVGProperty;
 153 using DOMLiveProperty::DOMLiveProperty;
154154
155155 ExceptionOr<bool> canAlterList() const
156156 {

Source/WebCore/svg/properties/SVGMemberAccessor.h

3131namespace WebCore {
3232
3333class SVGAnimatedProperty;
34 class SVGProperty;
 34class DOMLiveProperty;
3535
3636template<typename OwnerType>
3737class SVGMemberAccessor {

@@public:
4343 virtual bool isAnimatedProperty() const { return false; }
4444 virtual bool isAnimatedLength() const { return false; }
4545
46  virtual bool matches(const OwnerType&, const SVGProperty&) const { return false; }
 46 virtual bool matches(const OwnerType&, const DOMLiveProperty&) const { return false; }
4747 virtual bool matches(const OwnerType&, const SVGAnimatedProperty&) const { return false; }
4848 virtual String valueAsString(const OwnerType&) const { return emptyString(); }
4949

Source/WebCore/svg/properties/SVGPrimitivePropertyAnimator.h

@@class SVGPrimitivePropertyAnimator : public SVGPropertyAnimator<AnimationFunctio
4242 using Base::m_function;
4343
4444public:
45  static auto create(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
 45 static auto create(const QualifiedName& attributeName, Ref<DOMLiveProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
4646 {
4747 return adoptRef(*new SVGPrimitivePropertyAnimator(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive));
4848 }
4949
5050 template<typename... Arguments>
51  SVGPrimitivePropertyAnimator(const QualifiedName& attributeName, Ref<SVGProperty>&& property, Arguments&&... arguments)
 51 SVGPrimitivePropertyAnimator(const QualifiedName& attributeName, Ref<DOMLiveProperty>&& property, Arguments&&... arguments)
5252 : Base(attributeName, std::forward<Arguments>(arguments)...)
5353 , m_property(static_reference_cast<ValuePropertyType>(WTFMove(property)))
5454 {

Source/WebCore/svg/properties/SVGProperty.h

1 /*
2  * Copyright (C) Research In Motion Limited 2010. All rights reserved.
3  * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #pragma once
22 
23 #include "SVGPropertyOwner.h"
24 #include <wtf/Optional.h>
25 #include <wtf/RefCounted.h>
26 #include <wtf/text/WTFString.h>
27 
28 namespace WebCore {
29 
30 enum class SVGPropertyAccess : uint8_t { ReadWrite, ReadOnly };
31 enum class SVGPropertyState : uint8_t { Clean, Dirty };
32 
33 class SVGProperty : public RefCounted<SVGProperty> {
34 public:
35  virtual ~SVGProperty() = default;
36 
37  // Managing the relationship with the owner.
38  bool isAttached() const { return m_owner; }
39  void attach(SVGPropertyOwner* owner, SVGPropertyAccess access)
40  {
41  ASSERT(!m_owner);
42  ASSERT(m_state == SVGPropertyState::Clean);
43  m_owner = owner;
44  m_access = access;
45  }
46 
47  void detach()
48  {
49  m_owner = nullptr;
50  m_access = SVGPropertyAccess::ReadWrite;
51  m_state = SVGPropertyState::Clean;
52  }
53 
54  const SVGElement* contextElement() const
55  {
56  if (!m_owner)
57  return nullptr;
58  return m_owner->attributeContextElement();
59  }
60 
61  void commitChange()
62  {
63  if (!m_owner)
64  return;
65  m_owner->commitPropertyChange(this);
66  }
67 
68  // DOM access.
69  SVGPropertyAccess access() const { return m_access; }
70  bool isReadOnly() const { return m_access == SVGPropertyAccess::ReadOnly; }
71 
72  // Synchronizing the SVG attribute and its reflection here.
73  bool isDirty() const { return m_state == SVGPropertyState::Dirty; }
74  void setDirty() { m_state = SVGPropertyState::Dirty; }
75  Optional<String> synchronize()
76  {
77  if (m_state == SVGPropertyState::Clean)
78  return WTF::nullopt;
79  m_state = SVGPropertyState::Clean;
80  return valueAsString();
81  }
82 
83  // This is used when calling setAttribute().
84  virtual String valueAsString() const { return emptyString(); }
85 
86  // Visual Studio doesn't seem to see these private constructors from subclasses.
87  // FIXME: See what it takes to remove this hack.
88 #if !COMPILER(MSVC)
89 protected:
90 #endif
91  SVGProperty(SVGPropertyOwner* owner = nullptr, SVGPropertyAccess access = SVGPropertyAccess::ReadWrite)
92  : m_owner(owner)
93  , m_access(access)
94  {
95  }
96 
97  SVGPropertyOwner* m_owner { nullptr };
98  SVGPropertyAccess m_access { SVGPropertyAccess::ReadWrite };
99  SVGPropertyState m_state { SVGPropertyState::Clean };
100 };
101 
102 } // namespace WebCore

Source/WebCore/svg/properties/SVGPropertyAccessor.h

@@protected:
4040 using Base::property;
4141 using Base::singleton;
4242
43  bool matches(const OwnerType& owner, const SVGProperty& property) const override
 43 bool matches(const OwnerType& owner, const DOMLiveProperty& property) const override
4444 {
4545 return this->property(owner).ptr() == &property;
4646 }

Source/WebCore/svg/properties/SVGPropertyAnimatorFactory.h

@@public:
6969
7070private:
7171 // This HashMap maps an attribute name to a pair of static methods. The first one creates a shared
72  // Ref<SVGProperty> for the value type of this attribute. The second creates the animator given the
73  // attribute name and the shared Ref<SVGProperty>.
 72 // Ref<DOMLiveProperty> for the value type of this attribute. The second creates the animator given the
 73 // attribute name and the shared Ref<DOMLiveProperty>.
7474 using AttributeAnimatorCreator = HashMap<
7575 QualifiedName::QualifiedNameImpl*,
7676 std::pair<
77  std::function<Ref<SVGProperty>()>,
78  std::function<Ref<SVGAttributeAnimator>(const QualifiedName&, Ref<SVGProperty>&&, AnimationMode, CalcMode, bool, bool)>
 77 std::function<Ref<DOMLiveProperty>()>,
 78 std::function<Ref<SVGAttributeAnimator>(const QualifiedName&, Ref<DOMLiveProperty>&&, AnimationMode, CalcMode, bool, bool)>
7979 >
8080 >;
8181
82  static auto createColorAnimator(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
 82 static auto createColorAnimator(const QualifiedName& attributeName, Ref<DOMLiveProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
8383 {
8484 return SVGColorAnimator::create(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive);
8585 }
8686
87  static auto createLengthAnimator(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
 87 static auto createLengthAnimator(const QualifiedName& attributeName, Ref<DOMLiveProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
8888 {
8989 return SVGLengthAnimator::create(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive);
9090 }
9191
92  static auto createLengthListAnimator(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
 92 static auto createLengthListAnimator(const QualifiedName& attributeName, Ref<DOMLiveProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
9393 {
9494 return SVGLengthListAnimator::create(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive);
9595 }
9696
97  static auto createNumberAnimator(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
 97 static auto createNumberAnimator(const QualifiedName& attributeName, Ref<DOMLiveProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
9898 {
9999 return SVGNumberAnimator::create(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive);
100100 }
101101
102  static auto createStringAnimator(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
 102 static auto createStringAnimator(const QualifiedName& attributeName, Ref<DOMLiveProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
103103 {
104104 return SVGStringAnimator::create(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive);
105105 }

@@private:
170170 return map;
171171 }
172172
173  using AttributeProperty = HashMap<QualifiedName, Ref<SVGProperty>>;
 173 using AttributeProperty = HashMap<QualifiedName, Ref<DOMLiveProperty>>;
174174 AttributeProperty m_attributeProperty;
175175};
176176

Source/WebCore/svg/properties/SVGPropertyList.h

3030namespace WebCore {
3131
3232template<typename PropertyType>
33 class SVGPropertyList : public SVGList<Ref<PropertyType>>, public SVGPropertyOwner {
 33class SVGPropertyList : public SVGList<Ref<PropertyType>>, public DOMLivePropertyObserver {
3434public:
3535 using BaseList = SVGList<Ref<PropertyType>>;
3636 using BaseList::isEmpty;

@@public:
4242#if !COMPILER(MSVC)
4343protected:
4444#endif
45  using SVGPropertyOwner::SVGPropertyOwner;
 45 using DOMLivePropertyObserver::DOMLivePropertyObserver;
4646 using BaseList::m_items;
47  using BaseList::m_owner;
 47 using BaseList::m_observer;
4848
49  SVGPropertyList(SVGPropertyOwner* owner = nullptr)
50  : BaseList(owner)
 49 SVGPropertyList(DOMLivePropertyObserver* observer = nullptr)
 50 : BaseList(observer)
5151 {
5252 }
5353

@@protected:
6363 item->detach();
6464 }
6565
66  SVGPropertyOwner* owner() const override { return m_owner; }
 66 DOMLivePropertyObserver* observer() const override { return m_observer; }
6767
68  bool isPropertyReadOnly(const SVGProperty&) const override
 68 bool isPropertyReadOnly(const DOMLiveProperty&) const override
6969 {
70  return owner() && owner()->isPropertyReadOnly(*this);
 70 return observer() && observer()->isPropertyReadOnly(*this);
7171 }
7272
73  void commitPropertyChange(SVGProperty*) override
 73 void commitPropertyChange(DOMLiveProperty*) override
7474 {
75  if (owner())
76  owner()->commitPropertyChange(this);
 75 if (observer())
 76 observer()->commitPropertyChange(this);
7777 }
7878
7979 Ref<PropertyType> at(unsigned index) const override

Source/WebCore/svg/properties/SVGPropertyOwner.h

1 /*
2  * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 
26 #pragma once
27 
28 namespace WebCore {
29 
30 class SVGElement;
31 class SVGProperty;
32 
33 class SVGPropertyOwner {
34 public:
35  virtual ~SVGPropertyOwner() = default;
36 
37  virtual SVGPropertyOwner* owner() const { return nullptr; }
38 
39  virtual const SVGElement* attributeContextElement() const
40  {
41  if (!owner())
42  return nullptr;
43  return owner()->attributeContextElement();
44  }
45 
46  virtual void commitPropertyChange(SVGProperty* property)
47  {
48  if (!owner())
49  return;
50  owner()->commitPropertyChange(property);
51  }
52 
53 protected:
54  SVGPropertyOwner() = default;
55 };
56 
57 }

Source/WebCore/svg/properties/SVGPropertyOwnerRegistry.h

@@public:
178178 return false;
179179 }
180180
181  QualifiedName propertyAttributeName(const SVGProperty& property) const override
 181 QualifiedName propertyAttributeName(const DOMLiveProperty& property) const override
182182 {
183183 QualifiedName attributeName = nullQName();
184184 enumerateRecursively([&](const auto& entry) -> bool {

Source/WebCore/svg/properties/SVGPropertyRegistry.h

@@public:
3737 virtual ~SVGPropertyRegistry() = default;
3838
3939 virtual void detachAllProperties() const = 0;
40  virtual QualifiedName propertyAttributeName(const SVGProperty&) const = 0;
 40 virtual QualifiedName propertyAttributeName(const DOMLiveProperty&) const = 0;
4141 virtual QualifiedName animatedPropertyAttributeName(const SVGAnimatedProperty&) const = 0;
4242 virtual String valueAsString(const QualifiedName&) const = 0;
4343

Source/WebCore/svg/properties/SVGSharedPrimitiveProperty.h

2525
2626#pragma once
2727
28 #include "SVGProperty.h"
 28#include "DOMLiveProperty.h"
2929
3030namespace WebCore {
3131
3232template<typename PropertyType>
33 class SVGSharedPrimitiveProperty : public SVGProperty {
 33class SVGSharedPrimitiveProperty : public DOMLiveProperty {
3434public:
3535 using ValueType = PropertyType;
3636

Source/WebCore/svg/properties/SVGValueProperty.h

2525
2626#pragma once
2727
28 #include "SVGProperty.h"
 28#include "DOMLiveProperty.h"
2929
3030namespace WebCore {
3131
3232template<typename PropertyType>
33 class SVGValueProperty : public SVGProperty {
 33class SVGValueProperty : public DOMLiveProperty {
3434public:
3535 using ValueType = PropertyType;
3636

@@protected:
6363 {
6464 }
6565
66  // Base and default constructor. Do not use "using SVGProperty::SVGProperty" because of Windows and GTK ports.
67  SVGValueProperty(SVGPropertyOwner* owner = nullptr)
68  : SVGProperty(owner)
 66 // Base and default constructor. Do not use "using DOMLiveProperty::DOMLiveProperty" because of Windows and GTK ports.
 67 SVGValueProperty(DOMLivePropertyObserver* observer = nullptr)
 68 : DOMLiveProperty(observer)
6969 {
7070 }
7171
7272 // Create an initialized and attached property.
73  SVGValueProperty(SVGPropertyOwner* owner, const PropertyType& value)
74  : SVGProperty(owner)
 73 SVGValueProperty(DOMLivePropertyObserver* observer, const PropertyType& value)
 74 : DOMLiveProperty(observer)
7575 , m_value(value)
7676 {
7777 }

Source/WebCore/svg/properties/SVGValuePropertyAnimator.h

@@class SVGValuePropertyAnimator : public SVGPropertyAnimator<AnimationFunction> {
3838
3939public:
4040 template<typename... Arguments>
41  SVGValuePropertyAnimator(const QualifiedName& attributeName, Ref<SVGProperty>&& property, Arguments&&... arguments)
 41 SVGValuePropertyAnimator(const QualifiedName& attributeName, Ref<DOMLiveProperty>&& property, Arguments&&... arguments)
4242 : Base(attributeName, std::forward<Arguments>(arguments)...)
4343 , m_property(static_reference_cast<PropertyType>(WTFMove(property)))
4444 {

Source/WebCore/svg/properties/SVGValuePropertyAnimatorImpl.h

@@class SVGLengthAnimator final : public SVGValuePropertyAnimator<SVGLength, SVGAn
3737 using Base::m_property;
3838
3939public:
40  static auto create(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
 40 static auto create(const QualifiedName& attributeName, Ref<DOMLiveProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
4141 {
4242 return adoptRef(*new SVGLengthAnimator(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive, SVGLengthMode::Other));
4343 }

Source/WebCore/svg/properties/SVGValuePropertyList.h

@@protected:
7575 using Base::remove;
7676
7777 // Base and default constructor. Do not use "using Base::Base" because of Windows and GTK ports.
78  SVGValuePropertyList(SVGPropertyOwner* owner = nullptr)
79  : Base(owner)
 78 SVGValuePropertyList(DOMLivePropertyObserver* observer = nullptr)
 79 : Base(observer)
8080 {
8181 }
8282
8383 // Used by SVGAnimatedPropertyList when creating it animVal from baseVal.
8484 SVGValuePropertyList(const SVGValuePropertyList& other)
85  : Base(other.owner())
 85 : Base(other.observer())
8686 {
8787 // Clone all items.
8888 for (const auto& item : other.items())

Source/WebCore/svg/properties/SVGValuePropertyListAnimator.h

@@class SVGValuePropertyListAnimator : public SVGPropertyAnimator<AnimationFunctio
3838
3939public:
4040 template<typename... Arguments>
41  SVGValuePropertyListAnimator(const QualifiedName& attributeName, Ref<SVGProperty>&& property, Arguments&&... arguments)
 41 SVGValuePropertyListAnimator(const QualifiedName& attributeName, Ref<DOMLiveProperty>&& property, Arguments&&... arguments)
4242 : Base(attributeName, std::forward<Arguments>(arguments)...)
4343 , m_list(static_reference_cast<ListType>(WTFMove(property)))
4444 {

Source/WebCore/svg/properties/SVGValuePropertyListAnimatorImpl.h

@@class SVGLengthListAnimator final : public SVGValuePropertyListAnimator<SVGLengt
3737 using Base::m_list;
3838
3939public:
40  static auto create(const QualifiedName& attributeName, Ref<SVGProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
 40 static auto create(const QualifiedName& attributeName, Ref<DOMLiveProperty>&& property, AnimationMode animationMode, CalcMode calcMode, bool isAccumulated, bool isAdditive)
4141 {
4242 return adoptRef(*new SVGLengthListAnimator(attributeName, WTFMove(property), animationMode, calcMode, isAccumulated, isAdditive, SVGLengthMode::Other));
4343 }