Changeset 243130 in webkit
- Timestamp:
- Mar 18, 2019 9:23:27 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 1 added
- 3 deleted
- 21 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r243129 r243130 1 2019-03-18 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Remove the SVG property tear off objects for SVGStringList 4 https://bugs.webkit.org/show_bug.cgi?id=195863 5 6 Reviewed by Simon Fraser. 7 8 SVGStringList is not animated list. So we need to introduce two new classes: 9 10 -- SVGProperty: This will be the base of all the non-animated properties. 11 Like the SVGAnimatedProperty, SVGProperty will be registered with the 12 attribute name in SVGPropertyRegistery. It will also commit changes 13 to the reflecting attribute. And it will provide a synchronize string 14 for lazy attribute update. 15 16 -- SVGList: It will be the base of all the list properties. It can hold 17 primitive types or SVG types. In this patch primitive types will be 18 supported only. To do that, a superclass called SVGPrimitiveList is 19 added. Its items are of primitive type such as String type. 20 21 * Sources.txt: 22 * WebCore.xcodeproj/project.pbxproj: 23 * svg/SVGElement.cpp: 24 (WebCore::SVGElement::synchronizeAnimatedSVGAttribute const): 25 (WebCore::SVGElement::commitPropertyChange): 26 * svg/SVGElement.h: 27 * svg/SVGStringList.h: 28 * svg/SVGStringListValues.cpp: Removed. 29 * svg/SVGStringListValues.h: Removed. 30 * svg/SVGTests.cpp: 31 (WebCore::SVGTests::SVGTests): 32 (WebCore::SVGTests::isKnownAttribute): 33 (WebCore::SVGTests::isValid const): 34 (WebCore::SVGTests::parseAttribute): 35 (WebCore::SVGTests::registerAttributes): Deleted. 36 (WebCore::SVGTests::requiredFeatures): Deleted. 37 (WebCore::SVGTests::requiredExtensions): Deleted. 38 (WebCore::SVGTests::systemLanguage): Deleted. 39 * svg/SVGTests.h: 40 (WebCore::SVGTests::requiredFeatures): 41 (WebCore::SVGTests::requiredExtensions): 42 (WebCore::SVGTests::systemLanguage): 43 (): Deleted. 44 * svg/SVGTests.idl: 45 * svg/SVGTextPositioningElement.h: 46 * svg/SVGViewElement.cpp: 47 (WebCore::SVGViewElement::SVGViewElement): 48 (WebCore::SVGViewElement::parseAttribute): 49 (WebCore::SVGViewElement::viewTarget): Deleted. 50 * svg/SVGViewElement.h: 51 * svg/properties/SVGAnimatedListPropertyTearOff.h: 52 * svg/properties/SVGAnimatedPrimitiveProperty.h: 53 (WebCore::SVGAnimatedPrimitiveProperty::setBaseVal): 54 * svg/properties/SVGAnimatedProperty.cpp: 55 (WebCore::SVGAnimatedProperty::commitPropertyChange): 56 * svg/properties/SVGAnimatedProperty.h: 57 * svg/properties/SVGAttributeRegistry.h: 58 * svg/properties/SVGList.h: Added. 59 (WebCore::SVGList::numberOfItems const): 60 (WebCore::SVGList::clear): 61 (WebCore::SVGList::getItem): 62 (WebCore::SVGList::initialize): 63 (WebCore::SVGList::insertItemBefore): 64 (WebCore::SVGList::replaceItem): 65 (WebCore::SVGList::removeItem): 66 (WebCore::SVGList::appendItem): 67 (WebCore::SVGList::items): 68 (WebCore::SVGList::items const): 69 (WebCore::SVGList::size const): 70 (WebCore::SVGList::isEmpty const): 71 (WebCore::SVGList::clearItems): 72 (WebCore::SVGList::canAlterList const): 73 (WebCore::SVGList::canGetItem): 74 (WebCore::SVGList::canReplaceItem): 75 (WebCore::SVGList::canRemoveItem): 76 (WebCore::SVGList::detachItems): 77 * svg/properties/SVGMemberAccessor.h: 78 (WebCore::SVGMemberAccessor::matches const): 79 * svg/properties/SVGPrimitiveList.h: Added. 80 * svg/properties/SVGProperty.h: 81 (WebCore::SVGProperty::isAttached const): 82 (WebCore::SVGProperty::attach): 83 (WebCore::SVGProperty::detach): 84 (WebCore::SVGProperty::contextElement const): 85 (WebCore::SVGProperty::commitChange): 86 (WebCore::SVGProperty::access const): 87 (WebCore::SVGProperty::isReadOnly const): 88 (WebCore::SVGProperty::isDirty const): 89 (WebCore::SVGProperty::setDirty): 90 (WebCore::SVGProperty::synchronize): 91 (WebCore::SVGProperty::valueAsString const): 92 (WebCore::SVGProperty::SVGProperty): 93 * svg/properties/SVGPropertyAccessor.h: Added. 94 * svg/properties/SVGPropertyAccessorImpl.h: Added. 95 * svg/properties/SVGPropertyOwner.h: 96 (WebCore::SVGPropertyOwner::commitPropertyChange): 97 * svg/properties/SVGPropertyOwnerRegistry.h: 98 (WebCore::SVGPropertyOwnerRegistry::registerProperty): 99 * svg/properties/SVGPropertyRegistry.h: 100 * svg/properties/SVGStaticListPropertyTearOff.h: Removed. 101 1 102 2019-03-18 Simon Fraser <simon.fraser@apple.com> 2 103 -
trunk/Source/WebCore/Sources.txt
r243121 r243130 2385 2385 svg/SVGSetElement.cpp 2386 2386 svg/SVGStopElement.cpp 2387 svg/SVGStringListValues.cpp2388 2387 svg/SVGStyleElement.cpp 2389 2388 svg/SVGSwitchElement.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r243121 r243130 267 267 087558C613B4A57D00F49307 /* SurrogatePairAwareTextIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 087558C413B4A57D00F49307 /* SurrogatePairAwareTextIterator.h */; settings = {ATTRIBUTES = (Private, ); }; }; 268 268 087B84961272CEC800A14417 /* SVGAnimatedAngle.h in Headers */ = {isa = PBXBuildFile; fileRef = 087B84951272CEC700A14417 /* SVGAnimatedAngle.h */; }; 269 0880F70E1282B46D00948505 /* SVGStaticListPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 0880F70D1282B46D00948505 /* SVGStaticListPropertyTearOff.h */; };270 269 0885067F11DA045B00182B98 /* PaintInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 0885067D11DA045B00182B98 /* PaintInfo.h */; settings = {ATTRIBUTES = (Private, ); }; }; 271 270 0885068011DA045B00182B98 /* PaintPhase.h in Headers */ = {isa = PBXBuildFile; fileRef = 0885067E11DA045B00182B98 /* PaintPhase.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 1788 1787 55AF14E61EAAC59B0026EEAA /* UTIRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 55AF14E41EAAC59B0026EEAA /* UTIRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1789 1788 55D70D23223B017C00044B8E /* SVGLegacyAnimatedProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 55D70D20223B009100044B8E /* SVGLegacyAnimatedProperty.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1789 55DCC52822407B2000C26E32 /* SVGPrimitiveList.h in Headers */ = {isa = PBXBuildFile; fileRef = 55DCC5252240749E00C26E32 /* SVGPrimitiveList.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1790 55DCC52922407B2A00C26E32 /* SVGList.h in Headers */ = {isa = PBXBuildFile; fileRef = 55DCC523224073FE00C26E32 /* SVGList.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1790 1791 55EC9599206AA7A0007DD0A9 /* PaintFrequencyTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 55EC95972069C92D007DD0A9 /* PaintFrequencyTracker.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1791 1792 55FA7FF0210FA386005AEFE7 /* SVGAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 55FA7FEF210FA386005AEFE7 /* SVGAttribute.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 2138 2139 71EFCEDC202B38A900D7C411 /* AnimationEffect.h in Headers */ = {isa = PBXBuildFile; fileRef = 71EFCED7202B388D00D7C411 /* AnimationEffect.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2139 2140 71FB967B1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 71FB967A1383D64600AC8A4C /* SVGAnimatedEnumerationPropertyTearOff.h */; }; 2141 72144331223EC85400F12FF7 /* (null) in Headers */ = {isa = PBXBuildFile; settings = {ATTRIBUTES = (Private, ); }; }; 2142 72144332223EC85F00F12FF7 /* (null) in Headers */ = {isa = PBXBuildFile; settings = {ATTRIBUTES = (Private, ); }; }; 2143 72144333223EC8B000F12FF7 /* SVGProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 55EE5363223B2A2400FBA944 /* SVGProperty.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2144 72144334223EC91600F12FF7 /* SVGPropertyOwner.h in Headers */ = {isa = PBXBuildFile; fileRef = 55EE5360223B2A2100FBA944 /* SVGPropertyOwner.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2140 2145 724ED32C1A3A7E5400F5F13C /* EXTBlendMinMax.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 724ED3291A3A7E5400F5F13C /* EXTBlendMinMax.cpp */; }; 2141 2146 724ED3321A3A8B2300F5F13C /* JSEXTBlendMinMax.h in Headers */ = {isa = PBXBuildFile; fileRef = 724ED3301A3A8B2300F5F13C /* JSEXTBlendMinMax.h */; }; … … 2234 2239 7C330A081DF9F95100D3395C /* JSPositionOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C330A061DF9F95100D3395C /* JSPositionOptions.h */; }; 2235 2240 7C39C3651DDA865200FEFB29 /* SVGLengthListValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C39C3631DDA864900FEFB29 /* SVGLengthListValues.h */; }; 2236 7C39C3771DDBE17000FEFB29 /* SVGStringListValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C39C3671DDB82CF00FEFB29 /* SVGStringListValues.h */; settings = {ATTRIBUTES = (Private, ); }; };2237 2241 7C3A91E61C963B8800D1A7E3 /* ClipboardAccessPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C3A91E51C963B8800D1A7E3 /* ClipboardAccessPolicy.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2238 2242 7C3B79711908757B00B47A2D /* UserMessageHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C3B796F1908757B00B47A2D /* UserMessageHandler.cpp */; }; … … 5641 5645 087558C413B4A57D00F49307 /* SurrogatePairAwareTextIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SurrogatePairAwareTextIterator.h; sourceTree = "<group>"; }; 5642 5646 087B84951272CEC700A14417 /* SVGAnimatedAngle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGAnimatedAngle.h; sourceTree = "<group>"; }; 5643 0880F70D1282B46D00948505 /* SVGStaticListPropertyTearOff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGStaticListPropertyTearOff.h; sourceTree = "<group>"; };5644 5647 0885067D11DA045B00182B98 /* PaintInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PaintInfo.h; sourceTree = "<group>"; }; 5645 5648 0885067E11DA045B00182B98 /* PaintPhase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PaintPhase.h; sourceTree = "<group>"; }; … … 8681 8684 55DCC51C2240605E00C26E32 /* SVGAnimationDiscreteFunctionImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimationDiscreteFunctionImpl.h; sourceTree = "<group>"; }; 8682 8685 55DCC51D2240615500C26E32 /* SVGAnimationDiscreteFunction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimationDiscreteFunction.h; sourceTree = "<group>"; }; 8686 55DCC523224073FE00C26E32 /* SVGList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGList.h; sourceTree = "<group>"; }; 8687 55DCC5252240749E00C26E32 /* SVGPrimitiveList.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGPrimitiveList.h; sourceTree = "<group>"; }; 8688 55DCC526224074FA00C26E32 /* SVGPropertyAccessor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGPropertyAccessor.h; sourceTree = "<group>"; }; 8689 55DCC5272240750B00C26E32 /* SVGPropertyAccessorImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGPropertyAccessorImpl.h; sourceTree = "<group>"; }; 8683 8690 55EC95972069C92D007DD0A9 /* PaintFrequencyTracker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PaintFrequencyTracker.h; sourceTree = "<group>"; }; 8684 8691 55EE5354223B29E900FBA944 /* SVGMemberAccessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGMemberAccessor.h; sourceTree = "<group>"; }; … … 9732 9739 7C39C3621DDA864900FEFB29 /* SVGLengthListValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGLengthListValues.cpp; sourceTree = "<group>"; }; 9733 9740 7C39C3631DDA864900FEFB29 /* SVGLengthListValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGLengthListValues.h; sourceTree = "<group>"; }; 9734 7C39C3661DDB82CF00FEFB29 /* SVGStringListValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGStringListValues.cpp; sourceTree = "<group>"; };9735 7C39C3671DDB82CF00FEFB29 /* SVGStringListValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGStringListValues.h; sourceTree = "<group>"; };9736 9741 7C39C3681DDB86D300FEFB29 /* SVGNumberListValues.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGNumberListValues.cpp; sourceTree = "<group>"; }; 9737 9742 7C39C3691DDB86D300FEFB29 /* SVGNumberListValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGNumberListValues.h; sourceTree = "<group>"; }; … … 16244 16249 55D70D20223B009100044B8E /* SVGLegacyAnimatedProperty.h */, 16245 16250 55D70D22223B00EA00044B8E /* SVGLegacyProperty.h */, 16251 55DCC523224073FE00C26E32 /* SVGList.h */, 16246 16252 0810764312828556007C63BA /* SVGListProperty.h */, 16247 16253 088A0E00126EF1DB00978F7A /* SVGListPropertyTearOff.h */, … … 16249 16255 55EE5354223B29E900FBA944 /* SVGMemberAccessor.h */, 16250 16256 55BE025A223B29C20032F08A /* SVGPointerMemberAccessor.h */, 16257 55DCC5252240749E00C26E32 /* SVGPrimitiveList.h */, 16251 16258 55EE5363223B2A2400FBA944 /* SVGProperty.h */, 16259 55DCC526224074FA00C26E32 /* SVGPropertyAccessor.h */, 16260 55DCC5272240750B00C26E32 /* SVGPropertyAccessorImpl.h */, 16252 16261 55EE5360223B2A2100FBA944 /* SVGPropertyOwner.h */, 16253 16262 55BE025C223B29C30032F08A /* SVGPropertyOwnerRegistry.h */, … … 16255 16264 088A0E02126EF1DB00978F7A /* SVGPropertyTearOff.h */, 16256 16265 088A0E03126EF1DB00978F7A /* SVGPropertyTraits.h */, 16257 0880F70D1282B46D00948505 /* SVGStaticListPropertyTearOff.h */,16258 16266 0813A4E91284132600992511 /* SVGStaticPropertyTearOff.h */, 16259 16267 ); … … 24512 24520 B22279160D00BF210071B782 /* SVGStringList.h */, 24513 24521 B22279170D00BF210071B782 /* SVGStringList.idl */, 24514 7C39C3661DDB82CF00FEFB29 /* SVGStringListValues.cpp */,24515 7C39C3671DDB82CF00FEFB29 /* SVGStringListValues.h */,24516 24522 B22279210D00BF210071B782 /* SVGStyleElement.cpp */, 24517 24523 B22279220D00BF210071B782 /* SVGStyleElement.h */, … … 28440 28446 buildActionMask = 2147483647; 28441 28447 files = ( 28448 72144332223EC85F00F12FF7 /* (null) in Headers */, 28449 72144331223EC85400F12FF7 /* (null) in Headers */, 28442 28450 7CD0E2B81F80A4820016A4CE /* AbortController.h in Headers */, 28443 28451 7CD0E2BF1F80A56E0016A4CE /* AbortSignal.h in Headers */, … … 32018 32026 B2227A390D00BF220071B782 /* SVGLinearGradientElement.h in Headers */, 32019 32027 B2227A3C0D00BF220071B782 /* SVGLineElement.h in Headers */, 32028 55DCC52922407B2A00C26E32 /* SVGList.h in Headers */, 32020 32029 0810764412828556007C63BA /* SVGListProperty.h in Headers */, 32021 32030 088A0E09126EF1DB00978F7A /* SVGListPropertyTearOff.h in Headers */, … … 32085 32094 B2227A940D00BF220071B782 /* SVGPolylineElement.h in Headers */, 32086 32095 B2227A970D00BF220071B782 /* SVGPreserveAspectRatio.h in Headers */, 32096 55DCC52822407B2000C26E32 /* SVGPrimitiveList.h in Headers */, 32097 72144333223EC8B000F12FF7 /* SVGProperty.h in Headers */, 32098 72144334223EC91600F12FF7 /* SVGPropertyOwner.h in Headers */, 32087 32099 088A0E0B126EF1DB00978F7A /* SVGPropertyTearOff.h in Headers */, 32088 32100 088A0E0C126EF1DB00978F7A /* SVGPropertyTraits.h in Headers */, … … 32103 32115 B2227AA60D00BF220071B782 /* SVGSetElement.h in Headers */, 32104 32116 E4AFD0100DAF335500F5F55C /* SVGSMILElement.h in Headers */, 32105 0880F70E1282B46D00948505 /* SVGStaticListPropertyTearOff.h in Headers */,32106 32117 0813A4EA1284132600992511 /* SVGStaticPropertyTearOff.h in Headers */, 32107 32118 B2227AA90D00BF220071B782 /* SVGStopElement.h in Headers */, 32108 32119 B2227AAC0D00BF220071B782 /* SVGStringList.h in Headers */, 32109 7C39C3771DDBE17000FEFB29 /* SVGStringListValues.h in Headers */,32110 32120 B2227AB80D00BF220071B782 /* SVGStyleElement.h in Headers */, 32111 32121 B2227ABB0D00BF220071B782 /* SVGSVGElement.h in Headers */, -
trunk/Source/WebCore/svg/SVGElement.cpp
r243036 r243130 721 721 if (name == anyQName()) 722 722 synchronizeAllAnimatedSVGAttribute(nonConstThis); 723 else if (isAnimatedPropertyAttribute(name)){723 else { 724 724 // If the value of the property has changed, serialize the new value to the attribute. 725 725 if (auto value = propertyRegistry().synchronize(name)) 726 726 nonConstThis->setSynchronizedLazyAttribute(name, *value); 727 } else 728 nonConstThis->synchronizeAttribute(name); 727 else 728 nonConstThis->synchronizeAttribute(name); 729 } 730 } 731 732 void SVGElement::commitPropertyChange(SVGProperty* property) 733 { 734 // We want to dirty the top-level property when a descendant changes. For example 735 // a change in an SVGLength item in SVGLengthList should set the dirty flag on 736 // SVGLengthList and not the SVGLength. 737 property->setDirty(); 738 739 invalidateSVGAttributes(); 740 svgAttributeChanged(propertyRegistry().propertyAttributeName(*property)); 729 741 } 730 742 -
trunk/Source/WebCore/svg/SVGElement.h
r243114 r243130 158 158 bool isAnimatedAttribute(const QualifiedName&) const; 159 159 160 void commitPropertyChange( ) override { }160 void commitPropertyChange(SVGProperty*) override; 161 161 void commitPropertyChange(SVGAnimatedProperty&); 162 162 -
trunk/Source/WebCore/svg/SVGStringList.h
r208871 r243130 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 #pragma once 27 27 28 #include "SVGAnimatedListPropertyTearOff.h" 29 #include "SVGListPropertyTearOff.h" 30 #include "SVGStringListValues.h" 28 #include "SVGParserUtilities.h" 29 #include "SVGPrimitiveList.h" 31 30 32 31 namespace WebCore { 33 32 34 class SVGStringList final : public SVGStaticListPropertyTearOff<SVGStringListValues> { 33 class SVGStringList final : public SVGPrimitiveList<String> { 34 using Base = SVGPrimitiveList<String>; 35 using Base::Base; 36 using Base::m_items; 37 35 38 public: 36 using AnimatedListPropertyTearOff = SVGAnimatedListPropertyTearOff<SVGStringListValues>; 37 using ListWrapperCache = AnimatedListPropertyTearOff::ListWrapperCache; 38 39 static Ref<SVGStringList> create(SVGElement& contextElement, SVGStringListValues& values) 39 static Ref<SVGStringList> create(SVGPropertyOwner* owner) 40 40 { 41 return adoptRef(*new SVGStringList( &contextElement, values));41 return adoptRef(*new SVGStringList(owner)); 42 42 } 43 43 44 static Ref<SVGStringList> create(AnimatedListPropertyTearOff&, SVGPropertyRole, SVGStringListValues& values, ListWrapperCache&)44 void reset(const String& string) 45 45 { 46 // FIXME: Find a way to remove this. It's only needed to keep Windows compiling. 47 ASSERT_NOT_REACHED(); 48 return adoptRef(*new SVGStringList(nullptr, values)); 46 parse(string, ' '); 47 48 // Add empty string, if list is empty. 49 if (m_items.isEmpty()) 50 m_items.append(emptyString()); 49 51 } 50 52 51 private: 52 SVGStringList(SVGElement* contextElement, SVGStringListValues& values) 53 : SVGStaticListPropertyTearOff<SVGStringListValues>(contextElement, values) 53 bool parse(const String& data, UChar delimiter) 54 54 { 55 clearItems(); 56 57 auto upconvertedCharacters = StringView(data).upconvertedCharacters(); 58 const UChar* ptr = upconvertedCharacters; 59 const UChar* end = ptr + data.length(); 60 while (ptr < end) { 61 const UChar* start = ptr; 62 while (ptr < end && *ptr != delimiter && !isSVGSpace(*ptr)) 63 ptr++; 64 if (ptr == start) 65 break; 66 m_items.append(String(start, ptr - start)); 67 skipOptionalSVGSpacesOrDelimiter(ptr, end, delimiter); 68 } 69 70 return ptr == end; 71 } 72 73 String valueAsString() const override 74 { 75 StringBuilder builder; 76 77 for (auto string : m_items) { 78 if (builder.length()) 79 builder.append(' '); 80 81 builder.append(string); 82 } 83 84 return builder.toString(); 55 85 } 56 86 }; -
trunk/Source/WebCore/svg/SVGTests.cpp
r234620 r243130 110 110 SVGTests::SVGTests(SVGElement* contextElement) 111 111 : m_contextElement(*contextElement) 112 { 113 registerAttributes(); 114 } 115 116 void SVGTests::registerAttributes() 117 { 118 auto& registry = attributeRegistry(); 119 if (!registry.isEmpty()) 120 return; 121 registry.registerAttribute<SVGNames::requiredFeaturesAttr, &SVGTests::m_requiredFeatures>(); 122 registry.registerAttribute<SVGNames::requiredExtensionsAttr, &SVGTests::m_requiredExtensions>(); 123 registry.registerAttribute<SVGNames::systemLanguageAttr, &SVGTests::m_systemLanguage>(); 112 , m_requiredFeatures(SVGStringList::create(contextElement)) 113 , m_requiredExtensions(SVGStringList::create(contextElement)) 114 , m_systemLanguage(SVGStringList::create(contextElement)) 115 { 116 static std::once_flag onceFlag; 117 std::call_once(onceFlag, [] { 118 PropertyRegistry::registerProperty<SVGNames::requiredFeaturesAttr, &SVGTests::m_requiredFeatures>(); 119 PropertyRegistry::registerProperty<SVGNames::requiredExtensionsAttr, &SVGTests::m_requiredExtensions>(); 120 PropertyRegistry::registerProperty<SVGNames::systemLanguageAttr, &SVGTests::m_systemLanguage>(); 121 }); 124 122 } 125 123 … … 131 129 bool SVGTests::isKnownAttribute(const QualifiedName& attributeName) 132 130 { 133 return AttributeOwnerProxy::isKnownAttribute(attributeName);131 return PropertyRegistry::isKnownAttribute(attributeName); 134 132 } 135 133 … … 146 144 bool SVGTests::isValid() const 147 145 { 148 for (auto& feature : m_requiredFeatures .value()) {146 for (auto& feature : m_requiredFeatures->items()) { 149 147 if (feature.isEmpty() || !supportedSVGFeatures().contains(feature)) 150 148 return false; 151 149 } 152 for (auto& language : m_systemLanguage .value()) {150 for (auto& language : m_systemLanguage->items()) { 153 151 if (language != defaultLanguage().substring(0, 2)) 154 152 return false; 155 153 } 156 for (auto& extension : m_requiredExtensions .value()) {154 for (auto& extension : m_requiredExtensions->items()) { 157 155 if (!hasExtension(extension)) 158 156 return false; … … 164 162 { 165 163 if (attributeName == requiredFeaturesAttr) 166 m_requiredFeatures .value().reset(value);164 m_requiredFeatures->reset(value); 167 165 if (attributeName == requiredExtensionsAttr) 168 m_requiredExtensions .value().reset(value);166 m_requiredExtensions->reset(value); 169 167 if (attributeName == systemLanguageAttr) 170 m_systemLanguage .value().reset(value);168 m_systemLanguage->reset(value); 171 169 } 172 170 … … 186 184 supportedAttributes.add(requiredExtensionsAttr); 187 185 supportedAttributes.add(systemLanguageAttr); 188 }189 190 Ref<SVGStringList> SVGTests::requiredFeatures()191 {192 m_requiredFeatures.setShouldSynchronize(true);193 return SVGStringList::create(m_contextElement, m_requiredFeatures.value());194 }195 196 Ref<SVGStringList> SVGTests::requiredExtensions()197 {198 m_requiredExtensions.setShouldSynchronize(true);199 return SVGStringList::create(m_contextElement, m_requiredExtensions.value());200 }201 202 Ref<SVGStringList> SVGTests::systemLanguage()203 {204 m_systemLanguage.setShouldSynchronize(true);205 return SVGStringList::create(m_contextElement, m_systemLanguage.value());206 186 } 207 187 -
trunk/Source/WebCore/svg/SVGTests.h
r243114 r243130 22 22 #pragma once 23 23 24 #include "SVGAttribute.h" 25 #include "SVGStringListValues.h" 24 #include "SVGStringList.h" 26 25 27 26 namespace WebCore { … … 60 59 61 60 // These methods are called from DOM through the super classes. 62 Ref<SVGStringList> requiredFeatures();63 Ref<SVGStringList> requiredExtensions();64 Ref<SVGStringList> systemLanguage();61 SVGStringList& requiredFeatures() { return m_requiredFeatures; } 62 SVGStringList& requiredExtensions() { return m_requiredExtensions; } 63 SVGStringList& systemLanguage() { return m_systemLanguage; } 65 64 66 65 protected: … … 69 68 private: 70 69 using AttributeOwnerProxy = SVGAttributeOwnerProxyImpl<SVGTests>; 71 static void registerAttributes();72 70 73 71 SVGElement& m_contextElement; 74 SVGStringListValuesAttribute m_requiredFeatures { SVGNames::requiredFeaturesAttr };75 SVGStringListValuesAttribute m_requiredExtensions { SVGNames::requiredExtensionsAttr };76 SVGStringListValuesAttribute m_systemLanguage { SVGNames::systemLanguageAttr };72 Ref<SVGStringList> m_requiredFeatures; 73 Ref<SVGStringList> m_requiredExtensions; 74 Ref<SVGStringList> m_systemLanguage; 77 75 }; 78 76 -
trunk/Source/WebCore/svg/SVGTests.idl
r208863 r243130 29 29 SuppressToJSObject, 30 30 ] interface SVGTests { 31 [NewObject]readonly attribute SVGStringList requiredFeatures;32 [NewObject]readonly attribute SVGStringList requiredExtensions;33 [NewObject]readonly attribute SVGStringList systemLanguage;31 readonly attribute SVGStringList requiredFeatures; 32 readonly attribute SVGStringList requiredExtensions; 33 readonly attribute SVGStringList systemLanguage; 34 34 35 35 // FIXME: Using "undefined" as default parameter value is wrong. -
trunk/Source/WebCore/svg/SVGViewElement.cpp
r234620 r243130 2 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 3 3 * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2018 Apple Inc. All rights reserved.4 * Copyright (C) 2018-2019 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 35 35 , SVGExternalResourcesRequired(this) 36 36 , SVGFitToViewBox(this) 37 , m_viewTarget(SVGNames::viewTargetAttr)38 37 { 39 38 ASSERT(hasTagName(SVGNames::viewTag)); 39 40 static std::once_flag onceFlag; 41 std::call_once(onceFlag, [] { 42 PropertyRegistry::registerProperty<SVGNames::viewTargetAttr, &SVGViewElement::m_viewTarget>(); 43 }); 40 44 } 41 45 … … 45 49 } 46 50 47 Ref<SVGStringList> SVGViewElement::viewTarget()48 {49 return SVGStringList::create(*this, m_viewTarget);50 }51 52 51 void SVGViewElement::parseAttribute(const QualifiedName& name, const AtomicString& value) 53 52 { 54 if (name == SVGNames::viewTargetAttr) 55 m_viewTarget.reset(value); 53 if (name == SVGNames::viewTargetAttr) { 54 m_viewTarget->reset(value); 55 return; 56 } 56 57 57 58 SVGElement::parseAttribute(name, value); -
trunk/Source/WebCore/svg/SVGViewElement.h
r243114 r243130 25 25 #include "SVGExternalResourcesRequired.h" 26 26 #include "SVGFitToViewBox.h" 27 #include "SVGStringList.h" 27 28 #include "SVGZoomAndPan.h" 28 29 29 30 namespace WebCore { 30 31 class SVGStringList;32 31 33 32 class SVGViewElement final : public SVGElement, public SVGExternalResourcesRequired, public SVGFitToViewBox, public SVGZoomAndPan { … … 39 38 using SVGElement::deref; 40 39 41 Ref<SVGStringList> viewTarget() ;40 Ref<SVGStringList> viewTarget() { return m_viewTarget.copyRef(); } 42 41 43 42 private: … … 57 56 AttributeOwnerProxy m_attributeOwnerProxy { *this }; 58 57 PropertyRegistry m_propertyRegistry { *this }; 59 SVGStringListValues m_viewTarget;58 Ref<SVGStringList> m_viewTarget { SVGStringList::create(this) }; 60 59 }; 61 60 -
trunk/Source/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h
r242978 r243130 23 23 #include "SVGLegacyAnimatedProperty.h" 24 24 #include "SVGListPropertyTearOff.h" 25 #include "SVGStaticListPropertyTearOff.h"26 25 27 26 namespace WebCore { -
trunk/Source/WebCore/svg/properties/SVGAnimatedPrimitiveProperty.h
r243036 r243130 50 50 { 51 51 m_baseVal = baseVal; 52 commitPropertyChange( );52 commitPropertyChange(nullptr); 53 53 return { }; 54 54 } -
trunk/Source/WebCore/svg/properties/SVGAnimatedProperty.cpp
r243036 r243130 36 36 } 37 37 38 void SVGAnimatedProperty::commitPropertyChange( )38 void SVGAnimatedProperty::commitPropertyChange(SVGProperty*) 39 39 { 40 40 if (!m_contextElement) -
trunk/Source/WebCore/svg/properties/SVGAnimatedProperty.h
r243036 r243130 27 27 28 28 #include "SVGPropertyOwner.h" 29 #include <wtf/Optional.h> 30 #include <wtf/RefCounted.h> 31 #include <wtf/text/WTFString.h> 29 32 30 33 namespace WebCore { 34 35 class SVGElement; 31 36 32 37 class SVGAnimatedProperty : public RefCounted<SVGAnimatedProperty>, public SVGPropertyOwner { … … 63 68 64 69 SVGPropertyOwner* owner() const override; 65 void commitPropertyChange( ) override;70 void commitPropertyChange(SVGProperty*) override; 66 71 67 72 SVGElement* m_contextElement { nullptr }; -
trunk/Source/WebCore/svg/properties/SVGAttributeRegistry.h
r243121 r243130 38 38 #include "SVGAttributeAccessor.h" 39 39 #include "SVGLegacyAnimatedProperty.h" 40 #include "SVGStringListValues.h"41 40 #include "SVGZoomAndPanType.h" 42 41 #include <wtf/HashMap.h> … … 51 50 static NeverDestroyed<SVGAttributeRegistry<OwnerType, BaseTypes...>> map; 52 51 return map; 53 }54 55 // Non animatable attributes56 template<const LazyNeverDestroyed<const QualifiedName>& attributeName, SVGStringListValuesAttribute OwnerType::*attribute>57 void registerAttribute()58 {59 registerAttribute(SVGStringListValuesAttributeAccessor<OwnerType>::template singleton<attributeName, attribute>());60 52 } 61 53 -
trunk/Source/WebCore/svg/properties/SVGMemberAccessor.h
r243036 r243130 32 32 33 33 class SVGAnimatedProperty; 34 class SVGProperty; 34 35 35 36 template<typename OwnerType> … … 43 44 virtual bool isAnimatedLength() const { return false; } 44 45 46 virtual bool matches(const OwnerType&, const SVGProperty&) const { return false; } 45 47 virtual bool matches(const OwnerType&, const SVGAnimatedProperty&) const { return false; } 46 48 virtual Optional<String> synchronize(const OwnerType&) const { return WTF::nullopt; } -
trunk/Source/WebCore/svg/properties/SVGPrimitiveList.h
r243129 r243130 1 1 /* 2 * Copyright (C) 201 8-2019 Apple Inc. All rights reserved.2 * Copyright (C) 2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 #pragma once 27 27 28 #include "SVGList.h" 29 28 30 namespace WebCore { 29 31 30 class SVGPropertyOwner { 31 public: 32 virtual ~SVGPropertyOwner() = default; 32 template<typename PropertyType> 33 class SVGPrimitiveList : public SVGList<PropertyType> { 34 protected: 35 using Base = SVGList<PropertyType>; 36 using Base::Base; 37 using Base::size; 38 using Base::m_items; 33 39 34 virtual SVGPropertyOwner* owner() const { return nullptr; } 35 36 virtual const SVGElement* attributeContextElement() const 40 PropertyType at(unsigned index) const override 37 41 { 38 if (!owner()) 39 return nullptr; 40 return owner()->attributeContextElement(); 42 ASSERT(index < size()); 43 return m_items.at(index); 41 44 } 42 43 virtual void commitPropertyChange()45 46 PropertyType insert(unsigned index, PropertyType&& newItem) override 44 47 { 45 if (!owner())46 return;47 owner()->commitPropertyChange();48 ASSERT(index <= size()); 49 m_items.insert(index, WTFMove(newItem)); 50 return at(index); 48 51 } 49 50 protected: 51 SVGPropertyOwner() = default; 52 53 PropertyType replace(unsigned index, PropertyType&& newItem) override 54 { 55 ASSERT(index < size()); 56 m_items.at(index) = WTFMove(newItem); 57 return at(index); 58 } 59 60 PropertyType remove(unsigned index) override 61 { 62 ASSERT(index < size()); 63 PropertyType item = at(index); 64 m_items.remove(index); 65 return WTFMove(item); 66 } 67 68 PropertyType append(PropertyType&& newItem) override 69 { 70 m_items.append(WTFMove(newItem)); 71 return at(size() - 1); 72 } 52 73 }; 53 74 -
trunk/Source/WebCore/svg/properties/SVGProperty.h
r243036 r243130 21 21 #pragma once 22 22 23 #include "SVGPropertyOwner.h" 24 #include <wtf/RefCounted.h> 25 23 26 namespace WebCore { 24 27 … … 26 29 enum class SVGPropertyState : uint8_t { Clean, Dirty }; 27 30 31 class SVGProperty : public RefCounted<SVGProperty> { 32 public: 33 virtual ~SVGProperty() = default; 34 35 // Managing the relationship with the owner. 36 bool isAttached() const { return m_owner; } 37 void attach(SVGPropertyOwner* owner, SVGPropertyAccess access) 38 { 39 ASSERT(!m_owner); 40 ASSERT(m_state == SVGPropertyState::Clean); 41 m_owner = owner; 42 m_access = access; 43 } 44 45 void detach() 46 { 47 m_owner = nullptr; 48 m_access = SVGPropertyAccess::ReadWrite; 49 m_state = SVGPropertyState::Clean; 50 } 51 52 const SVGElement* contextElement() const 53 { 54 if (!m_owner) 55 return nullptr; 56 return m_owner->attributeContextElement(); 57 } 58 59 void commitChange() 60 { 61 if (!m_owner) 62 return; 63 m_owner->commitPropertyChange(this); 64 } 65 66 // DOM access. 67 SVGPropertyAccess access() const { return m_access; } 68 bool isReadOnly() const { return m_access == SVGPropertyAccess::ReadOnly; } 69 70 // Synchronizing the SVG attribute and its reflection here. 71 bool isDirty() const { return m_state == SVGPropertyState::Dirty; } 72 void setDirty() { m_state = SVGPropertyState::Dirty; } 73 Optional<String> synchronize() 74 { 75 if (m_state == SVGPropertyState::Clean) 76 return WTF::nullopt; 77 m_state = SVGPropertyState::Clean; 78 return valueAsString(); 79 } 80 81 // This is used when calling setAttribute(). 82 virtual String valueAsString() const { return emptyString(); } 83 84 protected: 85 SVGProperty(SVGPropertyOwner* owner = nullptr, SVGPropertyAccess access = SVGPropertyAccess::ReadWrite) 86 : m_owner(owner) 87 , m_access(access) 88 { 89 } 90 91 SVGPropertyOwner* m_owner { nullptr }; 92 SVGPropertyAccess m_access { SVGPropertyAccess::ReadWrite }; 93 SVGPropertyState m_state { SVGPropertyState::Clean }; 94 }; 95 28 96 } // namespace WebCore 29 -
trunk/Source/WebCore/svg/properties/SVGPropertyAccessor.h
r243129 r243130 26 26 #pragma once 27 27 28 #include "SVGPointerMemberAccessor.h" 29 28 30 namespace WebCore { 29 31 30 class SVGPropertyOwner { 32 template<typename OwnerType, typename PropertyType> 33 class SVGPropertyAccessor : public SVGPointerMemberAccessor<OwnerType, PropertyType> { 34 using Base = SVGPointerMemberAccessor<OwnerType, PropertyType>; 35 31 36 public: 32 virtual ~SVGPropertyOwner() = default;37 using Base::Base; 33 38 34 virtual SVGPropertyOwner* owner() const { return nullptr; } 35 36 virtual const SVGElement* attributeContextElement() const 39 protected: 40 using Base::property; 41 using Base::singleton; 42 43 bool matches(const OwnerType& owner, const SVGProperty& property) const override 37 44 { 38 if (!owner()) 39 return nullptr; 40 return owner()->attributeContextElement(); 45 return this->property(owner).ptr() == &property; 41 46 } 42 43 virtual void commitPropertyChange()44 {45 if (!owner())46 return;47 owner()->commitPropertyChange();48 }49 50 protected:51 SVGPropertyOwner() = default;52 47 }; 53 48 -
trunk/Source/WebCore/svg/properties/SVGPropertyAccessorImpl.h
r243129 r243130 24 24 */ 25 25 26 #include "config.h" 27 #include "SVGAnimatedProperty.h" 26 #pragma once 28 27 29 #include "SVGElement.h" 28 #include "SVGPropertyAccessor.h" 29 #include "SVGStringList.h" 30 30 31 31 namespace WebCore { 32 32 33 SVGPropertyOwner* SVGAnimatedProperty::owner() const 34 { 35 return m_contextElement; 36 } 33 template<typename OwnerType> 34 class SVGStringListAccessor final : public SVGPropertyAccessor<OwnerType, SVGStringList> { 35 using Base = SVGPropertyAccessor<OwnerType, SVGStringList>; 37 36 38 void SVGAnimatedProperty::commitPropertyChange() 39 { 40 if (!m_contextElement) 41 return; 42 m_contextElement->commitPropertyChange(*this); 43 } 37 public: 38 using Base::Base; 39 template<Ref<SVGStringList> OwnerType::*property> 40 constexpr static const SVGMemberAccessor<OwnerType>& singleton() { return Base::template singleton<SVGStringListAccessor, property>(); } 41 }; 44 42 45 43 } -
trunk/Source/WebCore/svg/properties/SVGPropertyOwner.h
r243036 r243130 27 27 28 28 namespace WebCore { 29 30 class SVGElement; 31 class SVGProperty; 29 32 30 33 class SVGPropertyOwner { … … 41 44 } 42 45 43 virtual void commitPropertyChange( )46 virtual void commitPropertyChange(SVGProperty* property) 44 47 { 45 48 if (!owner()) 46 49 return; 47 owner()->commitPropertyChange( );50 owner()->commitPropertyChange(property); 48 51 } 49 52 -
trunk/Source/WebCore/svg/properties/SVGPropertyOwnerRegistry.h
r243121 r243130 28 28 #include "SVGAnimatedPropertyAccessorImpl.h" 29 29 #include "SVGAnimatedPropertyPairAccessorImpl.h" 30 #include "SVGPropertyAccessorImpl.h" 30 31 #include "SVGPropertyRegistry.h" 31 32 #include <wtf/HashMap.h> … … 43 44 } 44 45 46 template<const LazyNeverDestroyed<const QualifiedName>& attributeName, Ref<SVGStringList> OwnerType::*property> 47 static void registerProperty() 48 { 49 registerProperty(attributeName, SVGStringListAccessor<OwnerType>::template singleton<property>()); 50 } 51 45 52 template<const LazyNeverDestroyed<const QualifiedName>& attributeName, Ref<SVGAnimatedBoolean> OwnerType::*property> 46 53 static void registerProperty() … … 78 85 } 79 86 87 QualifiedName propertyAttributeName(const SVGProperty& property) const override 88 { 89 QualifiedName attributeName = nullQName(); 90 enumerateRecursively([&](const auto& entry) -> bool { 91 if (!entry.value->matches(m_owner, property)) 92 return true; 93 attributeName = entry.key; 94 return false; 95 }); 96 return attributeName; 97 } 98 80 99 QualifiedName animatedPropertyAttributeName(const SVGAnimatedProperty& animatedProperty) const override 81 100 { -
trunk/Source/WebCore/svg/properties/SVGPropertyRegistry.h
r243036 r243130 38 38 39 39 virtual void detachAllProperties() const = 0; 40 virtual QualifiedName propertyAttributeName(const SVGProperty&) const = 0; 40 41 virtual QualifiedName animatedPropertyAttributeName(const SVGAnimatedProperty&) const = 0; 41 42 virtual Optional<String> synchronize(const QualifiedName&) const = 0;
Note: See TracChangeset
for help on using the changeset viewer.