Skip to content

Commit

Permalink
[Legacy line layout removal] Remove float and pagination support
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=271056
rdar://problem/124691392

Reviewed by Alan Baradlay.

Neither is used or needed anymore.

* Source/WebCore/layout/integration/inline/InlineIteratorLineBoxLegacyPath.h:
(WebCore::InlineIterator::LineBoxIteratorLegacyPath::containingFragment const):
(WebCore::InlineIterator::LineBoxIteratorLegacyPath::isFirstAfterPageBreak const):
* Source/WebCore/rendering/FloatingObjects.cpp:
(WebCore::FloatingObjects::remove):
(WebCore::FloatingObjects::clearLineBoxTreePointers): Deleted.
* Source/WebCore/rendering/FloatingObjects.h:
(WebCore::FloatingObjects::set const):
(WebCore::FloatingObject::originatingLine const): Deleted.
(WebCore::FloatingObject::clearOriginatingLine): Deleted.
(WebCore::FloatingObject::setOriginatingLine): Deleted.
* Source/WebCore/rendering/LegacyInlineBox.cpp:
(WebCore::LegacyInlineBox::logicalHeight const):
* Source/WebCore/rendering/LegacyInlineFlowBox.h:
(WebCore::LegacyInlineFlowBox::LegacyInlineFlowBox):
* Source/WebCore/rendering/LegacyLineLayout.cpp:
(WebCore::LegacyLineLayout::~LegacyLineLayout):
(WebCore::LegacyLineLayout::layoutRunsAndFloats):
(WebCore::LegacyLineLayout::layoutRunsAndFloatsInRange):
(WebCore::LegacyLineLayout::linkToEndLineIfNeeded):
(WebCore::LegacyLineLayout::layoutLineBoxes):
(WebCore::LegacyLineLayout::determineStartPosition):
(WebCore::LegacyLineLayout::determineEndPosition):
(WebCore::LegacyLineLayout::matchedEndLine):
(WebCore::LegacyLineLayout::addOverflowFromInlineChildren):
(WebCore::LegacyLineLayout::appendFloatingObjectToLastLine): Deleted.
(WebCore::repaintDirtyFloats): Deleted.
(WebCore::LegacyLineLayout::restartLayoutRunsAndFloatsInRange): Deleted.
(WebCore::LegacyLineLayout::reattachCleanLineFloats): Deleted.
(WebCore::LegacyLineLayout::checkFloatInCleanLine): Deleted.
(WebCore::LegacyLineLayout::checkPaginationAndFloatsAtEndLine): Deleted.
(WebCore::LegacyLineLayout::lineWidthForPaginatedLineChanged const): Deleted.
(WebCore::LegacyLineLayout::positionNewFloatOnLine): Deleted.
(WebCore::LegacyLineLayout::updateFragmentForLine const): Deleted.
* Source/WebCore/rendering/LegacyLineLayout.h:
* Source/WebCore/rendering/LegacyRootInlineBox.cpp:
(WebCore::LegacyRootInlineBox::~LegacyRootInlineBox):
(WebCore::containingFragmentMap): Deleted.
(WebCore::LegacyRootInlineBox::containingFragment const): Deleted.
(WebCore::LegacyRootInlineBox::clearContainingFragment): Deleted.
(WebCore::LegacyRootInlineBox::setContainingFragment): Deleted.
* Source/WebCore/rendering/LegacyRootInlineBox.h:
(WebCore::LegacyRootInlineBox::lineBoxHeight const):
(WebCore::LegacyRootInlineBox::paginationStrut const): Deleted.
(WebCore::LegacyRootInlineBox::setPaginationStrut): Deleted.
(WebCore::LegacyRootInlineBox::isFirstAfterPageBreak const): Deleted.
(WebCore::LegacyRootInlineBox::setIsFirstAfterPageBreak): Deleted.
(WebCore::LegacyRootInlineBox::paginatedLineWidth const): Deleted.
(WebCore::LegacyRootInlineBox::setPaginatedLineWidth): Deleted.
(WebCore::LegacyRootInlineBox::isForTrailingFloats const): Deleted.
(WebCore::LegacyRootInlineBox::setIsForTrailingFloats): Deleted.
(WebCore::LegacyRootInlineBox::appendFloat): Deleted.
(WebCore::LegacyRootInlineBox::removeFloat): Deleted.
(WebCore::LegacyRootInlineBox::floatsPtr): Deleted.
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats):
(WebCore::RenderBlockFlow::removeFloatingObject):
(WebCore::RenderBlockFlow::adjustLinePositionForPagination): Deleted.
* Source/WebCore/rendering/RenderBlockFlow.h:
* Source/WebCore/rendering/RenderFragmentContainer.cpp:
(WebCore::RenderFragmentContainer::visualOverflowRectForBox const):
(WebCore::RenderFragmentContainer::visualOverflowRectForBoxForPropagation):

Tighten RenderBoxModelObject -> RenderBox making it clear
RenderInline::linesVisualOverflowBoundingBoxInFragment is unneeded.

* Source/WebCore/rendering/RenderFragmentContainer.h:
* Source/WebCore/rendering/RenderInline.cpp:
(WebCore::RenderInline::linesVisualOverflowBoundingBoxInFragment const): Deleted.
* Source/WebCore/rendering/RenderInline.h:
(WebCore::RenderInline::linesVisualOverflowBoundingBoxInFragment const):
* Source/WebCore/rendering/RenderLineBoxList.cpp:
(WebCore::RenderLineBoxList::dirtyLinesFromChangedChild):
* Source/WebCore/rendering/line/BreakingContext.h:
(WebCore::BreakingContext::BreakingContext):
(WebCore::shouldSkipWhitespaceAfterStartObject):
(WebCore::BreakingContext::handleFloat): Deleted.
* Source/WebCore/rendering/line/LineBreaker.cpp:
(WebCore::LineBreaker::reset):
(WebCore::LineBreaker::skipTrailingWhitespace):
(WebCore::LineBreaker::skipLeadingWhitespace):
(WebCore::LineBreaker::nextLineBreak):
* Source/WebCore/rendering/line/LineBreaker.h:
(WebCore::LineBreaker::lineWasHyphenated):
(WebCore::LineBreaker::usedClear): Deleted.
(WebCore::LineBreaker::insertFloatingObject): Deleted.
(WebCore::LineBreaker::positionNewFloatOnLine): Deleted.
* Source/WebCore/rendering/line/LineLayoutState.h:
(WebCore::LineLayoutState::LineLayoutState):
(WebCore::FloatWithRect::create): Deleted.
(WebCore::FloatWithRect::renderer const): Deleted.
(WebCore::FloatWithRect::rect const): Deleted.
(WebCore::FloatWithRect::everHadLayout const): Deleted.
(WebCore::FloatWithRect::adjustRect): Deleted.
(WebCore::FloatWithRect::FloatWithRect): Deleted.
(): Deleted.
(WebCore::LineLayoutState::FloatList::append): Deleted.
(WebCore::LineLayoutState::FloatList::setLastFloat): Deleted.
(WebCore::LineLayoutState::FloatList::lastFloat const): Deleted.
(WebCore::LineLayoutState::FloatList::setLastCleanFloat): Deleted.
(WebCore::LineLayoutState::FloatList::lastCleanFloat const): Deleted.
(WebCore::LineLayoutState::FloatList::floatWithRect const): Deleted.
(WebCore::LineLayoutState::FloatList::begin): Deleted.
(WebCore::LineLayoutState::FloatList::end): Deleted.
(WebCore::LineLayoutState::FloatList::find): Deleted.
(WebCore::LineLayoutState::FloatList::isEmpty const): Deleted.
(WebCore::LineLayoutState::fragmentedFlow const): Deleted.
(WebCore::LineLayoutState::checkForFloatsFromLastLine const): Deleted.
(WebCore::LineLayoutState::setCheckForFloatsFromLastLine): Deleted.
(WebCore::LineLayoutState::floatList): Deleted.

Canonical link: https://commits.webkit.org/276188@main
  • Loading branch information
anttijk committed Mar 15, 2024
1 parent 5aa1396 commit 1a03c11
Show file tree
Hide file tree
Showing 20 changed files with 46 additions and 919 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ class LineBoxIteratorLegacyPath {

const RenderBlockFlow& formattingContextRoot() const { return m_rootInlineBox->blockFlow(); }

RenderFragmentContainer* containingFragment() const { return m_rootInlineBox->containingFragment(); }
bool isFirstAfterPageBreak() const { return m_rootInlineBox->isFirstAfterPageBreak(); }
RenderFragmentContainer* containingFragment() const { return nullptr; }
bool isFirstAfterPageBreak() const { return false; }

size_t lineIndex() const
{
Expand Down
11 changes: 0 additions & 11 deletions Source/WebCore/rendering/FloatingObjects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ namespace WebCore {

struct SameSizeAsFloatingObject {
SingleThreadWeakPtr<RenderBox> renderer;
WeakPtr<LegacyRootInlineBox> originatingLine;
LayoutRect rect;
int paginationStrut;
LayoutSize size;
Expand Down Expand Up @@ -276,15 +275,6 @@ FloatingObjects::FloatingObjects(const RenderBlockFlow& renderer)

FloatingObjects::~FloatingObjects() = default;

void FloatingObjects::clearLineBoxTreePointers()
{
// Clear references to originating lines, since the lines are being deleted
for (auto it = m_set.begin(), end = m_set.end(); it != end; ++it) {
ASSERT(!((*it)->originatingLine()) || &((*it)->originatingLine()->renderer()) == &renderer());
(*it)->clearOriginatingLine();
}
}

void FloatingObjects::clear()
{
m_set.clear();
Expand Down Expand Up @@ -372,7 +362,6 @@ void FloatingObjects::remove(FloatingObject* floatingObject)
ASSERT(floatingObject->isPlaced() || !floatingObject->isInPlacedTree());
if (floatingObject->isPlaced())
removePlacedObject(floatingObject);
ASSERT(!floatingObject->originatingLine());
m_set.remove(floatingObject);
}

Expand Down
7 changes: 0 additions & 7 deletions Source/WebCore/rendering/FloatingObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,6 @@ class FloatingObject {
bool isDescendant() const { return m_isDescendant; }
void setIsDescendant(bool isDescendant) { m_isDescendant = isDescendant; }

// FIXME: Callers of these methods are dangerous and should be allowed explicitly or removed.
LegacyRootInlineBox* originatingLine() const { return m_originatingLine.get(); }
void clearOriginatingLine() { m_originatingLine = nullptr; }
void setOriginatingLine(LegacyRootInlineBox& line) { m_originatingLine = line; }

LayoutSize locationOffsetOfBorderBox() const
{
ASSERT(isPlaced());
Expand All @@ -107,7 +102,6 @@ class FloatingObject {
friend FloatingObjects;

SingleThreadWeakPtr<RenderBox> m_renderer;
WeakPtr<LegacyRootInlineBox> m_originatingLine;
LayoutRect m_frameRect;
LayoutUnit m_paginationStrut;
LayoutSize m_marginOffset;
Expand Down Expand Up @@ -168,7 +162,6 @@ class FloatingObjects {
bool hasLeftObjects() const { return m_leftObjectsCount > 0; }
bool hasRightObjects() const { return m_rightObjectsCount > 0; }
const FloatingObjectSet& set() const { return m_set; }
void clearLineBoxTreePointers();

LayoutUnit logicalLeftOffset(LayoutUnit fixedOffset, LayoutUnit logicalTop, LayoutUnit logicalHeight);
LayoutUnit logicalRightOffset(LayoutUnit fixedOffset, LayoutUnit logicalTop, LayoutUnit logicalHeight);
Expand Down
3 changes: 0 additions & 3 deletions Source/WebCore/rendering/LegacyInlineBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ float LegacyInlineBox::logicalHeight() const
if (hasVirtualLogicalHeight())
return virtualLogicalHeight();

if (auto* inlineBox = dynamicDowncast<LegacyRootInlineBox>(*this); inlineBox && inlineBox->isForTrailingFloats())
return 0;

const RenderStyle& lineStyle = this->lineStyle();
if (renderer().isRenderTextOrLineBreak())
return lineStyle.metricsOfPrimaryFont().intHeight();
Expand Down
4 changes: 0 additions & 4 deletions Source/WebCore/rendering/LegacyInlineFlowBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ class LegacyInlineFlowBox : public LegacyInlineBox {
, m_baselineType(AlphabeticBaseline)
, m_hasAnnotationsBefore(false)
, m_hasAnnotationsAfter(false)
, m_isFirstAfterPageBreak(false)
, m_isForTrailingFloats(false)
, m_hasSelfPaintInlineBox(false)
#if !ASSERT_WITH_SECURITY_IMPLICATION_DISABLED
, m_hasBadChildList(false)
Expand Down Expand Up @@ -254,8 +252,6 @@ class LegacyInlineFlowBox : public LegacyInlineBox {
unsigned m_lineBreakBidiStatusLastStrong : 5; // UCharDirection
unsigned m_lineBreakBidiStatusLast : 5; // UCharDirection

unsigned m_isFirstAfterPageBreak : 1;
unsigned m_isForTrailingFloats : 1;
unsigned m_hasSelfPaintInlineBox : 1;

// End of RootInlineBox-specific members.
Expand Down
567 changes: 19 additions & 548 deletions Source/WebCore/rendering/LegacyLineLayout.cpp

Large diffs are not rendered by default.

14 changes: 3 additions & 11 deletions Source/WebCore/rendering/LegacyLineLayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class LegacyLineLayout {
void layoutLineBoxes(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom);

LegacyRootInlineBox* constructLine(BidiRunList<BidiRun>&, const LineInfo&);
bool positionNewFloatOnLine(const FloatingObject& newFloat, FloatingObject* lastFloatFromPreviousLine, LineInfo&, LineWidth&);
void addOverflowFromInlineChildren();

size_t lineCount() const;
Expand All @@ -82,20 +81,13 @@ class LegacyLineLayout {
void removeInlineBox(BidiRun&, const LegacyRootInlineBox&) const;
void removeEmptyTextBoxesAndUpdateVisualReordering(LegacyRootInlineBox*, BidiRun* firstRun);
inline BidiRun* handleTrailingSpaces(BidiRunList<BidiRun>& bidiRuns, BidiContext* currentContext);
void appendFloatingObjectToLastLine(FloatingObject&);
LegacyRootInlineBox* createLineBoxesFromBidiRuns(unsigned bidiLevel, BidiRunList<BidiRun>& bidiRuns, const LegacyInlineIterator& end, LineInfo&);
void layoutRunsAndFloats(LineLayoutState&, bool hasInlineChild);
inline const LegacyInlineIterator& restartLayoutRunsAndFloatsInRange(LayoutUnit oldLogicalHeight, LayoutUnit newLogicalHeight, FloatingObject* lastFloatFromPreviousLine, InlineBidiResolver&, const LegacyInlineIterator& oldEnd);
void layoutRunsAndFloatsInRange(LineLayoutState&, InlineBidiResolver&, const LegacyInlineIterator& cleanLineStart, const BidiStatus& cleanLineBidiStatus, unsigned consecutiveHyphenatedLines);
void reattachCleanLineFloats(LegacyRootInlineBox& cleanLine, LayoutUnit delta, bool isFirstCleanLine);
void layoutRunsAndFloatsInRange(LineLayoutState&, InlineBidiResolver&, const LegacyInlineIterator& cleanLineStart, unsigned consecutiveHyphenatedLines);
void linkToEndLineIfNeeded(LineLayoutState&);
void checkFloatInCleanLine(LegacyRootInlineBox& cleanLine, RenderBox& floatBoxOnCleanLine, FloatWithRect& matchingFloatWithRect, bool& encounteredNewFloat, bool& dirtiedByFloat);
LegacyRootInlineBox* determineStartPosition(LineLayoutState&, InlineBidiResolver&);
void determineEndPosition(LineLayoutState&, LegacyRootInlineBox* startLine, LegacyInlineIterator& cleanLineStart, BidiStatus& cleanLineBidiStatus);
bool checkPaginationAndFloatsAtEndLine(LineLayoutState&);
bool lineWidthForPaginatedLineChanged(LegacyRootInlineBox* rootBox, LayoutUnit lineDelta, RenderFragmentedFlow*) const;
bool matchedEndLine(LineLayoutState&, const InlineBidiResolver&, const LegacyInlineIterator& endLineStart, const BidiStatus& endLineStatus);
void updateFragmentForLine(LegacyRootInlineBox*) const;
void determineEndPosition(LineLayoutState&, LegacyRootInlineBox* startLine, LegacyInlineIterator& cleanLineStart);
bool matchedEndLine(LineLayoutState&, const InlineBidiResolver&, const LegacyInlineIterator& endLineStart);

const RenderStyle& style() const;
const LocalFrameViewLayoutContext& layoutContext() const;
Expand Down
45 changes: 1 addition & 44 deletions Source/WebCore/rendering/LegacyRootInlineBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,14 @@ struct SameSizeAsLegacyRootInlineBox : LegacyInlineFlowBox, CanMakeWeakPtr<Legac
unsigned lineBreakPos;
SingleThreadWeakPtr<RenderObject> lineBreakObj;
void* lineBreakContext;
int layoutUnits[6];
void* floats;
int layoutUnits[4];
};

static_assert(sizeof(LegacyRootInlineBox) == sizeof(SameSizeAsLegacyRootInlineBox), "LegacyRootInlineBox should stay small");
#if !ASSERT_ENABLED
static_assert(sizeof(SingleThreadWeakPtr<RenderObject>) == sizeof(void*), "WeakPtr should be same size as raw pointer");
#endif

static ContainingFragmentMap& containingFragmentMap(RenderBlockFlow& block)
{
ASSERT(block.enclosingFragmentedFlow());
return block.enclosingFragmentedFlow()->containingFragmentMap();
}

LegacyRootInlineBox::LegacyRootInlineBox(RenderBlockFlow& block)
: LegacyInlineFlowBox(block)
{
Expand All @@ -69,8 +62,6 @@ LegacyRootInlineBox::LegacyRootInlineBox(RenderBlockFlow& block)

LegacyRootInlineBox::~LegacyRootInlineBox()
{
if (!renderer().document().renderTreeBeingDestroyed() && blockFlow().enclosingFragmentedFlow())
containingFragmentMap(blockFlow()).remove(this);
}

bool LegacyRootInlineBox::isHyphenated() const
Expand Down Expand Up @@ -114,40 +105,6 @@ void LegacyRootInlineBox::childRemoved(LegacyInlineBox* box)
}
}

RenderFragmentContainer* LegacyRootInlineBox::containingFragment() const
{
ContainingFragmentMap& fragmentMap = containingFragmentMap(blockFlow());
bool hasContainingFragment = fragmentMap.contains(this);
RenderFragmentContainer* fragment = hasContainingFragment ? fragmentMap.get(this).get() : nullptr;

#ifndef NDEBUG
if (hasContainingFragment) {
RenderFragmentedFlow* fragmentedFlow = blockFlow().enclosingFragmentedFlow();
const RenderFragmentContainerList& fragmentList = fragmentedFlow->renderFragmentContainerList();
ASSERT_WITH_SECURITY_IMPLICATION(fragmentList.contains(*fragment));
}
#endif

return fragment;
}

void LegacyRootInlineBox::clearContainingFragment()
{
ASSERT(!isDirty());

if (!containingFragmentMap(blockFlow()).contains(this))
return;

containingFragmentMap(blockFlow()).remove(this);
}

void LegacyRootInlineBox::setContainingFragment(RenderFragmentContainer& fragment)
{
ASSERT(!isDirty());

containingFragmentMap(blockFlow()).set(this, &fragment);
}

RenderObject::HighlightState LegacyRootInlineBox::selectionState() const
{
// Walk over all of the selected boxes.
Expand Down
45 changes: 0 additions & 45 deletions Source/WebCore/rendering/LegacyRootInlineBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ namespace WebCore {
class HitTestResult;
class LogicalSelectionOffsetCaches;
class RenderBlockFlow;
class RenderFragmentContainer;

struct BidiStatus;
struct GapRects;
Expand All @@ -55,21 +54,6 @@ class LegacyRootInlineBox : public LegacyInlineFlowBox, public CanMakeWeakPtr<Le
LayoutUnit lineBoxTop() const { return m_lineBoxTop; }
LayoutUnit lineBoxBottom() const { return m_lineBoxBottom; }
LayoutUnit lineBoxHeight() const { return lineBoxBottom() - lineBoxTop(); }

LayoutUnit paginationStrut() const { return m_paginationStrut; }
void setPaginationStrut(LayoutUnit strut) { m_paginationStrut = strut; }

bool isFirstAfterPageBreak() const { return m_isFirstAfterPageBreak; }
void setIsFirstAfterPageBreak(bool isFirstAfterPageBreak) { m_isFirstAfterPageBreak = isFirstAfterPageBreak; }

LayoutUnit paginatedLineWidth() const { return m_paginatedLineWidth; }
void setPaginatedLineWidth(LayoutUnit width) { m_paginatedLineWidth = width; }

// It should not be assumed the containingFragment() is always valid.
// It can also be nullptr if the flow has no fragment chain.
RenderFragmentContainer* containingFragment() const;
void setContainingFragment(RenderFragmentContainer&);
void clearContainingFragment();

LayoutUnit selectionTop() const;
LayoutUnit selectionBottom() const;
Expand All @@ -93,9 +77,6 @@ class LegacyRootInlineBox : public LegacyInlineFlowBox, public CanMakeWeakPtr<Le
unsigned lineBreakPos() const { return m_lineBreakPos; }
void setLineBreakPos(unsigned p) { m_lineBreakPos = p; }

bool isForTrailingFloats() const { return m_isForTrailingFloats; }
void setIsForTrailingFloats() { m_isForTrailingFloats = true; }

using LegacyInlineBox::endsWithBreak;
using LegacyInlineBox::setEndsWithBreak;

Expand All @@ -110,25 +91,6 @@ class LegacyRootInlineBox : public LegacyInlineFlowBox, public CanMakeWeakPtr<Le
const LegacyInlineBox* firstSelectedBox() const;
const LegacyInlineBox* lastSelectedBox() const;

using CleanLineFloatList = Vector<SingleThreadWeakPtr<RenderBox>>;
void appendFloat(RenderBox& floatingBox)
{
ASSERT(!isDirty());
if (m_floats)
m_floats->append(floatingBox);
else
m_floats = makeUnique<CleanLineFloatList>(1, floatingBox);
}

void removeFloat(RenderBox& floatingBox)
{
ASSERT(m_floats);
ASSERT(m_floats->contains(&floatingBox));
m_floats->remove(m_floats->find(&floatingBox));
}

CleanLineFloatList* floatsPtr() { ASSERT(!isDirty()); return m_floats.get(); }

void extractLineBoxFromRenderObject() final;
void attachLineBoxToRenderObject() final;
void removeLineBoxFromRenderObject() final;
Expand Down Expand Up @@ -175,13 +137,6 @@ class LegacyRootInlineBox : public LegacyInlineFlowBox, public CanMakeWeakPtr<Le

LayoutUnit m_lineBoxTop;
LayoutUnit m_lineBoxBottom;

LayoutUnit m_paginationStrut;
LayoutUnit m_paginatedLineWidth;

// Floats hanging off the line are pushed into this vector during layout. It is only
// good for as long as the line has not been marked dirty.
std::unique_ptr<CleanLineFloatList> m_floats;
};

inline LegacyRootInlineBox* LegacyRootInlineBox::nextRootBox() const
Expand Down
25 changes: 0 additions & 25 deletions Source/WebCore/rendering/RenderBlockFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,6 @@ void RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats()
changeLogicalBottom = std::max(changeLogicalBottom, std::max(logicalTop, oldLogicalTop));
}
}

if (oldFloatingObject->originatingLine() && !selfNeedsLayout()) {
ASSERT(&oldFloatingObject->originatingLine()->renderer() == this);
oldFloatingObject->originatingLine()->markDirty();
}
} else {
changeLogicalTop = 0;
changeLogicalBottom = std::max(changeLogicalBottom, logicalBottom);
Expand Down Expand Up @@ -1985,16 +1980,6 @@ static void clearShouldBreakAtLineToAvoidWidowIfNeeded(RenderBlockFlow& blockFlo
blockFlow.setDidBreakAtLineToAvoidWidow();
}

void RenderBlockFlow::adjustLinePositionForPagination(LegacyRootInlineBox* rootInlineBox, LayoutUnit& delta)
{
auto adjustment = computeLineAdjustmentForPagination(rootInlineBox, delta);

rootInlineBox->setPaginationStrut(adjustment.strut);
rootInlineBox->setIsFirstAfterPageBreak(adjustment.isFirstAfterPageBreak);

delta += adjustment.strut;
}

RenderBlockFlow::LinePaginationAdjustment RenderBlockFlow::computeLineAdjustmentForPagination(const InlineIterator::LineBoxIterator& lineBox, LayoutUnit delta, LayoutUnit floatMinimumBottom)
{
// FIXME: For now we paginate using line overflow. This ensures that lines don't overlap at all when we
Expand Down Expand Up @@ -2689,16 +2674,6 @@ void RenderBlockFlow::removeFloatingObject(RenderBox& floatBox)
// accomplished by pretending they have a height of 1.
logicalBottom = std::max(logicalBottom, logicalTop + 1);
}
if (floatingObject.originatingLine()) {
floatingObject.originatingLine()->removeFloat(floatBox);
if (!selfNeedsLayout()) {
ASSERT(&floatingObject.originatingLine()->renderer() == this);
floatingObject.originatingLine()->markDirty();
}
#if ASSERT_ENABLED
floatingObject.clearOriginatingLine();
#endif
}
markLinesDirtyInBlockRange(0, logicalBottom);
}
m_floatingObjects->remove(&floatingObject);
Expand Down
3 changes: 0 additions & 3 deletions Source/WebCore/rendering/RenderBlockFlow.h
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,6 @@ class RenderBlockFlow : public RenderBlock {
std::optional<LayoutUnit> selfCollapsingMarginBeforeWithClear(RenderObject* candidate);

public:
// Computes a deltaOffset value that put a line at the top of the next page if it doesn't fit on the current page.
void adjustLinePositionForPagination(LegacyRootInlineBox*, LayoutUnit& deltaOffset);

struct LinePaginationAdjustment {
LayoutUnit strut { 0_lu };
bool isFirstAfterPageBreak { false };
Expand Down
20 changes: 6 additions & 14 deletions Source/WebCore/rendering/RenderFragmentContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,21 +494,13 @@ void RenderFragmentContainer::addVisualOverflowForBox(const RenderBox& box, cons
fragmentOverflow->addVisualOverflow(flippedRect);
}

LayoutRect RenderFragmentContainer::visualOverflowRectForBox(const RenderBoxModelObject& box) const
LayoutRect RenderFragmentContainer::visualOverflowRectForBox(const RenderBox& box) const
{
if (CheckedPtr inlineBox = dynamicDowncast<RenderInline>(box))
return inlineBox->linesVisualOverflowBoundingBoxInFragment(this);
RefPtr<RenderOverflow> overflow;
ensureOverflowForBox(box, overflow, true);

if (CheckedPtr renderBox = dynamicDowncast<RenderBox>(box)) {
RefPtr<RenderOverflow> overflow;
ensureOverflowForBox(*renderBox, overflow, true);

ASSERT(overflow);
return overflow->visualOverflowRect();
}

ASSERT_NOT_REACHED();
return LayoutRect();
ASSERT(overflow);
return overflow->visualOverflowRect();
}

// FIXME: This doesn't work for writing modes.
Expand Down Expand Up @@ -536,7 +528,7 @@ LayoutRect RenderFragmentContainer::layoutOverflowRectForBoxForPropagation(const
return rect;
}

LayoutRect RenderFragmentContainer::visualOverflowRectForBoxForPropagation(const RenderBoxModelObject& box)
LayoutRect RenderFragmentContainer::visualOverflowRectForBoxForPropagation(const RenderBox& box)
{
LayoutRect rect = visualOverflowRectForBox(box);
fragmentedFlow()->flipForWritingModeLocalCoordinates(rect);
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/rendering/RenderFragmentContainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ class RenderFragmentContainer : public RenderBlockFlow {

void addLayoutOverflowForBox(const RenderBox&, const LayoutRect&);
void addVisualOverflowForBox(const RenderBox&, const LayoutRect&);
LayoutRect visualOverflowRectForBox(const RenderBoxModelObject&) const;
LayoutRect visualOverflowRectForBox(const RenderBox&) const;
LayoutRect layoutOverflowRectForBoxForPropagation(const RenderBox&);
LayoutRect visualOverflowRectForBoxForPropagation(const RenderBoxModelObject&);
LayoutRect visualOverflowRectForBoxForPropagation(const RenderBox&);

LayoutRect rectFlowPortionForBox(const RenderBox&, const LayoutRect&) const;

Expand Down
Loading

0 comments on commit 1a03c11

Please sign in to comment.