Title: [234584] trunk/Source/WebCore
Revision
234584
Author
[email protected]
Date
2018-08-05 16:19:57 -0700 (Sun, 05 Aug 2018)

Log Message

[LFC][BFC] contentHeightForFormattingContextRoot uses the wrong coordinate system to compute the height.
https://bugs.webkit.org/show_bug.cgi?id=188319

Reviewed by Antti Koivisto.

Display::Box::marginBox() is in the coordinate system of the box itself (8px top margin translates to y = -8px).
What we need instead to compute the content height is the top/bottom position in the containing block's coordinate system (rect and rectWithMargin).

* layout/FormattingContextGeometry.cpp:
(WebCore::Layout::contentHeightForFormattingContextRoot):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (234583 => 234584)


--- trunk/Source/WebCore/ChangeLog	2018-08-05 10:10:10 UTC (rev 234583)
+++ trunk/Source/WebCore/ChangeLog	2018-08-05 23:19:57 UTC (rev 234584)
@@ -1,3 +1,16 @@
+2018-08-05  Zalan Bujtas  <[email protected]>
+
+        [LFC][BFC] contentHeightForFormattingContextRoot uses the wrong coordinate system to compute the height.
+        https://bugs.webkit.org/show_bug.cgi?id=188319
+
+        Reviewed by Antti Koivisto.
+
+        Display::Box::marginBox() is in the coordinate system of the box itself (8px top margin translates to y = -8px).
+        What we need instead to compute the content height is the top/bottom position in the containing block's coordinate system (rect and rectWithMargin).
+
+        * layout/FormattingContextGeometry.cpp:
+        (WebCore::Layout::contentHeightForFormattingContextRoot):
+
 2018-08-05  Ms2ger  <[email protected]>
 
         [GStreamer] Remove unsound assertions in MediaPlayerPrivateGStreamerBase.

Modified: trunk/Source/WebCore/layout/FormattingContextGeometry.cpp (234583 => 234584)


--- trunk/Source/WebCore/layout/FormattingContextGeometry.cpp	2018-08-05 10:10:10 UTC (rev 234583)
+++ trunk/Source/WebCore/layout/FormattingContextGeometry.cpp	2018-08-05 23:19:57 UTC (rev 234584)
@@ -55,6 +55,9 @@
 
     auto* firstDisplayBox = layoutContext.displayBoxForLayoutBox(*formattingRootContainer.firstInFlowChild());
     auto* lastDisplayBox = layoutContext.displayBoxForLayoutBox(*formattingRootContainer.lastInFlowChild());
+    auto top = firstDisplayBox->rectWithMargin().top();
+    auto bottom = lastDisplayBox->rectWithMargin().bottom();
+
     auto* formattingContextRoot = &layoutBox;
     // TODO: The document renderer is not a formatting context root by default at all. Need to find out what it is.
     if (!layoutBox.establishesFormattingContext()) {
@@ -61,12 +64,11 @@
         ASSERT(layoutBox.isDocumentBox());
         formattingContextRoot = &layoutBox.formattingContextRoot();
     }
+
     auto floatsBottom = layoutContext.establishedFormattingState(*formattingContextRoot).floatingState().bottom(*formattingContextRoot);
-
-    auto top = firstDisplayBox->marginBox().top();
-    auto bottom = lastDisplayBox->marginBox().bottom();
     if (floatsBottom)
         bottom = std::max(*floatsBottom, bottom);
+
     auto computedHeight = bottom - top;
     LOG_WITH_STREAM(FormattingContextLayout, stream << "[Height] -> content height for formatting context root -> height(" << computedHeight << "px) layoutBox("<< &layoutBox << ")");
     return computedHeight;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to