Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp

Issue 1602773005: Respect break-inside:avoid on table rows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
index e9d007419042c786cccfc583a3b5e339e3730c45..b079f6c5af17d95caf210de248f17991fe705795 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
@@ -41,6 +41,7 @@
#include "core/layout/LayoutMultiColumnFlowThread.h"
#include "core/layout/LayoutMultiColumnSpannerPlaceholder.h"
#include "core/layout/LayoutPagedFlowThread.h"
+#include "core/layout/LayoutTableRow.h"
mstensho (USE GERRIT) 2016/02/26 13:29:59 No need for this, I hope.
#include "core/layout/LayoutText.h"
#include "core/layout/LayoutView.h"
#include "core/layout/TextAutosizer.h"
@@ -722,8 +723,15 @@ LayoutUnit LayoutBlockFlow::adjustBlockChildForPagination(LayoutUnit logicalTop,
static bool shouldSetStrutOnBlock(const LayoutBlockFlow& block, const RootInlineBox& lineBox, LayoutUnit lineLogicalOffset, int lineIndex, LayoutUnit pageLogicalHeight)
{
+ LayoutUnit lineHeight = lineBox.lineBottomWithLeading() - lineBox.lineTopWithLeading();
mstensho (USE GERRIT) 2016/02/26 13:29:59 Maybe you meant to revert these changes, now that
+ LayoutUnit totalLogicalHeight = lineHeight + lineLogicalOffset.clampNegativeToZero();
+
+
bool wantsStrutOnBlock = false;
- if (!block.style()->hasAutoOrphans() && block.style()->orphans() >= lineIndex) {
+ // We avoid letting table cells straddle a page boundary unless the cell is taller than the page.
+ if (block.isTableCell() && totalLogicalHeight <= pageLogicalHeight) {
+ wantsStrutOnBlock = true;
+ } else if (!block.style()->hasAutoOrphans() && block.style()->orphans() >= lineIndex) {
// Not enough orphans here. Push the entire block to the next column / page as an
// attempt to better satisfy the orphans requirement.
wantsStrutOnBlock = true;
@@ -734,8 +742,6 @@ static bool shouldSetStrutOnBlock(const LayoutBlockFlow& block, const RootInline
// means that the line was pushed downwards by preceding floats that didn't fit beside the
// line, and we don't want to move all that, since it has already been established that it
// fits nicely where it is.
- LayoutUnit lineHeight = lineBox.lineBottomWithLeading() - lineBox.lineTopWithLeading();
- LayoutUnit totalLogicalHeight = lineHeight + lineLogicalOffset.clampNegativeToZero();
// It's rather pointless to break before the block if the current line isn't going to
// fit in the same column or page, so check that as well.
if (totalLogicalHeight <= pageLogicalHeight)
@@ -2678,6 +2684,9 @@ bool LayoutBlockFlow::allowsPaginationStrut() const
// previous one. But currently we have no mechanism in place to handle this.
return false;
}
+ if (isTableCell())
+ return true;
+
LayoutBlock* containingBlock = this->containingBlock();
return containingBlock && containingBlock->isLayoutBlockFlow();
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.h ('k') | third_party/WebKit/Source/core/layout/LayoutTableCell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698