Changeset 235561 in webkit


Ignore:
Timestamp:
Aug 31, 2018, 11:07:46 AM (7 years ago)
Author:
Alan Bujtas
Message:

[LFC] Add margin box verification back now that Display::Box has non-computed horizontal margin.
https://bugs.webkit.org/show_bug.cgi?id=189193

Reviewed by Antti Koivisto.

Source/WebCore:

Use the non-computed margin values to verify correctness.
This patch also fixes a margin collapsing issue when the inflow box has a float sibling. The float
sibling does not prevent collapsing with the parent's top/bottom margin.

Test: fast/block/block-only/floating-and-next-previous-inflow-with-margin-with-no-border.html

  • layout/Verification.cpp:

(WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
(WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const):

  • layout/blockformatting/BlockMarginCollapse.cpp:

(WebCore::Layout::isMarginTopCollapsedWithParent):
(WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent):

Tools:

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

LayoutTests:

  • fast/block/block-only/floating-and-next-previous-inflow-with-margin-with-no-border-expected.txt: Added.
  • fast/block/block-only/floating-and-next-previous-inflow-with-margin-with-no-border.html: Added.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r235550 r235561  
     12018-08-31  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC] Add margin box verification back now that Display::Box has non-computed horizontal margin.
     4        https://bugs.webkit.org/show_bug.cgi?id=189193
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * fast/block/block-only/floating-and-next-previous-inflow-with-margin-with-no-border-expected.txt: Added.
     9        * fast/block/block-only/floating-and-next-previous-inflow-with-margin-with-no-border.html: Added.
     10
    1112018-08-31  Per Arne Vollan  <pvollan@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r235560 r235561  
     12018-08-31  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC] Add margin box verification back now that Display::Box has non-computed horizontal margin.
     4        https://bugs.webkit.org/show_bug.cgi?id=189193
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Use the non-computed margin values to verify correctness.
     9        This patch also fixes a margin collapsing issue when the inflow box has a float sibling. The float
     10        sibling does not prevent collapsing with the parent's top/bottom margin.
     11
     12        Test: fast/block/block-only/floating-and-next-previous-inflow-with-margin-with-no-border.html
     13
     14        * layout/Verification.cpp:
     15        (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
     16        (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const):
     17        * layout/blockformatting/BlockMarginCollapse.cpp:
     18        (WebCore::Layout::isMarginTopCollapsedWithParent):
     19        (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent):
     20
    1212018-08-31  Antti Koivisto  <antti@apple.com>
    222
  • trunk/Source/WebCore/layout/Verification.cpp

    r234924 r235561  
    122122    };
    123123
     124    auto renderBoxLikeMarginBox = [](auto& displayBox) {
     125        // Produce a RenderBox matching margin box.
     126        auto borderBox = displayBox.borderBox();
     127
     128        return Display::Box::Rect {
     129            borderBox.top() - displayBox.nonCollapsedMarginTop(),
     130            borderBox.left() - displayBox.nonComputedMarginLeft(),
     131            displayBox.nonComputedMarginLeft() + borderBox.width() + displayBox.nonComputedMarginRight(),
     132            displayBox.nonCollapsedMarginTop() + borderBox.height() + displayBox.nonCollapsedMarginBottom()
     133        };
     134    };
     135
    124136    auto* displayBox = context.displayBoxForLayoutBox(layoutBox);
    125137    ASSERT(displayBox);
     
    135147    }
    136148
     149    if (renderer.marginBoxRect() != renderBoxLikeMarginBox(*displayBox)) {
     150        outputRect("marginBox", renderer.marginBoxRect(), renderBoxLikeMarginBox(*displayBox));
     151        return true;
     152    }
     153
    137154    if (renderer.borderBoxRect() != displayBox->borderBox()) {
    138155        outputRect("borderBox", renderer.borderBoxRect(), displayBox->borderBox());
     
    150167    }
    151168
    152     // TODO: The RenderBox::marginBox() does not follow the spec and ignores certain constraints. Skip them for now.
    153169    return false;
    154170}
  • trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp

    r235170 r235561  
    9898    ASSERT(layoutBox.parent());
    9999    auto& parent = *layoutBox.parent();
    100     // Only the first inlflow child collapses with parent (floating sibling also prevents collapsing).
    101     if (layoutBox.previousInFlowOrFloatingSibling())
     100    // Only the first inlflow child collapses with parent.
     101    if (layoutBox.previousInFlowSibling())
    102102        return false;
    103103
     
    275275    ASSERT(layoutBox.parent());
    276276    auto& parent = *layoutBox.parent();
    277     // Only the last inlflow child collapses with parent (floating sibling also prevents collapsing).
    278     if (layoutBox.nextInFlowOrFloatingSibling())
     277    // Only the last inlflow child collapses with parent.
     278    if (layoutBox.nextInFlowSibling())
    279279        return false;
    280280
  • trunk/Tools/ChangeLog

    r235560 r235561  
     12018-08-31  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC] Add margin box verification back now that Display::Box has non-computed horizontal margin.
     4        https://bugs.webkit.org/show_bug.cgi?id=189193
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * LayoutReloaded/misc/LFC-passing-tests.txt:
     9
    1102018-08-31  Antti Koivisto  <antti@apple.com>
    211
  • trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt

    r235505 r235561  
    4848fast/block/block-only/floating-multiple-lefts.html
    4949fast/block/block-only/floating-and-next-previous-inflow-with-margin.html
     50fast/block/block-only/floating-and-next-previous-inflow-with-margin-with-no-border.html
    5051fast/block/block-only/floating-left-and-right-with-clearance.html
    5152fast/block/block-only/float-and-siblings-with-margins.html
Note: See TracChangeset for help on using the changeset viewer.