Created attachment 458204 [details] expected rendering result of chrome example url: https://codepen.io/chijinz/pen/eYyoLbz Steps to reproduce the problem: 1. use Safari to visit the example url 2. the green light is on the top of the page even though white-space has been set to "pre-line". This is inconsistent with the document (https://developer.mozilla.org/en-US/docs/Web/CSS/white-space). Other browsers (e.g. chrome) works fine with this issue.
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.
<rdar://problem/92559818>
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!