Skip to content

Commit

Permalink
[LFC] Add ElementBox::hasOutOfFlowChild
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=260805

Reviewed by Antti Koivisto.

This is in preparation for out-of-flow box static position (we need to know if the IFC should need to run inflow layout).

* Source/WebCore/layout/layouttree/LayoutElementBox.cpp:
(WebCore::Layout::ElementBox::hasOutOfFlowChild const):
* Source/WebCore/layout/layouttree/LayoutElementBox.h:

Canonical link: https://commits.webkit.org/267397@main
  • Loading branch information
alanbaradlay committed Aug 29, 2023
1 parent 07db150 commit da7c3de
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ InlineLayoutResult InlineFormattingContext::layoutInFlowAndFloatContent(const Co
{
auto& floatingState = inlineLayoutState.parentBlockLayoutState().floatingState();
if (!root().hasInFlowChild()) {
// Float and/or out-of-flow only content does not support partial layout.
// Float only content does not support partial layout.
ASSERT(!lineDamage);
layoutFloatContentOnly(constraints, floatingState);
return { { }, InlineLayoutResult::Range::Full };
Expand Down Expand Up @@ -239,13 +239,6 @@ void InlineFormattingContext::layoutFloatContentOnly(const ConstraintsForInlineC
floatingState.append(floatingContext.toFloatItem(floatBox, floatBoxGeometry));
continue;
}
if (inlineItem.isOpaque()) {
auto& opaqueBox = inlineItem.layoutBox();
if (opaqueBox.isOutOfFlowPositioned()) {
// FIXME: set the static position.
continue;
}
}
ASSERT_NOT_REACHED();
}
}
Expand Down
9 changes: 9 additions & 0 deletions Source/WebCore/layout/layouttree/LayoutElementBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ const Box* ElementBox::lastInFlowOrFloatingChild() const
return nullptr;
}

bool ElementBox::hasOutOfFlowChild() const
{
for (auto* child = this->firstChild(); child; child = child->nextSibling()) {
if (child->isOutOfFlowPositioned())
return true;
}
return false;
}

void ElementBox::appendChild(UniqueRef<Box> childRef)
{
insertChild(WTFMove(childRef), m_lastChild.get());
Expand Down
1 change: 1 addition & 0 deletions Source/WebCore/layout/layouttree/LayoutElementBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class ElementBox : public Box {
bool hasChild() const { return firstChild(); }
bool hasInFlowChild() const { return firstInFlowChild(); }
bool hasInFlowOrFloatingChild() const { return firstInFlowOrFloatingChild(); }
bool hasOutOfFlowChild() const;

void appendChild(UniqueRef<Box>);
void insertChild(UniqueRef<Box>, Box* beforeChild = nullptr);
Expand Down

0 comments on commit da7c3de

Please sign in to comment.