summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderBlockFlow.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/rendering/RenderBlockFlow.h
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/rendering/RenderBlockFlow.h')
-rw-r--r--Source/WebCore/rendering/RenderBlockFlow.h275
1 files changed, 157 insertions, 118 deletions
diff --git a/Source/WebCore/rendering/RenderBlockFlow.h b/Source/WebCore/rendering/RenderBlockFlow.h
index 1f5a07cf9..f1611175b 100644
--- a/Source/WebCore/rendering/RenderBlockFlow.h
+++ b/Source/WebCore/rendering/RenderBlockFlow.h
@@ -20,32 +20,32 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef RenderBlockFlow_h
-#define RenderBlockFlow_h
+#pragma once
#include "FloatingObjects.h"
+#include "LineWidth.h"
#include "RenderBlock.h"
#include "RenderLineBoxList.h"
#include "SimpleLineLayout.h"
#include "TrailingObjects.h"
+#include <memory>
namespace WebCore {
+class FloatWithRect;
class LayoutStateMaintainer;
class LineBreaker;
class LineInfo;
-class LineWidth;
class RenderMultiColumnFlowThread;
class RenderNamedFlowFragment;
class RenderRubyRun;
-struct FloatWithRect;
struct WordMeasurement;
template <class Run> class BidiRunList;
typedef Vector<WordMeasurement, 64> WordMeasurements;
-#if ENABLE(IOS_TEXT_AUTOSIZING)
+#if ENABLE(TEXT_AUTOSIZING)
enum LineCount {
NOT_SET = 0, NO_LINE = 1, ONE_LINE = 2, MULTI_LINE = 3
};
@@ -53,21 +53,21 @@ enum LineCount {
class RenderBlockFlow : public RenderBlock {
public:
- RenderBlockFlow(Element&, PassRef<RenderStyle>);
- RenderBlockFlow(Document&, PassRef<RenderStyle>);
+ RenderBlockFlow(Element&, RenderStyle&&);
+ RenderBlockFlow(Document&, RenderStyle&&);
virtual ~RenderBlockFlow();
- virtual void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) override;
+ void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) override;
protected:
- virtual void insertedIntoTree() override;
- virtual void willBeDestroyed() override;
+ void insertedIntoTree() override;
+ void willBeDestroyed() override;
// This method is called at the start of layout to wipe away all of the floats in our floating objects list. It also
// repopulates the list with any floats that intrude from previous siblings or parents. Floats that were added by
// descendants are gone when this call completes and will get added back later on after the children have gotten
// a relayout.
- void clearFloats();
+ void rebuildFloatingObjectSetFromIntrudingFloats();
// RenderBlockFlow always contains either lines or paragraphs. When the children are all blocks (e.g. paragraphs), we call layoutBlockChildren.
// When the children are are all inline (e.g., lines), we call layoutInlineChildren.
@@ -75,11 +75,13 @@ protected:
void layoutInlineChildren(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom);
// RenderBlockFlows override these methods, since they are the only class that supports margin collapsing.
- virtual LayoutUnit collapsedMarginBefore() const override final { return maxPositiveMarginBefore() - maxNegativeMarginBefore(); }
- virtual LayoutUnit collapsedMarginAfter() const override final { return maxPositiveMarginAfter() - maxNegativeMarginAfter(); }
+ LayoutUnit collapsedMarginBefore() const final { return maxPositiveMarginBefore() - maxNegativeMarginBefore(); }
+ LayoutUnit collapsedMarginAfter() const final { return maxPositiveMarginAfter() - maxNegativeMarginAfter(); }
- virtual void dirtyLinesFromChangedChild(RenderObject* child) override final { lineBoxes().dirtyLinesFromChangedChild(this, child); }
- virtual void updateLogicalHeight() override;
+ void dirtyLinesFromChangedChild(RenderObject& child) final { lineBoxes().dirtyLinesFromChangedChild(*this, child); }
+ void updateLogicalHeight() override;
+
+ void paintColumnRules(PaintInfo&, const LayoutPoint&) override;
public:
class MarginValues {
@@ -125,7 +127,7 @@ public:
{
}
- virtual ~RenderBlockFlowRareData()
+ ~RenderBlockFlowRareData()
{
}
@@ -191,7 +193,7 @@ public:
LayoutUnit m_negativeMargin;
public:
- MarginInfo(RenderBlockFlow&, LayoutUnit beforeBorderPadding, LayoutUnit afterBorderPadding);
+ MarginInfo(const RenderBlockFlow&, LayoutUnit beforeBorderPadding, LayoutUnit afterBorderPadding);
void setAtBeforeSideOfBlock(bool b) { m_atBeforeSideOfBlock = b; }
void setAtAfterSideOfBlock(bool b) { m_atAfterSideOfBlock = b; }
@@ -243,15 +245,19 @@ public:
void adjustFloatingBlock(const MarginInfo&);
void setStaticInlinePositionForChild(RenderBox& child, LayoutUnit blockOffset, LayoutUnit inlinePosition);
- void updateStaticInlinePositionForChild(RenderBox& child, LayoutUnit logicalTop);
+ void updateStaticInlinePositionForChild(RenderBox& child, LayoutUnit logicalTop, IndentTextOrNot shouldIndentText);
LayoutUnit collapseMargins(RenderBox& child, MarginInfo&);
+ LayoutUnit collapseMarginsWithChildInfo(RenderBox* child, RenderObject* prevSibling, MarginInfo&);
+
LayoutUnit clearFloatsIfNeeded(RenderBox& child, MarginInfo&, LayoutUnit oldTopPosMargin, LayoutUnit oldTopNegMargin, LayoutUnit yPos);
LayoutUnit estimateLogicalTopPosition(RenderBox& child, const MarginInfo&, LayoutUnit& estimateWithoutPagination);
void marginBeforeEstimateForChild(RenderBox&, LayoutUnit&, LayoutUnit&, bool&) const;
void handleAfterSideOfBlock(LayoutUnit top, LayoutUnit bottom, MarginInfo&);
void setCollapsedBottomMargin(const MarginInfo&);
+ bool childrenPreventSelfCollapsing() const final;
+
bool shouldBreakAtLineToAvoidWidow() const { return hasRareBlockFlowData() && rareBlockFlowData()->m_lineBreakToAvoidWidow >= 0; }
void clearShouldBreakAtLineToAvoidWidow() const;
int lineBreakToAvoidWidow() const { return hasRareBlockFlowData() ? rareBlockFlowData()->m_lineBreakToAvoidWidow : -1; }
@@ -261,87 +267,90 @@ public:
bool didBreakAtLineToAvoidWidow() const { return hasRareBlockFlowData() && rareBlockFlowData()->m_didBreakAtLineToAvoidWidow; }
bool relayoutToAvoidWidows(LayoutStateMaintainer&);
- virtual bool canHaveGeneratedChildren() const override;
+ bool canHaveGeneratedChildren() const override;
RootInlineBox* lineGridBox() const { return hasRareBlockFlowData() ? rareBlockFlowData()->m_lineGridBox.get() : nullptr; }
void setLineGridBox(std::unique_ptr<RootInlineBox> box)
{
- ensureRareBlockFlowData().m_lineGridBox = std::move(box);
+ ensureRareBlockFlowData().m_lineGridBox = WTFMove(box);
}
void layoutLineGridBox();
- virtual bool canCollapseAnonymousBlockChild() const override { return !renderNamedFlowFragment(); }
+ bool canDropAnonymousBlockChild() const override { return !renderNamedFlowFragment(); }
RenderNamedFlowFragment* renderNamedFlowFragment() const { return hasRareBlockFlowData() ? rareBlockFlowData()->m_renderNamedFlowFragment : nullptr; }
void setRenderNamedFlowFragment(RenderNamedFlowFragment*);
RenderMultiColumnFlowThread* multiColumnFlowThread() const { return hasRareBlockFlowData() ? rareBlockFlowData()->m_multiColumnFlowThread : nullptr; }
void setMultiColumnFlowThread(RenderMultiColumnFlowThread*);
+ bool willCreateColumns(std::optional<unsigned> desiredColumnCount = std::nullopt) const;
bool containsFloats() const override { return m_floatingObjects && !m_floatingObjects->set().isEmpty(); }
bool containsFloat(RenderBox&) const;
- virtual void deleteLines() override;
- virtual void computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFloats = false) override;
- virtual VisiblePosition positionForPoint(const LayoutPoint&) override;
+ void deleteLines() override;
+ void computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFloats = false) override;
+ Position positionForPoint(const LayoutPoint&) override;
+ VisiblePosition positionForPoint(const LayoutPoint&, const RenderRegion*) override;
void removeFloatingObjects();
void markAllDescendantsWithFloatsForLayout(RenderBox* floatToRemove = nullptr, bool inLayout = true);
void markSiblingsWithFloatsForLayout(RenderBox* floatToRemove = nullptr);
- LayoutUnit logicalTopForFloat(const FloatingObject* floatingObject) const { return isHorizontalWritingMode() ? floatingObject->y() : floatingObject->x(); }
- LayoutUnit logicalBottomForFloat(const FloatingObject* floatingObject) const { return isHorizontalWritingMode() ? floatingObject->maxY() : floatingObject->maxX(); }
- LayoutUnit logicalLeftForFloat(const FloatingObject* floatingObject) const { return isHorizontalWritingMode() ? floatingObject->x() : floatingObject->y(); }
- LayoutUnit logicalRightForFloat(const FloatingObject* floatingObject) const { return isHorizontalWritingMode() ? floatingObject->maxX() : floatingObject->maxY(); }
- LayoutUnit logicalWidthForFloat(const FloatingObject* floatingObject) const { return isHorizontalWritingMode() ? floatingObject->width() : floatingObject->height(); }
- LayoutUnit logicalHeightForFloat(const FloatingObject* floatingObject) const { return isHorizontalWritingMode() ? floatingObject->height() : floatingObject->width(); }
- LayoutSize logicalSizeForFloat(const FloatingObject* floatingObject) const { return isHorizontalWritingMode() ? LayoutSize(floatingObject->width(), floatingObject->height()) : LayoutSize(floatingObject->height(), floatingObject->width()); }
+ const FloatingObjectSet* floatingObjectSet() const { return m_floatingObjects ? &m_floatingObjects->set() : nullptr; }
- int pixelSnappedLogicalTopForFloat(const FloatingObject* floatingObject) const { return isHorizontalWritingMode() ? floatingObject->frameRect().pixelSnappedY() : floatingObject->frameRect().pixelSnappedX(); }
- int pixelSnappedLogicalBottomForFloat(const FloatingObject* floatingObject) const { return isHorizontalWritingMode() ? floatingObject->frameRect().pixelSnappedMaxY() : floatingObject->frameRect().pixelSnappedMaxX(); }
- int pixelSnappedLogicalLeftForFloat(const FloatingObject* floatingObject) const { return isHorizontalWritingMode() ? floatingObject->frameRect().pixelSnappedX() : floatingObject->frameRect().pixelSnappedY(); }
- int pixelSnappedLogicalRightForFloat(const FloatingObject* floatingObject) const { return isHorizontalWritingMode() ? floatingObject->frameRect().pixelSnappedMaxX() : floatingObject->frameRect().pixelSnappedMaxY(); }
+ LayoutUnit logicalTopForFloat(const FloatingObject& floatingObject) const { return isHorizontalWritingMode() ? floatingObject.y() : floatingObject.x(); }
+ LayoutUnit logicalBottomForFloat(const FloatingObject& floatingObject) const { return isHorizontalWritingMode() ? floatingObject.maxY() : floatingObject.maxX(); }
+ LayoutUnit logicalLeftForFloat(const FloatingObject& floatingObject) const { return isHorizontalWritingMode() ? floatingObject.x() : floatingObject.y(); }
+ LayoutUnit logicalRightForFloat(const FloatingObject& floatingObject) const { return isHorizontalWritingMode() ? floatingObject.maxX() : floatingObject.maxY(); }
+ LayoutUnit logicalWidthForFloat(const FloatingObject& floatingObject) const { return isHorizontalWritingMode() ? floatingObject.width() : floatingObject.height(); }
+ LayoutUnit logicalHeightForFloat(const FloatingObject& floatingObject) const { return isHorizontalWritingMode() ? floatingObject.height() : floatingObject.width(); }
- void setLogicalTopForFloat(FloatingObject* floatingObject, LayoutUnit logicalTop)
+ void setLogicalTopForFloat(FloatingObject& floatingObject, LayoutUnit logicalTop)
{
if (isHorizontalWritingMode())
- floatingObject->setY(logicalTop);
+ floatingObject.setY(logicalTop);
else
- floatingObject->setX(logicalTop);
+ floatingObject.setX(logicalTop);
}
- void setLogicalLeftForFloat(FloatingObject* floatingObject, LayoutUnit logicalLeft)
+ void setLogicalLeftForFloat(FloatingObject& floatingObject, LayoutUnit logicalLeft)
{
if (isHorizontalWritingMode())
- floatingObject->setX(logicalLeft);
+ floatingObject.setX(logicalLeft);
else
- floatingObject->setY(logicalLeft);
+ floatingObject.setY(logicalLeft);
}
- void setLogicalHeightForFloat(FloatingObject* floatingObject, LayoutUnit logicalHeight)
+ void setLogicalHeightForFloat(FloatingObject& floatingObject, LayoutUnit logicalHeight)
{
if (isHorizontalWritingMode())
- floatingObject->setHeight(logicalHeight);
+ floatingObject.setHeight(logicalHeight);
else
- floatingObject->setWidth(logicalHeight);
+ floatingObject.setWidth(logicalHeight);
}
- void setLogicalWidthForFloat(FloatingObject* floatingObject, LayoutUnit logicalWidth)
+ void setLogicalWidthForFloat(FloatingObject& floatingObject, LayoutUnit logicalWidth)
{
if (isHorizontalWritingMode())
- floatingObject->setWidth(logicalWidth);
+ floatingObject.setWidth(logicalWidth);
else
- floatingObject->setHeight(logicalWidth);
+ floatingObject.setHeight(logicalWidth);
}
- LayoutUnit xPositionForFloatIncludingMargin(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->x() + child->renderer().marginLeft() : child->x() + marginBeforeForChild(child->renderer()); }
- LayoutUnit yPositionForFloatIncludingMargin(const FloatingObject* child) const { return isHorizontalWritingMode() ? child->y() + marginBeforeForChild(child->renderer()) : child->y() + child->renderer().marginTop(); }
+ LayoutUnit xPositionForFloatIncludingMargin(const FloatingObject& floatingObject) const { return isHorizontalWritingMode() ? floatingObject.x() + floatingObject.renderer().marginLeft() : floatingObject.x() + marginBeforeForChild(floatingObject.renderer()); }
+ LayoutUnit yPositionForFloatIncludingMargin(const FloatingObject& floatingObject) const { return isHorizontalWritingMode() ? floatingObject.y() + marginBeforeForChild(floatingObject.renderer()) : floatingObject.y() + floatingObject.renderer().marginTop(); }
- LayoutPoint flipFloatForWritingModeForChild(const FloatingObject*, const LayoutPoint&) const;
+ LayoutPoint flipFloatForWritingModeForChild(const FloatingObject&, const LayoutPoint&) const;
RenderLineBoxList& lineBoxes() { return m_lineBoxes; }
const RenderLineBoxList& lineBoxes() const { return m_lineBoxes; }
- RootInlineBox* firstRootBox() const { return toRootInlineBox(m_lineBoxes.firstLineBox()); }
- RootInlineBox* lastRootBox() const { return toRootInlineBox(m_lineBoxes.lastLineBox()); }
+ RootInlineBox* firstRootBox() const { return downcast<RootInlineBox>(m_lineBoxes.firstLineBox()); }
+ RootInlineBox* lastRootBox() const { return downcast<RootInlineBox>(m_lineBoxes.lastLineBox()); }
+
+ bool hasLines() const;
+ void invalidateLineLayoutPath() final;
- virtual bool hasLines() const override final;
+ enum LineLayoutPath { UndeterminedPath = 0, SimpleLinesPath, LineBoxesPath, ForceLineBoxesPath };
+ LineLayoutPath lineLayoutPath() const { return static_cast<LineLayoutPath>(renderBlockFlowLineLayoutPath()); }
+ void setLineLayoutPath(LineLayoutPath path) { setRenderBlockFlowLineLayoutPath(path); }
// Helper methods for computing line counts and heights for line counts.
RootInlineBox* lineAtIndex(int) const;
@@ -349,17 +358,17 @@ public:
int heightForLineCount(int);
void clearTruncation();
- void setHasMarkupTruncation(bool b) { m_hasMarkupTruncation = b; }
- bool hasMarkupTruncation() const { return m_hasMarkupTruncation; }
+ void setHasMarkupTruncation(bool b) { setRenderBlockFlowHasMarkupTruncation(b); }
+ bool hasMarkupTruncation() const { return renderBlockFlowHasMarkupTruncation(); }
bool containsNonZeroBidiLevel() const;
- const SimpleLineLayout::Layout* simpleLineLayout() const { return m_simpleLineLayout.get(); }
+ const SimpleLineLayout::Layout* simpleLineLayout() const;
void deleteLineBoxesBeforeSimpleLineLayout();
void ensureLineBoxes();
-#ifndef NDEBUG
- virtual void showLineTreeAndMark(const InlineBox* = nullptr, const char* = nullptr, const InlineBox* = nullptr, const char* = nullptr, const RenderObject* = nullptr) const override;
+#if ENABLE(TREE_DEBUGGING)
+ void showLineTreeAndMark(const InlineBox* markedBox, int depth) const;
#endif
// Returns the logicalOffset at the top of the next page. If the offset passed in is already at the top of the current page,
@@ -372,23 +381,31 @@ public:
LayoutUnit pageLogicalTopForOffset(LayoutUnit offset) const;
LayoutUnit pageLogicalHeightForOffset(LayoutUnit offset) const;
LayoutUnit pageRemainingLogicalHeightForOffset(LayoutUnit offset, PageBoundaryRule = IncludePageBoundary) const;
+ LayoutUnit logicalHeightForChildForFragmentation(const RenderBox& child) const;
bool hasNextPage(LayoutUnit logicalOffset, PageBoundaryRule = ExcludePageBoundary) const;
void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) override;
-
+ void removeChild(RenderObject&) override;
+
void createMultiColumnFlowThread();
void destroyMultiColumnFlowThread();
-
- virtual void updateColumnProgressionFromStyle(RenderStyle*) override;
-protected:
+ void updateColumnProgressionFromStyle(RenderStyle&);
+ void updateStylesForColumnChildren();
+
+ bool needsLayoutAfterRegionRangeChange() const override;
+ WEBCORE_EXPORT RenderText* findClosestTextAtAbsolutePoint(const FloatPoint&);
+
// A page break is required at some offset due to space shortage in the current fragmentainer.
void setPageBreak(LayoutUnit offset, LayoutUnit spaceShortage);
-
// Update minimum page height required to avoid fragmentation where it shouldn't occur (inside
// unbreakable content, between orphans and widows, etc.). This will be used as a hint to the
// column balancer to help set a good minimum column height.
void updateMinimumPageHeight(LayoutUnit offset, LayoutUnit minHeight);
+
+protected:
+ void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const override;
+
bool pushToNextPageWithMinimumLogicalHeight(LayoutUnit& adjustment, LayoutUnit logicalOffset, LayoutUnit minimumLogicalHeight) const;
// If the child is unsplittable and can't fit on the current page, return the top of the next page/column.
@@ -427,124 +444,138 @@ protected:
bool mustSeparateMarginBeforeForChild(const RenderBox&) const;
bool mustSeparateMarginAfterForChild(const RenderBox&) const;
- virtual void styleWillChange(StyleDifference, const RenderStyle& newStyle) override;
- virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
+ void styleWillChange(StyleDifference, const RenderStyle& newStyle) override;
+ void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
void createFloatingObjects();
- virtual int firstLineBaseline() const override;
- virtual int inlineBlockBaseline(LineDirectionMode) const override;
+ std::optional<int> firstLineBaseline() const override;
+ std::optional<int> inlineBlockBaseline(LineDirectionMode) const override;
- virtual bool isMultiColumnBlockFlow() const override { return multiColumnFlowThread(); }
+ bool isMultiColumnBlockFlow() const override { return multiColumnFlowThread(); }
- virtual void setComputedColumnCountAndWidth(int, LayoutUnit) override;
+ void setComputedColumnCountAndWidth(int, LayoutUnit);
- virtual LayoutUnit computedColumnWidth() const override;
- virtual unsigned computedColumnCount() const override;
+ LayoutUnit computedColumnWidth() const;
+ unsigned computedColumnCount() const;
bool isTopLayoutOverflowAllowed() const override;
bool isLeftLayoutOverflowAllowed() const override;
+ void addFloatsToNewParent(RenderBlockFlow& toBlockFlow) const;
+
+ virtual void computeColumnCountAndWidth();
+ virtual bool requiresColumns(int) const;
+
+ virtual void cachePriorCharactersIfNeeded(const LazyLineBreakIterator&) {};
+
private:
+ bool recomputeLogicalWidthAndColumnWidth();
+ LayoutUnit columnGap() const;
+
+ RenderBlockFlow* previousSiblingWithOverhangingFloats(bool& parentHasFloats) const;
+
// Called to lay out the legend for a fieldset or the ruby text of a ruby run. Also used by multi-column layout to handle
// the flow thread child.
virtual RenderObject* layoutSpecialExcludedChild(bool /*relayoutChildren*/);
- void checkForPaginationLogicalHeightChange(LayoutUnit& pageLogicalHeight, bool& pageLogicalHeightChanged, bool& hasSpecifiedPageLogicalHeight);
+ void checkForPaginationLogicalHeightChange(bool& relayoutChildren, LayoutUnit& pageLogicalHeight, bool& pageLogicalHeightChanged);
- virtual void paintInlineChildren(PaintInfo&, const LayoutPoint&) override;
- virtual void paintFloats(PaintInfo&, const LayoutPoint&, bool preservePhase = false) override;
+ void paintInlineChildren(PaintInfo&, const LayoutPoint&) override;
+ void paintFloats(PaintInfo&, const LayoutPoint&, bool preservePhase = false) override;
- virtual void moveAllChildrenIncludingFloatsTo(RenderBlock* toBlock, bool fullRemoveInsert) override;
- virtual void repaintOverhangingFloats(bool paintAllDescendants) override final;
- virtual void clipOutFloatingObjects(RenderBlock&, const PaintInfo*, const LayoutPoint&, const LayoutSize&) override;
+ void moveAllChildrenIncludingFloatsTo(RenderBlock& toBlock, bool fullRemoveInsert) override;
+ void repaintOverhangingFloats(bool paintAllDescendants) final;
+ void clipOutFloatingObjects(RenderBlock&, const PaintInfo*, const LayoutPoint&, const LayoutSize&) override;
FloatingObject* insertFloatingObject(RenderBox&);
void removeFloatingObject(RenderBox&);
void removeFloatingObjectsBelow(FloatingObject*, int logicalOffset);
- LayoutPoint computeLogicalLocationForFloat(const FloatingObject*, LayoutUnit logicalTopOffset) const;
+ LayoutPoint computeLogicalLocationForFloat(const FloatingObject&, LayoutUnit logicalTopOffset);
// Called from lineWidth, to position the floats added in the last line.
// Returns true if and only if it has positioned any floats.
bool positionNewFloats();
- void newLine(EClear);
+ void clearFloats(EClear);
- virtual LayoutUnit logicalRightFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, LayoutUnit logicalHeight) const override;
- virtual LayoutUnit logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, LayoutUnit logicalHeight) const override;
+ LayoutUnit logicalRightFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, LayoutUnit logicalHeight) const override;
+ LayoutUnit logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, LayoutUnit logicalHeight) const override;
LayoutUnit logicalRightOffsetForPositioningFloat(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining) const;
LayoutUnit logicalLeftOffsetForPositioningFloat(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining) const;
+ LayoutUnit lowestInitialLetterLogicalBottom() const;
+
LayoutUnit lowestFloatLogicalBottom(FloatingObject::Type = FloatingObject::FloatLeftRight) const;
LayoutUnit nextFloatLogicalBottomBelow(LayoutUnit) const;
LayoutUnit nextFloatLogicalBottomBelowForBlock(LayoutUnit) const;
LayoutUnit addOverhangingFloats(RenderBlockFlow& child, bool makeChildPaintOtherFloats);
bool hasOverhangingFloat(RenderBox&);
- void addIntrudingFloats(RenderBlockFlow* prev, LayoutUnit xoffset, LayoutUnit yoffset);
- bool hasOverhangingFloats() { return parent() && !hasColumns() && containsFloats() && lowestFloatLogicalBottom() > logicalHeight(); }
+ void addIntrudingFloats(RenderBlockFlow* prev, RenderBlockFlow* container, LayoutUnit xoffset, LayoutUnit yoffset);
+ bool hasOverhangingFloats() { return parent() && containsFloats() && lowestFloatLogicalBottom() > logicalHeight(); }
LayoutUnit getClearDelta(RenderBox& child, LayoutUnit yPos);
void determineLogicalLeftPositionForChild(RenderBox& child, ApplyLayoutDeltaMode = DoNotApplyLayoutDelta);
- virtual bool hitTestFloats(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset) override;
- virtual bool hitTestInlineChildren(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override;
+ bool hitTestFloats(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset) override;
+ bool hitTestInlineChildren(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override;
void addOverflowFromFloats();
- virtual void addOverflowFromInlineChildren();
+ void addOverflowFromInlineChildren() override;
void fitBorderToLinesIfNeeded(); // Shrink the box in which the border paints if border-fit is set.
void adjustForBorderFit(LayoutUnit x, LayoutUnit& left, LayoutUnit& right) const;
void markLinesDirtyInBlockRange(LayoutUnit logicalTop, LayoutUnit logicalBottom, RootInlineBox* highest = 0);
- virtual GapRects inlineSelectionGaps(RenderBlock& rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
+ GapRects inlineSelectionGaps(RenderBlock& rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLogicalRight, const LogicalSelectionOffsetCaches&, const PaintInfo*) override;
Position positionForBox(InlineBox*, bool start = true) const;
- virtual VisiblePosition positionForPointWithInlineChildren(const LayoutPoint& pointInLogicalContents) override;
- virtual void addFocusRingRectsForInlineChildren(Vector<IntRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*) override;
+ VisiblePosition positionForPointWithInlineChildren(const LayoutPoint& pointInLogicalContents, const RenderRegion*) override;
+ void addFocusRingRectsForInlineChildren(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*) override;
// FIXME-BLOCKFLOW: These methods have implementations in
// RenderBlockLineLayout. They should be moved to the proper header once the
// line layout code is separated from RenderBlock and RenderBlockFlow.
// START METHODS DEFINED IN RenderBlockLineLayout
public:
- static void appendRunsForObject(BidiRunList<BidiRun>&, int start, int end, RenderObject*, InlineBidiResolver&);
+ static void appendRunsForObject(BidiRunList<BidiRun>*, int start, int end, RenderObject&, InlineBidiResolver&);
RootInlineBox* createAndAppendRootInlineBox();
- LayoutUnit startAlignedOffsetForLine(LayoutUnit position, bool shouldIndentText);
+ LayoutUnit startAlignedOffsetForLine(LayoutUnit position, IndentTextOrNot shouldIndentText);
virtual ETextAlign textAlignmentForLine(bool endsWithSoftBreak) const;
virtual void adjustInlineDirectionLineBounds(int /* expansionOpportunityCount */, float& /* logicalLeft */, float& /* logicalWidth */) const { }
-private:
+private:
+ void adjustIntrinsicLogicalWidthsForColumns(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const;
+
void layoutLineBoxes(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom);
- void layoutSimpleLines(LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom);
+ void layoutSimpleLines(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom);
virtual std::unique_ptr<RootInlineBox> createRootInlineBox(); // Subclassed by RenderSVGText.
- InlineFlowBox* createLineBoxes(RenderObject*, const LineInfo&, InlineBox* childBox, bool startsNewSegment);
+ InlineFlowBox* createLineBoxes(RenderObject*, const LineInfo&, InlineBox* childBox);
RootInlineBox* constructLine(BidiRunList<BidiRun>&, const LineInfo&);
void setMarginsForRubyRun(BidiRun*, RenderRubyRun&, RenderObject*, const LineInfo&);
void computeInlineDirectionPositionsForLine(RootInlineBox*, const LineInfo&, BidiRun* firstRun, BidiRun* trailingSpaceRun, bool reachedEnd, GlyphOverflowAndFallbackFontsMap&, VerticalPositionCache&, WordMeasurements&);
+ void updateRubyForJustifiedText(RenderRubyRun&, BidiRun&, const Vector<unsigned, 16>& expansionOpportunities, unsigned& expansionOpportunityCount, float& totalLogicalWidth, float availableLogicalWidth, size_t& expansionIndex);
+ void computeExpansionForJustifiedText(BidiRun* firstRun, BidiRun* trailingSpaceRun, const Vector<unsigned, 16>& expansionOpportunities, unsigned expansionOpportunityCount, float totalLogicalWidth, float availableLogicalWidth);
BidiRun* computeInlineDirectionPositionsForSegment(RootInlineBox*, const LineInfo&, ETextAlign, float& logicalLeft,
float& availableLogicalWidth, BidiRun* firstRun, BidiRun* trailingSpaceRun, GlyphOverflowAndFallbackFontsMap& textBoxDataMap, VerticalPositionCache&, WordMeasurements&);
void computeBlockDirectionPositionsForLine(RootInlineBox*, BidiRun*, GlyphOverflowAndFallbackFontsMap&, VerticalPositionCache&);
BidiRun* handleTrailingSpaces(BidiRunList<BidiRun>&, BidiContext*);
- void appendFloatingObjectToLastLine(FloatingObject*);
+ void appendFloatingObjectToLastLine(FloatingObject&);
// Helper function for layoutInlineChildren()
- RootInlineBox* createLineBoxesFromBidiRuns(BidiRunList<BidiRun>&, const InlineIterator& end, LineInfo&, VerticalPositionCache&, BidiRun* trailingSpaceRun, WordMeasurements&);
+ RootInlineBox* createLineBoxesFromBidiRuns(unsigned bidiLevel, BidiRunList<BidiRun>&, const InlineIterator& end, LineInfo&, VerticalPositionCache&, BidiRun* trailingSpaceRun, WordMeasurements&);
void layoutRunsAndFloats(LineLayoutState&, bool hasInlineChild);
const InlineIterator& restartLayoutRunsAndFloatsInRange(LayoutUnit oldLogicalHeight, LayoutUnit newLogicalHeight, FloatingObject* lastFloatFromPreviousLine, InlineBidiResolver&, const InlineIterator&);
void layoutRunsAndFloatsInRange(LineLayoutState&, InlineBidiResolver&, const InlineIterator& cleanLineStart, const BidiStatus& cleanLineBidiStatus, unsigned consecutiveHyphenatedLines);
-#if ENABLE(CSS_SHAPES)
- void updateShapeAndSegmentsForCurrentLine(ShapeInsideInfo*&, const LayoutSize&, LineLayoutState&);
- void updateShapeAndSegmentsForCurrentLineInFlowThread(ShapeInsideInfo*&, LineLayoutState&);
- bool adjustLogicalLineTopAndLogicalHeightIfNeeded(ShapeInsideInfo*, LayoutUnit, LineLayoutState&, InlineBidiResolver&, FloatingObject*, InlineIterator&, WordMeasurements&);
-#endif
+ void reattachCleanLineFloats(RootInlineBox& cleanLine, LayoutUnit delta, bool isFirstCleanLine);
void linkToEndLineIfNeeded(LineLayoutState&);
- static void repaintDirtyFloats(Vector<FloatWithRect>& floats);
- void checkFloatsInCleanLine(RootInlineBox*, Vector<FloatWithRect>&, size_t& floatIndex, bool& encounteredNewFloat, bool& dirtiedByFloat);
+ void checkFloatInCleanLine(RootInlineBox& cleanLine, RenderBox& floatBoxOnCleanLine, FloatWithRect& matchingFloatWithRect,
+ bool& encounteredNewFloat, bool& dirtiedByFloat);
RootInlineBox* determineStartPosition(LineLayoutState&, InlineBidiResolver&);
void determineEndPosition(LineLayoutState&, RootInlineBox* startBox, InlineIterator& cleanLineStart, BidiStatus& cleanLineBidiStatus);
bool checkPaginationAndFloatsAtEndLine(LineLayoutState&);
@@ -553,39 +584,44 @@ private:
void checkLinesForTextOverflow();
// Positions new floats and also adjust all floats encountered on the line if any of them
// have to move to the next page/column.
- bool positionNewFloatOnLine(FloatingObject* newFloat, FloatingObject* lastFloatFromPreviousLine, LineInfo&, LineWidth&);
+ bool positionNewFloatOnLine(const FloatingObject& newFloat, FloatingObject* lastFloatFromPreviousLine, LineInfo&, LineWidth&);
// This function is called to test a line box that has moved in the block direction to see if it has ended up in a new
// region/page/column that has a different available line width than the old one. Used to know when you have to dirty a
// line, i.e., that it can't be re-used.
bool lineWidthForPaginatedLineChanged(RootInlineBox*, LayoutUnit lineDelta, RenderFlowThread*) const;
- void updateLogicalWidthForAlignment(const ETextAlign&, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, int expansionOpportunityCount);
-
+ void updateLogicalWidthForAlignment(const ETextAlign&, const RootInlineBox*, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, int expansionOpportunityCount);
+ void marginCollapseLinesFromStart(LineLayoutState&, RootInlineBox* stopLine);
// END METHODS DEFINED IN RenderBlockLineLayout
bool namedFlowFragmentNeedsUpdate() const;
- virtual bool canHaveChildren() const override;
+ bool canHaveChildren() const override;
+
+ void computeInlinePreferredLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const;
-#if ENABLE(IOS_TEXT_AUTOSIZING)
+#if ENABLE(TEXT_AUTOSIZING)
int m_widthForTextAutosizing;
unsigned m_lineCountForTextAutosizing : 2;
#endif
+ void setSelectionState(SelectionState) final;
+
+ void removeInlineBox(BidiRun&, const RootInlineBox&) const;
public:
// FIXME-BLOCKFLOW: These can be made protected again once all callers have been moved here.
- void adjustLinePositionForPagination(RootInlineBox*, LayoutUnit& deltaOffset, RenderFlowThread*); // 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(RootInlineBox*, LayoutUnit& deltaOffset, bool& overflowsRegion, RenderFlowThread*); // 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 updateRegionForLine(RootInlineBox*) const;
void createRenderNamedFlowFragmentIfNeeded();
// Pagination routines.
- virtual bool relayoutForPagination(bool hasSpecifiedPageLogicalHeight, LayoutUnit pageLogicalHeight, LayoutStateMaintainer&);
+ bool relayoutForPagination(LayoutStateMaintainer&);
bool hasRareBlockFlowData() const { return m_rareBlockFlowData.get(); }
RenderBlockFlowRareData* rareBlockFlowData() const { ASSERT_WITH_SECURITY_IMPLICATION(hasRareBlockFlowData()); return m_rareBlockFlowData.get(); }
RenderBlockFlowRareData& ensureRareBlockFlowData();
void materializeRareBlockFlowData();
-#if ENABLE(IOS_TEXT_AUTOSIZING)
- int immediateLineCount();
+#if ENABLE(TEXT_AUTOSIZING)
+ int lineCountForTextAutosizing();
void adjustComputedFontSizes(float size, float visibleWidth);
void resetComputedFontSize()
{
@@ -595,7 +631,7 @@ public:
#endif
protected:
- OwnPtr<FloatingObjects> m_floatingObjects;
+ std::unique_ptr<FloatingObjects> m_floatingObjects;
std::unique_ptr<RenderBlockFlowRareData> m_rareBlockFlowData;
RenderLineBoxList m_lineBoxes;
std::unique_ptr<SimpleLineLayout::Layout> m_simpleLineLayout;
@@ -604,14 +640,17 @@ protected:
friend class LineWidth; // Needs to know FloatingObject
};
-template<> inline bool isRendererOfType<const RenderBlockFlow>(const RenderObject& renderer) { return renderer.isRenderBlockFlow(); }
-RENDER_OBJECT_TYPE_CASTS(RenderBlockFlow, isRenderBlockFlow())
-
inline bool RenderElement::isRenderNamedFlowFragmentContainer() const
{
- return isRenderBlockFlow() && toRenderBlockFlow(this)->renderNamedFlowFragment();
+ return is<RenderBlockFlow>(*this) && downcast<RenderBlockFlow>(*this).renderNamedFlowFragment();
+}
+
+inline const SimpleLineLayout::Layout* RenderBlockFlow::simpleLineLayout() const
+{
+ ASSERT(lineLayoutPath() == SimpleLinesPath || !m_simpleLineLayout);
+ return m_simpleLineLayout.get();
}
} // namespace WebCore
-#endif // RenderBlockFlow_h
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderBlockFlow, isRenderBlockFlow())