Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8ec0ca7d7b3d50f5fc8153bdf9d05eb67247fbb3
      
https://github.com/WebKit/WebKit/commit/8ec0ca7d7b3d50f5fc8153bdf9d05eb67247fbb3
  Author: Alan Baradlay <[email protected]>
  Date:   2026-03-16 (Mon, 16 Mar 2026)

  Changed paths:
    M LayoutTests/TestExpectations
    A LayoutTests/fast/ruby/ruby-underline-decoration-stretch-expected.html
    A LayoutTests/fast/ruby/ruby-underline-decoration-stretch.html
    M Source/WebCore/rendering/TextBoxPainter.cpp

  Log Message:
  -----------
  Underlines are split when ruby base is expanded because of long ruby text
https://bugs.webkit.org/show_bug.cgi?id=78957
<rdar://problem/171653095>

Reviewed by Antti Koivisto.

This change fixes ruby base content decoration painting by expanding the 
decoration width
to the size of the base.

In most cases, the text box width matches the decoration width due to the 
hugging
behavior of inline boxes.
e.g.
  <span style="text-decoration: underline">text</span>

here the text box's geometry matches the decorating box (span) geometry as far 
as
background geometry (e.g. underline) is concerned.

However ruby base text is an exception: the text may be aligned (e.g. centered) 
by offsetting
the base content inside the ruby base inline box (due to annotation stretching 
the base).
It essentially means (text box geometry based) background geometry would not 
stretch
all the way to the edge of the ruby base.

e.g.
  <u>before<ruby>base<rt>annotation</rt></ruby>after</u>

         annotation
  before    base    after
  ------    ----    -----

while the expected rendering is:

         annotation
  before    base    after
  -----------------------

If we see a ruby base between the decorating box (<u>) and the text content 
('base'),
expand the background geometry to include the base inline box (make it hugging).

Test: fast/ruby/ruby-underline-decoration-stretch.html

* LayoutTests/TestExpectations:
  css-text-decor/ruby-text-decoration-01.html: now test PASSes but the 
expected.html uses a technique that is still broken in WebKit (see 
webkit.org/b/310038). The reason why this test is PASS on trunk is simply 
because test and expected htmls are broken the same way.

  text-decoration-in-descendants-ruby.html: -expected.html uses the same, 
broken technique (webkit.org/b/310038)

* LayoutTests/fast/ruby/ruby-underline-decoration-stretch-expected.html: Added.
* LayoutTests/fast/ruby/ruby-underline-decoration-stretch.html: Added.
* Source/WebCore/rendering/TextBoxPainter.cpp:
(WebCore::TextBoxPainter::collectDecoratingBoxesForBackgroundPainting):

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



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

Reply via email to