diff options
Diffstat (limited to 'Source/WebCore/rendering/RenderBlockFlow.cpp')
-rw-r--r-- | Source/WebCore/rendering/RenderBlockFlow.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/Source/WebCore/rendering/RenderBlockFlow.cpp b/Source/WebCore/rendering/RenderBlockFlow.cpp index 33bce4025..53ff0b6c7 100644 --- a/Source/WebCore/rendering/RenderBlockFlow.cpp +++ b/Source/WebCore/rendering/RenderBlockFlow.cpp @@ -1648,7 +1648,15 @@ static inline bool needsAppleMailPaginationQuirk(RootInlineBox& lineBox) return false; } - + +static void clearShouldBreakAtLineToAvoidWidowIfNeeded(RenderBlockFlow& blockFlow) +{ + if (!blockFlow.shouldBreakAtLineToAvoidWidow()) + return; + blockFlow.clearShouldBreakAtLineToAvoidWidow(); + blockFlow.setDidBreakAtLineToAvoidWidow(); +} + void RenderBlockFlow::adjustLinePositionForPagination(RootInlineBox* lineBox, LayoutUnit& delta, bool& overflowsRegion, RenderFlowThread* flowThread) { // FIXME: Ignore anonymous inline blocks. Handle the delta already having been set because of @@ -1702,8 +1710,11 @@ void RenderBlockFlow::adjustLinePositionForPagination(RootInlineBox* lineBox, La logicalBottom = intMinForLayoutUnit; lineBox->computeReplacedAndTextLineTopAndBottom(logicalOffset, logicalBottom); lineHeight = logicalBottom - logicalOffset; - if (logicalOffset == intMaxForLayoutUnit || lineHeight > pageLogicalHeight) - return; // Give up. We're genuinely too big even after excluding blank space and overflow. + if (logicalOffset == intMaxForLayoutUnit || lineHeight > pageLogicalHeight) { + // Give up. We're genuinely too big even after excluding blank space and overflow. + clearShouldBreakAtLineToAvoidWidowIfNeeded(*this); + return; + } pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); } @@ -1712,10 +1723,8 @@ void RenderBlockFlow::adjustLinePositionForPagination(RootInlineBox* lineBox, La int lineIndex = lineCount(lineBox); if (remainingLogicalHeight < lineHeight || (shouldBreakAtLineToAvoidWidow() && lineBreakToAvoidWidow() == lineIndex)) { - if (shouldBreakAtLineToAvoidWidow() && lineBreakToAvoidWidow() == lineIndex) { - clearShouldBreakAtLineToAvoidWidow(); - setDidBreakAtLineToAvoidWidow(); - } + if (lineBreakToAvoidWidow() == lineIndex) + clearShouldBreakAtLineToAvoidWidowIfNeeded(*this); // If we have a non-uniform page height, then we have to shift further possibly. if (!hasUniformPageLogicalHeight && !pushToNextPageWithMinimumLogicalHeight(remainingLogicalHeight, logicalOffset, lineHeight)) return; @@ -3528,7 +3537,8 @@ bool RenderBlockFlow::relayoutForPagination(LayoutStateMaintainer& statePusher) bool RenderBlockFlow::hasLines() const { - ASSERT(childrenInline()); + if (!childrenInline()) + return false; if (auto simpleLineLayout = this->simpleLineLayout()) return simpleLineLayout->lineCount(); |