⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 267587 in webkit


Ignore:
Timestamp:
Sep 25, 2020, 12:03:37 PM (6 years ago)
Author:
Alan Bujtas
Message:

[LFC][MarginCollapsing] Only inflow boxes collapse their quirk margins with their parents
https://bugs.webkit.org/show_bug.cgi?id=216981

Reviewed by Antti Koivisto.

Source/WebCore:

Test: fast/layoutformattingcontext/quirk-margin-not-collapse-when-floating.html

  • layout/blockformatting/BlockFormattingContextQuirks.cpp:

(WebCore::Layout::BlockFormattingContext::Quirks::shouldCollapseMarginBeforeWithParentMarginBefore const):

LayoutTests:

  • fast/layoutformattingcontext/quirk-margin-not-collapse-when-floating-expected.html: Added.
  • fast/layoutformattingcontext/quirk-margin-not-collapse-when-floating.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r267578 r267587  
     12020-09-25  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][MarginCollapsing] Only inflow boxes collapse their quirk margins with their parents
     4        https://bugs.webkit.org/show_bug.cgi?id=216981
     5
     6        Reviewed by Antti Koivisto.
     7
     8        * fast/layoutformattingcontext/quirk-margin-not-collapse-when-floating-expected.html: Added.
     9        * fast/layoutformattingcontext/quirk-margin-not-collapse-when-floating.html: Added.
     10
    1112020-09-25  Frederic Wang  <fwang@igalia.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r267578 r267587  
     12020-09-25  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][MarginCollapsing] Only inflow boxes collapse their quirk margins with their parents
     4        https://bugs.webkit.org/show_bug.cgi?id=216981
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Test: fast/layoutformattingcontext/quirk-margin-not-collapse-when-floating.html
     9
     10        * layout/blockformatting/BlockFormattingContextQuirks.cpp:
     11        (WebCore::Layout::BlockFormattingContext::Quirks::shouldCollapseMarginBeforeWithParentMarginBefore const):
     12
    1132020-09-25  Frederic Wang  <fwang@igalia.com>
    214
  • trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp

    r267076 r267587  
    105105}
    106106
     107enum class VerticalMargin { Before, After };
     108static inline bool hasQuirkMarginToCollapse(const Box& layoutBox, VerticalMargin verticalMargin)
     109{
     110    if (!layoutBox.isInFlow())
     111        return false;
     112    auto& style = layoutBox.style();
     113    return (verticalMargin == VerticalMargin::Before && style.hasMarginBeforeQuirk()) || (verticalMargin == VerticalMargin::After && style.hasMarginAfterQuirk());
     114}
     115
    107116bool BlockFormattingContext::Quirks::shouldCollapseMarginBeforeWithParentMarginBefore(const Box& layoutBox) const
    108117{
    109     return layoutState().inQuirksMode() && layoutBox.style().hasMarginBeforeQuirk() && isQuirkContainer(layoutBox.containingBlock());
     118    return layoutState().inQuirksMode() && hasQuirkMarginToCollapse(layoutBox, VerticalMargin::Before) && isQuirkContainer(layoutBox.containingBlock());
    110119}
    111120
    112121bool BlockFormattingContext::Quirks::shouldCollapseMarginAfterWithParentMarginAfter(const Box& layoutBox) const
    113122{
    114     return layoutState().inQuirksMode() && layoutBox.style().hasMarginAfterQuirk() && isQuirkContainer(layoutBox.containingBlock());
     123    return layoutState().inQuirksMode() && hasQuirkMarginToCollapse(layoutBox, VerticalMargin::After) && isQuirkContainer(layoutBox.containingBlock());
    115124}
    116125
Note: See TracChangeset for help on using the changeset viewer.