Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2e738f0fc7c762980cc151c3263d46208924e6a4
      
https://github.com/WebKit/WebKit/commit/2e738f0fc7c762980cc151c3263d46208924e6a4
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-07-14 (Tue, 14 Jul 2026)

  Changed paths:
    M LayoutTests/inspector/formatting/formatting-html-expected.txt
    M LayoutTests/inspector/formatting/formatting-html.html
    A LayoutTests/inspector/formatting/resources/html-tests/canvas-expected.html
    A LayoutTests/inspector/formatting/resources/html-tests/canvas.html
    M 
Source/WebInspectorUI/UserInterface/Workers/Formatter/HTMLTreeBuilderFormatter.js

  Log Message:
  -----------
  Web Inspector: HTML pretty-printer mis-nests <canvas> fallback content 
because "canvas" is wrongly treated as a void element
https://bugs.webkit.org/show_bug.cgi?id=319365
rdar://182171240

Reviewed by Devin Rousso.

HTMLTreeBuilderFormatter.TagNamesWithoutChildren lists the HTML void
elements: tags that can never have children, so the tree builder does
not push them onto the stack of open elements. "canvas" was included in
this set since the formatter was first added, but <canvas> is not a void
element -- it has a transparent content model and legitimately contains
fallback content (e.g. <p> or <a> shown when canvas is unsupported).

Because "canvas" was in the set, _isEmptyNode() returned true for it, so
its fallback content was attached as siblings instead of children and
its closing tag went unmatched. Pretty-printing HTML that used canvas
fallback content therefore produced incorrectly-nested, non-indented
output.

Remove "canvas" from TagNamesWithoutChildren so it is treated as a
normal container element.

* LayoutTests/inspector/formatting/formatting-html-expected.txt:
* LayoutTests/inspector/formatting/formatting-html.html:
* LayoutTests/inspector/formatting/resources/html-tests/canvas-expected.html: 
Added.
* LayoutTests/inspector/formatting/resources/html-tests/canvas.html: Added.
* 
Source/WebInspectorUI/UserInterface/Workers/Formatter/HTMLTreeBuilderFormatter.js:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to