WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Initial patch
ExposeString.diff (text/plain), 6.64 KB, created by
Nikolas Zimmermann
on 2008-07-16 05:25:40 PDT
(
hide
)
Description:
Initial patch
Filename:
MIME Type:
Creator:
Nikolas Zimmermann
Created:
2008-07-16 05:25:40 PDT
Size:
6.64 KB
patch
obsolete
>Index: ChangeLog >=================================================================== >--- ChangeLog (revision 35198) >+++ ChangeLog (working copy) >@@ -1,3 +1,18 @@ >+2008-07-16 Nikolas Zimmermann <zimmermann@kde.org> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Prepare SVGAnimatedProperty introduction. >+ Allow to export the tag & attribute names as string literals. SVGAnimatedProperty contains two string literal >+ template parameters, and we're using these exported string literals from SVGNames 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-15 Maxime Britto <britto@apple.com> > > Reviewed by Eric. >Index: dom/make_names.pl >=================================================================== >--- dom/make_names.pl (revision 35198) >+++ dom/make_names.pl (working copy) >@@ -86,12 +86,14 @@ if ($parameters{'generateWrapperFactory' > 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 >@@ -105,7 +107,8 @@ 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 >@@ -224,8 +227,14 @@ sub readNames > 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 const char $name", "${suffix}String[];\n"; >+ } > } > } > >@@ -394,7 +403,6 @@ DEFINE_GLOBAL(AtomicString, ${lowerNames > print F " *size = ", scalar(keys %tags), ";\n"; > print F " return $parameters{'namespace'}Tags;\n"; > print F "}\n"; >- > } > > if (keys %attrs) { >@@ -413,6 +421,14 @@ DEFINE_GLOBAL(AtomicString, ${lowerNames > 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; >@@ -466,6 +482,25 @@ sub printElementIncludes > } > } > >+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 "extern const char $name","${shortCamelType}String[] = \"$realName\";\n"; >+ } >+} >+ > sub printDefinitions > { > my ($F, $namesRef, $type, $namespaceURI) = @_; >@@ -476,23 +511,18 @@ sub printDefinitions > > 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 >Index: html/HTMLAttributeNames.in >=================================================================== >--- html/HTMLAttributeNames.in (revision 35198) >+++ html/HTMLAttributeNames.in (working copy) >@@ -38,7 +38,7 @@ > <checked/> > <cellborder/> > <cite/> >-<class/> >+<class exportString="1"/> > <classid/> > <clear/> > <code/> >Index: svg/svgattrs.in >=================================================================== >--- svg/svgattrs.in (revision 35198) >+++ svg/svgattrs.in (working copy) >@@ -1,4 +1,4 @@ >-<attrs namespace="SVG" cppNamespace="WebCore" namespaceURI="http://www.w3.org/2000/svg" generateFactory="1" generateWrapperFactory="1" guardFactoryWith="ENABLE(SVG)" nullNamespace="1"> >+<attrs namespace="SVG" cppNamespace="WebCore" namespaceURI="http://www.w3.org/2000/svg" generateFactory="1" generateWrapperFactory="1" guardFactoryWith="ENABLE(SVG)" nullNamespace="1" exportStrings="1"> > <accent-height/> > <accumulate/> > <additive/> >Index: svg/svgtags.in >=================================================================== >--- svg/svgtags.in (revision 35198) >+++ svg/svgtags.in (working copy) >@@ -1,4 +1,4 @@ >-<tags namespace="SVG" cppNamespace="WebCore" namespaceURI="http://www.w3.org/2000/svg" generateFactory="1" generateWrapperFactory="1" guardFactoryWith="ENABLE(SVG)"> >+<tags namespace="SVG" cppNamespace="WebCore" namespaceURI="http://www.w3.org/2000/svg" generateFactory="1" generateWrapperFactory="1" guardFactoryWith="ENABLE(SVG)" exportStrings="1"> > <a/> > #if ENABLE_SVG_FONTS > <altGlyph/> >Index: svg/xlinkattrs.in >=================================================================== >--- svg/xlinkattrs.in (revision 35198) >+++ svg/xlinkattrs.in (working copy) >@@ -1,4 +1,4 @@ >-<attrs namespace="XLink" cppNamespace="WebCore" namespaceURI="http://www.w3.org/1999/xlink"> >+<attrs namespace="XLink" cppNamespace="WebCore" namespaceURI="http://www.w3.org/1999/xlink" exportStrings="1"> > <actuate/> > <arcrole/> > <href/>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
sam
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 20052
: 22305