Title: [233145] trunk/Source/WebCore
Revision
233145
Author
za...@apple.com
Date
2018-06-25 08:01:35 -0700 (Mon, 25 Jun 2018)

Log Message

[LFC] Adjust static position with containing block's content box top/left
https://bugs.webkit.org/show_bug.cgi?id=186999

Reviewed by Antti Koivisto.

* layout/blockformatting/BlockFormattingContextGeometry.cpp:
(WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
* layout/displaytree/DisplayBox.cpp:
(WebCore::Display::Box::contentBox const):
* layout/displaytree/DisplayBox.h:
(WebCore::Display::Box::contentBoxTop const):
(WebCore::Display::Box::contentBoxLeft const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (233144 => 233145)


--- trunk/Source/WebCore/ChangeLog	2018-06-25 12:43:00 UTC (rev 233144)
+++ trunk/Source/WebCore/ChangeLog	2018-06-25 15:01:35 UTC (rev 233145)
@@ -1,3 +1,18 @@
+2018-06-25  Zalan Bujtas  <za...@apple.com>
+
+        [LFC] Adjust static position with containing block's content box top/left
+        https://bugs.webkit.org/show_bug.cgi?id=186999
+
+        Reviewed by Antti Koivisto.
+
+        * layout/blockformatting/BlockFormattingContextGeometry.cpp:
+        (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
+        * layout/displaytree/DisplayBox.cpp:
+        (WebCore::Display::Box::contentBox const):
+        * layout/displaytree/DisplayBox.h:
+        (WebCore::Display::Box::contentBoxTop const):
+        (WebCore::Display::Box::contentBoxLeft const):
+
 2018-06-25  David Kilzer  <ddkil...@apple.com>
 
         REGRESSION (r233140): Windows build failure due to incomplete DocumentAnimationScheduler type

Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp (233144 => 233145)


--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp	2018-06-25 12:43:00 UTC (rev 233144)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp	2018-06-25 15:01:35 UTC (rev 233145)
@@ -270,13 +270,14 @@
     // Vertical margins between adjacent block-level boxes in a block formatting context collapse.
     // In a block formatting context, each box's left outer edge touches the left edge of the containing block (for right-to-left formatting, right edges touch).
 
-    // Start from the top of the container's content box.
-    LayoutUnit top = { };
-    LayoutUnit left = { };
+    auto& containingBlockDisplayBox = *layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock());
+    LayoutUnit top;
     if (auto* previousInFlowSibling = layoutBox.previousInFlowSibling()) {
         auto& previousInFlowDisplayBox = *layoutContext.displayBoxForLayoutBox(*previousInFlowSibling);
         top = previousInFlowDisplayBox.bottom() + previousInFlowDisplayBox.marginBottom();
-    }
+    } else
+        top = containingBlockDisplayBox.contentBoxTop();
+    auto left = containingBlockDisplayBox.contentBoxLeft();
     LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position] -> static -> top(" << top << "px) left(" << left << "px) layoutBox(" << &layoutBox << ")");
     return { left, top };
 }

Modified: trunk/Source/WebCore/layout/displaytree/DisplayBox.cpp (233144 => 233145)


--- trunk/Source/WebCore/layout/displaytree/DisplayBox.cpp	2018-06-25 12:43:00 UTC (rev 233144)
+++ trunk/Source/WebCore/layout/displaytree/DisplayBox.cpp	2018-06-25 15:01:35 UTC (rev 233145)
@@ -84,13 +84,11 @@
 
 Box::Rect Box::contentBox() const
 {
-    auto paddingBox = this->paddingBox();
-
     Rect contentBox;
-    contentBox.setTop(paddingBox.top() + paddingTop());
-    contentBox.setLeft(paddingBox.left() + paddingLeft());
-    contentBox.setWidth(m_contentWidth);
-    contentBox.setHeight(m_contentHeight);
+    contentBox.setTop(contentBoxTop());
+    contentBox.setLeft(contentBoxLeft());
+    contentBox.setWidth(contentBoxWidth());
+    contentBox.setHeight(contentBoxHeight());
     return contentBox;
 }
 

Modified: trunk/Source/WebCore/layout/displaytree/DisplayBox.h (233144 => 233145)


--- trunk/Source/WebCore/layout/displaytree/DisplayBox.h	2018-06-25 12:43:00 UTC (rev 233144)
+++ trunk/Source/WebCore/layout/displaytree/DisplayBox.h	2018-06-25 15:01:35 UTC (rev 233145)
@@ -141,6 +141,8 @@
     LayoutUnit paddingBottom() const;
     LayoutUnit paddingRight() const;
 
+    LayoutUnit contentBoxTop() const { return borderTop() + paddingTop(); }
+    LayoutUnit contentBoxLeft() const { return borderLeft() + paddingLeft(); }
     LayoutUnit contentBoxHeight() const;
     LayoutUnit contentBoxWidth() const;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to