提交 7d3feb39 编写于 作者: O Ojan Vafai

Remove line breaking to avoid window.

Now that we don't have multi-column or pagination, this
is dead code. This also means we don't need to call
layoutBlockFlow in a loop.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/697713002
上级 8279e860
......@@ -161,42 +161,6 @@ bool RenderBlockFlow::updateLogicalWidthAndColumnWidth()
return RenderBlock::updateLogicalWidthAndColumnWidth();
}
void RenderBlockFlow::setBreakAtLineToAvoidWidow(int lineToBreak)
{
ASSERT(lineToBreak >= 0);
ensureRareData();
ASSERT(!m_rareData->m_didBreakAtLineToAvoidWidow);
m_rareData->m_lineBreakToAvoidWidow = lineToBreak;
}
void RenderBlockFlow::setDidBreakAtLineToAvoidWidow()
{
ASSERT(!shouldBreakAtLineToAvoidWidow());
// This function should be called only after a break was applied to avoid widows
// so assert |m_rareData| exists.
ASSERT(m_rareData);
m_rareData->m_didBreakAtLineToAvoidWidow = true;
}
void RenderBlockFlow::clearDidBreakAtLineToAvoidWidow()
{
if (!m_rareData)
return;
m_rareData->m_didBreakAtLineToAvoidWidow = false;
}
void RenderBlockFlow::clearShouldBreakAtLineToAvoidWidow() const
{
ASSERT(shouldBreakAtLineToAvoidWidow());
if (!m_rareData)
return;
m_rareData->m_lineBreakToAvoidWidow = -1;
}
bool RenderBlockFlow::isSelfCollapsingBlock() const
{
m_hasOnlySelfCollapsingChildren = RenderBlock::isSelfCollapsingBlock();
......@@ -218,13 +182,7 @@ void RenderBlockFlow::layoutBlock(bool relayoutChildren)
SubtreeLayoutScope layoutScope(*this);
// Multiple passes might be required for column and pagination based layout
// In the case of the old column code the number of passes will only be two
// however, in the newer column code the number of passes could equal the
// number of columns.
bool done = false;
while (!done)
done = layoutBlockFlow(relayoutChildren, layoutScope);
layoutBlockFlow(relayoutChildren, layoutScope);
updateLayerTransformAfterLayout();
......@@ -238,7 +196,7 @@ void RenderBlockFlow::layoutBlock(bool relayoutChildren)
clearNeedsLayout();
}
inline bool RenderBlockFlow::layoutBlockFlow(bool relayoutChildren, SubtreeLayoutScope& layoutScope)
inline void RenderBlockFlow::layoutBlockFlow(bool relayoutChildren, SubtreeLayoutScope& layoutScope)
{
LayoutUnit oldLeft = logicalLeft();
bool logicalWidthChanged = updateLogicalWidthAndColumnWidth();
......@@ -278,11 +236,6 @@ inline bool RenderBlockFlow::layoutBlockFlow(bool relayoutChildren, SubtreeLayou
if (lowestFloatLogicalBottom() > (logicalHeight() - afterEdge) && createsBlockFormattingContext())
setLogicalHeight(lowestFloatLogicalBottom() + afterEdge);
if (shouldBreakAtLineToAvoidWidow()) {
setEverHadLayout(true);
return false;
}
// Calculate our new height.
LayoutUnit oldHeight = logicalHeight();
LayoutUnit oldClientAfterEdge = clientLogicalBottom();
......@@ -311,7 +264,6 @@ inline bool RenderBlockFlow::layoutBlockFlow(bool relayoutChildren, SubtreeLayou
computeOverflow(oldClientAfterEdge);
m_descendantsWithFloatsMarkedForLayout = false;
return true;
}
void RenderBlockFlow::determineLogicalLeftPositionForChild(RenderBox* child)
......
......@@ -156,7 +156,7 @@ protected:
void determineLogicalLeftPositionForChild(RenderBox* child);
private:
bool layoutBlockFlow(bool relayoutChildren, SubtreeLayoutScope&);
void layoutBlockFlow(bool relayoutChildren, SubtreeLayoutScope&);
void layoutBlockChildren(bool relayoutChildren, SubtreeLayoutScope&, LayoutUnit beforeEdge, LayoutUnit afterEdge);
void layoutBlockChild(RenderBox* child, MarginInfo&, LayoutUnit& previousFloatLogicalBottom);
......@@ -199,14 +199,6 @@ private:
void updateLogicalWidthForAlignment(const ETextAlign&, const RootInlineBox*, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float& availableLogicalWidth, unsigned expansionOpportunityCount);
bool shouldBreakAtLineToAvoidWidow() const { return m_rareData && m_rareData->m_lineBreakToAvoidWidow >= 0; }
void clearShouldBreakAtLineToAvoidWidow() const;
int lineBreakToAvoidWidow() const { return m_rareData ? m_rareData->m_lineBreakToAvoidWidow : -1; }
void setBreakAtLineToAvoidWidow(int);
void clearDidBreakAtLineToAvoidWidow();
void setDidBreakAtLineToAvoidWidow();
bool didBreakAtLineToAvoidWidow() const { return m_rareData && m_rareData->m_didBreakAtLineToAvoidWidow; }
public:
struct FloatWithRect {
FloatWithRect(RenderBox* f)
......@@ -254,8 +246,6 @@ public:
public:
RenderBlockFlowRareData(const RenderBlockFlow* block)
: m_margins(positiveMarginBeforeDefault(block), negativeMarginBeforeDefault(block), positiveMarginAfterDefault(block), negativeMarginAfterDefault(block))
, m_lineBreakToAvoidWidow(-1)
, m_didBreakAtLineToAvoidWidow(false)
, m_discardMarginBefore(false)
, m_discardMarginAfter(false)
{
......@@ -280,9 +270,6 @@ public:
}
MarginValues m_margins;
int m_lineBreakToAvoidWidow;
bool m_didBreakAtLineToAvoidWidow : 1;
bool m_discardMarginBefore : 1;
bool m_discardMarginAfter : 1;
};
......
......@@ -800,8 +800,6 @@ void RenderBlockFlow::layoutRunsAndFloatsInRange(LineLayoutState& layoutState,
lineMidpointState.reset();
resolver.setPosition(endOfLine, numberOfIsolateAncestors(endOfLine));
}
clearDidBreakAtLineToAvoidWidow();
}
void RenderBlockFlow::linkToEndLineIfNeeded(LineLayoutState& layoutState)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册