Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename WebCore::findHTMLTag to findTag and extend it to find SVG and MathML tags #3395

Closed
wants to merge 1 commit into from

Conversation

heycam
Copy link
Contributor

@heycam heycam commented Aug 17, 2022

fdf12c1

Rename WebCore::findHTMLTag to findTag and extend it to find SVG and MathML tags
https://bugs.webkit.org/show_bug.cgi?id=244020
rdar://problem/98767683

Reviewed by NOBODY (OOPS!).

We currently generate the WebCore::findHTMLTag function and use this in the
AtomHTMLToken constructor. We can extend this to look for any known tag name
(HTML, SVG, or MathML) by reworking make-names.pl a bit.

This isn't helpful for Speedometer performance, since parsing non-HTML tags is
rare, but local testing shows it to be a neutral change. Handling all known tag
names will set the stage for a later patch that does improve Speedometer
performance.

We generate a new pair of files, KnownTag.h and KnownTag.cpp, move the
old findHTMLTag function there, and rename it to findTag.

* Source/WebCore/CMakeLists.txt:
* Source/WebCore/DerivedSources-output.xcfilelist:
* Source/WebCore/DerivedSources.make:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/WebCoreMacros.cmake:

Build system changes to invoke make_names.pl to generate
KnownTag.{h,cpp}.

* Source/WebCore/dom/make_names.pl:
(readKnownTags):

Read a list of tag name files. Any duplicate tag name found in a
subsequent file is ignored (e.g. the SVG script tag will be ignored if
the HTML tag name file is parsed first). Since the %parameters hash
doesn't make much sense when parsing multiple files, it's cleared out
by the end of the function, but the namespace for each tag (which comes
from the parameters object) is recorded on the tag object.

(printNamesHeaderFile):
(printNamesCppFile):

Remove the findHTMLTag generation from generated HTMLNames.{h,cpp} etc.

(printKnownTagsHeaderFile):
(printKnownTagsCppFile):

Generated findTag in KnownTag.{h,cpp}. Use the namespace stored on the
tag object to decide the QualifiedName on which to look up the local
name.

(findMaxTagLength): Just refer to the global %allTags variable, like other
functions do.

(tagsWithLength): Simplify.

(generateFindTagForLength): We need to replace "_"s with "-"s when generating
the big switch statement, since the tag names it's operating on have already
been converted into identifiers.

* Source/WebCore/html/parser/AtomHTMLToken.h:
(WebCore::AtomHTMLToken::AtomHTMLToken):

Call the new findTag function.

fdf12c1

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  πŸ§ͺ win
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-debug βœ… πŸ›  gtk βœ… πŸ›  wincairo
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ gtk-wk2
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ api-mac βœ… πŸ§ͺ api-gtk
βœ… πŸ›  tv βœ… πŸ§ͺ mac-wk1
βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-wk2
βœ… πŸ›  watch βœ… πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  watch-sim βœ… πŸ§ͺ mac-wk2-stress

@heycam heycam self-assigned this Aug 17, 2022
@heycam heycam added DOM For bugs specific to XML/HTML DOM elements (including parsing). WebKit Nightly Build labels Aug 17, 2022
@heycam
Copy link
Contributor Author

heycam commented Aug 17, 2022

Not sure if I've got the cmake changes right. Let's see what the bots say.

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Aug 17, 2022
@heycam heycam removed the merging-blocked Applied to prevent a change from being merged label Aug 17, 2022
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Aug 17, 2022
…MathML tags

https://bugs.webkit.org/show_bug.cgi?id=244020
rdar://problem/98767683

Reviewed by NOBODY (OOPS!).

We currently generate the WebCore::findHTMLTag function and use this in the
AtomHTMLToken constructor. We can extend this to look for any known tag name
(HTML, SVG, or MathML) by reworking make-names.pl a bit.

This isn't helpful for Speedometer performance, since parsing non-HTML tags is
rare, but local testing shows it to be a neutral change. Handling all known tag
names will set the stage for a later patch that does improve Speedometer
performance.

We generate a new pair of files, KnownTag.h and KnownTag.cpp, move the
old findHTMLTag function there, and rename it to findTag.

* Source/WebCore/CMakeLists.txt:
* Source/WebCore/DerivedSources-output.xcfilelist:
* Source/WebCore/DerivedSources.make:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/WebCoreMacros.cmake:

Build system changes to invoke make_names.pl to generate
KnownTag.{h,cpp}.

* Source/WebCore/dom/make_names.pl:
(readKnownTags):

Read a list of tag name files. Any duplicate tag name found in a
subsequent file is ignored (e.g. the SVG script tag will be ignored if
the HTML tag name file is parsed first). Since the %parameters hash
doesn't make much sense when parsing multiple files, it's cleared out
by the end of the function, but the namespace for each tag (which comes
from the parameters object) is recorded on the tag object.

(printNamesHeaderFile):
(printNamesCppFile):

Remove the findHTMLTag generation from generated HTMLNames.{h,cpp} etc.

(printKnownTagsHeaderFile):
(printKnownTagsCppFile):

Generated findTag in KnownTag.{h,cpp}. Use the namespace stored on the
tag object to decide the QualifiedName on which to look up the local
name.

(findMaxTagLength): Just refer to the global %allTags variable, like other
functions do.

(tagsWithLength): Simplify.

(generateFindTagForLength): We need to replace "_"s with "-"s when generating
the big switch statement, since the tag names it's operating on have already
been converted into identifiers.

* Source/WebCore/html/parser/AtomHTMLToken.h:
(WebCore::AtomHTMLToken::AtomHTMLToken):

Call the new findTag function.
@heycam heycam removed the merging-blocked Applied to prevent a change from being merged label Aug 17, 2022
1 similar comment
1 similar comment
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Aug 18, 2022
@heycam heycam marked this pull request as draft August 18, 2022 22:17
@heycam
Copy link
Contributor Author

heycam commented Aug 18, 2022

Cancelling review for now; I think the new findTag function needs to work on all lowercase tag names (like "foreignobject").

@heycam heycam closed this Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DOM For bugs specific to XML/HTML DOM elements (including parsing). merging-blocked Applied to prevent a change from being merged
Projects
None yet
3 participants