Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1fb5ba86b2ce9efb9e27e0dc84bd06c9cc445e46
      
https://github.com/WebKit/WebKit/commit/1fb5ba86b2ce9efb9e27e0dc84bd06c9cc445e46
  Author: Chris Dumez <[email protected]>
  Date:   2026-04-25 (Sat, 25 Apr 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/html/dom/elements/the-innertext-and-outertext-properties/getter-expected.txt
    M Source/WebCore/editing/TextIterator.cpp

  Log Message:
  -----------
  innerText should not emit newlines for visibility:hidden block elements
https://bugs.webkit.org/show_bug.cgi?id=313212

Reviewed by Anne van Kesteren.

Per the WHATWG spec step 3 of the inner text collection steps: "If node's
computed value of 'visibility' is not 'visible', then return items." This
means visibility:hidden elements should not contribute their own block-level
formatting (newlines) — only their visible children's content should be
included. WebKit was incorrectly emitting block boundary newlines and extra
<p> newlines for visibility:hidden elements, causing a <p> with
visibility:hidden to produce a blank line instead of a single line break
between visible children.

The fix adds visibility checks in TextIterator::representNodeOffsetZero()
and TextIterator::exitNode() to skip newline emission for visibility:hidden
elements when in innerText mode (EmitsNewlinesPerInnerTextSpec).

No new tests, rebaselined existing WPT test. This subtest was already
passing in Chrome and Firefox.

* 
LayoutTests/imported/w3c/web-platform-tests/html/dom/elements/the-innertext-and-outertext-properties/getter-expected.txt:
* Source/WebCore/editing/TextIterator.cpp:
(WebCore::TextIterator::representNodeOffsetZero):
(WebCore::TextIterator::exitNode):

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



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

Reply via email to