Changeset 249590 in webkit


Ignore:
Timestamp:
Sep 6, 2019 1:51:21 PM (5 years ago)
Author:
Alan Bujtas
Message:

[LFC] A formatting context root is always a containing block for relative: static boxes.
https://bugs.webkit.org/show_bug.cgi?id=201554
<rdar://problem/55123295>

Reviewed by Antti Koivisto.

"For other elements, if the element's position is 'relative' or 'static', the containing block is formed by the content
edge of the nearest ancestor box that is a block container or which establishes a formatting context."

  • layout/layouttree/LayoutBox.cpp:

(WebCore::Layout::Box::containingBlock const):

  • page/FrameViewLayoutContext.cpp:

(WebCore::layoutUsingFormattingContext):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r249583 r249590  
     12019-09-06  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC] A formatting context root is always a containing block for relative: static boxes.
     4        https://bugs.webkit.org/show_bug.cgi?id=201554
     5        <rdar://problem/55123295>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        "For other elements, if the element's position is 'relative' or 'static', the containing block is formed by the content
     10        edge of the nearest ancestor box that is a block container or which establishes a formatting context."
     11
     12        * layout/layouttree/LayoutBox.cpp:
     13        (WebCore::Layout::Box::containingBlock const):
     14        * page/FrameViewLayoutContext.cpp:
     15        (WebCore::layoutUsingFormattingContext):
     16
    1172019-09-06  Sihui Liu  <sihui_liu@apple.com>
    218
  • trunk/Source/WebCore/layout/layouttree/LayoutBox.cpp

    r249288 r249590  
    189189    // The containing block in which the root element lives is a rectangle called the initial containing block.
    190190    // For other elements, if the element's position is 'relative' or 'static', the containing block is formed by the
    191     // content edge of the nearest block container ancestor box.
     191    // content edge of the nearest block container ancestor box or which establishes a formatting context.
    192192    // If the element has 'position: fixed', the containing block is established by the viewport
    193193    // If the element has 'position: absolute', the containing block is established by the nearest ancestor with a
     
    197197
    198198    if (!isPositioned() || isInFlowPositioned()) {
    199         auto* nearestBlockContainer = parent();
    200         for (; nearestBlockContainer->parent() && !nearestBlockContainer->isBlockContainerBox(); nearestBlockContainer = nearestBlockContainer->parent()) { }
    201         return nearestBlockContainer;
     199        for (auto* nearestBlockContainerOrFormattingContextRoot = parent(); nearestBlockContainerOrFormattingContextRoot; nearestBlockContainerOrFormattingContextRoot = nearestBlockContainerOrFormattingContextRoot->parent()) {
     200            if (nearestBlockContainerOrFormattingContextRoot->isBlockContainerBox() || nearestBlockContainerOrFormattingContextRoot->establishesFormattingContext())
     201                return nearestBlockContainerOrFormattingContextRoot;
     202        }
     203        // We should always manage to find the ICB.
     204        ASSERT_NOT_REACHED();
     205        return nullptr;
    202206    }
    203207
Note: See TracChangeset for help on using the changeset viewer.