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

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, 11 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 a53a7603bd935af6e556c0e1855197b420c4c62f..0b1d2b88ddf91a6c48b575dfda3fd304da450e19 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"
#include "core/layout/LayoutText.h"
#include "core/layout/LayoutView.h"
#include "core/layout/TextAutosizer.h"
@@ -732,6 +733,13 @@ 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();
+ LayoutUnit totalLogicalHeight = lineHeight + std::max<LayoutUnit>(0, lineLogicalOffset);
+
+ // We avoid letting table cells straddle a page boundary unless the cell is taller than the page.
+ if (block.isTableCell() && totalLogicalHeight <= pageLogicalHeight)
mstensho (USE GERRIT) 2016/02/03 14:38:48 It should be better to have allowsPaginationStrut(
+ return true;
+
bool wantsStrutOnBlock = false;
if (!block.style()->hasAutoOrphans() && block.style()->orphans() >= lineIndex) {
// Not enough orphans here. Push the entire block to the next column / page as an
@@ -744,8 +752,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 + std::max<LayoutUnit>(0, lineLogicalOffset);
// 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)

Powered by Google App Engine
This is Rietveld 408576698