Diff
Modified: trunk/Source/WebCore/ChangeLog (249440 => 249441)
--- trunk/Source/WebCore/ChangeLog 2019-09-03 19:55:11 UTC (rev 249440)
+++ trunk/Source/WebCore/ChangeLog 2019-09-03 20:05:49 UTC (rev 249441)
@@ -1,5 +1,51 @@
2019-09-03 Zalan Bujtas <za...@apple.com>
+ [LFC][Floating] Replace all LayoutState::displayBoxForLayoutBox() calls with FormattingContext::displayBoxForLayoutBox()
+ https://bugs.webkit.org/show_bug.cgi?id=201414
+ <rdar://problem/54963302>
+
+ Reviewed by Antti Koivisto.
+
+ Fix the final LayoutState::displayBoxForLayoutBox() callsites. Now all displayBoxForLayoutBox() calls are directed to the
+ established FormattingContext.
+
+ * layout/FormattingContext.cpp:
+ (WebCore::Layout::mapHorizontalPositionToAncestor):
+ (WebCore::Layout::FormattingContext::mapLeftToAncestor const):
+ (WebCore::Layout::FormattingContext::mapRightToAncestor const):
+ (WebCore::Layout::FormattingContext::mapBoxToAncestor const):
+ (WebCore::Layout::FormattingContext::mapTopToAncestor const):
+ (WebCore::Layout::FormattingContext::mapPointToAncestor const):
+ (WebCore::Layout::FormattingContext::mapPointToDescendent const):
+ (WebCore::Layout::FormattingContext::mapLeftToAncestor): Deleted.
+ (WebCore::Layout::FormattingContext::mapRightToAncestor): Deleted.
+ (WebCore::Layout::FormattingContext::mapBoxToAncestor): Deleted.
+ (WebCore::Layout::FormattingContext::mapTopToAncestor): Deleted.
+ (WebCore::Layout::FormattingContext::mapPointToAncestor): Deleted.
+ (WebCore::Layout::FormattingContext::mapPointToDescendent): Deleted.
+ * layout/FormattingContext.h:
+ (WebCore::Layout::FormattingContext::root const):
+ (WebCore::Layout::FormattingContext::formattingState const):
+ * layout/blockformatting/BlockFormattingContext.cpp:
+ (WebCore::Layout::BlockFormattingContext::layout):
+ (WebCore::Layout::BlockFormattingContext::usedAvailableWidthForFloatAvoider const):
+ * layout/floats/FloatingContext.cpp:
+ (WebCore::Layout::mapToFormattingContextRoot):
+ (WebCore::Layout::FloatingContext::FloatingContext):
+ (WebCore::Layout::FloatingContext::positionForFloat const):
+ (WebCore::Layout::FloatingContext::positionForFormattingContextRoot const):
+ (WebCore::Layout::FloatingContext::verticalPositionWithClearance const):
+ (WebCore::Layout::FloatingContext::constraints const):
+ (WebCore::Layout::FloatingContext::append):
+ * layout/floats/FloatingContext.h:
+ (WebCore::Layout::FloatingContext::formattingContext const):
+ (WebCore::Layout::FloatingContext::root const):
+ * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
+ (WebCore::Layout::InlineFormattingContext::InlineLayout::layout const):
+ (WebCore::Layout::InlineFormattingContext::InlineLayout::createDisplayRuns const):
+
+2019-09-03 Zalan Bujtas <za...@apple.com>
+
[LFC] FloatingState should not need to query for display boxes.
https://bugs.webkit.org/show_bug.cgi?id=201408
<rdar://problem/54958348>
Modified: trunk/Source/WebCore/layout/FormattingContext.cpp (249440 => 249441)
--- trunk/Source/WebCore/layout/FormattingContext.cpp 2019-09-03 19:55:11 UTC (rev 249440)
+++ trunk/Source/WebCore/layout/FormattingContext.cpp 2019-09-03 20:05:49 UTC (rev 249441)
@@ -148,7 +148,7 @@
LOG_WITH_STREAM(FormattingContextLayout, stream << "End: layout out-of-flow content -> context: " << &layoutState() << " root: " << &root());
}
-static LayoutUnit mapHorizontalPositionToAncestor(const LayoutState& layoutState, LayoutUnit horizontalPosition, const Container& containingBlock, const Container& ancestor)
+static LayoutUnit mapHorizontalPositionToAncestor(const FormattingContext& formattingContext, LayoutUnit horizontalPosition, const Container& containingBlock, const Container& ancestor)
{
// "horizontalPosition" is in the coordinate system of the "containingBlock". -> map from containingBlock to ancestor.
if (&containingBlock == &ancestor)
@@ -155,30 +155,30 @@
return horizontalPosition;
ASSERT(containingBlock.isContainingBlockDescendantOf(ancestor));
for (auto* container = &containingBlock; container && container != &ancestor; container = container->containingBlock())
- horizontalPosition += layoutState.displayBoxForLayoutBox(*container).left();
+ horizontalPosition += formattingContext.displayBoxForLayoutBox(*container).left();
return horizontalPosition;
}
// FIXME: turn these into templates.
-LayoutUnit FormattingContext::mapLeftToAncestor(const LayoutState& layoutState, const Box& layoutBox, const Container& ancestor)
+LayoutUnit FormattingContext::mapLeftToAncestor(const Box& layoutBox, const Container& ancestor) const
{
ASSERT(layoutBox.containingBlock());
- return mapHorizontalPositionToAncestor(layoutState, layoutState.displayBoxForLayoutBox(layoutBox).left(), *layoutBox.containingBlock(), ancestor);
+ return mapHorizontalPositionToAncestor(*this, displayBoxForLayoutBox(layoutBox).left(), *layoutBox.containingBlock(), ancestor);
}
-LayoutUnit FormattingContext::mapRightToAncestor(const LayoutState& layoutState, const Box& layoutBox, const Container& ancestor)
+LayoutUnit FormattingContext::mapRightToAncestor(const Box& layoutBox, const Container& ancestor) const
{
ASSERT(layoutBox.containingBlock());
- return mapHorizontalPositionToAncestor(layoutState, layoutState.displayBoxForLayoutBox(layoutBox).right(), *layoutBox.containingBlock(), ancestor);
+ return mapHorizontalPositionToAncestor(*this, displayBoxForLayoutBox(layoutBox).right(), *layoutBox.containingBlock(), ancestor);
}
-Display::Box FormattingContext::mapBoxToAncestor(const LayoutState& layoutState, const Box& layoutBox, const Container& ancestor)
+Display::Box FormattingContext::mapBoxToAncestor(const Box& layoutBox, const Container& ancestor) const
{
ASSERT(layoutBox.isContainingBlockDescendantOf(ancestor));
- auto& displayBox = layoutState.displayBoxForLayoutBox(layoutBox);
+ auto& displayBox = displayBoxForLayoutBox(layoutBox);
auto topLeft = displayBox.topLeft();
for (auto* containingBlock = layoutBox.containingBlock(); containingBlock && containingBlock != &ancestor; containingBlock = containingBlock->containingBlock())
- topLeft.moveBy(layoutState.displayBoxForLayoutBox(*containingBlock).topLeft());
+ topLeft.moveBy(displayBoxForLayoutBox(*containingBlock).topLeft());
auto mappedDisplayBox = Display::Box(displayBox);
mappedDisplayBox.setTopLeft(topLeft);
@@ -185,16 +185,16 @@
return mappedDisplayBox;
}
-LayoutUnit FormattingContext::mapTopToAncestor(const LayoutState& layoutState, const Box& layoutBox, const Container& ancestor)
+LayoutUnit FormattingContext::mapTopToAncestor(const Box& layoutBox, const Container& ancestor) const
{
ASSERT(layoutBox.isContainingBlockDescendantOf(ancestor));
- auto top = layoutState.displayBoxForLayoutBox(layoutBox).top();
+ auto top = displayBoxForLayoutBox(layoutBox).top();
for (auto* container = layoutBox.containingBlock(); container && container != &ancestor; container = container->containingBlock())
- top += layoutState.displayBoxForLayoutBox(*container).top();
+ top += displayBoxForLayoutBox(*container).top();
return top;
}
-Point FormattingContext::mapPointToAncestor(const LayoutState& layoutState, Point position, const Container& from, const Container& to)
+Point FormattingContext::mapPointToAncestor(Point position, const Container& from, const Container& to) const
{
if (&from == &to)
return position;
@@ -201,11 +201,11 @@
ASSERT(from.isContainingBlockDescendantOf(to));
auto mappedPosition = position;
for (auto* container = &from; container && container != &to; container = container->containingBlock())
- mappedPosition.moveBy(layoutState.displayBoxForLayoutBox(*container).topLeft());
+ mappedPosition.moveBy(displayBoxForLayoutBox(*container).topLeft());
return mappedPosition;
}
-Point FormattingContext::mapPointToDescendent(const LayoutState& layoutState, Point point, const Container& from, const Container& to)
+Point FormattingContext::mapPointToDescendent(Point point, const Container& from, const Container& to) const
{
// "point" is in the coordinate system of the "from" container.
if (&from == &to)
@@ -212,7 +212,7 @@
return point;
ASSERT(to.isContainingBlockDescendantOf(from));
for (auto* container = &to; container && container != &from; container = container->containingBlock())
- point.moveBy(-layoutState.displayBoxForLayoutBox(*container).topLeft());
+ point.moveBy(displayBoxForLayoutBox(*container).topLeft());
return point;
}
Modified: trunk/Source/WebCore/layout/FormattingContext.h (249440 => 249441)
--- trunk/Source/WebCore/layout/FormattingContext.h 2019-09-03 19:55:11 UTC (rev 249440)
+++ trunk/Source/WebCore/layout/FormattingContext.h 2019-09-03 20:05:49 UTC (rev 249441)
@@ -61,12 +61,12 @@
};
virtual IntrinsicWidthConstraints computedIntrinsicWidthConstraints() = 0;
- static Display::Box mapBoxToAncestor(const LayoutState&, const Box&, const Container& ancestor);
- static LayoutUnit mapTopToAncestor(const LayoutState&, const Box&, const Container& ancestor);
- static LayoutUnit mapLeftToAncestor(const LayoutState&, const Box&, const Container& ancestor);
- static LayoutUnit mapRightToAncestor(const LayoutState&, const Box&, const Container& ancestor);
- static Point mapPointToAncestor(const LayoutState&, Point, const Container& from, const Container& to);
- static Point mapPointToDescendent(const LayoutState&, Point, const Container& from, const Container& to);
+ Display::Box mapBoxToAncestor(const Box&, const Container& ancestor) const;
+ LayoutUnit mapTopToAncestor(const Box&, const Container& ancestor) const;
+ LayoutUnit mapLeftToAncestor(const Box&, const Container& ancestor) const;
+ LayoutUnit mapRightToAncestor(const Box&, const Container& ancestor) const;
+ Point mapPointToAncestor(Point, const Container& from, const Container& to) const;
+ Point mapPointToDescendent(Point, const Container& from, const Container& to) const;
bool isBlockFormattingContext() const { return root().establishesBlockFormattingContext(); }
bool isInlineFormattingContext() const { return root().establishesInlineFormattingContext(); }
@@ -75,12 +75,13 @@
Display::Box& displayBoxForLayoutBox(const Box& layoutBox) const { return layoutState().displayBoxForLayoutBox(layoutBox); }
bool hasDisplayBox(const Box& layoutBox) const { return layoutState().hasDisplayBox(layoutBox); }
+ const Box& root() const { return *m_root; }
+
protected:
using LayoutQueue = Vector<const Box*>;
LayoutState& layoutState() const;
FormattingState& formattingState() const { return m_formattingState; }
- const Box& root() const { return *m_root; }
void computeBorderAndPadding(const Box&, Optional<UsedHorizontalValues> = WTF::nullopt);
Modified: trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp (249440 => 249441)
--- trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2019-09-03 19:55:11 UTC (rev 249440)
+++ trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp 2019-09-03 20:05:49 UTC (rev 249441)
@@ -62,7 +62,7 @@
auto& formattingRoot = downcast<Container>(root());
LayoutQueue layoutQueue;
- auto floatingContext = FloatingContext { formattingRoot, formattingState().floatingState() };
+ auto floatingContext = FloatingContext { *this, formattingState().floatingState() };
// This is a post-order tree traversal layout.
// The root container layout is done in the formatting context it lives in, not that one it creates, so let's start with the first child.
if (auto* firstChild = formattingRoot.firstInFlowOrFloatingChild())
@@ -127,7 +127,7 @@
return { };
// Vertical static position is not computed yet, so let's just estimate it for now.
auto& formattingRoot = downcast<Container>(root());
- auto verticalPosition = FormattingContext::mapTopToAncestor(layoutState(), layoutBox, formattingRoot);
+ auto verticalPosition = mapTopToAncestor(layoutBox, formattingRoot);
auto constraints = floatingContext.constraints({ verticalPosition });
if (!constraints.left && !constraints.right)
return { };
@@ -139,8 +139,8 @@
LayoutUnit containingBlockRight = containingBlockDisplayBox.right();
if (&containingBlock != &formattingRoot) {
// Move containing block left/right to the root's coordinate system.
- containingBlockLeft = FormattingContext::mapLeftToAncestor(layoutState(), containingBlock, formattingRoot);
- containingBlockRight = FormattingContext::mapRightToAncestor(layoutState(), containingBlock, formattingRoot);
+ containingBlockLeft = mapLeftToAncestor(containingBlock, formattingRoot);
+ containingBlockRight = mapRightToAncestor(containingBlock, formattingRoot);
}
auto containingBlockContentBoxLeft = containingBlockLeft + containingBlockDisplayBox.borderLeft() + containingBlockDisplayBox.paddingLeft().valueOr(0);
auto containingBlockContentBoxRight = containingBlockRight - containingBlockDisplayBox.borderRight() + containingBlockDisplayBox.paddingRight().valueOr(0);
Modified: trunk/Source/WebCore/layout/floats/FloatingContext.cpp (249440 => 249441)
--- trunk/Source/WebCore/layout/floats/FloatingContext.cpp 2019-09-03 19:55:11 UTC (rev 249440)
+++ trunk/Source/WebCore/layout/floats/FloatingContext.cpp 2019-09-03 20:05:49 UTC (rev 249441)
@@ -155,22 +155,22 @@
LayoutPoint containingBlockTopLeft;
HorizontalEdges containingBlockContentBox;
};
-static AbsoluteCoordinateValuesForFloatAvoider mapToFormattingContextRoot(const Box& layoutBox, const Container& formattingContextRoot, const LayoutState& layoutState)
+static AbsoluteCoordinateValuesForFloatAvoider mapToFormattingContextRoot(const Box& layoutBox, const Container& formattingContextRoot, const FormattingContext& formattingContext)
{
auto& containingBlock = *layoutBox.containingBlock();
- auto displayBox = FormattingContext::mapBoxToAncestor(layoutState, layoutBox, formattingContextRoot);
+ auto displayBox = formattingContext.mapBoxToAncestor(layoutBox, formattingContextRoot);
if (&containingBlock == &formattingContextRoot) {
- auto containingBlockDisplayBox = layoutState.displayBoxForLayoutBox(containingBlock);
+ auto containingBlockDisplayBox = formattingContext.displayBoxForLayoutBox(containingBlock);
return { displayBox, { }, { containingBlockDisplayBox.contentBoxLeft(), containingBlockDisplayBox.contentBoxRight() } };
}
- auto containingBlockAbsoluteDisplayBox = FormattingContext::mapBoxToAncestor(layoutState, containingBlock, formattingContextRoot);
+ auto containingBlockAbsoluteDisplayBox = formattingContext.mapBoxToAncestor(containingBlock, formattingContextRoot);
auto containingBlockLeft = containingBlockAbsoluteDisplayBox.left();
return { displayBox, containingBlockAbsoluteDisplayBox.topLeft(), { containingBlockLeft + containingBlockAbsoluteDisplayBox.contentBoxLeft(), containingBlockLeft + containingBlockAbsoluteDisplayBox.contentBoxRight() } };
}
-FloatingContext::FloatingContext(const Container& formattingContextRoot, FloatingState& floatingState)
- : m_root(makeWeakPtr(formattingContextRoot))
+FloatingContext::FloatingContext(const FormattingContext& formattingContext, FloatingState& floatingState)
+ : m_formattingContext(formattingContext)
, m_floatingState(floatingState)
{
}
@@ -181,11 +181,11 @@
ASSERT(areFloatsHorizontallySorted(m_floatingState));
if (isEmpty()) {
- auto& displayBox = layoutState().displayBoxForLayoutBox(layoutBox);
+ auto& displayBox = formattingContext().displayBoxForLayoutBox(layoutBox);
auto alignWithContainingBlock = [&]() -> Position {
// If there is no floating to align with, push the box to the left/right edge of its containing block's content box.
- auto& containingBlockDisplayBox = layoutState().displayBoxForLayoutBox(*layoutBox.containingBlock());
+ auto& containingBlockDisplayBox = formattingContext().displayBoxForLayoutBox(*layoutBox.containingBlock());
if (layoutBox.isLeftFloatingPositioned())
return Position { containingBlockDisplayBox.contentBoxLeft() + displayBox.marginStart() };
@@ -198,7 +198,7 @@
}
// Find the top most position where the float box fits.
- auto absoluteDisplayBoxCoordinates = mapToFormattingContextRoot(layoutBox, downcast<Container>(m_floatingState.root()), layoutState());
+ auto absoluteDisplayBoxCoordinates = mapToFormattingContextRoot(layoutBox, downcast<Container>(m_floatingState.root()), formattingContext());
Optional<LayoutUnit> previousFloatAbsoluteTop;
if (!isEmpty())
@@ -218,7 +218,7 @@
if (isEmpty())
return { };
- auto absoluteDisplayBoxCoordinates = mapToFormattingContextRoot(layoutBox, downcast<Container>(m_floatingState.root()), layoutState());
+ auto absoluteDisplayBoxCoordinates = mapToFormattingContextRoot(layoutBox, downcast<Container>(m_floatingState.root()), formattingContext());
auto floatAvoider = FloatAvoider { layoutBox, absoluteDisplayBoxCoordinates.displayBox, absoluteDisplayBoxCoordinates.containingBlockTopLeft, absoluteDisplayBoxCoordinates.containingBlockContentBox };
findPositionForFormattingContextRoot(floatAvoider);
return { floatAvoider.rectInContainingBlock().topLeft() };
@@ -243,8 +243,7 @@
//
// 1. The amount necessary to place the border edge of the block even with the bottom outer edge of the lowest float that is to be cleared.
// 2. The amount necessary to place the top border edge of the block at its hypothetical position.
- auto& layoutState = this->layoutState();
- auto rootRelativeTop = FormattingContext::mapTopToAncestor(layoutState, layoutBox, downcast<Container>(m_floatingState.root()));
+ auto rootRelativeTop = formattingContext().mapTopToAncestor(layoutBox, downcast<Container>(m_floatingState.root()));
auto clearance = *floatBottom - rootRelativeTop;
if (clearance <= 0)
return { };
@@ -252,9 +251,9 @@
// Clearance inhibits margin collapsing.
if (auto* previousInFlowSibling = layoutBox.previousInFlowSibling()) {
// Does this box with clearance actually collapse its margin before with the previous inflow box's margin after?
- auto verticalMargin = layoutState.displayBoxForLayoutBox(layoutBox).verticalMargin();
+ auto verticalMargin = formattingContext().displayBoxForLayoutBox(layoutBox).verticalMargin();
if (verticalMargin.hasCollapsedValues() && verticalMargin.collapsedValues().before) {
- auto previousVerticalMargin = layoutState.displayBoxForLayoutBox(*previousInFlowSibling).verticalMargin();
+ auto previousVerticalMargin = formattingContext().displayBoxForLayoutBox(*previousInFlowSibling).verticalMargin();
auto collapsedMargin = *verticalMargin.collapsedValues().before;
auto nonCollapsedMargin = previousVerticalMargin.after() + verticalMargin.before();
auto marginDifference = nonCollapsedMargin - collapsedMargin;
@@ -272,7 +271,7 @@
if (layoutBox.containingBlock() == &m_floatingState.root())
return { Position { rootRelativeTop }, clearance };
- auto containingBlockRootRelativeTop = FormattingContext::mapTopToAncestor(layoutState, *layoutBox.containingBlock(), downcast<Container>(m_floatingState.root()));
+ auto containingBlockRootRelativeTop = formattingContext().mapTopToAncestor(*layoutBox.containingBlock(), downcast<Container>(m_floatingState.root()));
return { Position { rootRelativeTop - containingBlockRootRelativeTop }, clearance };
};
@@ -303,7 +302,7 @@
LayoutSize adjustingDelta;
if (coordinateMappingIsRequired) {
- adjustedPosition = FormattingContext::mapPointToAncestor(layoutState(), adjustedPosition, root(), downcast<Container>(floatingState().root()));
+ adjustedPosition = formattingContext().mapPointToAncestor(adjustedPosition, root(), downcast<Container>(floatingState().root()));
adjustingDelta = { adjustedPosition.x, adjustedPosition.y - verticalPosition };
}
@@ -343,7 +342,7 @@
void FloatingContext::append(const Box& floatBox)
{
- floatingState().append(FloatingState::FloatItem { floatBox, FormattingContext::mapBoxToAncestor(layoutState(), floatBox, downcast<Container>(floatingState().root())) });
+ floatingState().append(FloatingState::FloatItem { floatBox, formattingContext().mapBoxToAncestor(floatBox, downcast<Container>(floatingState().root())) });
}
void FloatingContext::remove(const Box& floatBox)
Modified: trunk/Source/WebCore/layout/floats/FloatingContext.h (249440 => 249441)
--- trunk/Source/WebCore/layout/floats/FloatingContext.h 2019-09-03 19:55:11 UTC (rev 249440)
+++ trunk/Source/WebCore/layout/floats/FloatingContext.h 2019-09-03 20:05:49 UTC (rev 249441)
@@ -28,6 +28,8 @@
#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
#include "FloatingState.h"
+#include "FormattingContext.h"
+#include "LayoutContainer.h"
#include "LayoutUnits.h"
#include <wtf/IsoMalloc.h>
@@ -37,7 +39,6 @@
class FloatAvoider;
class Box;
-class Container;
class FloatingPair;
class LayoutState;
@@ -46,7 +47,7 @@
class FloatingContext {
WTF_MAKE_ISO_ALLOCATED(FloatingContext);
public:
- FloatingContext(const Container& formattingContextRoot, FloatingState&);
+ FloatingContext(const FormattingContext&, FloatingState&);
FloatingState& floatingState() const { return m_floatingState; }
@@ -71,12 +72,13 @@
private:
LayoutState& layoutState() const { return m_floatingState.layoutState(); }
- const Container& root() const { return *m_root; }
+ const FormattingContext& formattingContext() const { return m_formattingContext; }
+ const Container& root() const { return downcast<Container>(formattingContext().root()); }
void findPositionForFloatBox(FloatBox&) const;
void findPositionForFormattingContextRoot(FloatAvoider&) const;
- WeakPtr<const Container> m_root;
+ const FormattingContext& m_formattingContext;
FloatingState& m_floatingState;
};
Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp (249440 => 249441)
--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp 2019-09-03 19:55:11 UTC (rev 249440)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextLineLayout.cpp 2019-09-03 20:05:49 UTC (rev 249441)
@@ -282,7 +282,7 @@
auto& formattingContext = this->formattingContext();
auto& formattingRoot = this->formattingRoot();
auto& formattingRootDisplayBox = formattingContext.displayBoxForLayoutBox(formattingRoot);
- auto floatingContext = FloatingContext { formattingRoot, layoutState.establishedFormattingState(formattingRoot).floatingState() };
+ auto floatingContext = FloatingContext { formattingContext, layoutState.establishedFormattingState(formattingRoot).floatingState() };
auto lineLogicalTop = formattingRootDisplayBox.contentBoxTop();
auto lineLogicalLeft = formattingRootDisplayBox.contentBoxLeft();
@@ -364,7 +364,7 @@
auto& layoutState = this->layoutState();
auto& formattingContext = this->formattingContext();
auto& formattingState = downcast<InlineFormattingState>(layoutState.establishedFormattingState(formattingRoot()));
- auto floatingContext = FloatingContext { formattingRoot(), formattingState.floatingState() };
+ auto floatingContext = FloatingContext { formattingContext, formattingState.floatingState() };
// Move floats to their final position.
for (auto floatItem : floats) {