Title: [240109] trunk
Revision
240109
Author
[email protected]
Date
2019-01-17 08:06:22 -0800 (Thu, 17 Jan 2019)

Log Message

[LFC][BFC][Quirk] Take body padding and border into account when stretching height.
https://bugs.webkit.org/show_bug.cgi?id=193528

Reviewed by Antti Koivisto.

Source/WebCore:

* layout/blockformatting/BlockFormattingContextQuirks.cpp:
(WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):
* layout/displaytree/DisplayBox.h:
(WebCore::Display::Box::verticalBorder const):
(WebCore::Display::Box::horizontalBorder const):
(WebCore::Display::Box::verticalPadding const):
(WebCore::Display::Box::horizontalPadding const):
* page/FrameViewLayoutContext.cpp:
(WebCore::layoutUsingFormattingContext):

Tools:

* LayoutReloaded/misc/LFC-passing-tests.txt:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (240108 => 240109)


--- trunk/Source/WebCore/ChangeLog	2019-01-17 16:00:14 UTC (rev 240108)
+++ trunk/Source/WebCore/ChangeLog	2019-01-17 16:06:22 UTC (rev 240109)
@@ -1,5 +1,22 @@
 2019-01-17  Zalan Bujtas  <[email protected]>
 
+        [LFC][BFC][Quirk] Take body padding and border into account when stretching height.
+        https://bugs.webkit.org/show_bug.cgi?id=193528
+
+        Reviewed by Antti Koivisto.
+
+        * layout/blockformatting/BlockFormattingContextQuirks.cpp:
+        (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):
+        * layout/displaytree/DisplayBox.h:
+        (WebCore::Display::Box::verticalBorder const):
+        (WebCore::Display::Box::horizontalBorder const):
+        (WebCore::Display::Box::verticalPadding const):
+        (WebCore::Display::Box::horizontalPadding const):
+        * page/FrameViewLayoutContext.cpp:
+        (WebCore::layoutUsingFormattingContext):
+
+2019-01-17  Zalan Bujtas  <[email protected]>
+
         [LFC][BFC] For height computation, the bottom edge of the last line box value should not include top border/padding
         https://bugs.webkit.org/show_bug.cgi?id=193520
 

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp (240108 => 240109)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp	2019-01-17 16:00:14 UTC (rev 240108)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp	2019-01-17 16:06:22 UTC (rev 240109)
@@ -72,11 +72,9 @@
 
     auto& documentBox = layoutBox.isDocumentBox() ? layoutBox : *layoutBox.parent();
     auto& documentBoxDisplayBox = layoutState.displayBoxForLayoutBox(documentBox);
-    auto documentBoxVerticalBorders = documentBoxDisplayBox.borderTop() + documentBoxDisplayBox.borderBottom();
-    auto documentBoxVerticalPaddings = documentBoxDisplayBox.paddingTop().valueOr(0) + documentBoxDisplayBox.paddingBottom().valueOr(0);
 
     auto strechedHeight = layoutState.displayBoxForLayoutBox(initialContainingBlock(layoutBox)).contentBoxHeight();
-    strechedHeight -= documentBoxVerticalBorders + documentBoxVerticalPaddings;
+    strechedHeight -= documentBoxDisplayBox.verticalBorder() + documentBoxDisplayBox.verticalPadding().valueOr(0);
 
     LayoutUnit totalVerticalMargin;
     if (layoutBox.isDocumentBox()) {
@@ -90,6 +88,9 @@
         auto documentBoxVerticalMargin = Geometry::computedVerticalMargin(layoutState, documentBox);
         strechedHeight -= (documentBoxVerticalMargin.before.valueOr(0) + documentBoxVerticalMargin.after.valueOr(0));
 
+        auto& bodyBoxDisplayBox = layoutState.displayBoxForLayoutBox(layoutBox);
+        strechedHeight -= bodyBoxDisplayBox.verticalBorder() + bodyBoxDisplayBox.verticalPadding().valueOr(0);
+
         auto nonCollapsedMargin = heightAndMargin.nonCollapsedMargin;
         auto collapsedMargin = MarginCollapse::collapsedVerticalValues(layoutState, layoutBox, nonCollapsedMargin);
         totalVerticalMargin = collapsedMargin.before.valueOr(nonCollapsedMargin.before) + collapsedMargin.after.valueOr(nonCollapsedMargin.after);

Modified: trunk/Source/WebCore/layout/displaytree/DisplayBox.h (240108 => 240109)


--- trunk/Source/WebCore/layout/displaytree/DisplayBox.h	2019-01-17 16:00:14 UTC (rev 240108)
+++ trunk/Source/WebCore/layout/displaytree/DisplayBox.h	2019-01-17 16:06:22 UTC (rev 240109)
@@ -154,11 +154,15 @@
     LayoutUnit borderLeft() const;
     LayoutUnit borderBottom() const;
     LayoutUnit borderRight() const;
+    LayoutUnit verticalBorder() const { return borderTop() + borderBottom(); }
+    LayoutUnit horizontalBorder() const { return borderLeft() + borderRight(); }
 
     Optional<LayoutUnit> paddingTop() const;
     Optional<LayoutUnit> paddingLeft() const;
     Optional<LayoutUnit> paddingBottom() const;
     Optional<LayoutUnit> paddingRight() const;
+    Optional<LayoutUnit> verticalPadding() const;
+    Optional<LayoutUnit> horizontalPadding() const;
 
     LayoutUnit contentBoxTop() const { return paddingBoxTop() + paddingTop().valueOr(0); }
     LayoutUnit contentBoxLeft() const { return paddingBoxLeft() + paddingLeft().valueOr(0); }
@@ -655,6 +659,24 @@
     return m_padding->horizontal.right;
 }
 
+inline Optional<LayoutUnit> Box::verticalPadding() const
+{
+    auto paddingTop = this->paddingTop();
+    auto paddingBottom = this->paddingBottom();
+    if (!paddingTop && !paddingBottom)
+        return { };
+    return paddingTop.valueOr(0) + paddingBottom.valueOr(0);
+}
+
+inline Optional<LayoutUnit> Box::horizontalPadding() const
+{
+    auto paddingLeft = this->paddingLeft();
+    auto paddingRight = this->paddingRight();
+    if (!paddingLeft && !paddingRight)
+        return { };
+    return paddingLeft.valueOr(0) + paddingRight.valueOr(0);
+}
+
 inline LayoutUnit Box::borderTop() const
 {
     ASSERT(m_hasValidBorder);

Modified: trunk/Tools/ChangeLog (240108 => 240109)


--- trunk/Tools/ChangeLog	2019-01-17 16:00:14 UTC (rev 240108)
+++ trunk/Tools/ChangeLog	2019-01-17 16:06:22 UTC (rev 240109)
@@ -1,5 +1,14 @@
 2019-01-17  Zalan Bujtas  <[email protected]>
 
+        [LFC][BFC][Quirk] Take body padding and border into account when stretching height.
+        https://bugs.webkit.org/show_bug.cgi?id=193528
+
+        Reviewed by Antti Koivisto.
+
+        * LayoutReloaded/misc/LFC-passing-tests.txt:
+
+2019-01-17  Zalan Bujtas  <[email protected]>
+
         [LFC][BFC] For height computation, the bottom edge of the last line box value should include top border/padding
         https://bugs.webkit.org/show_bug.cgi?id=193520
 

Modified: trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt (240108 => 240109)


--- trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2019-01-17 16:00:14 UTC (rev 240108)
+++ trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt	2019-01-17 16:06:22 UTC (rev 240109)
@@ -91,6 +91,7 @@
 fast/block/basic/009.html
 fast/block/basic/012.html
 fast/block/basic/021.html
+fast/block/basic/quirk-height.html
 fast/block/basic/child-block-level-box-with-height-percent.html
 fast/block/basic/height-percentage-simple.html
 fast/block/basic/inline-content-with-floating-image.html
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to