Chromium Code Reviews
DescriptionChange requiresLineBox to return false for empty-text inline.
.:: WHAT ::.
This patch fixes trailing whitespace problem with empty ::pseudo.content in Inline Layout flow.
Example:
<style>
.pseudo::before {
content:'';
}
</style>
<div class="pseudo">
<img/></div>
Layout Tree:
...
LayoutBlockFlow {DIV} at (0,0) size 784x20
LayoutInline {<pseudo:before>} at (0,0) size 0x0
LayoutTextFragment (anonymous) at (0,0) size 0x0
LayoutText {#text} at (0,0) size 4x19
text run at (0,0) width 4: " " <- trailing whitespace
LayoutImage {IMG} at (4,15) size 0x
...
.:: WHY ::.
The root cause of the issue is that the empty LayoutTextFragement(::pseudo.content) is recognized as requiresLineBox during the inline-walk. As a result LineBreaker::nextLineBreak handles LayoutTextFragement(::pseudo.content) as a line break and lays out the following real line break "\n" as an independent LayoutText element.
.:: HOW ::.
To fix the issue requiresLineBox was changed to return false if the current LineLayoutItem is Text and empty. This is similar to what we do for inline boxes with collapsible whitespaces.
.:: Rebasline ::.
2 tests need to be rebaseline because their test expectation includes a trailing whitespace
- third_party/WebKit/LayoutTests/fast/css-generated-content/pseudo-inline-with-empty-content-expected.html
- third_party/WebKit/LayoutTests/fast/css-generated-content/pseudo-inline-with-empty-content.html
BUG=445243
TEST=third_party/WebKit/LayoutTests/fast/css-generated-content/pseudo-inline-with-empty-content.html
Committed: https://crrev.com/09cfb18fdabab040b47b637331ed5e2bd4d8a7ad
Cr-Commit-Position: refs/heads/master@{#409438}
Patch Set 1 : fix with the whitespace placeholder in ContentData::TextFragement #Patch Set 2 : fix in requiresLineBox #
Total comments: 2
Patch Set 3 : remove curly brackets around one-line control-flow statements #
Messages
Total messages: 21 (16 generated)
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||