Changeset 17783 in webkit
- Timestamp:
- Nov 15, 2006 10:19:37 AM (17 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r17782 r17783 1 2006-11-13 Lou Amadio <lamadio@apple.com> 2 3 Reviewed by Darin Adler, Maciej Stachowiak 4 5 Cleanup: Expanded macros in generated files 6 7 * html/HTMLElement.cpp: 8 (WebCore::HTMLElement::isRecognizedTagName): 9 * ksvg2/scripts/make_names.pl: 10 1 11 2006-11-15 Anders Carlsson <acarlsson@apple.com> 2 12 -
trunk/WebCore/html/HTMLElement.cpp
r15643 r17783 717 717 static HashSet<AtomicStringImpl*> tagList; 718 718 if (tagList.isEmpty()) { 719 #define ADD_TAG(name) tagList.add(name##Tag.localName().impl());720 DOM_HTMLNAMES_FOR_EACH_TAG(ADD_TAG)719 for (size_t i = 0; i < g_xhtmlTagsCount; i++) 720 tagList.add(g_xhtmlTags[i]->localName().impl()); 721 721 } 722 722 return tagList.contains(tagName.localName().impl()); -
trunk/WebCore/ksvg2/scripts/make_names.pl
r17529 r17783 100 100 sub printMacros 101 101 { 102 my @names= @_;102 my ($macro, $suffix, @names) = @_; 103 103 for my $name (@names) { 104 print " macro($name) \\\n";104 print " $macro $name","$suffix;\n"; 105 105 } 106 106 } … … 205 205 print "namespace $cppNamespace { namespace ${namespace}Names {\n\n"; 206 206 207 if (scalar(@tags)) {208 print"#define DOM_${namespace}NAMES_FOR_EACH_TAG(macro) \\\n";209 printMacros(@tags);210 print"// end of macro\n\n";211 }212 if (scalar(@attrs)) {213 print "#define DOM_${namespace}NAMES_FOR_EACH_ATTR(macro) \\\n";214 printMacros(@attrs);215 print "// end of macro\n\n";216 }217 218 207 my $lowerNamespace = lc($namespacePrefix); 219 208 print "#ifndef DOM_${namespace}NAMES_HIDE_GLOBALS\n"; … … 223 212 if (scalar(@tags)) { 224 213 print "// Tags\n"; 225 print "#define DOM_NAMES_DEFINE_TAG_GLOBAL(name) extern const WebCore::QualifiedName name##Tag;\n";226 print " DOM_${namespace}NAMES_FOR_EACH_TAG(DOM_NAMES_DEFINE_TAG_GLOBAL)\n";227 print " #undef DOM_NAMES_DEFINE_TAG_GLOBAL\n\n";214 printMacros("extern const WebCore::QualifiedName", "Tag", @tags); 215 print "\nextern const WebCore::QualifiedName* g_${lowerNamespace}Tags[];\n"; 216 print "extern const size_t g_${lowerNamespace}TagsCount;\n\n"; 228 217 } 229 218 230 219 if (scalar(@attrs)) { 231 220 print "// Attributes\n"; 232 print "#define DOM_NAMES_DEFINE_ATTR_GLOBAL(name) extern const WebCore::QualifiedName name##Attr;\n";233 print " DOM_${namespace}NAMES_FOR_EACH_ATTR(DOM_NAMES_DEFINE_ATTR_GLOBAL)\n";234 print " #undef DOM_NAMES_DEFINE_ATTR_GLOBAL\n\n";221 printMacros("extern const WebCore::QualifiedName", "Attr", @attrs); 222 print "\nextern const WebCore::QualifiedName* g_${lowerNamespace}Attr[];\n"; 223 print "extern const size_t g_${lowerNamespace}AttrCount;\n\n"; 235 224 } 236 225 print "#endif\n\n"; … … 259 248 print "#endif\n\n"; 260 249 250 261 251 print "#include \"${namespace}Names.h\"\n\n"; 262 252 print "#include \"StaticConstructors.h\"\n"; … … 270 260 271 261 if (scalar(@tags)) { 272 print "#define DEFINE_TAG_GLOBAL(name) DEFINE_GLOBAL(QualifiedName, name##Tag, nullAtom, #name, ${lowerNamespace}NamespaceURI)\n"; 273 print "DOM_${namespace}NAMES_FOR_EACH_TAG(DEFINE_TAG_GLOBAL)\n\n"; 262 print "// Tags\n"; 263 for my $name (@tags) { 264 print "DEFINE_GLOBAL(QualifiedName, ", $name, "Tag, nullAtom, \"$name\", ${lowerNamespace}NamespaceURI);\n"; 265 } 266 print "\nconst WebCore::QualifiedName* g_${lowerNamespace}Tags[] = {\n"; 267 for my $name (@tags) { 268 print " &${name}Tag,\n"; 269 } 270 print "};\n"; 271 print "const size_t g_${lowerNamespace}TagsCount = ", scalar(@tags), ";\n\n"; 274 272 } 275 273 276 274 if (scalar(@attrs)) { 277 print "#define DEFINE_ATTR_GLOBAL(name) DEFINE_GLOBAL(QualifiedName, name##Attr, nullAtom, #name, nullAtom)\n"; 278 print "DOM_${namespace}NAMES_FOR_EACH_ATTR(DEFINE_ATTR_GLOBAL)\n\n"; 279 } 280 281 print "void init() 275 print "\n// Attributes\n"; 276 for my $name (@attrs) { 277 print "DEFINE_GLOBAL(QualifiedName, ", $name, "Attr, nullAtom, \"$name\", ${lowerNamespace}NamespaceURI);\n"; 278 } 279 print "\nconst WebCore::QualifiedName* g_${lowerNamespace}Attr[] = {\n"; 280 for my $name (@attrs) { 281 print " &${name}Attr,\n"; 282 } 283 print "};\n"; 284 print "const size_t g_${lowerNamespace}AttrCount = ", scalar(@attrs), ";\n\n"; 285 } 286 287 print "\nvoid init() 282 288 { 283 289 static bool initialized = false; … … 326 332 327 333 print " // " . ucfirst($type) . "\n"; 328 print " #define DEFINE_${shortUpperType}_STRING(name) const char *name##${shortCamelType}String = #name;\n"; 329 print " DOM_${namespace}NAMES_FOR_EACH_${shortUpperType}(DEFINE_${shortUpperType}_STRING)\n\n"; 334 335 for my $name (@$namesRef) { 336 print " const char *$name","${shortCamelType}String = \"$name\";\n"; 337 } 338 330 339 for my $name (@$namesRef) { 331 340 if ($name =~ /_/) { … … 335 344 } 336 345 } 337 print "\n #define INITIALIZE_${shortUpperType}_GLOBAL(name) new ((void*)&name##${shortCamelType}) QualifiedName(nullAtom, name##${shortCamelType}String, $namespaceURI);\n"; 338 print " DOM_${namespace}NAMES_FOR_EACH_${shortUpperType}(INITIALIZE_${shortUpperType}_GLOBAL)\n\n"; 346 print "\n"; 347 348 for my $name (@$namesRef) { 349 print " new ((void*)&$name","${shortCamelType}) QualifiedName(nullAtom, $name","${shortCamelType}String, $namespaceURI);\n"; 350 } 351 339 352 } 340 353
Note: See TracChangeset
for help on using the changeset viewer.