Changeset 237783 in webkit


Ignore:
Timestamp:
Nov 4, 2018 7:46:38 AM (6 years ago)
Author:
Alan Bujtas
Message:

[LFC][BFC] Add support for percentage height in quirks mode.
https://bugs.webkit.org/show_bug.cgi?id=191232

Reviewed by Antti Koivisto.

Source/WebCore:

In quirks mode, we go and travers the containing block chain to find a block level
box with fixed height value to resolve the percentage value.

Test: fast/block/basic/quirk-mode-percent-height.html

  • layout/FormattingContextGeometry.cpp:

(WebCore::Layout::FormattingContext::Geometry::computedHeightValue):

  • layout/Verification.cpp:

(WebCore::Layout::LayoutState::verifyAndOutputMismatchingLayoutTree const):

Tools:

  • LayoutReloaded/misc/LFC-passing-tests.txt:

LayoutTests:

  • fast/block/basic/quirk-mode-percent-height-expected.txt: Added.
  • fast/block/basic/quirk-mode-percent-height.html: Added.
  • platform/ios/TestExpectations:
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r237782 r237783  
     12018-11-04  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][BFC] Add support for percentage height in quirks mode.
     4        https://bugs.webkit.org/show_bug.cgi?id=191232
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * fast/block/basic/quirk-mode-percent-height-expected.txt: Added.
     9        * fast/block/basic/quirk-mode-percent-height.html: Added.
     10        * platform/ios/TestExpectations:
     11
    1122018-11-04  Zalan Bujtas  <zalan@apple.com>
    213
  • trunk/LayoutTests/platform/ios/TestExpectations

    r237782 r237783  
    31183118fast/block/basic/height-percentage-simple.html [ Failure ]
    31193119fast/block/basic/child-block-level-box-with-height-percent.html [ Failure ]
     3120fast/block/basic/quirk-mode-percent-height.html [ Failure ]
    31203121
    31213122# Datalist
  • trunk/Source/WebCore/ChangeLog

    r237782 r237783  
     12018-11-04  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][BFC] Add support for percentage height in quirks mode.
     4        https://bugs.webkit.org/show_bug.cgi?id=191232
     5
     6        Reviewed by Antti Koivisto.
     7
     8        In quirks mode, we go and travers the containing block chain to find a block level
     9        box with fixed height value to resolve the percentage value.
     10
     11        Test: fast/block/basic/quirk-mode-percent-height.html
     12
     13        * layout/FormattingContextGeometry.cpp:
     14        (WebCore::Layout::FormattingContext::Geometry::computedHeightValue):
     15        * layout/Verification.cpp:
     16        (WebCore::Layout::LayoutState::verifyAndOutputMismatchingLayoutTree const):
     17
    1182018-11-04  Zalan Bujtas  <zalan@apple.com>
    219
  • trunk/Source/WebCore/layout/FormattingContextGeometry.cpp

    r237782 r237783  
    6969
    7070    std::optional<LayoutUnit> containingBlockHeightValue;
    71     auto containingBlockHeight = layoutBox.containingBlock()->style().logicalHeight();
    72     if (containingBlockHeight.isFixed())
    73         containingBlockHeightValue = { containingBlockHeight.value() };
    74     else if (layoutBox.isOutOfFlowPositioned()) {
    75         // Containing block's height is already computed.
     71    if (layoutBox.isOutOfFlowPositioned()) {
     72        // Containing block's height is already computed since we layout the out-of-flow boxes as the last step.
    7673        containingBlockHeightValue = layoutState.displayBoxForLayoutBox(*layoutBox.containingBlock()).height();
     74    } else {
     75        auto computedHeightValueForQuirksMode = [&]() -> LayoutUnit {
     76            // In quirks mode, we go and travers the containing block chain to find a block level box with fixed height value, even if it means leaving
     77            // the current formatting context. FIXME: surely we need to do some tricks here when block direction support is added.
     78            auto* containingBlock = layoutBox.containingBlock();
     79            LayoutUnit bodyAndDocumentVerticalMarginsPaddingsAndBorders;
     80            while (containingBlock) {
     81                auto containingBlockHeight = containingBlock->style().logicalHeight();
     82                if (containingBlockHeight.isFixed())
     83                    return containingBlockHeight.value() - bodyAndDocumentVerticalMarginsPaddingsAndBorders;
     84
     85                // If the only fixed value box we find is the ICB, then ignore the body and the document (vertical) margin, padding and border. So much quirkiness.
     86                // -and it's totally insane because now we freely travel across formatting context boundaries and computed margins are nonexistent.
     87                if (containingBlock->isBodyBox() || containingBlock->isDocumentBox()) {
     88                    auto& displayBox = layoutState.displayBoxForLayoutBox(*containingBlock);
     89
     90                    auto verticalMargins = computedNonCollapsedVerticalMarginValue(layoutState, *containingBlock);
     91                    auto verticalPaddings = displayBox.paddingTop().value_or(0) + displayBox.paddingBottom().value_or(0);
     92                    auto verticalBorders = displayBox.borderTop() + displayBox.borderBottom();
     93                    bodyAndDocumentVerticalMarginsPaddingsAndBorders += verticalMargins.top + verticalMargins.bottom + verticalPaddings + verticalBorders;
     94                }
     95
     96                containingBlock = containingBlock->containingBlock();
     97            }
     98            // Initial containing block has to have a height.
     99            return layoutState.displayBoxForLayoutBox(layoutBox.initialContainingBlock()).contentBox().height() - bodyAndDocumentVerticalMarginsPaddingsAndBorders;
     100        };
     101
     102        if (layoutState.inQuirksMode())
     103            containingBlockHeightValue = computedHeightValueForQuirksMode();
     104        else {
     105            auto containingBlockHeight = layoutBox.containingBlock()->style().logicalHeight();
     106            if (containingBlockHeight.isFixed())
     107                containingBlockHeightValue = { containingBlockHeight.value() };
     108        }
    77109    }
    78110
  • trunk/Tools/ChangeLog

    r237782 r237783  
     12018-11-04  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][BFC] Add support for percentage height in quirks mode.
     4        https://bugs.webkit.org/show_bug.cgi?id=191232
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * LayoutReloaded/misc/LFC-passing-tests.txt:
     9
    1102018-11-04  Zalan Bujtas  <zalan@apple.com>
    211
  • trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt

    r237782 r237783  
    7272fast/block/basic/height-percentage-simple.html
    7373fast/block/basic/child-block-level-box-with-height-percent.html
     74fast/block/basic/quirk-mode-percent-height.html
Note: See TracChangeset for help on using the changeset viewer.