Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 97774366800c5b796bc2144ebd55d152d074ed57
      
https://github.com/WebKit/WebKit/commit/97774366800c5b796bc2144ebd55d152d074ed57
  Author: Alan Baradlay <[email protected]>
  Date:   2022-12-08 (Thu, 08 Dec 2022)

  Changed paths:
    M Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp

  Log Message:
  -----------
  [LFC][IFC] Introduce a fast path for finding breaking position when text 
content uses fixed pitch font
https://bugs.webkit.org/show_bug.cgi?id=248015
<rdar://problem/102637833>

Reviewed by Simon Fraser.

While sometimes fixed pitch fonts (e.g. Monospace) lie about them being fixed 
pitch
(i.e. not all of their glyphs have the same advance width -see 
webkit.org/b/221581)
let's just assume they are uniform and
1. estimate the breaking position based on the assumed character width
2. confirm it by calling FontCascade::width()
In the common case (when the font is truly fixed), the estimated breaking 
position matches the actual breaking position,
while in the rare cases, we fall back to the regular, bisect algorithm.

This produces ~3x better line breaking perf on 
PerformanceTests/Layout/fixed-pitch-arbitrary-break-long-text.html 
microbenchmark.

* Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::breakWord):

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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to