Skip to content

Move embed to the void element case in HTMLTreeBuilder#62067

Merged
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
cdumez:311510_HTMLTreeBuilder_embed
Apr 5, 2026
Merged

Move embed to the void element case in HTMLTreeBuilder#62067
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
cdumez:311510_HTMLTreeBuilder_embed

Conversation

@cdumez
Copy link
Copy Markdown
Contributor

@cdumez cdumez commented Apr 5, 2026

8d32cf1

Move embed to the void element case in HTMLTreeBuilder
https://bugs.webkit.org/show_bug.cgi?id=311510

Reviewed by Anne van Kesteren.

The <embed> element was grouped with applet/marquee/object, which are
non-void elements that push a marker onto the active formatting elements.
Since <embed> is a void element, it was handled via a runtime tagName
check that called insertSelfClosingHTMLElement instead, with redundant
calls to reconstructTheActiveFormattingElements().

Per the WHATWG spec, <embed> belongs in the same case as area/br/img/keygen/wbr:
https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inbody
(see "A start tag whose tag name is one of: "area", "br", "embed", "img", "keygen", "wbr"")

Move it there and simplify the applet/marquee/object case by removing
the now-unnecessary if/else branch and redundant reconstruct calls.

No behavior change — the previous code was correct but inefficient,
as reconstructTheActiveFormattingElements() is idempotent.

* Source/WebCore/html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::processStartTagForInBody):

Canonical link: https://commits.webkit.org/310605@main

30aa51f

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win ✅ 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ✅ 🧪 win-tests ✅ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe ✅ 🛠 vision-apple
✅ 🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 ios-safer-cpp ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2
✅ 🛠 tv ❌ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@cdumez cdumez self-assigned this Apr 5, 2026
@cdumez cdumez added the DOM For bugs specific to XML/HTML DOM elements (including parsing). label Apr 5, 2026
@cdumez cdumez marked this pull request as ready for review April 5, 2026 12:33
@cdumez cdumez requested a review from rniwa as a code owner April 5, 2026 12:33
@cdumez cdumez marked this pull request as draft April 5, 2026 12:33
@cdumez cdumez marked this pull request as ready for review April 5, 2026 12:38
@cdumez cdumez requested review from annevk and darinadler April 5, 2026 12:38
Copy link
Copy Markdown
Contributor

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

@cdumez cdumez added the merge-queue Applied to send a pull request to merge-queue label Apr 5, 2026
@webkit-commit-queue webkit-commit-queue force-pushed the 311510_HTMLTreeBuilder_embed branch from 30aa51f to 113cca0 Compare April 5, 2026 12:58
https://bugs.webkit.org/show_bug.cgi?id=311510

Reviewed by Anne van Kesteren.

The <embed> element was grouped with applet/marquee/object, which are
non-void elements that push a marker onto the active formatting elements.
Since <embed> is a void element, it was handled via a runtime tagName
check that called insertSelfClosingHTMLElement instead, with redundant
calls to reconstructTheActiveFormattingElements().

Per the WHATWG spec, <embed> belongs in the same case as area/br/img/keygen/wbr:
https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inbody
(see "A start tag whose tag name is one of: "area", "br", "embed", "img", "keygen", "wbr"")

Move it there and simplify the applet/marquee/object case by removing
the now-unnecessary if/else branch and redundant reconstruct calls.

No behavior change — the previous code was correct but inefficient,
as reconstructTheActiveFormattingElements() is idempotent.

* Source/WebCore/html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::processStartTagForInBody):

Canonical link: https://commits.webkit.org/310605@main
@webkit-commit-queue webkit-commit-queue force-pushed the 311510_HTMLTreeBuilder_embed branch from 113cca0 to 8d32cf1 Compare April 5, 2026 12:59
@webkit-commit-queue
Copy link
Copy Markdown
Collaborator

Committed 310605@main (8d32cf1): https://commits.webkit.org/310605@main

Reviewed commits have been landed. Closing PR #62067 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 8d32cf1 into WebKit:main Apr 5, 2026
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Apr 5, 2026
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).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants