Changeset 270198 in webkit


Ignore:
Timestamp:
Nov 27, 2020, 9:45:58 AM (5 years ago)
Author:
Simon Fraser
Message:

[LFC Display] A ContainerBox can establish an inline formatting context and have box children
https://bugs.webkit.org/show_bug.cgi?id=218736

Reviewed by Zalan Bujtas.

If a layout box establishes an inline formatting context, then the only descendant container
boxes that we should make display boxes for while traversing non-inline descendants
are those which are out of flow.

  • display/DisplayTreeBuilder.cpp:

(WebCore::Display::TreeBuilder::recursiveBuildDisplayTree const):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r270197 r270198  
     12020-11-27  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [LFC Display] A ContainerBox can establish an inline formatting context and have box children
     4        https://bugs.webkit.org/show_bug.cgi?id=218736
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        If a layout box establishes an inline formatting context, then the only descendant container
     9        boxes that we should make display boxes for while traversing non-inline descendants
     10        are those which are out of flow.
     11
     12        * display/DisplayTreeBuilder.cpp:
     13        (WebCore::Display::TreeBuilder::recursiveBuildDisplayTree const):
     14
    1152020-11-27  Adrian Perez de Castro  <aperez@igalia.com>
    216
  • trunk/Source/WebCore/display/DisplayTreeBuilder.cpp

    r269822 r270198  
    142142
    143143    auto positionForChildren = InsertionPosition { downcast<ContainerBox>(*insertionPosition.currentChild) };
    144    
     144
     145    enum class DescendantBoxInclusion { AllBoxes, OutOfFlowOnly };
     146    auto boxInclusion = DescendantBoxInclusion::AllBoxes;
     147
    145148    if (layoutContainerBox.establishesInlineFormattingContext()) {
    146149        buildInlineDisplayTree(layoutState, offsetFromRoot, downcast<Layout::ContainerBox>(layoutContainerBox), positionForChildren);
    147         return;
    148     }
     150        boxInclusion = DescendantBoxInclusion::OutOfFlowOnly;
     151    }
     152
     153    auto includeBox = [](DescendantBoxInclusion boxInclusion, const Layout::Box& box) {
     154        switch (boxInclusion) {
     155        case DescendantBoxInclusion::AllBoxes: return true;
     156        case DescendantBoxInclusion::OutOfFlowOnly: return !box.isInFlow();
     157        }
     158        return false;
     159    };
    149160
    150161    for (auto& child : Layout::childrenOfType<Layout::Box>(layoutContainerBox)) {
    151         if (layoutState.hasBoxGeometry(child))
     162        if (includeBox(boxInclusion, child) && layoutState.hasBoxGeometry(child))
    152163            recursiveBuildDisplayTree(layoutState, offsetFromRoot, child, positionForChildren);
    153164    }
Note: See TracChangeset for help on using the changeset viewer.