Title: [293647] trunk/Source/WebCore
Revision
293647
Author
za...@apple.com
Date
2022-04-30 09:30:46 -0700 (Sat, 30 Apr 2022)

Log Message

Only stretch the percent height <body> when it is the document element's child
https://bugs.webkit.org/show_bug.cgi?id=239932
<rdar://92257660>

Reviewed by Antti Koivisto.

This IE quirk should only be applied to when the body is actually the document element's child (stretching case).

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeLogicalHeight const):
* rendering/RenderBox.h:
(WebCore::RenderBox::parentBox const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (293646 => 293647)


--- trunk/Source/WebCore/ChangeLog	2022-04-30 15:30:19 UTC (rev 293646)
+++ trunk/Source/WebCore/ChangeLog	2022-04-30 16:30:46 UTC (rev 293647)
@@ -1,5 +1,20 @@
 2022-04-30  Alan Bujtas  <za...@apple.com>
 
+        Only stretch the percent height <body> when it is the document element's child
+        https://bugs.webkit.org/show_bug.cgi?id=239932
+        <rdar://92257660>
+
+        Reviewed by Antti Koivisto.
+
+        This IE quirk should only be applied to when the body is actually the document element's child (stretching case).
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeLogicalHeight const):
+        * rendering/RenderBox.h:
+        (WebCore::RenderBox::parentBox const):
+
+2022-04-30  Alan Bujtas  <za...@apple.com>
+
         ASSERTION FAILED: *trailingRunIndex >= overflowingRunIndex in WebCore::Layout::InlineContentBreaker::tryBreakingNextOverflowingRuns
         https://bugs.webkit.org/show_bug.cgi?id=239838
         <rdar://problem/92455051>

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (293646 => 293647)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2022-04-30 15:30:19 UTC (rev 293646)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2022-04-30 16:30:46 UTC (rev 293647)
@@ -3203,14 +3203,20 @@
         }
     }
 
-    // WinIE quirk: The <html> block always fills the entire canvas in quirks mode.  The <body> always fills the
-    // <html> block in quirks mode.  Only apply this quirk if the block is normal flow and no height
+    // WinIE quirk: The <html> block always fills the entire canvas in quirks mode. The <body> always fills the
+    // <html> block in quirks mode. Only apply this quirk if the block is normal flow and no height
     // is specified. When we're printing, we also need this quirk if the body or root has a percentage 
     // height since we don't set a height in RenderView when we're printing. So without this quirk, the 
     // height has nothing to be a percentage of, and it ends up being 0. That is bad.
-    bool paginatedContentNeedsBaseHeight = document().printing() && h.isPercentOrCalculated()
-        && (isDocumentElementRenderer() || (isBody() && document().documentElement()->renderer()->style().logicalHeight().isPercentOrCalculated())) && !isInline();
-    if (stretchesToViewport() || paginatedContentNeedsBaseHeight) {
+    auto paginatedContentNeedsBaseHeight = [&] {
+        if (!document().printing() || !h.isPercentOrCalculated() || isInline())
+            return false;
+        if (isDocumentElementRenderer())
+            return true;
+        auto* documentElementRenderer = document().documentElement()->renderer();
+        return isBody() && parent() == documentElementRenderer && documentElementRenderer->style().logicalHeight().isPercentOrCalculated();
+    };
+    if (stretchesToViewport() || paginatedContentNeedsBaseHeight()) {
         LayoutUnit margins = collapsedMarginBefore() + collapsedMarginAfter();
         LayoutUnit visibleHeight = view().pageOrViewLogicalHeight();
         if (isDocumentElementRenderer())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to