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

Unified Diff: third_party/WebKit/Source/core/paint/TableSectionPainter.cpp

Issue 2021703002: Display table header groups at the top of each page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated Created 4 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/TableSectionPainter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp b/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
index 8065aa7dc27dece2724469983c99d2b062265a87..0b22c83ee829b06ff19c1293f23facb57681e0b8 100644
--- a/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
@@ -35,8 +35,44 @@ inline const LayoutTableCell* TableSectionPainter::primaryCellToPaint(unsigned r
return cell;
}
+void TableSectionPainter::paintRepeatingHeaderGroup(const PaintInfo& paintInfo, const LayoutPoint& paintOffset, const CollapsedBorderValue& currentBorderValue, ItemToPaint itemToPaint)
+{
+ if (m_layoutTableSection.getPaginationBreakability() == LayoutBox::AllowAnyBreaks)
+ return;
+ // TODO(rhogan): Should we paint a header repeatedly if it's self-painting?
+ if (m_layoutTableSection.hasSelfPaintingLayer())
+ return;
+ LayoutTable* table = m_layoutTableSection.table();
+ LayoutUnit pageHeight = table->pageLogicalHeightForOffset(LayoutUnit());
+ if (!pageHeight)
+ return;
+
+ LayoutPoint paginationOffset = paintOffset;
+ // Move paginationOffset to the top of the second page.
+ paginationOffset.move(0, pageHeight - table->pageLogicalOffset());
+ // Now move paginationOffset to the top of the page the cull rect starts on.
+ if (paintInfo.cullRect().m_rect.y() > paginationOffset.y())
+ paginationOffset.move(0, pageHeight * static_cast<int>((paintInfo.cullRect().m_rect.y() - paginationOffset.y()) / pageHeight));
+ LayoutUnit bottomBound = std::min(LayoutUnit(paintInfo.cullRect().m_rect.maxY()), paintOffset.y() + table->logicalHeight());
+ while (paginationOffset.y() < bottomBound) {
+ if (itemToPaint == PaintCollapsedBorders)
+ paintCollapsedSectionBorders(paintInfo, paginationOffset, currentBorderValue);
+ else
+ paintSection(paintInfo, paginationOffset);
+ paginationOffset.move(0, pageHeight);
+ }
+}
+
void TableSectionPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
+ paintSection(paintInfo, paintOffset);
+ LayoutTable* table = m_layoutTableSection.table();
+ if (table->header() == m_layoutTableSection)
+ paintRepeatingHeaderGroup(paintInfo, paintOffset, CollapsedBorderValue(), PaintSection);
+}
+
+void TableSectionPainter::paintSection(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
+{
DCHECK(!m_layoutTableSection.needsLayout());
// avoid crashing on bugs that cause us to paint with dirty layout
if (m_layoutTableSection.needsLayout())
@@ -78,6 +114,14 @@ static inline bool compareCellPositionsWithOverflowingCells(LayoutTableCell* ele
void TableSectionPainter::paintCollapsedBorders(const PaintInfo& paintInfo, const LayoutPoint& paintOffset, const CollapsedBorderValue& currentBorderValue)
{
+ paintCollapsedSectionBorders(paintInfo, paintOffset, currentBorderValue);
+ LayoutTable* table = m_layoutTableSection.table();
+ if (table->header() == m_layoutTableSection)
+ paintRepeatingHeaderGroup(paintInfo, paintOffset, currentBorderValue, PaintCollapsedBorders);
+}
+
+void TableSectionPainter::paintCollapsedSectionBorders(const PaintInfo& paintInfo, const LayoutPoint& paintOffset, const CollapsedBorderValue& currentBorderValue)
+{
if (!m_layoutTableSection.numRows() || !m_layoutTableSection.table()->effectiveColumns().size())
return;
« no previous file with comments | « third_party/WebKit/Source/core/paint/TableSectionPainter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698