[webkit-changes] [WebKit/WebKit] cd84be: Missing underline when skipping descenders with th...

Alan Baradlay noreply at github.com
Mon Nov 18 07:18:33 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cd84be1f3dd74350cf7c066e691ac78fc27b0fe7
      https://github.com/WebKit/WebKit/commit/cd84be1f3dd74350cf7c066e691ac78fc27b0fe7
  Author: Alan Baradlay <zalan at apple.com>
  Date:   2024-11-18 (Mon, 18 Nov 2024)

  Changed paths:
    A LayoutTests/fast/text/thick-underline-and-small-font-size-expected-mismatch.html
    A LayoutTests/fast/text/thick-underline-and-small-font-size.html
    M Source/WebCore/rendering/TextDecorationPainter.cpp

  Log Message:
  -----------
  Missing underline when skipping descenders with thick underline value
https://bugs.webkit.org/show_bug.cgi?id=283187

Reviewed by Antti Koivisto.

WebKit skips (not paint) underline on descenders when text-decoration-thickness is set to 'auto'.
e.g.
     __
    |  |
    |__|
  ____ | ____
     __|

WebKit paints 2 disjointed lines to make sure the glyph's descender would never cross the underline.
The gap value between these 2 lines is computed by using the thickness of the underline (see text-decoration-thickness),
where thicker underlines produce wider gaps (linear).
While this matches Firefox behavior, a relatively thick underline may produce a large enough gap where we end up not painting any underline at all.

However Firefox also puts a cap on the gap value ensuring that some underline is painted (though there are some extreme cases where no underline is painted)
Since we size our gap the same way as Firefox do, let's use a cap value similar to theirs (i.e. relative to font size and use 5 as a magic value).

* LayoutTests/fast/text/thick-underline-and-small-font-size-expected-mismatch.html: Added.
* LayoutTests/fast/text/thick-underline-and-small-font-size.html: Added.
* Source/WebCore/rendering/TextDecorationPainter.cpp:
(WebCore::TextDecorationPainter::paintBackgroundDecorations):

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



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


More information about the webkit-changes mailing list