Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Incorrect sizing of elements with visually hidden text inside
https://bugs.webkit.org/show_bug.cgi?id=241459 Reviewed by Antti Koivisto. This patch fixes the incorrect inline width computation when an inline box (e.g. <span>) with margin-inline-start (e.g. margin-left) is followed by an out-of-flow element. <div id=container>some<span style="margin-left: 10px"><div style="position: absolute"></div>text</span></div> In LineBreaker::nextLineBreak, while iterating through the content of [container], the margin-left of the inline box (span) is included twice; first for the out-of-flow box and second for the [text] content. This patch ensures that when we reach the [text] content, we check if we have already reserved the space for the inline box's margin (padding and border). (While out-of-flow inline level boxes are not supposed to participate in inline layout, (in legacy line layout) in order to compute their static position we include them in line layout. A more involved fix would be to exclude all out-of-flow boxes from line layout and deal with their static positioning after completing the core line layout). * LayoutTests/fast/block/shrink-to-fit-with-out-of-flow-and-inline-box-margin-expected.html: Added. * LayoutTests/fast/block/shrink-to-fit-with-out-of-flow-and-inline-box-margin.html: Added. * Source/WebCore/rendering/line/BreakingContext.h: Make sure when the out-of-flow box takes the margin, we don't add it again for the text content. Also, reset this flag for subsequent content. (WebCore::inlineLogicalWidth): Canonical link: https://commits.webkit.org/251483@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295478 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information