[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
zimmermann at webkit.org
zimmermann at webkit.org
Wed Dec 22 15:28:36 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 20ce6365d452dfccd97ccc3712bda335e68e4e45
Author: zimmermann at webkit.org <zimmermann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Nov 4 13:06:54 2010 +0000
2010-11-04 Nikolas Zimmermann <nzimmermann at rim.com>
Reviewed by Andreas Kling.
Refactor SVGStringListPropertyTearOff/SVGListPropertyTearOff to use a common base class
https://bugs.webkit.org/show_bug.cgi?id=48990
Introduce SVGListProperty as common base class between static lists (SVGStringListPropertyTearOff) and dynamic lists (SVGListPropertyTearOff).
This is a preparation for the addition of the next static list type: SVGPointList.
* GNUmakefile.am: Add new files to build.
* WebCore.gypi: Ditto.
* WebCore.pro: Ditto.
* WebCore.vcproj/WebCore.vcproj: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* bindings/scripts/CodeGenerator.pm: s/SVGStringListPropertyTearOff/SVGStaticListPropertyTearOff/.
* bindings/scripts/CodeGeneratorJS.pm: Ditto.
* bindings/scripts/CodeGeneratorObjC.pm: Ditto.
* bindings/scripts/CodeGeneratorV8.pm: Ditto.
* svg/properties/SVGAnimatedListPropertyTearOff.h: Include SVGStaticListPropertyTearOff.h here, to avoid special dependencies in CodeGenerator*.pm
* svg/properties/SVGListProperty.h: Added.
* svg/properties/SVGListPropertyTearOff.h: Use SVGList API implementation from SVGListProperty base class.
* svg/properties/SVGStaticListPropertyTearOff.h: Added. Use SVGList API implementation from SVGListProperty base class.
* svg/properties/SVGStringListPropertyTearOff.h: Removed.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71329 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 096859e..1f31a93 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,28 @@
+2010-11-04 Nikolas Zimmermann <nzimmermann at rim.com>
+
+ Reviewed by Andreas Kling.
+
+ Refactor SVGStringListPropertyTearOff/SVGListPropertyTearOff to use a common base class
+ https://bugs.webkit.org/show_bug.cgi?id=48990
+
+ Introduce SVGListProperty as common base class between static lists (SVGStringListPropertyTearOff) and dynamic lists (SVGListPropertyTearOff).
+ This is a preparation for the addition of the next static list type: SVGPointList.
+
+ * GNUmakefile.am: Add new files to build.
+ * WebCore.gypi: Ditto.
+ * WebCore.pro: Ditto.
+ * WebCore.vcproj/WebCore.vcproj: Ditto.
+ * WebCore.xcodeproj/project.pbxproj: Ditto.
+ * bindings/scripts/CodeGenerator.pm: s/SVGStringListPropertyTearOff/SVGStaticListPropertyTearOff/.
+ * bindings/scripts/CodeGeneratorJS.pm: Ditto.
+ * bindings/scripts/CodeGeneratorObjC.pm: Ditto.
+ * bindings/scripts/CodeGeneratorV8.pm: Ditto.
+ * svg/properties/SVGAnimatedListPropertyTearOff.h: Include SVGStaticListPropertyTearOff.h here, to avoid special dependencies in CodeGenerator*.pm
+ * svg/properties/SVGListProperty.h: Added.
+ * svg/properties/SVGListPropertyTearOff.h: Use SVGList API implementation from SVGListProperty base class.
+ * svg/properties/SVGStaticListPropertyTearOff.h: Added. Use SVGList API implementation from SVGListProperty base class.
+ * svg/properties/SVGStringListPropertyTearOff.h: Removed.
+
2010-11-04 Ryosuke Niwa <rniwa at webkit.org>
Unreviewed. Fixed WebCore.xcodeproject
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 1134d89..e76fcb2 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -3037,11 +3037,12 @@ webcore_sources += \
WebCore/svg/properties/SVGAnimatedPropertySynchronizer.h \
WebCore/svg/properties/SVGAnimatedPropertyTearOff.h \
WebCore/svg/properties/SVGAnimatedStaticPropertyTearOff.h \
+ WebCore/svg/properties/SVGListProperty.h \
WebCore/svg/properties/SVGListPropertyTearOff.h \
WebCore/svg/properties/SVGProperty.h \
WebCore/svg/properties/SVGPropertyTearOff.h \
WebCore/svg/properties/SVGPropertyTraits.h \
- WebCore/svg/properties/SVGStringListPropertyTearOff.h \
+ WebCore/svg/properties/SVGStaticListPropertyTearOff.h \
WebCore/svg/RadialGradientAttributes.h \
WebCore/svg/SVGAElement.cpp \
WebCore/svg/SVGAElement.h \
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 90c363d..335c648 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -3961,11 +3961,12 @@
'svg/properties/SVGAnimatedPropertySynchronizer.h',
'svg/properties/SVGAnimatedPropertyTearOff.h',
'svg/properties/SVGAnimatedStaticPropertyTearOff.h',
+ 'svg/properties/SVGListProperty.h',
'svg/properties/SVGListPropertyTearOff.h',
'svg/properties/SVGProperty.h',
'svg/properties/SVGPropertyTearOff.h',
'svg/properties/SVGPropertyTraits.h',
- 'svg/properties/SVGStringListPropertyTearOff.h',
+ 'svg/properties/SVGStaticListPropertyTearOff.h',
'svg/ColorDistance.cpp',
'svg/ColorDistance.h',
'svg/DeprecatedSVGAnimatedProperty.h',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 21f32b6..8933072 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -2364,11 +2364,12 @@ HEADERS += \
svg/properties/SVGAnimatedPropertySynchronizer.h \
svg/properties/SVGAnimatedPropertyTearOff.h \
svg/properties/SVGAnimatedStaticPropertyTearOff.h \
+ svg/properties/SVGListProperty.h \
svg/properties/SVGListPropertyTearOff.h \
svg/properties/SVGProperty.h \
svg/properties/SVGPropertyTearOff.h \
svg/properties/SVGPropertyTraits.h \
- svg/properties/SVGStringListPropertyTearOff.h \
+ svg/properties/SVGStaticListPropertyTearOff.h \
svg/SVGAElement.h \
svg/SVGAltGlyphElement.h \
svg/SVGAngle.h \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index e1277f1..f362653 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -62735,6 +62735,10 @@
>
</File>
<File
+ RelativePath="..\svg\properties\SVGListProperty.h"
+ >
+ </File>
+ <File
RelativePath="..\svg\properties\SVGListPropertyTearOff.h"
>
</File>
@@ -62751,7 +62755,7 @@
>
</File>
<File
- RelativePath="..\svg\properties\SVGStringListPropertyTearOff.h"
+ RelativePath="..\svg\properties\SVGStaticListPropertyTearOff.h"
>
</File>
</Filter>
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 5611ce9..6a9e2f1 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -70,6 +70,7 @@
080E49281255F3BD00EFCA27 /* SVGTextLayoutEngineSpacing.h in Headers */ = {isa = PBXBuildFile; fileRef = 080E49241255F3BD00EFCA27 /* SVGTextLayoutEngineSpacing.h */; };
080FAE1A0EEEBDA800AACDE9 /* WMLTemplateElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 080FAE180EEEBDA800AACDE9 /* WMLTemplateElement.cpp */; };
080FAE1B0EEEBDA800AACDE9 /* WMLTemplateElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 080FAE190EEEBDA800AACDE9 /* WMLTemplateElement.h */; };
+ 0810764412828556007C63BA /* SVGListProperty.h in Headers */ = {isa = PBXBuildFile; fileRef = 0810764312828556007C63BA /* SVGListProperty.h */; settings = {ATTRIBUTES = (Private, ); }; };
081093DB1255F0E700ED9D29 /* SVGTextLayoutAttributesBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 081093D91255F0E700ED9D29 /* SVGTextLayoutAttributesBuilder.cpp */; };
081093DC1255F0E700ED9D29 /* SVGTextLayoutAttributesBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 081093DA1255F0E700ED9D29 /* SVGTextLayoutAttributesBuilder.h */; };
081668D3125603BF006F25DE /* SVGTextChunkBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 081668D1125603BF006F25DE /* SVGTextChunkBuilder.cpp */; };
@@ -172,6 +173,7 @@
08807B7F0ED709AB003F6975 /* WMLRefreshElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08807B730ED709AB003F6975 /* WMLRefreshElement.h */; };
08807B800ED709AB003F6975 /* WMLSetvarElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08807B740ED709AB003F6975 /* WMLSetvarElement.cpp */; };
08807B810ED709AB003F6975 /* WMLSetvarElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08807B750ED709AB003F6975 /* WMLSetvarElement.h */; };
+ 0880F70E1282B46D00948505 /* SVGStaticListPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 0880F70D1282B46D00948505 /* SVGStaticListPropertyTearOff.h */; settings = {ATTRIBUTES = (Private, ); }; };
08820BDE0EF5D381009099A8 /* WMLTableElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08820BDC0EF5D381009099A8 /* WMLTableElement.cpp */; };
08820BDF0EF5D381009099A8 /* WMLTableElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08820BDD0EF5D381009099A8 /* WMLTableElement.h */; };
088451150F267B63007F139E /* WMLInputElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 088451130F267B62007F139E /* WMLInputElement.cpp */; };
@@ -244,7 +246,6 @@
08E192530EDE0C3A0087B780 /* WMLErrorHandling.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08E192510EDE0C390087B780 /* WMLErrorHandling.cpp */; };
08E192540EDE0C3A0087B780 /* WMLErrorHandling.h in Headers */ = {isa = PBXBuildFile; fileRef = 08E192520EDE0C3A0087B780 /* WMLErrorHandling.h */; };
08E4FE460E2BD41400F4CAE0 /* JSSVGLengthCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08E4FE450E2BD41400F4CAE0 /* JSSVGLengthCustom.cpp */; };
- 08E58FF512801CF70045903D /* SVGStringListPropertyTearOff.h in Headers */ = {isa = PBXBuildFile; fileRef = 08E58FF412801CF70045903D /* SVGStringListPropertyTearOff.h */; settings = {ATTRIBUTES = (Private, ); }; };
08E6A2E80EEE035200AC1206 /* WMLPostfieldElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08E6A2E60EEE035200AC1206 /* WMLPostfieldElement.cpp */; };
08E6A2E90EEE035200AC1206 /* WMLPostfieldElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08E6A2E70EEE035200AC1206 /* WMLPostfieldElement.h */; };
08E6E0F10EFF42BA00029FBF /* WMLFieldSetElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08E6E0EF0EFF42BA00029FBF /* WMLFieldSetElement.cpp */; };
@@ -6106,6 +6107,7 @@
080E49241255F3BD00EFCA27 /* SVGTextLayoutEngineSpacing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTextLayoutEngineSpacing.h; sourceTree = "<group>"; };
080FAE180EEEBDA800AACDE9 /* WMLTemplateElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLTemplateElement.cpp; sourceTree = "<group>"; };
080FAE190EEEBDA800AACDE9 /* WMLTemplateElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLTemplateElement.h; sourceTree = "<group>"; };
+ 0810764312828556007C63BA /* SVGListProperty.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGListProperty.h; sourceTree = "<group>"; };
081093D91255F0E700ED9D29 /* SVGTextLayoutAttributesBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTextLayoutAttributesBuilder.cpp; sourceTree = "<group>"; };
081093DA1255F0E700ED9D29 /* SVGTextLayoutAttributesBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTextLayoutAttributesBuilder.h; sourceTree = "<group>"; };
081668D1125603BF006F25DE /* SVGTextChunkBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGTextChunkBuilder.cpp; sourceTree = "<group>"; };
@@ -6206,6 +6208,7 @@
08807B730ED709AB003F6975 /* WMLRefreshElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLRefreshElement.h; sourceTree = "<group>"; };
08807B740ED709AB003F6975 /* WMLSetvarElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLSetvarElement.cpp; sourceTree = "<group>"; };
08807B750ED709AB003F6975 /* WMLSetvarElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLSetvarElement.h; sourceTree = "<group>"; };
+ 0880F70D1282B46D00948505 /* SVGStaticListPropertyTearOff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGStaticListPropertyTearOff.h; sourceTree = "<group>"; };
08820BDC0EF5D381009099A8 /* WMLTableElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLTableElement.cpp; sourceTree = "<group>"; };
08820BDD0EF5D381009099A8 /* WMLTableElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLTableElement.h; sourceTree = "<group>"; };
088451130F267B62007F139E /* WMLInputElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLInputElement.cpp; sourceTree = "<group>"; };
@@ -6265,7 +6268,6 @@
08E192510EDE0C390087B780 /* WMLErrorHandling.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLErrorHandling.cpp; sourceTree = "<group>"; };
08E192520EDE0C3A0087B780 /* WMLErrorHandling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLErrorHandling.h; sourceTree = "<group>"; };
08E4FE450E2BD41400F4CAE0 /* JSSVGLengthCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGLengthCustom.cpp; sourceTree = "<group>"; };
- 08E58FF412801CF70045903D /* SVGStringListPropertyTearOff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGStringListPropertyTearOff.h; sourceTree = "<group>"; };
08E6A2E60EEE035200AC1206 /* WMLPostfieldElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLPostfieldElement.cpp; sourceTree = "<group>"; };
08E6A2E70EEE035200AC1206 /* WMLPostfieldElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLPostfieldElement.h; sourceTree = "<group>"; };
08E6E0EF0EFF42BA00029FBF /* WMLFieldSetElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLFieldSetElement.cpp; sourceTree = "<group>"; };
@@ -11773,11 +11775,12 @@
081CDFBE126ECFE800D215CA /* SVGAnimatedPropertySynchronizer.h */,
088A0DFF126EF1DB00978F7A /* SVGAnimatedPropertyTearOff.h */,
08525E621278C00100A84778 /* SVGAnimatedStaticPropertyTearOff.h */,
+ 0810764312828556007C63BA /* SVGListProperty.h */,
088A0E00126EF1DB00978F7A /* SVGListPropertyTearOff.h */,
088A0E01126EF1DB00978F7A /* SVGProperty.h */,
088A0E02126EF1DB00978F7A /* SVGPropertyTearOff.h */,
088A0E03126EF1DB00978F7A /* SVGPropertyTraits.h */,
- 08E58FF412801CF70045903D /* SVGStringListPropertyTearOff.h */,
+ 0880F70D1282B46D00948505 /* SVGStaticListPropertyTearOff.h */,
);
path = properties;
sourceTree = "<group>";
@@ -20945,6 +20948,7 @@
B2227A390D00BF220071B782 /* SVGLinearGradientElement.h in Headers */,
B2227A3C0D00BF220071B782 /* SVGLineElement.h in Headers */,
B2227A3E0D00BF220071B782 /* SVGList.h in Headers */,
+ 0810764412828556007C63BA /* SVGListProperty.h in Headers */,
088A0E09126EF1DB00978F7A /* SVGListPropertyTearOff.h in Headers */,
B2227A3F0D00BF220071B782 /* SVGListTraits.h in Headers */,
B2227A410D00BF220071B782 /* SVGLocatable.h in Headers */,
@@ -21009,9 +21013,9 @@
B2227AA60D00BF220071B782 /* SVGSetElement.h in Headers */,
08DAB9C31103D9C1003E7ABA /* SVGShadowTreeElements.h in Headers */,
E4AFD0100DAF335500F5F55C /* SVGSMILElement.h in Headers */,
+ 0880F70E1282B46D00948505 /* SVGStaticListPropertyTearOff.h in Headers */,
B2227AA90D00BF220071B782 /* SVGStopElement.h in Headers */,
B2227AAC0D00BF220071B782 /* SVGStringList.h in Headers */,
- 08E58FF512801CF70045903D /* SVGStringListPropertyTearOff.h in Headers */,
B2227AAF0D00BF220071B782 /* SVGStylable.h in Headers */,
B2227AB20D00BF220071B782 /* SVGStyledElement.h in Headers */,
B2227AB40D00BF220071B782 /* SVGStyledLocatableElement.h in Headers */,
diff --git a/WebCore/bindings/scripts/CodeGenerator.pm b/WebCore/bindings/scripts/CodeGenerator.pm
index 641261b..71c53a8 100644
--- a/WebCore/bindings/scripts/CodeGenerator.pm
+++ b/WebCore/bindings/scripts/CodeGenerator.pm
@@ -85,7 +85,7 @@ my %svgNativeType = (
"SVGNumberList" => "SVGListPropertyTearOff<SVGNumberList>",
"SVGPreserveAspectRatio" => "SVGPropertyTearOff<SVGPreserveAspectRatio>",
"SVGRect" => "SVGPropertyTearOff<FloatRect>",
- "SVGStringList" => "SVGStringListPropertyTearOff"
+ "SVGStringList" => "SVGStaticListPropertyTearOff<SVGStringList>"
);
# Cache of IDL file pathnames.
@@ -398,7 +398,10 @@ sub GetSVGWrappedTypeNeedingTearOff
$svgNativeType =~ s/SVGPropertyTearOff<//;
} elsif ($svgNativeType =~ /SVGListPropertyTearOff/) {
$svgNativeType =~ s/SVGListPropertyTearOff<//;
+ } elsif ($svgNativeType =~ /SVGStaticListPropertyTearOff/) {
+ $svgNativeType =~ s/SVGStaticListPropertyTearOff<//;
}
+
$svgNativeType =~ s/>//;
return $svgNativeType;
}
diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm
index 919bee9..673f098 100644
--- a/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -2502,13 +2502,10 @@ sub GetSVGPropertyTypes
$svgPropertyType = $svgWrappedNativeType;
$headerIncludes{"$svgWrappedNativeType.h"} = 1;
$headerIncludes{"SVGAnimatedPropertyTearOff.h"} = 1;
- } elsif ($svgNativeType =~ /SVGListPropertyTearOff/) {
+ } elsif ($svgNativeType =~ /SVGListPropertyTearOff/ or $svgNativeType =~ /SVGStaticListPropertyTearOff/) {
$svgListPropertyType = $svgWrappedNativeType;
$headerIncludes{"$svgWrappedNativeType.h"} = 1;
$headerIncludes{"SVGAnimatedListPropertyTearOff.h"} = 1;
- } elsif ($svgNativeType =~ /SVGStringListPropertyTearOff/) {
- $svgListPropertyType = "SVGStringList";
- $headerIncludes{"$svgWrappedNativeType.h"} = 1;
}
return ($svgPropertyType, $svgListPropertyType, $svgNativeType);
@@ -2683,11 +2680,11 @@ sub NativeToJSValue
$value = "static_cast<" . GetNativeType($type) . ">($value)";
} elsif ($codeGenerator->IsSVGTypeNeedingTearOff($type) and not $implClassName =~ /List$/) {
my $tearOffType = $codeGenerator->GetSVGTypeNeedingTearOff($type);
- if ($tearOffType eq "SVGStringListPropertyTearOff") {
+ if ($tearOffType =~ /SVGStaticListPropertyTearOff/) {
my $extraImp = "GetOwnerElementForType<$implClassName, IsDerivedFromSVGElement<$implClassName>::value>::ownerElement(imp), ";
- $value = $codeGenerator->GetSVGTypeNeedingTearOff($type) . "::create($extraImp$value)";
+ $value = "${tearOffType}::create($extraImp$value)";
} else {
- $value = $codeGenerator->GetSVGTypeNeedingTearOff($type) . "::create($value)";
+ $value = "${tearOffType}::create($value)";
}
}
diff --git a/WebCore/bindings/scripts/CodeGeneratorObjC.pm b/WebCore/bindings/scripts/CodeGeneratorObjC.pm
index eed8cf9..b8999b5 100644
--- a/WebCore/bindings/scripts/CodeGeneratorObjC.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorObjC.pm
@@ -687,11 +687,9 @@ sub GetSVGPropertyTypes
$svgPropertyType = "WebCore::$svgWrappedNativeType";
$svgPropertyType =~ s/</\<WebCore::/;
}
- } elsif ($svgNativeType =~ /SVGListPropertyTearOff/) {
+ } elsif ($svgNativeType =~ /SVGListPropertyTearOff/ or $svgNativeType =~ /SVGStaticListPropertyTearOff/) {
$svgListPropertyType = "WebCore::$svgWrappedNativeType";
$svgListPropertyType =~ s/</\<WebCore::/;
- } elsif ($svgNativeType =~ /SVGStringListPropertyTearOff/) {
- $svgListPropertyType = "WebCore::SVGStringList";
}
return ($svgPropertyType, $svgListPropertyType, $svgNativeType);
@@ -1026,13 +1024,7 @@ sub GenerateHeader
push(@internalHeaderContent, "\n#import <WebCore/$className.h>\n\n");
push(@internalHeaderContent, "#import <WebCore/SVGAnimatedPropertyTearOff.h>\n\n") if $svgPropertyType;
- if ($svgListPropertyType) {
- if ($svgListPropertyType eq "WebCore::SVGStringList") {
- push(@internalHeaderContent, "#import <WebCore/SVGStringListPropertyTearOff.h>\n\n");
- } else {
- push(@internalHeaderContent, "#import <WebCore/SVGAnimatedListPropertyTearOff.h>\n\n");
- }
- }
+ push(@internalHeaderContent, "#import <WebCore/SVGAnimatedListPropertyTearOff.h>\n\n") if $svgListPropertyType;
push(@internalHeaderContent, $interfaceAvailabilityVersionCheck) if length $interfaceAvailabilityVersion;
if ($interfaceName eq "Node") {
@@ -1327,7 +1319,7 @@ sub GenerateImplementation
} elsif (ConversionNeeded($attribute->signature->type)) {
if ($codeGenerator->IsSVGTypeNeedingTearOff($attribute->signature->type) and not $implClassName =~ /List$/) {
my $idlTypeWithNamespace = GetSVGTypeWithNamespace($attribute->signature->type);
- if ($idlTypeWithNamespace eq "WebCore::SVGStringListPropertyTearOff") {
+ if ($idlTypeWithNamespace =~ /SVGStaticListPropertyTearOff/) {
my $extraImp = "WebCore::GetOwnerElementForType<$implClassNameWithNamespace, WebCore::IsDerivedFromSVGElement<$implClassNameWithNamespace>::value>::ownerElement(IMPL), ";
$getterContentHead = "kit(WTF::getPtr(${idlTypeWithNamespace}::create($extraImp$getterContentHead";
} else {
diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm
index 70dfb01..e26bb49 100644
--- a/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -223,12 +223,9 @@ sub GetSVGPropertyTypes
if ($svgNativeType =~ /SVGPropertyTearOff/) {
$svgPropertyType = $svgWrappedNativeType;
$implIncludes{"SVGAnimatedPropertyTearOff.h"} = 1;
- } elsif ($svgNativeType =~ /SVGListPropertyTearOff/) {
+ } elsif ($svgNativeType =~ /SVGListPropertyTearOff/ or $svgNativeType =~ /SVGStaticListPropertyTearOff/) {
$svgListPropertyType = $svgWrappedNativeType;
$implIncludes{"SVGAnimatedListPropertyTearOff.h"} = 1;
- } elsif ($svgNativeType =~ /SVGStringListPropertyTearOff/) {
- $svgListPropertyType = "SVGStringList";
- $implIncludes{"$svgWrappedNativeType.h"} = 1;
}
return ($svgPropertyType, $svgListPropertyType, $svgNativeType);
@@ -275,8 +272,8 @@ sub GenerateHeader
push(@headerContent, "\ntemplate<typename PODType> class V8SVGPODTypeWrapper;\n") if $podType;
push(@headerContent, "\ntemplate<typename PropertyType> class SVGPropertyTearOff;\n") if $svgPropertyType;
if ($svgListPropertyType) {
- if ($svgListPropertyType eq "SVGStringList") {
- push(@headerContent, "\nclass SVGStringListPropertyTearOff;\n");
+ if ($svgListPropertyType =~ /SVGStaticListPropertyTearOff/) {
+ push(@headerContent, "\ntemplate<typename PropertyType> class SVGStaticListPropertyTearOff;\n");
} else {
push(@headerContent, "\ntemplate<typename PropertyType> class SVGListPropertyTearOff;\n");
}
@@ -752,7 +749,7 @@ END
}
} elsif ($svgNativeType) {
my $svgWrappedNativeType = $codeGenerator->GetSVGWrappedTypeNeedingTearOff($implClassName);
- if ($svgWrappedNativeType =~ /List$/ or $implClassName eq "SVGStringList") {
+ if ($svgWrappedNativeType =~ /List$/) {
push(@implContentDecls, <<END);
$svgNativeType* imp = V8${implClassName}::toNative(info.Holder());
END
@@ -931,8 +928,7 @@ END
} elsif ($codeGenerator->IsSVGTypeNeedingTearOff($attrType) and not $implClassName =~ /List$/) {
$implIncludes{"V8$attrType.h"} = 1;
my $tearOffType = $codeGenerator->GetSVGTypeNeedingTearOff($attrType);
- if ($tearOffType eq "SVGStringListPropertyTearOff") {
- $implIncludes{"SVGStringListPropertyTearOff.h"} = 1;
+ if ($tearOffType =~ /SVGStaticListPropertyTearOff/) {
my $extraImp = "GetOwnerElementForType<$implClassName, IsDerivedFromSVGElement<$implClassName>::value>::ownerElement(imp), ";
push(@implContentDecls, " return toV8(WTF::getPtr(${tearOffType}::create($extraImp$result)));\n");
} else {
diff --git a/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h b/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h
index c69e20a..0777b6a 100644
--- a/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h
+++ b/WebCore/svg/properties/SVGAnimatedListPropertyTearOff.h
@@ -23,6 +23,7 @@
#if ENABLE(SVG)
#include "SVGAnimatedProperty.h"
#include "SVGListPropertyTearOff.h"
+#include "SVGStaticListPropertyTearOff.h"
namespace WebCore {
diff --git a/WebCore/svg/properties/SVGListProperty.h b/WebCore/svg/properties/SVGListProperty.h
new file mode 100644
index 0000000..8cdbfd0
--- /dev/null
+++ b/WebCore/svg/properties/SVGListProperty.h
@@ -0,0 +1,413 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGListProperty_h
+#define SVGListProperty_h
+
+#if ENABLE(SVG)
+#include "ExceptionCode.h"
+#include "SVGAnimatedProperty.h"
+#include "SVGPropertyTearOff.h"
+#include "SVGPropertyTraits.h"
+
+namespace WebCore {
+
+template<typename PropertyType>
+class SVGAnimatedListPropertyTearOff;
+
+template<typename PropertyType>
+class SVGListProperty : public SVGProperty {
+public:
+ typedef SVGListProperty<PropertyType> Self;
+
+ typedef typename SVGPropertyTraits<PropertyType>::ListItemType ListItemType;
+ typedef SVGPropertyTearOff<ListItemType> ListItemTearOff;
+ typedef PassRefPtr<ListItemTearOff> PassListItemTearOff;
+ typedef SVGAnimatedListPropertyTearOff<PropertyType> AnimatedListPropertyTearOff;
+ typedef typename SVGAnimatedListPropertyTearOff<PropertyType>::ListWrapperCache ListWrapperCache;
+
+ bool canAlterList(ExceptionCode& ec) const
+ {
+ if (m_role == AnimValRole) {
+ ec = NO_MODIFICATION_ALLOWED_ERR;
+ return false;
+ }
+
+ return true;
+ }
+
+ // SVGList::clear()
+ void clearValues(PropertyType& values, ExceptionCode& ec)
+ {
+ if (!canAlterList(ec))
+ return;
+
+ values.clear();
+ commitChange();
+ }
+
+ void clearValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, ExceptionCode& ec)
+ {
+ ASSERT(animatedList);
+ if (!canAlterList(ec))
+ return;
+
+ animatedList->detachListWrappers(0);
+ animatedList->values().clear();
+ commitChange();
+ }
+
+ // SVGList::numberOfItems()
+ unsigned numberOfItemsValues(PropertyType& values) const
+ {
+ return values.size();
+ }
+
+ unsigned numberOfItemsValuesAndWrappers(AnimatedListPropertyTearOff* animatedList) const
+ {
+ ASSERT(animatedList);
+ return animatedList->values().size();
+ }
+
+ // SVGList::initialize()
+ ListItemType initializeValues(PropertyType& values, const ListItemType& newItem, ExceptionCode& ec)
+ {
+ if (!canAlterList(ec))
+ return ListItemType();
+
+ // Spec: If the inserted item is already in a list, it is removed from its previous list before it is inserted into this list.
+ processIncomingListItemValue(newItem, 0);
+
+ // Spec: Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter.
+ values.clear();
+ values.append(newItem);
+
+ commitChange();
+ return newItem;
+ }
+
+ PassListItemTearOff initializeValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, PassListItemTearOff passNewItem, ExceptionCode& ec)
+ {
+ ASSERT(animatedList);
+ if (!canAlterList(ec))
+ return 0;
+
+ // Not specified, but FF/Opera do it this way, and it's just sane.
+ if (!passNewItem) {
+ ec = TYPE_MISMATCH_ERR;
+ return 0;
+ }
+
+ PropertyType& values = animatedList->values();
+ ListWrapperCache& wrappers = animatedList->wrappers();
+
+ RefPtr<ListItemTearOff> newItem = passNewItem;
+ ASSERT(values.size() == wrappers.size());
+
+ // Spec: If the inserted item is already in a list, it is removed from its previous list before it is inserted into this list.
+ processIncomingListItemWrapper(newItem, 0);
+
+ // Spec: Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter.
+ animatedList->detachListWrappers(0);
+ values.clear();
+
+ values.append(newItem->propertyReference());
+ wrappers.append(newItem);
+
+ commitChange();
+ return newItem.release();
+ }
+
+ // SVGList::getItem()
+ bool canGetItem(PropertyType& values, unsigned index, ExceptionCode& ec)
+ {
+ if (index >= values.size()) {
+ ec = INDEX_SIZE_ERR;
+ return false;
+ }
+
+ return true;
+ }
+
+ ListItemType getItemValues(PropertyType& values, unsigned index, ExceptionCode& ec)
+ {
+ if (!canGetItem(values, index, ec))
+ return ListItemType();
+
+ // Spec: Returns the specified item from the list. The returned item is the item itself and not a copy.
+ return values.at(index);
+ }
+
+ PassListItemTearOff getItemValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, unsigned index, ExceptionCode& ec)
+ {
+ ASSERT(animatedList);
+ PropertyType& values = animatedList->values();
+ if (!canGetItem(values, index, ec))
+ return 0;
+
+ ListWrapperCache& wrappers = animatedList->wrappers();
+
+ // Spec: Returns the specified item from the list. The returned item is the item itself and not a copy.
+ // Any changes made to the item are immediately reflected in the list.
+ ASSERT(values.size() == wrappers.size());
+ RefPtr<ListItemTearOff> wrapper = wrappers.at(index);
+ if (!wrapper) {
+ // Create new wrapper, which is allowed to directly modify the item in the list, w/o copying and cache the wrapper in our map.
+ // It is also associated with our animated property, so it can notify the SVG Element which holds the SVGAnimated*List
+ // that it has been modified (and thus can call svgAttributeChanged(associatedAttributeName)).
+ wrapper = ListItemTearOff::create(animatedList, UndefinedRole, values.at(index));
+ wrappers.at(index) = wrapper;
+ }
+
+ return wrapper.release();
+ }
+
+ // SVGList::insertItemBefore()
+ ListItemType insertItemBeforeValues(PropertyType& values, const ListItemType& newItem, unsigned index, ExceptionCode& ec)
+ {
+ if (!canAlterList(ec))
+ return ListItemType();
+
+ // Spec: If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list.
+ if (index > values.size())
+ index = values.size();
+
+ // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
+ processIncomingListItemValue(newItem, &index);
+
+ // Spec: Inserts a new item into the list at the specified position. The index of the item before which the new item is to be
+ // inserted. The first item is number 0. If the index is equal to 0, then the new item is inserted at the front of the list.
+ values.insert(index, newItem);
+
+ commitChange();
+ return newItem;
+ }
+
+ PassListItemTearOff insertItemBeforeValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, PassListItemTearOff passNewItem, unsigned index, ExceptionCode& ec)
+ {
+ ASSERT(animatedList);
+ if (!canAlterList(ec))
+ return 0;
+
+ // Not specified, but FF/Opera do it this way, and it's just sane.
+ if (!passNewItem) {
+ ec = TYPE_MISMATCH_ERR;
+ return 0;
+ }
+
+ PropertyType& values = animatedList->values();
+ ListWrapperCache& wrappers = animatedList->wrappers();
+
+ // Spec: If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list.
+ if (index > values.size())
+ index = values.size();
+
+ RefPtr<ListItemTearOff> newItem = passNewItem;
+ ASSERT(values.size() == wrappers.size());
+
+ // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
+ processIncomingListItemWrapper(newItem, &index);
+
+ // Spec: Inserts a new item into the list at the specified position. The index of the item before which the new item is to be
+ // inserted. The first item is number 0. If the index is equal to 0, then the new item is inserted at the front of the list.
+ values.insert(index, newItem->propertyReference());
+
+ // Store new wrapper at position 'index', change its underlying value, so mutations of newItem, directly affect the item in the list.
+ wrappers.insert(index, newItem);
+
+ commitChange();
+ return newItem.release();
+ }
+
+ // SVGList::replaceItem()
+ bool canReplaceItem(PropertyType& values, unsigned index, ExceptionCode& ec)
+ {
+ if (!canAlterList(ec))
+ return false;
+
+ if (index >= values.size()) {
+ ec = INDEX_SIZE_ERR;
+ return false;
+ }
+
+ return true;
+ }
+
+ ListItemType replaceItemValues(PropertyType& values, const ListItemType& newItem, unsigned index, ExceptionCode& ec)
+ {
+ if (!canReplaceItem(values, index, ec))
+ return ListItemType();
+
+ // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
+ // Spec: If the item is already in this list, note that the index of the item to replace is before the removal of the item.
+ processIncomingListItemValue(newItem, &index);
+
+ // Update the value at the desired position 'index'.
+ values.at(index) = newItem;
+
+ commitChange();
+ return newItem;
+ }
+
+ PassListItemTearOff replaceItemValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, PassListItemTearOff passNewItem, unsigned index, ExceptionCode& ec)
+ {
+ ASSERT(animatedList);
+ PropertyType& values = animatedList->values();
+ if (!canReplaceItem(values, index, ec))
+ return 0;
+
+ // Not specified, but FF/Opera do it this way, and it's just sane.
+ if (!passNewItem) {
+ ec = TYPE_MISMATCH_ERR;
+ return 0;
+ }
+
+ ListWrapperCache& wrappers = animatedList->wrappers();
+ ASSERT(values.size() == wrappers.size());
+ RefPtr<ListItemTearOff> newItem = passNewItem;
+
+ // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
+ // Spec: If the item is already in this list, note that the index of the item to replace is before the removal of the item.
+ processIncomingListItemWrapper(newItem, &index);
+
+ // Detach the existing wrapper.
+ RefPtr<ListItemTearOff>& oldItem = wrappers.at(index);
+ if (oldItem)
+ oldItem->detachWrapper();
+
+ // Update the value and the wrapper at the desired position 'index'.
+ values.at(index) = newItem->propertyReference();
+ wrappers.at(index) = newItem;
+
+ commitChange();
+ return newItem.release();
+ }
+
+ // SVGList::removeItem()
+ bool canRemoveItem(PropertyType& values, unsigned index, ExceptionCode& ec)
+ {
+ if (!canAlterList(ec))
+ return false;
+
+ if (index >= values.size()) {
+ ec = INDEX_SIZE_ERR;
+ return false;
+ }
+
+ return true;
+ }
+
+ ListItemType removeItemValues(PropertyType& values, unsigned index, ExceptionCode& ec)
+ {
+ if (!canRemoveItem(values, index, ec))
+ return ListItemType();
+
+ ListItemType oldItem = values.at(index);
+ values.remove(index);
+
+ commitChange();
+ return oldItem;
+ }
+
+ PassListItemTearOff removeItemValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, unsigned index, ExceptionCode& ec)
+ {
+ ASSERT(animatedList);
+ PropertyType& values = animatedList->values();
+ if (!canRemoveItem(values, index, ec))
+ return 0;
+
+ ListWrapperCache& wrappers = animatedList->wrappers();
+ ASSERT(values.size() == wrappers.size());
+
+ // Detach the existing wrapper.
+ RefPtr<ListItemTearOff>& oldItem = wrappers.at(index);
+ if (oldItem) {
+ oldItem->detachWrapper();
+ wrappers.remove(index);
+ }
+
+ values.remove(index);
+
+ commitChange();
+ return oldItem.release();
+ }
+
+ // SVGList::appendItem()
+ ListItemType appendItemValues(PropertyType& values, const ListItemType& newItem, ExceptionCode& ec)
+ {
+ if (!canAlterList(ec))
+ return ListItemType();
+
+ // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
+ processIncomingListItemValue(newItem, 0);
+
+ // Append the value at the end of the list.
+ values.append(newItem);
+
+ commitChange();
+ return newItem;
+ }
+
+ PassListItemTearOff appendItemValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, PassListItemTearOff passNewItem, ExceptionCode& ec)
+ {
+ ASSERT(animatedList);
+ if (!canAlterList(ec))
+ return 0;
+
+ // Not specified, but FF/Opera do it this way, and it's just sane.
+ if (!passNewItem) {
+ ec = TYPE_MISMATCH_ERR;
+ return 0;
+ }
+
+ PropertyType& values = animatedList->values();
+ ListWrapperCache& wrappers = animatedList->wrappers();
+
+ RefPtr<ListItemTearOff> newItem = passNewItem;
+ ASSERT(values.size() == wrappers.size());
+
+ // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
+ processIncomingListItemWrapper(newItem, 0);
+
+ // Append the value and wrapper at the end of the list.
+ values.append(newItem->propertyReference());
+ wrappers.append(newItem);
+
+ commitChange();
+ return newItem.release();
+ }
+
+protected:
+ SVGListProperty(SVGPropertyRole role)
+ : m_role(role)
+ {
+ }
+
+ virtual void commitChange() = 0;
+ virtual void processIncomingListItemValue(const ListItemType& newItem, unsigned* indexToModify) = 0;
+ virtual void processIncomingListItemWrapper(RefPtr<ListItemTearOff>& newItem, unsigned* indexToModify) = 0;
+
+private:
+ SVGPropertyRole m_role;
+};
+
+}
+
+#endif // ENABLE(SVG)
+#endif // SVGListProperty_h
diff --git a/WebCore/svg/properties/SVGListPropertyTearOff.h b/WebCore/svg/properties/SVGListPropertyTearOff.h
index 2ba925c..56d626f 100644
--- a/WebCore/svg/properties/SVGListPropertyTearOff.h
+++ b/WebCore/svg/properties/SVGListPropertyTearOff.h
@@ -21,20 +21,14 @@
#define SVGListPropertyTearOff_h
#if ENABLE(SVG)
-#include "ExceptionCode.h"
-#include "SVGAnimatedProperty.h"
-#include "SVGPropertyTearOff.h"
-#include "SVGPropertyTraits.h"
+#include "SVGListProperty.h"
namespace WebCore {
template<typename PropertyType>
-class SVGAnimatedListPropertyTearOff;
-
-template<typename PropertyType>
-class SVGListPropertyTearOff : public SVGProperty {
+class SVGListPropertyTearOff : public SVGListProperty<PropertyType> {
public:
- typedef SVGListPropertyTearOff<PropertyType> Self;
+ typedef SVGListProperty<PropertyType> Base;
typedef typename SVGPropertyTraits<PropertyType>::ListItemType ListItemType;
typedef SVGPropertyTearOff<ListItemType> ListItemTearOff;
@@ -42,10 +36,10 @@ public:
typedef SVGAnimatedListPropertyTearOff<PropertyType> AnimatedListPropertyTearOff;
typedef typename SVGAnimatedListPropertyTearOff<PropertyType>::ListWrapperCache ListWrapperCache;
- static PassRefPtr<Self> create(AnimatedListPropertyTearOff* animatedProperty, SVGPropertyRole role)
+ static PassRefPtr<SVGListPropertyTearOff<PropertyType> > create(AnimatedListPropertyTearOff* animatedProperty, SVGPropertyRole role)
{
ASSERT(animatedProperty);
- return adoptRef(new Self(animatedProperty, role));
+ return adoptRef(new SVGListPropertyTearOff<PropertyType>(animatedProperty, role));
}
int removeItemFromList(ListItemTearOff* removeItem, bool shouldSynchronizeWrappers)
@@ -77,224 +71,52 @@ public:
// SVGList API
void clear(ExceptionCode& ec)
{
- if (m_role == AnimValRole) {
- ec = NO_MODIFICATION_ALLOWED_ERR;
- return;
- }
-
- m_animatedProperty->detachListWrappers(0);
- m_animatedProperty->values().clear();
+ Base::clearValuesAndWrappers(m_animatedProperty.get(), ec);
}
unsigned numberOfItems() const
{
- return m_animatedProperty->values().size();
+ return Base::numberOfItemsValuesAndWrappers(m_animatedProperty.get());
}
PassListItemTearOff initialize(PassListItemTearOff passNewItem, ExceptionCode& ec)
{
- if (m_role == AnimValRole) {
- ec = NO_MODIFICATION_ALLOWED_ERR;
- return 0;
- }
-
- // Not specified, but FF/Opera do it this way, and it's just sane.
- if (!passNewItem) {
- ec = TYPE_MISMATCH_ERR;
- return 0;
- }
-
- PropertyType& values = m_animatedProperty->values();
- ListWrapperCache& wrappers = m_animatedProperty->wrappers();
-
- RefPtr<ListItemTearOff> newItem = passNewItem;
- ASSERT(values.size() == wrappers.size());
-
- // Spec: If the inserted item is already in a list, it is removed from its previous list before it is inserted into this list.
- processIncomingListItem(newItem, 0);
-
- // Spec: Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter.
- m_animatedProperty->detachListWrappers(0);
- values.clear();
-
- values.append(newItem->propertyReference());
- wrappers.append(newItem);
-
- commitChange();
- return newItem.release();
+ return Base::initializeValuesAndWrappers(m_animatedProperty.get(), passNewItem, ec);
}
PassListItemTearOff getItem(unsigned index, ExceptionCode& ec)
{
- PropertyType& values = m_animatedProperty->values();
- if (index >= values.size()) {
- ec = INDEX_SIZE_ERR;
- return 0;
- }
-
- ListWrapperCache& wrappers = m_animatedProperty->wrappers();
-
- // Spec: Returns the specified item from the list. The returned item is the item itself and not a copy.
- // Any changes made to the item are immediately reflected in the list.
- ASSERT(values.size() == wrappers.size());
- RefPtr<ListItemTearOff> wrapper = wrappers.at(index);
- if (!wrapper) {
- // Create new wrapper, which is allowed to directly modify the item in the list, w/o copying and cache the wrapper in our map.
- // It is also associated with our animated property, so it can notify the SVG Element which holds the SVGAnimated*List
- // that it has been modified (and thus can call svgAttributeChanged(associatedAttributeName)).
- wrapper = ListItemTearOff::create(m_animatedProperty.get(), UndefinedRole, values.at(index));
- wrappers.at(index) = wrapper;
- }
-
- return wrapper.release();
+ return Base::getItemValuesAndWrappers(m_animatedProperty.get(), index, ec);
}
PassListItemTearOff insertItemBefore(PassListItemTearOff passNewItem, unsigned index, ExceptionCode& ec)
{
- if (m_role == AnimValRole) {
- ec = NO_MODIFICATION_ALLOWED_ERR;
- return 0;
- }
-
- // Not specified, but FF/Opera do it this way, and it's just sane.
- if (!passNewItem) {
- ec = TYPE_MISMATCH_ERR;
- return 0;
- }
-
- PropertyType& values = m_animatedProperty->values();
- ListWrapperCache& wrappers = m_animatedProperty->wrappers();
-
- // Spec: If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list.
- if (index > values.size())
- index = values.size();
-
- RefPtr<ListItemTearOff> newItem = passNewItem;
- ASSERT(values.size() == wrappers.size());
-
- // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
- processIncomingListItem(newItem, &index);
-
- // Spec: Inserts a new item into the list at the specified position. The index of the item before which the new item is to be
- // inserted. The first item is number 0. If the index is equal to 0, then the new item is inserted at the front of the list.
- values.insert(index, newItem->propertyReference());
-
- // Store new wrapper at position 'index', change its underlying value, so mutations of newItem, directly affect the item in the list.
- wrappers.insert(index, newItem);
-
- commitChange();
- return newItem.release();
+ return Base::insertItemBeforeValuesAndWrappers(m_animatedProperty.get(), passNewItem, index, ec);
}
PassListItemTearOff replaceItem(PassListItemTearOff passNewItem, unsigned index, ExceptionCode& ec)
{
- if (m_role == AnimValRole) {
- ec = NO_MODIFICATION_ALLOWED_ERR;
- return 0;
- }
-
- PropertyType& values = m_animatedProperty->values();
- if (index >= values.size()) {
- ec = INDEX_SIZE_ERR;
- return 0;
- }
-
- // Not specified, but FF/Opera do it this way, and it's just sane.
- if (!passNewItem) {
- ec = TYPE_MISMATCH_ERR;
- return 0;
- }
-
- ListWrapperCache& wrappers = m_animatedProperty->wrappers();
- ASSERT(values.size() == wrappers.size());
- RefPtr<ListItemTearOff> newItem = passNewItem;
-
- // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
- // Spec: If the item is already in this list, note that the index of the item to replace is before the removal of the item.
- processIncomingListItem(newItem, &index);
-
- // Detach the existing wrapper.
- RefPtr<ListItemTearOff>& oldItem = wrappers.at(index);
- if (oldItem)
- oldItem->detachWrapper();
-
- // Update the value and the wrapper at the desired position 'index'.
- values.at(index) = newItem->propertyReference();
- wrappers.at(index) = newItem;
-
- commitChange();
- return newItem.release();
+ return Base::replaceItemValuesAndWrappers(m_animatedProperty.get(), passNewItem, index, ec);
}
PassListItemTearOff removeItem(unsigned index, ExceptionCode& ec)
{
- if (m_role == AnimValRole) {
- ec = NO_MODIFICATION_ALLOWED_ERR;
- return 0;
- }
-
- PropertyType& values = m_animatedProperty->values();
- if (index >= values.size()) {
- ec = INDEX_SIZE_ERR;
- return 0;
- }
-
- ListWrapperCache& wrappers = m_animatedProperty->wrappers();
- ASSERT(values.size() == wrappers.size());
-
- // Detach the existing wrapper.
- RefPtr<ListItemTearOff>& oldItem = wrappers.at(index);
- if (oldItem) {
- oldItem->detachWrapper();
- wrappers.remove(index);
- }
-
- values.remove(index);
-
- commitChange();
- return oldItem.release();
+ return Base::removeItemValuesAndWrappers(m_animatedProperty.get(), index, ec);
}
PassListItemTearOff appendItem(PassListItemTearOff passNewItem, ExceptionCode& ec)
{
- if (m_role == AnimValRole) {
- ec = NO_MODIFICATION_ALLOWED_ERR;
- return 0;
- }
-
- // Not specified, but FF/Opera do it this way, and it's just sane.
- if (!passNewItem) {
- ec = TYPE_MISMATCH_ERR;
- return 0;
- }
-
- PropertyType& values = m_animatedProperty->values();
- ListWrapperCache& wrappers = m_animatedProperty->wrappers();
-
- RefPtr<ListItemTearOff> newItem = passNewItem;
- ASSERT(values.size() == wrappers.size());
-
- // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
- processIncomingListItem(newItem, 0);
-
- // Append the value and wrapper at the end of the list.
- values.append(newItem->propertyReference());
- wrappers.append(newItem);
-
- commitChange();
- return newItem.release();
+ return Base::appendItemValuesAndWrappers(m_animatedProperty.get(), passNewItem, ec);
}
private:
SVGListPropertyTearOff(AnimatedListPropertyTearOff* animatedProperty, SVGPropertyRole role)
- : m_animatedProperty(animatedProperty)
- , m_role(role)
+ : SVGListProperty<PropertyType>(role)
+ , m_animatedProperty(animatedProperty)
{
- ASSERT(animatedProperty);
- ASSERT(role != UndefinedRole);
}
- void commitChange()
+ virtual void commitChange()
{
PropertyType& values = m_animatedProperty->values();
ListWrapperCache& wrappers = m_animatedProperty->wrappers();
@@ -313,7 +135,12 @@ private:
m_animatedProperty->commitChange();
}
- void processIncomingListItem(RefPtr<ListItemTearOff>& newItem, unsigned* indexToModify)
+ virtual void processIncomingListItemValue(const ListItemType&, unsigned*)
+ {
+ ASSERT_NOT_REACHED();
+ }
+
+ virtual void processIncomingListItemWrapper(RefPtr<ListItemTearOff>& newItem, unsigned* indexToModify)
{
SVGAnimatedProperty* animatedPropertyOfItem = newItem->animatedProperty();
@@ -337,7 +164,7 @@ private:
// Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list.
// 'newItem' is already living in another list. If it's not our list, synchronize the other lists wrappers after the removal.
bool livesInOtherList = animatedPropertyOfItem != m_animatedProperty;
- int removedIndex = static_cast<SVGAnimatedListPropertyTearOff<PropertyType>*>(animatedPropertyOfItem)->removeItemFromList(newItem.get(), livesInOtherList);
+ int removedIndex = static_cast<AnimatedListPropertyTearOff*>(animatedPropertyOfItem)->removeItemFromList(newItem.get(), livesInOtherList);
ASSERT(removedIndex != -1);
if (!indexToModify)
@@ -356,9 +183,6 @@ private:
// Back pointer to the animated property that created us
// For example (text.x.baseVal): m_animatedProperty points to the 'x' SVGAnimatedLengthList object
RefPtr<AnimatedListPropertyTearOff> m_animatedProperty;
-
- // The role of this property (baseVal or animVal)
- SVGPropertyRole m_role;
};
}
diff --git a/WebCore/svg/properties/SVGStaticListPropertyTearOff.h b/WebCore/svg/properties/SVGStaticListPropertyTearOff.h
new file mode 100644
index 0000000..a6f0f28
--- /dev/null
+++ b/WebCore/svg/properties/SVGStaticListPropertyTearOff.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) Research In Motion Limited 2010. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef SVGStaticListPropertyTearOff_h
+#define SVGStaticListPropertyTearOff_h
+
+#if ENABLE(SVG)
+#include "SVGListProperty.h"
+
+namespace WebCore {
+
+template<typename PropertyType>
+class SVGStaticListPropertyTearOff : public SVGListProperty<PropertyType> {
+public:
+ typedef SVGListProperty<PropertyType> Base;
+
+ typedef typename SVGPropertyTraits<PropertyType>::ListItemType ListItemType;
+ typedef SVGPropertyTearOff<ListItemType> ListItemTearOff;
+
+ static PassRefPtr<SVGStaticListPropertyTearOff<PropertyType> > create(SVGElement* contextElement, PropertyType& values)
+ {
+ ASSERT(contextElement);
+ return adoptRef(new SVGStaticListPropertyTearOff<PropertyType>(contextElement, values));
+ }
+
+ // SVGList API
+ void clear(ExceptionCode& ec)
+ {
+ Base::clearValues(m_values, ec);
+ }
+
+ unsigned numberOfItems() const
+ {
+ return Base::numberOfItemsValues(m_values);
+ }
+
+ ListItemType initialize(const ListItemType& newItem, ExceptionCode& ec)
+ {
+ return Base::initializeValues(m_values, newItem, ec);
+ }
+
+ ListItemType getItem(unsigned index, ExceptionCode& ec)
+ {
+ return Base::getItemValues(m_values, index, ec);
+ }
+
+ ListItemType insertItemBefore(const ListItemType& newItem, unsigned index, ExceptionCode& ec)
+ {
+ return Base::insertItemBeforeValues(m_values, newItem, index, ec);
+ }
+
+ ListItemType replaceItem(const ListItemType& newItem, unsigned index, ExceptionCode& ec)
+ {
+ return Base::replaceItemValues(m_values, newItem, index, ec);
+ }
+
+ ListItemType removeItem(unsigned index, ExceptionCode& ec)
+ {
+ return Base::removeItemValues(m_values, index, ec);
+ }
+
+ ListItemType appendItem(const ListItemType& newItem, ExceptionCode& ec)
+ {
+ return Base::appendItemValues(m_values, newItem, ec);
+ }
+
+private:
+ SVGStaticListPropertyTearOff(SVGElement* contextElement, PropertyType& values)
+ : SVGListProperty<PropertyType>(UndefinedRole)
+ , m_contextElement(contextElement)
+ , m_values(values)
+ {
+ }
+
+ virtual void commitChange()
+ {
+ m_values.commitChange(m_contextElement.get());
+ }
+
+ virtual void processIncomingListItemValue(const ListItemType&, unsigned*)
+ {
+ // no-op for static lists
+ }
+
+ virtual void processIncomingListItemWrapper(RefPtr<ListItemTearOff>&, unsigned*)
+ {
+ ASSERT_NOT_REACHED();
+ }
+
+private:
+ RefPtr<SVGElement> m_contextElement;
+ PropertyType& m_values;
+};
+
+}
+
+#endif // ENABLE(SVG)
+#endif // SVGStaticListPropertyTearOff_h
diff --git a/WebCore/svg/properties/SVGStringListPropertyTearOff.h b/WebCore/svg/properties/SVGStringListPropertyTearOff.h
deleted file mode 100644
index 10fa65d..0000000
--- a/WebCore/svg/properties/SVGStringListPropertyTearOff.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) Research In Motion Limited 2010. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef SVGStringListPropertyTearOff_h
-#define SVGStringListPropertyTearOff_h
-
-#if ENABLE(SVG)
-#include "ExceptionCode.h"
-#include "SVGProperty.h"
-#include "SVGStringList.h"
-
-namespace WebCore {
-
-// Used for lists that return non-modifyable values: SVGStringList.
-class SVGStringListPropertyTearOff : public SVGProperty {
-public:
- static PassRefPtr<SVGStringListPropertyTearOff> create(SVGElement* contextElement, SVGStringList& values)
- {
- return adoptRef(new SVGStringListPropertyTearOff(contextElement, values));
- }
-
- // SVGList API
- void clear(ExceptionCode&)
- {
- m_values.clear();
- }
-
- unsigned numberOfItems() const
- {
- return m_values.size();
- }
-
- String initialize(const String& newItem, ExceptionCode&)
- {
- // Spec: Clears all existing current items from the list and re-initializes the list to hold the single item specified by the parameter.
- m_values.clear();
- m_values.append(newItem);
-
- m_values.commitChange(m_contextElement.get());
- return newItem;
- }
-
- String getItem(unsigned index, ExceptionCode& ec)
- {
- if (index >= m_values.size()) {
- ec = INDEX_SIZE_ERR;
- return String();
- }
-
- return m_values.at(index);
- }
-
- String insertItemBefore(const String& newItem, unsigned index, ExceptionCode&)
- {
- // Spec: If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list.
- if (index > m_values.size())
- index = m_values.size();
-
- // Spec: Inserts a new item into the list at the specified position. The index of the item before which the new item is to be
- // inserted. The first item is number 0. If the index is equal to 0, then the new item is inserted at the front of the list.
- m_values.insert(index, newItem);
-
- m_values.commitChange(m_contextElement.get());
- return newItem;
- }
-
- String replaceItem(const String& newItem, unsigned index, ExceptionCode& ec)
- {
- if (index >= m_values.size()) {
- ec = INDEX_SIZE_ERR;
- return String();
- }
-
- // Update the value and the wrapper at the desired position 'index'.
- m_values.at(index) = newItem;
-
- m_values.commitChange(m_contextElement.get());
- return newItem;
- }
-
- String removeItem(unsigned index, ExceptionCode& ec)
- {
- if (index >= m_values.size()) {
- ec = INDEX_SIZE_ERR;
- return String();
- }
-
- String oldItem = m_values.at(index);
- m_values.remove(index);
-
- m_values.commitChange(m_contextElement.get());
- return oldItem;
- }
-
- String appendItem(const String& newItem, ExceptionCode&)
- {
- // Append the value and wrapper at the end of the list.
- m_values.append(newItem);
-
- m_values.commitChange(m_contextElement.get());
- return newItem;
- }
-
-private:
- SVGStringListPropertyTearOff(SVGElement* contextElement, SVGStringList& values)
- : m_contextElement(contextElement)
- , m_values(values)
- {
- ASSERT(m_contextElement);
- }
-
-private:
- RefPtr<SVGElement> m_contextElement;
- SVGStringList& m_values;
-};
-
-}
-
-#endif // ENABLE(SVG)
-#endif // SVGStringListPropertyTearOff_h
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list