Summary: | CJK ligatures are totally broken because computePreferredLogicalWidths() is totally busted | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Toto <_> | ||||||||||||||
Component: | Text | Assignee: | Myles C. Maxfield <mmaxfield> | ||||||||||||||
Status: | REOPENED --- | ||||||||||||||||
Severity: | Normal | CC: | mmaxfield, webkit-bug-importer | ||||||||||||||
Priority: | P2 | Keywords: | InRadar | ||||||||||||||
Version: | Safari 15 | ||||||||||||||||
Hardware: | Mac (Intel) | ||||||||||||||||
OS: | Other | ||||||||||||||||
Attachments: |
|
I believe this is https://bugs.webkit.org/show_bug.cgi?id=6148. *** This bug has been marked as a duplicate of bug 6148 *** I no longer think this is https://bugs.webkit.org/show_bug.cgi?id=6148 Created attachment 442443 [details]
Test html file
Created attachment 442444 [details]
macOS Monterey
I'm not seeing the bug on macOS Monterey using the attached .html file. Do you think you could tell me if the attached .html file shows the bug on your machine? If not, do you think you could provide a test file that shows the bug?
Thanks!
I also don't think the bug's the same as https://bugs.webkit.org/show_bug.cgi?id=6148, as I might not try to style anything. https://bug-231668-attachments.webkit.org/attachment.cgi?id=442443 is not using `dlig` feature because the default font is not supported. `font-family` should be set to 'Hiragino Mincho ProN', etc. to render the ligatures. Created attachment 442457 [details]
Repro
I can reproduce it now. Created attachment 442458 [details]
Reduction
We're not using LFC. Wait a minute, we are using LFC. Oh, no we're not. We're just using the iterators, which are in layout/integration. The iterators point to a LegacyInlineBox. RenderText::width is using the result of computePreferredLogicalWidths() to determine the width. m_maxWidth Because the text is Japanese, there are line breaking opportunities around each character, so computePreferredLogicalWidths() is measuring each character individually - ignoring the fact that there is a ligatures that crosses 4 characters. Created attachment 442463 [details]
Enable `dlig` in parent scope vs. in specific <span>
<p><span class="dlig">株式会社</span>カブシキ</p> <!-- Error -->
<p class="dlig">株式会社カブシキ</p> <!-- Worked, see attachment -->
Enabling `dlig` in parent scope works just fine. But sometimes you just want certain characters to have the effect.
This should be fixed by IFC. We'll stop calling computePreferredLogicalWidths(). |
Created attachment 441059 [details] An example in Safari, Firefox and Chrome Source code, in CSS: ```css .dlig { font-feature-settings: "dlig"; } ``` In <body>: ```html <p>中心気圧九四〇<span class="dlig">メリ</span>バール・瞬間最大風速五〇<span class="dlig">メートル</span>・暴風雨半径二五<span class="dlig">〇キロ</span>……</p> ``` <span> won't shrink for ligatures inside, which left extra spacing after.