Bug 235937 - [LFC][IFC] Using Fontcascade::spaceWidth to subtract the trailing space width may result in incorrect layout
Summary: [LFC][IFC] Using Fontcascade::spaceWidth to subtract the trailing space width...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: zalan
URL:
Keywords: InRadar
Depends on: 235998
Blocks:
  Show dependency treegraph
 
Reported: 2022-01-31 20:23 PST by zalan
Modified: 2022-02-02 06:37 PST (History)
8 users (show)

See Also:


Attachments
Patch (5.14 KB, patch)
2022-01-31 20:28 PST, zalan
no flags Details | Formatted Diff | Diff
Patch (5.32 KB, patch)
2022-02-01 08:16 PST, zalan
no flags Details | Formatted Diff | Diff
Patch (5.16 KB, patch)
2022-02-01 09:06 PST, zalan
no flags Details | Formatted Diff | Diff
Patch (52.97 KB, patch)
2022-02-01 13:04 PST, zalan
no flags Details | Formatted Diff | Diff
Patch (52.58 KB, patch)
2022-02-01 20:18 PST, zalan
ews-feeder: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description zalan 2022-01-31 20:23:58 PST
when the primary font does not have space glyph.
Comment 1 zalan 2022-01-31 20:24:16 PST
<rdar://88059633>
Comment 2 zalan 2022-01-31 20:28:09 PST
Created attachment 450492 [details]
Patch
Comment 3 zalan 2022-02-01 08:16:43 PST
Created attachment 450529 [details]
Patch
Comment 4 zalan 2022-02-01 09:06:55 PST
Created attachment 450538 [details]
Patch
Comment 5 Maciej Stachowiak 2022-02-01 12:10:21 PST
<rdar://88059633>
Comment 6 zalan 2022-02-01 13:04:45 PST
Created attachment 450559 [details]
Patch
Comment 7 EWS 2022-02-01 14:53:21 PST
Committed r288914 (246654@main): <https://commits.webkit.org/246654@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 450559 [details].
Comment 8 WebKit Commit Bot 2022-02-01 20:02:17 PST
Re-opened since this is blocked by bug 235998
Comment 9 zalan 2022-02-01 20:18:05 PST
Created attachment 450605 [details]
Patch
Comment 10 zalan 2022-02-01 20:22:50 PST
null terminator? where we're going we don't need null terminator.
Comment 11 EWS 2022-02-01 21:52:10 PST
Committed r288944 (246674@main): <https://commits.webkit.org/246674@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 450605 [details].
Comment 12 Myles C. Maxfield 2022-02-01 22:20:40 PST
Comment on attachment 450605 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=450605&action=review

> Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:94
> +    return fontCascade.width(TextRun { String { &space, 1 } });

There are no performance problems with this?
Comment 13 zalan 2022-02-02 06:37:55 PST
(In reply to Myles C. Maxfield from comment #12)
> Comment on attachment 450605 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=450605&action=review
> 
> > Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:94
> > +    return fontCascade.width(TextRun { String { &space, 1 } });
> 
> There are no performance problems with this?
I had run our classic PerformanceTests/Layout/line-layout-simple.html microbenchmark locally before landing this and it showed about 0.5% regression.
I also tested it with a slightly different version of the patch:
  const auto& spaceGlyphData = fontCascade.glyphDataForCharacter(space, false);
  return (!spaceGlyphData.font ? fontCascade.spaceWidth() : spaceGlyphData.font>widthForGlyph(spaceGlyphData.glyph)) + fontCascade.letterSpacing();
and it came back with the same numbers.