Changeset 293647 in webkit


Ignore:
Timestamp:
Apr 30, 2022 9:30:46 AM (2 years ago)
Author:
Alan Bujtas
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r293646 r293647  
     12022-04-30  Alan Bujtas  <zalan@apple.com>
     2
     3        Only stretch the percent height <body> when it is the document element's child
     4        https://bugs.webkit.org/show_bug.cgi?id=239932
     5        <rdar://92257660>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        This IE quirk should only be applied to when the body is actually the document element's child (stretching case).
     10
     11        * rendering/RenderBox.cpp:
     12        (WebCore::RenderBox::computeLogicalHeight const):
     13        * rendering/RenderBox.h:
     14        (WebCore::RenderBox::parentBox const):
     15
    1162022-04-30  Alan Bujtas  <zalan@apple.com>
    217
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r293209 r293647  
    32043204    }
    32053205
    3206     // WinIE quirk: The <html> block always fills the entire canvas in quirks mode.  The <body> always fills the
    3207     // <html> block in quirks mode.  Only apply this quirk if the block is normal flow and no height
     3206    // WinIE quirk: The <html> block always fills the entire canvas in quirks mode. The <body> always fills the
     3207    // <html> block in quirks mode. Only apply this quirk if the block is normal flow and no height
    32083208    // is specified. When we're printing, we also need this quirk if the body or root has a percentage
    32093209    // height since we don't set a height in RenderView when we're printing. So without this quirk, the
    32103210    // height has nothing to be a percentage of, and it ends up being 0. That is bad.
    3211     bool paginatedContentNeedsBaseHeight = document().printing() && h.isPercentOrCalculated()
    3212         && (isDocumentElementRenderer() || (isBody() && document().documentElement()->renderer()->style().logicalHeight().isPercentOrCalculated())) && !isInline();
    3213     if (stretchesToViewport() || paginatedContentNeedsBaseHeight) {
     3211    auto paginatedContentNeedsBaseHeight = [&] {
     3212        if (!document().printing() || !h.isPercentOrCalculated() || isInline())
     3213            return false;
     3214        if (isDocumentElementRenderer())
     3215            return true;
     3216        auto* documentElementRenderer = document().documentElement()->renderer();
     3217        return isBody() && parent() == documentElementRenderer && documentElementRenderer->style().logicalHeight().isPercentOrCalculated();
     3218    };
     3219    if (stretchesToViewport() || paginatedContentNeedsBaseHeight()) {
    32143220        LayoutUnit margins = collapsedMarginBefore() + collapsedMarginAfter();
    32153221        LayoutUnit visibleHeight = view().pageOrViewLogicalHeight();
Note: See TracChangeset for help on using the changeset viewer.