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

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

Issue 2584143003: Repeat footers in paginated context (Closed)
Patch Set: bug 656232 Created 3 years, 7 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/paint/TableSectionPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp b/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
index f66cc741d5c26522ae8ff130d27ed3a1c890c050..e76e47c9d8da8f6247bddfef4edf20941113533e 100644
--- a/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
@@ -37,9 +37,9 @@ void TableSectionPainter::PaintRepeatingHeaderGroup(
header_group_offset += row->PaginationStrut();
LayoutUnit offset_to_next_page =
page_height - IntMod(header_group_offset, page_height);
- // Move paginationOffset to the top of the next page.
+ // Move pagination_offset to the top of the next page.
pagination_offset.Move(LayoutUnit(), offset_to_next_page);
- // Now move paginationOffset to the top of the page the cull rect starts on.
+ // Now move pagination_offset to the top of the page the cull rect starts on.
if (paint_info.GetCullRect().rect_.Y() > pagination_offset.Y()) {
pagination_offset.Move(LayoutUnit(),
page_height * ((paint_info.GetCullRect().rect_.Y() -
@@ -69,15 +69,56 @@ void TableSectionPainter::PaintRepeatingHeaderGroup(
}
}
+void TableSectionPainter::PaintRepeatingFooterGroup(
+ const PaintInfo& paint_info,
+ const LayoutPoint& paint_offset,
+ const CollapsedBorderValue& current_border_value,
+ ItemToPaint item_to_paint) {
+ if (!layout_table_section_.IsRepeatingFooterGroup())
+ return;
+ LayoutTable* table = layout_table_section_.Table();
+ LayoutRect sections_rect(LayoutPoint(), table->Size());
+ // Keep the top captions as we need top_offset to be
+ // the offset from the top of table.
+ table->SubtractCaptionRect(sections_rect, LayoutTable::BottomCaptionsOnly);
+ LayoutUnit total_height_of_rows =
+ sections_rect.Height() - table->OuterBorderBottom();
+ // The footer section may be at the top of a page.
+ total_height_of_rows -= (layout_table_section_.LogicalHeight() -
+ layout_table_section_.FirstRow()->PaginationStrut());
+ LayoutPoint top_offset = paint_offset;
+ top_offset.Move(LayoutUnit(), -total_height_of_rows);
+ IntRect cull_rect = paint_info.GetCullRect().rect_;
+ cull_rect.Move(0, -total_height_of_rows.ToInt());
+ for (unsigned page = 0; page < table->PagesWithRepeatingFooters(); page++) {
+ LayoutPoint pagination_offset = top_offset;
+ LayoutUnit footer_position =
+ table->GetPositionOfRepeatingFooterGroupOnPage(page);
+ if (!footer_position)
+ continue;
+ pagination_offset.Move(LayoutUnit(), footer_position);
+ if (item_to_paint == kPaintCollapsedBorders) {
+ PaintCollapsedSectionBorders(paint_info, pagination_offset,
+ current_border_value);
+ } else {
+ PaintSection(paint_info, pagination_offset);
+ }
+ }
+}
+
void TableSectionPainter::Paint(const PaintInfo& paint_info,
const LayoutPoint& paint_offset) {
ObjectPainter(layout_table_section_)
.CheckPaintOffset(paint_info, paint_offset);
PaintSection(paint_info, paint_offset);
LayoutTable* table = layout_table_section_.Table();
- if (table->Header() == layout_table_section_)
+ if (table->Header() == layout_table_section_) {
PaintRepeatingHeaderGroup(paint_info, paint_offset, CollapsedBorderValue(),
kPaintSection);
+ } else if (table->Footer() == layout_table_section_) {
+ PaintRepeatingFooterGroup(paint_info, paint_offset, CollapsedBorderValue(),
+ kPaintSection);
+ }
}
void TableSectionPainter::PaintSection(const PaintInfo& paint_info,
@@ -132,9 +173,13 @@ void TableSectionPainter::PaintCollapsedBorders(
const CollapsedBorderValue& current_border_value) {
PaintCollapsedSectionBorders(paint_info, paint_offset, current_border_value);
LayoutTable* table = layout_table_section_.Table();
- if (table->Header() == layout_table_section_)
+ if (table->Header() == layout_table_section_) {
PaintRepeatingHeaderGroup(paint_info, paint_offset, current_border_value,
kPaintCollapsedBorders);
+ } else if (table->Footer() == layout_table_section_) {
+ PaintRepeatingFooterGroup(paint_info, paint_offset, current_border_value,
+ kPaintCollapsedBorders);
+ }
}
void TableSectionPainter::PaintCollapsedSectionBorders(

Powered by Google App Engine
This is Rietveld 408576698