diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2016-09-28 16:39:37 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2017-02-02 12:31:01 +0000 |
commit | 9daf1655d7e4eaaa6ed5f44055a4b4fd399fd25c (patch) | |
tree | 322337ad0acbc75732f916376ec6d36e7ec0e5bc /Source/WebCore/rendering/RenderBlockFlow.cpp | |
parent | 6882a04fb36642862b11efe514251d32070c3d65 (diff) | |
download | qtwebkit-9daf1655d7e4eaaa6ed5f44055a4b4fd399fd25c.tar.gz |
Imported WebKit commit eb954cdcf58f9b915b2fcb6f8e4cb3a60650a4f3
Change-Id: I8dda875c38075d43b76fe3a21acb0ffa102bb82d
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
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(); |