Index: third_party/WebKit/Source/core/paint/TablePainter.cpp |
diff --git a/third_party/WebKit/Source/core/paint/TablePainter.cpp b/third_party/WebKit/Source/core/paint/TablePainter.cpp |
index 0e1ea132e9dc1facd49a7aaa19d08bcd1fdf3c12..d2da724433ca7a4b21516e4e625e25b2595656bd 100644 |
--- a/third_party/WebKit/Source/core/paint/TablePainter.cpp |
+++ b/third_party/WebKit/Source/core/paint/TablePainter.cpp |
@@ -6,6 +6,7 @@ |
#include "core/layout/LayoutTable.h" |
#include "core/layout/LayoutTableSection.h" |
+#include "core/layout/LayoutView.h" |
#include "core/style/CollapsedBorderValue.h" |
#include "core/paint/BoxClipper.h" |
#include "core/paint/BoxPainter.h" |
@@ -17,6 +18,32 @@ |
namespace blink { |
+void TablePainter::paintRepeatingHeaderGroup(const PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutBox* child, const CollapsedBorderValue& currentBorderValue, ItemToPaint itemToPaint) |
Xianzhu
2016/05/31 02:11:33
Pass paintInfoForDescendants from caller, then you
Xianzhu
2016/06/01 19:19:39
s/LayoutBox* child/const LayoutTableSection& heade
|
+{ |
+ if (m_layoutTable.header() != child) |
+ return; |
+ if (child->getPaginationBreakability() == LayoutTableBoxComponent::AllowAnyBreaks) |
Xianzhu
2016/05/31 02:11:33
Use LayoutBox::AllowAnyBreaks.
|
+ return; |
+ LayoutUnit printedPageLogicalHeight = child->view() ? child->view()->pageLogicalHeight() : LayoutUnit(); |
+ LayoutUnit pageHeight = std::max(printedPageLogicalHeight, m_layoutTable.flowThreadContainingBlock() ? m_layoutTable.pageLogicalHeightForOffset(LayoutUnit()) : LayoutUnit()); |
+ if (!pageHeight) |
+ return; |
+ |
+ int pages = static_cast<int>(ceilf(m_layoutTable.logicalHeight() / pageHeight)); |
+ LayoutPoint paginationOffset = paintOffset; |
+ paginationOffset += LayoutPoint(0, pageHeight - m_layoutTable.pageLogicalOffset()); |
+ for (int i = 1; i < pages; i++) { |
+ LayoutPoint childPoint = m_layoutTable.flipForWritingModeForChild(child, paginationOffset); |
+ if (itemToPaint == PaintCollapsedBorders) { |
+ LayoutTableSection* section = toLayoutTableSection(child); |
+ TableSectionPainter(*section).paintCollapsedBorders(paintInfo.forDescendants(), childPoint, currentBorderValue); |
Xianzhu
2016/06/01 19:19:39
Move the common code (LayoutTableSection* section
|
+ } else { |
+ child->paint(paintInfo.forDescendants(), childPoint); |
+ } |
+ paginationOffset += LayoutPoint(0, pageHeight); |
+ } |
Xianzhu
2016/05/31 02:11:34
We paint each page as a layer fragment in PaintLay
rhogan
2016/06/01 18:39:46
Right, but table headers don't have a layer - so t
Xianzhu
2016/06/01 19:19:39
I think this is the right place (and TableSectionP
|
+} |
+ |
void TablePainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
{ |
PaintPhase paintPhase = paintInfo.phase; |
@@ -39,6 +66,7 @@ void TablePainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& pa |
if (child->isBox() && !toLayoutBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child->isTableCaption())) { |
LayoutPoint childPoint = m_layoutTable.flipForWritingModeForChild(toLayoutBox(child), paintOffset); |
child->paint(paintInfoForDescendants, childPoint); |
+ paintRepeatingHeaderGroup(paintInfo, paintOffset, toLayoutBox(child), CollapsedBorderValue(), PaintChild); |
Xianzhu
2016/06/01 19:19:39
This should be in TableSectionPainter::paint(). Wi
|
} |
} |
@@ -51,6 +79,7 @@ void TablePainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& pa |
for (LayoutTableSection* section = m_layoutTable.bottomSection(); section; section = m_layoutTable.sectionAbove(section)) { |
LayoutPoint childPoint = m_layoutTable.flipForWritingModeForChild(section, paintOffset); |
TableSectionPainter(*section).paintCollapsedBorders(paintInfoForDescendants, childPoint, collapsedBorders[i]); |
+ paintRepeatingHeaderGroup(paintInfo, paintOffset, section, collapsedBorders[i], PaintCollapsedBorders); |
} |
} |
} |