Changeset 239267 in webkit


Ignore:
Timestamp:
Dec 17, 2018 7:44:55 AM (5 years ago)
Author:
Alan Bujtas
Message:

[LFC][BFC][MarginCollapsing] Unify margin collapse function naming
https://bugs.webkit.org/show_bug.cgi?id=192747

Reviewed by Antti Koivisto.

Rename some margin collapse getters.

  • layout/blockformatting/BlockFormattingContext.h:
  • layout/blockformatting/BlockFormattingContextGeometry.cpp:

(WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):

  • layout/blockformatting/BlockMarginCollapse.cpp:

(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBefore):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginAfter):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginBefore):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginAfter):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBeforeFromFirstChild):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginAfterFromLastChild):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithParentMarginAfter):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithPreviousSibling):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithNextSibling):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginsCollapseThrough):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBefore):
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfter):
(WebCore::Layout::isMarginBeforeCollapsedWithSibling): Deleted.
(WebCore::Layout::isMarginAfterCollapsedWithSibling): Deleted.
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginBeforeCollapsedWithParent): Deleted.
(WebCore::Layout::isMarginAfterCollapsedThrough): Deleted.
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginAfterCollapsedWithParent): Deleted.
(WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginBeforeCollapsedWithParentMarginAfter): Deleted.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r239266 r239267  
     12018-12-17  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][BFC][MarginCollapsing] Unify margin collapse function naming
     4        https://bugs.webkit.org/show_bug.cgi?id=192747
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Rename some margin collapse getters.
     9
     10        * layout/blockformatting/BlockFormattingContext.h:
     11        * layout/blockformatting/BlockFormattingContextGeometry.cpp:
     12        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
     13        * layout/blockformatting/BlockMarginCollapse.cpp:
     14        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBefore):
     15        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginAfter):
     16        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginBefore):
     17        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginAfter):
     18        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBeforeFromFirstChild):
     19        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginAfterFromLastChild):
     20        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter):
     21        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore):
     22        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithParentMarginAfter):
     23        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithPreviousSibling):
     24        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithNextSibling):
     25        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginsCollapseThrough):
     26        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBefore):
     27        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfter):
     28        (WebCore::Layout::isMarginBeforeCollapsedWithSibling): Deleted.
     29        (WebCore::Layout::isMarginAfterCollapsedWithSibling): Deleted.
     30        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginBeforeCollapsedWithParent): Deleted.
     31        (WebCore::Layout::isMarginAfterCollapsedThrough): Deleted.
     32        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginAfterCollapsedWithParent): Deleted.
     33        (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginBeforeCollapsedWithParentMarginAfter): Deleted.
     34
    1352018-12-17  David Kilzer  <ddkilzer@apple.com>
    236
  • trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h

    r239206 r239267  
    9090            static LayoutUnit marginAfter(const LayoutState&, const Box&);
    9191
    92             static bool isMarginAfterCollapsedWithParent(const Box&);
    93             static bool isMarginBeforeCollapsedWithParentMarginAfter(const Box&);
     92            static bool marginBeforeCollapsesWithParentMarginAfter(const Box&);
     93            static bool marginAfterCollapsesWithParentMarginAfter(const Box&);
    9494
    9595        private:
     
    103103            static LayoutUnit nonCollapsedMarginBefore(const LayoutState&, const Box&);
    104104
    105             static bool isMarginBeforeCollapsedWithParent(const LayoutState&, const Box&);
     105            static bool marginBeforeCollapsesWithParentMarginBefore(const LayoutState&, const Box&);
     106            static bool marginBeforeCollapsesWithPreviousSibling(const Box&);
     107            static bool marginAfterCollapsesWithNextSibling(const Box&);
     108            static bool marginsCollapseThrough(const Box&);
    106109        };
    107110
  • trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp

    r239206 r239267  
    8585        auto* lastInFlowChild = downcast<Container>(layoutBox).lastInFlowChild();
    8686        ASSERT(lastInFlowChild);
    87         if (!MarginCollapse::isMarginAfterCollapsedWithParent(*lastInFlowChild)) {
     87        if (!MarginCollapse::marginAfterCollapsesWithParentMarginAfter(*lastInFlowChild)) {
    8888            auto& lastInFlowDisplayBox = layoutState.displayBoxForLayoutBox(*lastInFlowChild);
    8989            return { lastInFlowDisplayBox.bottom() + lastInFlowDisplayBox.marginAfter() - borderAndPaddingTop, { nonCollapsedMargin, collapsedMargin } };
     
    9292        // 3. the bottom border edge of the last in-flow child whose top margin doesn't collapse with the element's bottom margin
    9393        auto* inFlowChild = lastInFlowChild;
    94         while (inFlowChild && MarginCollapse::isMarginBeforeCollapsedWithParentMarginAfter(*inFlowChild))
     94        while (inFlowChild && MarginCollapse::marginBeforeCollapsesWithParentMarginAfter(*inFlowChild))
    9595            inFlowChild = inFlowChild->previousInFlowSibling();
    9696        if (inFlowChild) {
  • trunk/Source/WebCore/layout/blockformatting/BlockMarginCollapse.cpp

    r239206 r239267  
    9595}
    9696
    97 static bool isMarginBeforeCollapsedWithSibling(const Box& layoutBox)
     97LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBefore(const LayoutState& layoutState, const Box& layoutBox)
     98{
     99    ASSERT(layoutBox.isBlockLevelBox());
     100
     101    return computedNonCollapsedVerticalMarginValue(layoutState, layoutBox).before;
     102}
     103
     104LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginAfter(const LayoutState& layoutState, const Box& layoutBox)
     105{
     106    ASSERT(layoutBox.isBlockLevelBox());
     107
     108    return computedNonCollapsedVerticalMarginValue(layoutState, layoutBox).after;
     109}
     110
     111LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginBefore(const LayoutState& layoutState, const Box& layoutBox)
     112{
     113    ASSERT(layoutBox.isBlockLevelBox());
     114
     115    // Non collapsed margin top includes collapsed margin from inflow first child.
     116    return marginValue(computedNonCollapsedMarginBefore(layoutState, layoutBox), collapsedMarginBeforeFromFirstChild(layoutState, layoutBox));
     117}
     118
     119LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginAfter(const LayoutState& layoutState, const Box& layoutBox)
     120{
     121    ASSERT(layoutBox.isBlockLevelBox());
     122
     123    // Non collapsed margin bottom includes collapsed margin from inflow last child.
     124    return marginValue(computedNonCollapsedMarginAfter(layoutState, layoutBox), collapsedMarginAfterFromLastChild(layoutState, layoutBox));
     125}
     126
     127LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBeforeFromFirstChild(const LayoutState& layoutState, const Box& layoutBox)
     128{
     129    ASSERT(layoutBox.isBlockLevelBox());
     130
     131    // Check if the first child collapses its margin top.
     132    if (!is<Container>(layoutBox) || !downcast<Container>(layoutBox).hasInFlowChild())
     133        return 0;
     134
     135    // Do not collapse margin with a box from a non-block formatting context <div><span>foobar</span></div>.
     136    if (layoutBox.establishesFormattingContext() && !layoutBox.establishesBlockFormattingContextOnly())
     137        return 0;
     138
     139    // FIXME: Take collapsed through margin into account.
     140    auto& firstInFlowChild = *downcast<Container>(layoutBox).firstInFlowChild();
     141    if (!marginBeforeCollapsesWithParentMarginBefore(layoutState, firstInFlowChild))
     142        return 0;
     143    // Collect collapsed margin top recursively.
     144    return marginValue(computedNonCollapsedMarginBefore(layoutState, firstInFlowChild), collapsedMarginBeforeFromFirstChild(layoutState, firstInFlowChild));
     145}
     146
     147LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginAfterFromLastChild(const LayoutState& layoutState, const Box& layoutBox)
     148{
     149    ASSERT(layoutBox.isBlockLevelBox());
     150
     151    // Check if the last child propagates its margin bottom.
     152    if (!is<Container>(layoutBox) || !downcast<Container>(layoutBox).hasInFlowChild())
     153        return 0;
     154
     155    // Do not collapse margin with a box from a non-block formatting context <div><span>foobar</span></div>.
     156    if (layoutBox.establishesFormattingContext() && !layoutBox.establishesBlockFormattingContextOnly())
     157        return 0;
     158
     159    // FIXME: Check for collapsed through margin.
     160    auto& lastInFlowChild = *downcast<Container>(layoutBox).lastInFlowChild();
     161    if (!marginAfterCollapsesWithParentMarginAfter(lastInFlowChild))
     162        return 0;
     163
     164    // Collect collapsed margin bottom recursively.
     165    return marginValue(computedNonCollapsedMarginAfter(layoutState, lastInFlowChild), collapsedMarginAfterFromLastChild(layoutState, lastInFlowChild));
     166}
     167
     168bool BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter(const Box&)
     169{
     170    return false;
     171}
     172
     173bool BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore(const LayoutState& layoutState, const Box& layoutBox)
     174{
     175    // The first inflow child could propagate its top margin to parent.
     176    // https://www.w3.org/TR/CSS21/box.html#collapsing-margins
     177    if (layoutBox.isAnonymous())
     178        return false;
     179
     180    ASSERT(layoutBox.isBlockLevelBox());
     181
     182    if (layoutBox.isFloatingOrOutOfFlowPositioned())
     183        return false;
     184
     185    // Only the first inlflow child collapses with parent.
     186    if (layoutBox.previousInFlowSibling())
     187        return false;
     188
     189    auto& parent = *layoutBox.parent();
     190    // Margins of elements that establish new block formatting contexts do not collapse with their in-flow children
     191    if (establishesBlockFormattingContext(parent))
     192        return false;
     193
     194    if (hasBorderBefore(parent))
     195        return false;
     196
     197    if (hasPaddingBefore(parent))
     198        return false;
     199
     200    if (BlockFormattingContext::Quirks::shouldIgnoreMarginBefore(layoutState, layoutBox))
     201        return false;
     202
     203    return true;
     204}
     205
     206bool BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithParentMarginAfter(const Box& layoutBox)
     207{
     208    // last inflow box to parent.
     209    // https://www.w3.org/TR/CSS21/box.html#collapsing-margins
     210    if (layoutBox.isAnonymous())
     211        return false;
     212
     213    ASSERT(layoutBox.isBlockLevelBox());
     214
     215    if (layoutBox.isFloatingOrOutOfFlowPositioned())
     216        return false;
     217
     218    if (marginsCollapseThrough(layoutBox))
     219        return false;
     220
     221    // Only the last inlflow child collapses with parent.
     222    if (layoutBox.nextInFlowSibling())
     223        return false;
     224
     225    auto& parent = *layoutBox.parent();
     226    // Margins of elements that establish new block formatting contexts do not collapse with their in-flow children
     227    if (establishesBlockFormattingContext(parent))
     228        return false;
     229
     230    if (hasBorderBefore(parent))
     231        return false;
     232
     233    if (hasPaddingBefore(parent))
     234        return false;
     235
     236    if (!parent.style().height().isAuto())
     237        return false;
     238
     239    return true;
     240}
     241
     242bool BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithPreviousSibling(const Box& layoutBox)
    98243{
    99244    ASSERT(layoutBox.isBlockLevelBox());
     
    110255}
    111256
    112 static bool isMarginAfterCollapsedWithSibling(const Box& layoutBox)
     257bool BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithNextSibling(const Box& layoutBox)
    113258{
    114259    ASSERT(layoutBox.isBlockLevelBox());
     
    125270}
    126271
    127 bool BlockFormattingContext::Geometry::MarginCollapse::isMarginBeforeCollapsedWithParent(const LayoutState& layoutState, const Box& layoutBox)
    128 {
    129     // The first inflow child could propagate its top margin to parent.
    130     // https://www.w3.org/TR/CSS21/box.html#collapsing-margins
    131     if (layoutBox.isAnonymous())
    132         return false;
    133 
    134     ASSERT(layoutBox.isBlockLevelBox());
    135 
    136     if (layoutBox.isFloatingOrOutOfFlowPositioned())
    137         return false;
    138 
    139     // Only the first inlflow child collapses with parent.
    140     if (layoutBox.previousInFlowSibling())
    141         return false;
    142 
    143     auto& parent = *layoutBox.parent();
    144     // Margins of elements that establish new block formatting contexts do not collapse with their in-flow children
    145     if (establishesBlockFormattingContext(parent))
    146         return false;
    147 
    148     if (hasBorderBefore(parent))
    149         return false;
    150 
    151     if (hasPaddingBefore(parent))
    152         return false;
    153 
    154     if (BlockFormattingContext::Quirks::shouldIgnoreMarginBefore(layoutState, layoutBox))
    155         return false;
    156 
    157     return true;
    158 }
    159 
    160 static bool isMarginAfterCollapsedThrough(const Box& layoutBox)
     272bool BlockFormattingContext::Geometry::MarginCollapse::marginsCollapseThrough(const Box& layoutBox)
    161273{
    162274    ASSERT(layoutBox.isBlockLevelBox());
     
    182294}
    183295
    184 LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBeforeFromFirstChild(const LayoutState& layoutState, const Box& layoutBox)
    185 {
    186     ASSERT(layoutBox.isBlockLevelBox());
    187 
    188     // Check if the first child collapses its margin top.
    189     if (!is<Container>(layoutBox) || !downcast<Container>(layoutBox).hasInFlowChild())
    190         return 0;
    191 
    192     // Do not collapse margin with a box from a non-block formatting context <div><span>foobar</span></div>.
    193     if (layoutBox.establishesFormattingContext() && !layoutBox.establishesBlockFormattingContextOnly())
    194         return 0;
    195 
    196     // FIXME: Take collapsed through margin into account.
    197     auto& firstInFlowChild = *downcast<Container>(layoutBox).firstInFlowChild();
    198     if (!isMarginBeforeCollapsedWithParent(layoutState, firstInFlowChild))
    199         return 0;
    200     // Collect collapsed margin top recursively.
    201     return marginValue(computedNonCollapsedMarginBefore(layoutState, firstInFlowChild), collapsedMarginBeforeFromFirstChild(layoutState, firstInFlowChild));
    202 }
    203 
    204 LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginBefore(const LayoutState& layoutState, const Box& layoutBox)
    205 {
    206     ASSERT(layoutBox.isBlockLevelBox());
    207 
    208     // Non collapsed margin top includes collapsed margin from inflow first child.
    209     return marginValue(computedNonCollapsedMarginBefore(layoutState, layoutBox), collapsedMarginBeforeFromFirstChild(layoutState, layoutBox));
    210 }
    211 
    212 /*static bool hasAdjoiningMarginBeforeAndAfter(const Box&)
    213 {
    214     // Two margins are adjoining if and only if:
    215     // 1. both belong to in-flow block-level boxes that participate in the same block formatting context
    216     // 2. no line boxes, no clearance, no padding and no border separate them (Note that certain zero-height line boxes (see 9.4.2) are ignored for this purpose.)
    217     // 3. both belong to vertically-adjacent box edges, i.e. form one of the following pairs:
    218     //        top margin of a box and top margin of its first in-flow child
    219     //        bottom margin of box and top margin of its next in-flow following sibling
    220     //        bottom margin of a last in-flow child and bottom margin of its parent if the parent has 'auto' computed height
    221     //        top and bottom margins of a box that does not establish a new block formatting context and that has zero computed 'min-height',
    222     //        zero or 'auto' computed 'height', and no in-flow children
    223     // A collapsed margin is considered adjoining to another margin if any of its component margins is adjoining to that margin.
    224     return false;
    225 }*/
    226 LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBefore(const LayoutState& layoutState, const Box& layoutBox)
    227 {
    228     ASSERT(layoutBox.isBlockLevelBox());
    229 
    230     return computedNonCollapsedVerticalMarginValue(layoutState, layoutBox).before;
    231 }
    232 
    233 LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginAfter(const LayoutState& layoutState, const Box& layoutBox)
    234 {
    235     ASSERT(layoutBox.isBlockLevelBox());
    236 
    237     return computedNonCollapsedVerticalMarginValue(layoutState, layoutBox).after;
    238 }
    239 
    240296LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::marginBefore(const LayoutState& layoutState, const Box& layoutBox)
    241297{
     
    246302
    247303    // TODO: take _hasAdjoiningMarginBeforeAndAfter() into account.
    248     if (isMarginBeforeCollapsedWithParent(layoutState, layoutBox))
     304    if (marginBeforeCollapsesWithParentMarginBefore(layoutState, layoutBox))
    249305        return 0;
    250306
     
    253309        return 0;
    254310
    255     if (!isMarginBeforeCollapsedWithSibling(layoutBox)) {
    256         if (!isMarginAfterCollapsedThrough(layoutBox))
     311    if (!marginBeforeCollapsesWithPreviousSibling(layoutBox)) {
     312        if (!marginsCollapseThrough(layoutBox))
    257313            return nonCollapsedMarginBefore(layoutState, layoutBox);
    258314        // Compute the collapsed through value.
     
    281337
    282338    // TODO: take _hasAdjoiningMarginBeforeAndBottom() into account.
    283     if (isMarginAfterCollapsedWithParent(layoutBox))
    284         return 0;
    285 
    286     if (isMarginAfterCollapsedThrough(layoutBox))
     339    if (marginAfterCollapsesWithParentMarginAfter(layoutBox))
     340        return 0;
     341
     342    if (marginsCollapseThrough(layoutBox))
    287343        return 0;
    288344
    289345    // Floats and out of flow positioned boxes do not collapse their margins.
    290     if (!isMarginAfterCollapsedWithSibling(layoutBox))
     346    if (!marginAfterCollapsesWithNextSibling(layoutBox))
    291347        return nonCollapsedMarginAfter(layoutState, layoutBox);
    292348
     
    298354}
    299355
    300 bool BlockFormattingContext::Geometry::MarginCollapse::isMarginAfterCollapsedWithParent(const Box& layoutBox)
    301 {
    302     // last inflow box to parent.
    303     // https://www.w3.org/TR/CSS21/box.html#collapsing-margins
    304     if (layoutBox.isAnonymous())
    305         return false;
    306 
    307     ASSERT(layoutBox.isBlockLevelBox());
    308 
    309     if (layoutBox.isFloatingOrOutOfFlowPositioned())
    310         return false;
    311 
    312     if (isMarginAfterCollapsedThrough(layoutBox))
    313         return false;
    314 
    315     // Only the last inlflow child collapses with parent.
    316     if (layoutBox.nextInFlowSibling())
    317         return false;
    318 
    319     auto& parent = *layoutBox.parent();
    320     // Margins of elements that establish new block formatting contexts do not collapse with their in-flow children
    321     if (establishesBlockFormattingContext(parent))
    322         return false;
    323 
    324     if (hasBorderBefore(parent))
    325         return false;
    326 
    327     if (hasPaddingBefore(parent))
    328         return false;
    329 
    330     if (!parent.style().height().isAuto())
    331         return false;
    332 
    333     return true;
    334 }
    335 
    336 bool BlockFormattingContext::Geometry::MarginCollapse::isMarginBeforeCollapsedWithParentMarginAfter(const Box&)
    337 {
    338     return false;
    339 }
    340 
    341 LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginAfterFromLastChild(const LayoutState& layoutState, const Box& layoutBox)
    342 {
    343     ASSERT(layoutBox.isBlockLevelBox());
    344 
    345     // Check if the last child propagates its margin bottom.
    346     if (!is<Container>(layoutBox) || !downcast<Container>(layoutBox).hasInFlowChild())
    347         return 0;
    348 
    349     // Do not collapse margin with a box from a non-block formatting context <div><span>foobar</span></div>.
    350     if (layoutBox.establishesFormattingContext() && !layoutBox.establishesBlockFormattingContextOnly())
    351         return 0;
    352 
    353     // FIXME: Check for collapsed through margin.
    354     auto& lastInFlowChild = *downcast<Container>(layoutBox).lastInFlowChild();
    355     if (!isMarginAfterCollapsedWithParent(lastInFlowChild))
    356         return 0;
    357 
    358     // Collect collapsed margin bottom recursively.
    359     return marginValue(computedNonCollapsedMarginAfter(layoutState, lastInFlowChild), collapsedMarginAfterFromLastChild(layoutState, lastInFlowChild));
    360 }
    361 
    362 LayoutUnit BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginAfter(const LayoutState& layoutState, const Box& layoutBox)
    363 {
    364     ASSERT(layoutBox.isBlockLevelBox());
    365 
    366     // Non collapsed margin bottom includes collapsed margin from inflow last child.
    367     return marginValue(computedNonCollapsedMarginAfter(layoutState, layoutBox), collapsedMarginAfterFromLastChild(layoutState, layoutBox));
    368 }
    369 
    370356}
    371357}
Note: See TracChangeset for help on using the changeset viewer.