Title: [270230] trunk
- Revision
- 270230
- Author
- [email protected]
- Date
- 2020-11-29 12:50:20 -0800 (Sun, 29 Nov 2020)
Log Message
[LFC][BFC] Do not assume float avoiders have pre-computed vertical positions
https://bugs.webkit.org/show_bug.cgi?id=219326
Reviewed by Antti Koivisto.
Source/WebCore:
Move the final vertical position computation from computeHeightAndMargin() (it does not really belong in there) to
layoutInFlowContent(). This patch also ensures that we only adjust the vertical position when needed.
Test: fast/layoutformattingcontext/block-only/child-containing-block-margin-collapse-when-float-avoiders.html
* layout/blockformatting/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
LayoutTests:
* fast/layoutformattingcontext/block-only/child-containing-block-margin-collapse-when-float-avoiders-expected.html: Added.
* fast/layoutformattingcontext/block-only/child-containing-block-margin-collapse-when-float-avoiders.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (270229 => 270230)
--- trunk/LayoutTests/ChangeLog 2020-11-29 19:44:42 UTC (rev 270229)
+++ trunk/LayoutTests/ChangeLog 2020-11-29 20:50:20 UTC (rev 270230)
@@ -1,3 +1,13 @@
+2020-11-29 Zalan Bujtas <[email protected]>
+
+ [LFC][BFC] Do not assume float avoiders have pre-computed vertical positions
+ https://bugs.webkit.org/show_bug.cgi?id=219326
+
+ Reviewed by Antti Koivisto.
+
+ * fast/layoutformattingcontext/block-only/child-containing-block-margin-collapse-when-float-avoiders-expected.html: Added.
+ * fast/layoutformattingcontext/block-only/child-containing-block-margin-collapse-when-float-avoiders.html: Added.
+
2020-11-22 Diego Pino Garcia <[email protected]>
[WPE] Unreviewed test gardening. Remove unnecessary passes after r270017.
Added: trunk/LayoutTests/fast/layoutformattingcontext/block-only/child-containing-block-margin-collapse-when-float-avoiders-expected.html (0 => 270230)
--- trunk/LayoutTests/fast/layoutformattingcontext/block-only/child-containing-block-margin-collapse-when-float-avoiders-expected.html (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/block-only/child-containing-block-margin-collapse-when-float-avoiders-expected.html 2020-11-29 20:50:20 UTC (rev 270230)
@@ -0,0 +1,18 @@
+<!-- webkit-test-runner [ LayoutFormattingContextEnabled=true LayoutFormattingContextIntegrationEnabled=false ] -->
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ .container {
+ background-color: green;
+ border: 10px solid blue;
+ position: absolute;
+ }
+ </style>
+</head>
+<body>
+<div class=container style="width: 116px; height: 116px; left: 20px; top: 20px;"></div>
+<div class=container style="width: 78px; height: 78px; left: 58px; top: 58px; z-index: 1"></div>
+<div class=container style="width: 40px; height: 40px; left: 96px; top: 96px; z-index: 2"></div>
+</body>
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/fast/layoutformattingcontext/block-only/child-containing-block-margin-collapse-when-float-avoiders.html (0 => 270230)
--- trunk/LayoutTests/fast/layoutformattingcontext/block-only/child-containing-block-margin-collapse-when-float-avoiders.html (rev 0)
+++ trunk/LayoutTests/fast/layoutformattingcontext/block-only/child-containing-block-margin-collapse-when-float-avoiders.html 2020-11-29 20:50:20 UTC (rev 270230)
@@ -0,0 +1,28 @@
+<!-- webkit-test-runner [ LayoutFormattingContextEnabled=true LayoutFormattingContextIntegrationEnabled=false ] -->
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+body {
+ margin: 0px;
+}
+
+.container {
+ margin: 20px;
+ width: 100px;
+ height: 100px;
+ background-color: green;
+ border: 10px solid blue;
+ padding: 8px;
+ overflow: hidden;
+}
+</style>
+</head>
+<body>
+<div class="container">
+ <div class="container">
+ <div class="container"></div>
+ </div>
+</div>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (270229 => 270230)
--- trunk/Source/WebCore/ChangeLog 2020-11-29 19:44:42 UTC (rev 270229)
+++ trunk/Source/WebCore/ChangeLog 2020-11-29 20:50:20 UTC (rev 270230)
@@ -1,5 +1,20 @@
2020-11-29 Zalan Bujtas <[email protected]>
+ [LFC][BFC] Do not assume float avoiders have pre-computed vertical positions
+ https://bugs.webkit.org/show_bug.cgi?id=219326
+
+ Reviewed by Antti Koivisto.
+
+ Move the final vertical position computation from computeHeightAndMargin() (it does not really belong in there) to
+ layoutInFlowContent(). This patch also ensures that we only adjust the vertical position when needed.
+
+ Test: fast/layoutformattingcontext/block-only/child-containing-block-margin-collapse-when-float-avoiders.html
+
+ * layout/blockformatting/BlockFormattingContext.cpp:
+ (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin):
+
+2020-11-29 Zalan Bujtas <[email protected]>
+
[LFC][IFC] Create runs for inline boxes
https://bugs.webkit.org/show_bug.cgi?id=219329
Modified: trunk/Source/WebCore/layout/Verification.cpp (270229 => 270230)
--- trunk/Source/WebCore/layout/Verification.cpp 2020-11-29 19:44:42 UTC (rev 270229)
+++ trunk/Source/WebCore/layout/Verification.cpp 2020-11-29 20:50:20 UTC (rev 270230)
@@ -81,6 +81,8 @@
static bool checkForMatchingTextRuns(const LineRun& lineRun, const WebCore::InlineTextBox& inlineTextBox)
{
+ if (!lineRun.text())
+ return false;
return areEssentiallyEqual(inlineTextBox.left(), lineRun.logicalLeft())
&& areEssentiallyEqual(inlineTextBox.right(), lineRun.logicalRight())
&& areEssentiallyEqual(inlineTextBox.top(), lineRun.logicalTop())
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (270229 => 270230)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2020-11-29 19:44:42 UTC (rev 270229)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2020-11-29 20:50:20 UTC (rev 270230)
@@ -141,11 +141,19 @@
auto& layoutBox = *layoutQueue.takeLast();
auto containingBlockConstraints = constraintsForLayoutBox(layoutBox);
- // All inflow descendants (if there are any) are laid out by now. Let's compute the box's height.
+ // All inflow descendants (if there are any) are laid out by now. Let's compute the box's height and vertical margin.
computeHeightAndMargin(layoutBox, containingBlockConstraints);
if (layoutBox.isFloatingPositioned())
floatingState.append(floatingContext.toFloatItem(layoutBox));
-
+ else {
+ // Adjust the vertical position now that we've got final margin values for non-float avoider boxes.
+ // Float avoiders have pre-computed vertical positions when floats are present.
+ if (!layoutBox.isFloatAvoider() || floatingContext.isEmpty()) {
+ auto& formattingState = this->formattingState();
+ auto& boxGeometry = formattingState.boxGeometry(layoutBox);
+ boxGeometry.setLogicalTop(verticalPositionWithMargin(layoutBox, formattingState.usedVerticalMargin(layoutBox), containingBlockConstraints.vertical));
+ }
+ }
auto establishesFormattingContext = layoutBox.establishesFormattingContext();
if (establishesFormattingContext) {
// Now that we computed the box's height, we can layout the out-of-flow descendants.
@@ -383,10 +391,6 @@
}
#endif
auto& boxGeometry = formattingState().boxGeometry(layoutBox);
- if (!layoutBox.isFloatAvoider()) {
- // Float avoiders have pre-computed vertical margins.
- boxGeometry.setLogicalTop(verticalPositionWithMargin(layoutBox, verticalMargin, constraints.vertical));
- }
boxGeometry.setContentBoxHeight(contentHeightAndMargin.contentHeight);
boxGeometry.setVerticalMargin({ marginBefore(verticalMargin), marginAfter(verticalMargin) });
// Adjust the previous sibling's margin bottom now that this box's vertical margin is computed.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes