+2008-07-16 Nikolas Zimmermann <zimmermann@kde.org>
+
+ Reviewed by Sam.
+
+ Fixes: https://bugs.webkit.org/show_bug.cgi?id=20052
+ Prepare SVGAnimatedProperty introduction.
+
+ Export the tag & attribute names as string literals for SVGNames/XLinkNames and one property in HTMLNames. SVGAnimatedProperty
+ contains two string literal template parameters, and we're using these exported string literals from {SVG,HTML,XLink}Names as input paramters.
+ See https://bugs.webkit.org/show_bug.cgi?id=20051 for details.
+
+ * dom/make_names.pl: Handle new params "exportString" / "exportStrings".
+ * html/HTMLAttributeNames.in: Expose just the single "class" attribute, as string.
+ * svg/svgattrs.in: Export all SVG attributes as strings.
+ * svg/svgtags.in: Export all SVG tags as strings.
+ * svg/xlinkattrs.in: Expose all XLink attributes as strings.
+
2008-07-16 Nikolas Zimmermann <zimmermann@kde.org>
Reviewed by Eric.
sub initializeTagPropertyHash
{
return ('upperCase' => upperCaseName($_[0]),
- 'applyAudioHack' => 0);
+ 'applyAudioHack' => 0,
+ 'exportString' => 0);
}
sub initializeAttrPropertyHash
{
- return ('upperCase' => upperCaseName($_[0]));
+ return ('upperCase' => upperCaseName($_[0]),
+ 'exportString' => 0);
}
sub initializeParametersHash
'generateWrapperFactory' => 0,
# The 2 nullNamespace properties are generated from the "nullNamespace" attribute with respect to the file parsed (attrs or tags).
'tagsNullNamespace' => 0,
- 'attrsNullNamespace' => 0);
+ 'attrsNullNamespace' => 0,
+ 'exportStrings' => 0);
}
### Parsing handlers
sub printMacros
{
my ($F, $macro, $suffix, $namesRef) = @_;
+ my %names = %$namesRef;
+
for my $name (sort keys %$namesRef) {
- print F " $macro $name","$suffix;\n";
+ print F "$macro $name","$suffix;\n";
+
+ if ($parameters{'exportStrings'} or $names{$name}{"exportString"}) {
+ print F "extern char $name", "${suffix}String[];\n";
+ }
}
}
print F " *size = ", scalar(keys %tags), ";\n";
print F " return $parameters{'namespace'}Tags;\n";
print F "}\n";
-
}
if (keys %attrs) {
print F "}\n";
}
+ if (keys %tags) {
+ printDefinitionStrings($F, \%tags, "tags");
+ }
+
+ if (keys %attrs) {
+ printDefinitionStrings($F, \%attrs, "attributes");
+ }
+
print F "\nvoid init()
{
static bool initialized = false;
}
}
+sub printDefinitionStrings
+{
+ my ($F, $namesRef, $type) = @_;
+ my $singularType = substr($type, 0, -1);
+ my $shortType = substr($singularType, 0, 4);
+ my $shortCamelType = ucfirst($shortType);
+ print F "\n// " . ucfirst($type) . " as strings\n";
+
+ my %names = %$namesRef;
+ for my $name (sort keys %$namesRef) {
+ next if (!$parameters{'exportStrings'} and !$names{$name}{"exportString"});
+
+ my $realName = $name;
+ $realName =~ s/_/-/g;
+
+ print F "char $name","${shortCamelType}String[] = \"$realName\";\n";
+ }
+}
+
sub printDefinitions
{
my ($F, $namesRef, $type, $namespaceURI) = @_;
print F " // " . ucfirst($type) . "\n";
+ my %names = %$namesRef;
for my $name (sort keys %$namesRef) {
- print F " const char *$name","${shortCamelType}String = \"$name\";\n";
- }
-
- for my $name (sort keys %$namesRef) {
- if ($name =~ /_/) {
- my $realName = $name;
- $realName =~ s/_/-/g;
- print F " ${name}${shortCamelType}String = \"$realName\";\n";
- }
+ next if ($parameters{'exportStrings'} or $names{$name}{"exportString"});
+
+ my $realName = $name;
+ $realName =~ s/_/-/g;
+ print F " const char *$name","${shortCamelType}String = \"$realName\";\n\n";
}
- print F "\n";
for my $name (sort keys %$namesRef) {
print F " new ((void*)&$name","${shortCamelType}) QualifiedName(nullAtom, $name","${shortCamelType}String, $namespaceURI);\n";
}
-
}
## ElementFactory routines