Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[LFC][IFC] Empty generated content should not prevent margin collapsing
https://bugs.webkit.org/show_bug.cgi?id=243485 Reviewed by Antti Koivisto. In some cases (e.g. pseudo content with '') we construct empty InlineTextItems (they are required so that we keep layout boxes and inline items synced). These truly empty inline items should be collapsed at InlineLine::append so that they don't show up on the line box as (blank) text runs (and make the iterator believe there's content on the line, which in turn prevents margin collapsing). (This makes content: ''; behave as content: ' '; (provided collapsing is allowed)) * LayoutTests/fast/inline/incorrect-content-height-with-empty-generated-content-expected.html: Added. * LayoutTests/fast/inline/incorrect-content-height-with-empty-generated-content.html: Added. * Source/WebCore/layout/formattingContexts/inline/InlineLine.cpp: (WebCore::Layout::Line::appendTextContent): * Source/WebCore/layout/formattingContexts/inline/InlineTextItem.cpp: (WebCore::Layout::InlineTextItem::InlineTextItem): * Source/WebCore/layout/formattingContexts/inline/InlineTextItem.h: (WebCore::Layout::InlineTextItem::isEmpty const): (WebCore::Layout::InlineTextItem::createEmptyItem): Canonical link: https://commits.webkit.org/253079@main
- Loading branch information
1 parent
febc2b3
commit fe9010d
Showing
15 changed files
with
55 additions
and
42 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
LayoutTests/fast/inline/incorrect-content-height-with-empty-generated-content-expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<style> | ||
div { | ||
width: 100px; | ||
height: 100px; | ||
background-color: green; | ||
padding: 1px; | ||
} | ||
</style> | ||
<div></div> |
16 changes: 16 additions & 0 deletions
16
LayoutTests/fast/inline/incorrect-content-height-with-empty-generated-content.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<style> | ||
div { | ||
width: 100px; | ||
background-color: green; | ||
padding: 1px; | ||
} | ||
|
||
span::before { | ||
display: block; | ||
content: ''; | ||
margin-top: 100px; | ||
margin-bottom: 100px; | ||
} | ||
</style> | ||
<!-- empty content should not prevent margin collapsing --> | ||
<div><span></span></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters