| Summary: | Setting white-space to non-default value dynamically on a blank (whitespace/new line) does not work correctly | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Chijin <tlock.chijin> | ||||||||||||||
| Component: | Layout and Rendering | Assignee: | zalan <zalan> | ||||||||||||||
| Status: | RESOLVED FIXED | ||||||||||||||||
| Severity: | Normal | CC: | ahmad.saleem792, bfulgham, changseok, esprehn+autocc, ews-watchlist, glenn, koivisto, kondapallykalyan, pdr, simon.fraser, webkit-bug-importer, zalan | ||||||||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||||||||
| Version: | Safari 15 | ||||||||||||||||
| Hardware: | All | ||||||||||||||||
| OS: | All | ||||||||||||||||
| Attachments: |
|
||||||||||||||||
|
Description
Chijin
2022-04-23 00:57:01 PDT
Created attachment 458239 [details]
Test reduction
This bug only occurs when the pre-line is set dynamically on an "inline empty" content (no text or other inline level box).
We don't create RenderText renderers for the whitespace/new line only content. It looks like in RenderTreeUpdater::updateRenderTree bool mayNeedUpdateWhitespaceOnlyRenderer = renderingParent().didCreateOrDestroyChildRenderer && text.data().isAllSpecialCharacters<isHTMLSpace>(); may need to be updated so that certain parent styles (e.g. white-space) are also taken into account when checking if the text node needs a renderer. Hi, anyone take care of this issue? I am still able to reproduce this in Safari 16.2 & STP160, is this something progressed with IFC on trunk? @Alan? (In reply to zalan from comment #2) > We don't create RenderText renderers for the whitespace/new line only > content. > > It looks like in RenderTreeUpdater::updateRenderTree > bool mayNeedUpdateWhitespaceOnlyRenderer = > renderingParent().didCreateOrDestroyChildRenderer && > text.data().isAllSpecialCharacters<isHTMLSpace>(); > may need to be updated so that certain parent styles (e.g. white-space) are > also taken into account when checking if the text node needs a renderer. Let's see what Antti thinks. Hi zalan, one year has been passed, any update for this bug? Created attachment 470405 [details]
Patch
(In reply to Chijin from comment #7) > Hi zalan, one year has been passed, any update for this bug? This is not really my area, but let's see if I got this right. Created attachment 470413 [details]
Patch
Thanks for the fixing! Created attachment 470415 [details]
Patch
Comment on attachment 470415 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=470415&action=review > Source/WebCore/style/StyleTreeResolver.cpp:975 > + if (!node.renderer() && containsOnlyASCIIWhitespace && parent.style.preserveNewline()) > + return true; This could test !text->renderer() for consistency. This really needs to be done only when parent.style.preserveNewline() changes value. We could set a bit in the parent struct when that happens and test for that. Created attachment 470417 [details]
[fast-cq]Patch
Committed 276277@main (40f3c61c1d9d): <https://commits.webkit.org/276277@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 470417 [details]. (In reply to Chijin from comment #11) > Thanks for the fixing! Thank you for filing it! |