Changeset 267059 in webkit


Ignore:
Timestamp:
Sep 14, 2020 5:40:18 PM (4 years ago)
Author:
Alan Bujtas
Message:

[LFC][FFC] Block box flex items establish block formatting contexts
https://bugs.webkit.org/show_bug.cgi?id=216502

Reviewed by Simon Fraser.

  1. The display value of a flex item is blockified: if the specified display of an in-flow child of an element generating a flex container is an inline-level value, it computes to its block-level equivalent.
  2. A block box that establishes an independent formatting context establishes a new block formatting context for its contents.
  • layout/layouttree/LayoutBox.cpp:

(WebCore::Layout::Box::establishesBlockFormattingContext const):
(WebCore::Layout::Box::isBlockBox const):

  • layout/layouttree/LayoutBox.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r267057 r267059  
     12020-09-14  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC][FFC] Block box flex items establish block formatting contexts
     4        https://bugs.webkit.org/show_bug.cgi?id=216502
     5
     6        Reviewed by Simon Fraser.
     7
     8        1. The display value of a flex item is blockified: if the specified display of an in-flow child of an element
     9           generating a flex container is an inline-level value, it computes to its block-level equivalent.
     10        2. A block box that establishes an independent formatting context establishes a new block formatting context for its contents.
     11
     12        * layout/layouttree/LayoutBox.cpp:
     13        (WebCore::Layout::Box::establishesBlockFormattingContext const):
     14        (WebCore::Layout::Box::isBlockBox const):
     15        * layout/layouttree/LayoutBox.h:
     16
    1172020-09-14  Jer Noble  <jer.noble@apple.com>
    218
  • trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp

    r267054 r267059  
    8282        return true;
    8383
     84    // A block box that establishes an independent formatting context establishes a new block formatting context for its contents.
     85    if (isBlockBox() && establishesIndependentFormattingContext())
     86        return true;
     87
    8488    // 9.4.1 Block formatting contexts
    8589    // Floats, absolutely positioned elements, block containers (such as inline-blocks, table-cells, and table-captions)
    8690    // that are not block boxes, and block boxes with 'overflow' other than 'visible' (except when that value has been propagated to the viewport)
    8791    // establish new block formatting contexts for their contents.
    88     if (isFloatingPositioned() || isAbsolutelyPositioned()) {
     92    if (isFloatingPositioned()) {
    8993        // Not all floating or out-of-positioned block level boxes establish BFC.
    9094        // See [9.7 Relationships between 'display', 'position', and 'float'] for details.
     
    9296    }
    9397
    94     if (isBlockContainerBox() && !isBlockLevelBox())
     98    if (isBlockContainer() && !isBlockLevelBox())
    9599        return true;
    96100
     
    105109    // 9.4.2 Inline formatting contexts
    106110    // An inline formatting context is established by a block container box that contains no block-level boxes.
    107     if (!isBlockContainerBox())
     111    if (!isBlockContainer())
    108112        return false;
    109113
     
    205209        auto* ancestor = &parent();
    206210        for (; !is<InitialContainingBlock>(*ancestor); ancestor = &ancestor->parent()) {
    207             if (ancestor->isBlockContainerBox() || ancestor->establishesFormattingContext())
     211            if (ancestor->isBlockContainer() || ancestor->establishesFormattingContext())
    208212                return *ancestor;
    209213        }
     
    295299}
    296300
     301bool Box::isBlockBox() const
     302{
     303    // A block-level box that is also a block container.
     304    return isBlockLevelBox() && isBlockContainer();
     305}
     306
    297307bool Box::isInlineLevelBox() const
    298308{
     
    322332}
    323333
    324 bool Box::isBlockContainerBox() const
     334bool Box::isBlockContainer() const
    325335{
    326336    auto display = m_style.display();
  • trunk/Source/WebCore/layout/layouttree/LayoutBox.h

    r267054 r267059  
    102102    bool isAnonymous() const { return m_isAnonymous; }
    103103
     104    // Block level elements generate block level boxes.
    104105    bool isBlockLevelBox() const;
     106    // A block-level box that is also a block container.
     107    bool isBlockBox() const;
     108    // A block-level box is also a block container box unless it is a table box or the principal box of a replaced element.
     109    bool isBlockContainer() const;
    105110    bool isInlineLevelBox() const;
    106111    bool isInlineBox() const;
     
    108113    bool isInlineBlockBox() const;
    109114    bool isInlineTableBox() const;
    110     bool isBlockContainerBox() const;
    111115    bool isInitialContainingBlock() const { return baseTypeFlags().contains(InitialContainingBlockFlag); }
    112116
Note: See TracChangeset for help on using the changeset viewer.