Title: [231780] trunk/Source/WebCore
Revision
231780
Author
za...@apple.com
Date
2018-05-14 18:31:21 -0700 (Mon, 14 May 2018)

Log Message

[LFC] FormattingContext:computeOutOfFlowNonReplacedHeight/Width should use the computed margins/paddings/borders
https://bugs.webkit.org/show_bug.cgi?id=185633

Reviewed by Sam Weinig.

By the time we start computing height and width, DisplayBox should already have the computed values for margin/padding/border.

* layout/FormattingContext.cpp:
(WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedHeight const):
(WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedWidth const):
* layout/displaytree/DisplayBox.h:
(WebCore::Display::Box::paddingTop const):
(WebCore::Display::Box::paddingLeft const):
(WebCore::Display::Box::paddingBottom const):
(WebCore::Display::Box::paddingRight const):
(WebCore::Display::Box::borderTop const):
(WebCore::Display::Box::borderLeft const):
(WebCore::Display::Box::borderBottom const):
(WebCore::Display::Box::borderRight const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (231779 => 231780)


--- trunk/Source/WebCore/ChangeLog	2018-05-15 01:07:36 UTC (rev 231779)
+++ trunk/Source/WebCore/ChangeLog	2018-05-15 01:31:21 UTC (rev 231780)
@@ -1,3 +1,25 @@
+2018-05-14  Zalan Bujtas  <za...@apple.com>
+
+        [LFC] FormattingContext:computeOutOfFlowNonReplacedHeight/Width should use the computed margins/paddings/borders
+        https://bugs.webkit.org/show_bug.cgi?id=185633
+
+        Reviewed by Sam Weinig.
+
+        By the time we start computing height and width, DisplayBox should already have the computed values for margin/padding/border.
+
+        * layout/FormattingContext.cpp:
+        (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedHeight const):
+        (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedWidth const):
+        * layout/displaytree/DisplayBox.h:
+        (WebCore::Display::Box::paddingTop const):
+        (WebCore::Display::Box::paddingLeft const):
+        (WebCore::Display::Box::paddingBottom const):
+        (WebCore::Display::Box::paddingRight const):
+        (WebCore::Display::Box::borderTop const):
+        (WebCore::Display::Box::borderLeft const):
+        (WebCore::Display::Box::borderBottom const):
+        (WebCore::Display::Box::borderRight const):
+
 2018-05-14  Wenson Hsieh  <wenson_hs...@apple.com>
 
         [Extra zoom mode] Google search results are excessively zoomed in

Modified: trunk/Source/WebCore/layout/FormattingContext.cpp (231779 => 231780)


--- trunk/Source/WebCore/layout/FormattingContext.cpp	2018-05-15 01:07:36 UTC (rev 231779)
+++ trunk/Source/WebCore/layout/FormattingContext.cpp	2018-05-15 01:31:21 UTC (rev 231780)
@@ -185,17 +185,16 @@
         computedHeightValue = contentHeightForFormattingContextRoot(layoutContext, layoutBox);
     } else if (!top.isAuto() && height.isAuto() && !bottom.isAuto()) {
         // #5
-        auto marginTop = style.marginTop().isAuto() ? LayoutUnit() : valueForLength(style.marginTop(), containingBlockHeight);
-        auto marginBottom = style.marginBottom().isAuto() ? LayoutUnit() : valueForLength(style.marginBottom(), containingBlockHeight);
+        auto marginTop = displayBox.marginTop();
+        auto marginBottom = displayBox.marginBottom();
     
-        auto containingBlockWidth = layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock())->width();
-        auto paddingTop = valueForLength(style.paddingTop(), containingBlockWidth);
-        auto paddingBottom = valueForLength(style.paddingBottom(), containingBlockWidth);
+        auto paddingTop = displayBox.paddingTop();
+        auto paddingBottom = displayBox.paddingBottom();
 
-        auto borderTopWidth = style.borderBeforeWidth();
-        auto borderBottomWidth = style.borderAfterWidth();
+        auto borderTop = displayBox.borderTop();
+        auto borderBottom = displayBox.borderBottom();
 
-        computedHeightValue = containingBlockHeight - (top.value() + marginTop + borderTopWidth + paddingTop + paddingBottom + borderBottomWidth + marginBottom + bottom.value());
+        computedHeightValue = containingBlockHeight - (top.value() + marginTop + borderTop + paddingTop + paddingBottom + borderBottom + marginBottom + bottom.value());
     } else if (!height.isAuto())
         computedHeightValue = valueForLength(height, containingBlockHeight);
     else
@@ -264,16 +263,16 @@
         computedWidthValue = shrinkToFitWidth(layoutContext, layoutBox);
     } else if (!left.isAuto() && width.isAuto() && !right.isAuto()) {
         // #5
-        auto marginLeft = style.marginLeft().isAuto() ? LayoutUnit() : valueForLength(style.marginLeft(), containingBlockWidth);
-        auto marginRight = style.marginRight().isAuto() ? LayoutUnit() : valueForLength(style.marginRight(), containingBlockWidth);
+        auto marginLeft = displayBox.marginLeft();
+        auto marginRight = displayBox.marginRight();
     
-        auto paddingLeft = valueForLength(style.paddingTop(), containingBlockWidth);
-        auto paddingRight = valueForLength(style.paddingBottom(), containingBlockWidth);
+        auto paddingLeft = displayBox.paddingLeft();
+        auto paddingRight = displayBox.paddingRight();
 
-        auto borderLeftWidth = style.borderStartWidth();
-        auto borderRightWidth = style.borderEndWidth();
+        auto borderLeft = displayBox.borderLeft();
+        auto borderRight = displayBox.borderRight();
 
-        computedWidthValue = containingBlockWidth - (left.value() + marginLeft + borderLeftWidth + paddingLeft + paddingRight + borderRightWidth + marginRight + right.value());
+        computedWidthValue = containingBlockWidth - (left.value() + marginLeft + borderLeft + paddingLeft + paddingRight + borderRight + marginRight + right.value());
     } else if (!width.isAuto())
         computedWidthValue = valueForLength(width, containingBlockWidth);
     else

Modified: trunk/Source/WebCore/layout/displaytree/DisplayBox.h (231779 => 231780)


--- trunk/Source/WebCore/layout/displaytree/DisplayBox.h	2018-05-15 01:07:36 UTC (rev 231779)
+++ trunk/Source/WebCore/layout/displaytree/DisplayBox.h	2018-05-15 01:31:21 UTC (rev 231780)
@@ -70,6 +70,16 @@
     LayoutUnit marginBottom() const;
     LayoutUnit marginRight() const;
 
+    LayoutUnit borderTop() const;
+    LayoutUnit borderLeft() const;
+    LayoutUnit borderBottom() const;
+    LayoutUnit borderRight() const;
+
+    LayoutUnit paddingTop() const;
+    LayoutUnit paddingLeft() const;
+    LayoutUnit paddingBottom() const;
+    LayoutUnit paddingRight() const;
+
     LayoutRect marginBox() const;
     LayoutRect borderBox() const;
     LayoutRect paddingBox() const;
@@ -347,6 +357,54 @@
     return m_marginRight;
 }
 
+inline LayoutUnit Box::paddingTop() const
+{
+    ASSERT(m_hasValidPadding);
+    return m_paddingTop;
 }
+
+inline LayoutUnit Box::paddingLeft() const
+{
+    ASSERT(m_hasValidPadding);
+    return m_paddingLeft;
 }
+
+inline LayoutUnit Box::paddingBottom() const
+{
+    ASSERT(m_hasValidPadding);
+    return m_paddingBottom;
+}
+
+inline LayoutUnit Box::paddingRight() const
+{
+    ASSERT(m_hasValidPadding);
+    return m_paddingRight;
+}
+
+inline LayoutUnit Box::borderTop() const
+{
+    ASSERT(m_hasValidBorder);
+    return m_borderTop;
+}
+
+inline LayoutUnit Box::borderLeft() const
+{
+    ASSERT(m_hasValidBorder);
+    return m_borderLeft;
+}
+
+inline LayoutUnit Box::borderBottom() const
+{
+    ASSERT(m_hasValidBorder);
+    return m_borderBottom;
+}
+
+inline LayoutUnit Box::borderRight() const
+{
+    ASSERT(m_hasValidBorder);
+    return m_borderRight;
+}
+
+}
+}
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to