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

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, 8 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..8be19177297d48a2c5fb08abe8ad519147d93d3e 100644
--- a/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
@@ -18,6 +18,41 @@
namespace blink {
+void TableSectionPainter::PaintRepeatingFooterGroup(
mstensho (USE GERRIT) 2017/04/24 11:57:16 Please match the order of declaration. There Paint
+ 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());
+ table->SubtractCaptionRect(sections_rect, true);
mstensho (USE GERRIT) 2017/04/24 11:57:16 Why do we want to keep the top captions?
+ LayoutUnit total_height_of_rows =
+ sections_rect.Height() - table->OuterBorderAfter();
mstensho (USE GERRIT) 2017/04/24 11:57:16 Mixing physical (Height()) and logical (OuterBorde
+ total_height_of_rows -= (layout_table_section_.LogicalHeight() -
+ layout_table_section_.FirstRow()->PaginationStrut());
mstensho (USE GERRIT) 2017/04/24 11:57:16 Will there ever be a pagination strut here? Seems
+ LayoutPoint top_offset = paint_offset;
+ top_offset.Move(0, -total_height_of_rows.ToInt());
+ IntRect cull_rect = paint_info.GetCullRect().rect_;
+ cull_rect.Move(0, -total_height_of_rows.ToInt());
+ for (unsigned page = 0;
+ page < table->PositionOfRepeatingFooterGroupOnPage().size(); page++) {
+ LayoutPoint pagination_offset = top_offset;
+ int footer_position =
+ table->GetPositionOfRepeatingFooterGroupOnPage(page).ToInt();
+ if (!footer_position)
+ continue;
+ pagination_offset.Move(0, footer_position);
+ if (item_to_paint == kPaintCollapsedBorders) {
+ PaintCollapsedSectionBorders(paint_info, pagination_offset,
+ current_border_value);
+ } else {
+ PaintSection(paint_info, pagination_offset);
+ }
+ }
+}
+
void TableSectionPainter::PaintRepeatingHeaderGroup(
const PaintInfo& paint_info,
const LayoutPoint& paint_offset,
@@ -33,13 +68,15 @@ void TableSectionPainter::PaintRepeatingHeaderGroup(
LayoutUnit header_group_offset = table->BlockOffsetToFirstRepeatableHeader();
// The header may have a pagination strut before it so we need to account for
// that when establishing its position.
+ LayoutUnit first_row_offset;
if (LayoutTableRow* row = layout_table_section_.FirstRow())
- header_group_offset += row->PaginationStrut();
+ first_row_offset = row->PaginationStrut();
+ header_group_offset += first_row_offset;
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() -
@@ -56,7 +93,7 @@ void TableSectionPainter::PaintRepeatingHeaderGroup(
sections_rect.Height() - table->VBorderSpacing();
LayoutUnit bottom_bound =
std::min(LayoutUnit(paint_info.GetCullRect().rect_.MaxY()),
- paint_offset.Y() + total_height_of_rows);
+ (paint_offset.Y() - first_row_offset) + total_height_of_rows);
mstensho (USE GERRIT) 2017/04/24 11:57:16 No need for the parentheses.
while (pagination_offset.Y() < bottom_bound) {
if (item_to_paint == kPaintCollapsedBorders) {
@@ -78,6 +115,10 @@ void TableSectionPainter::Paint(const PaintInfo& paint_info,
if (table->Header() == layout_table_section_)
PaintRepeatingHeaderGroup(paint_info, paint_offset, CollapsedBorderValue(),
kPaintSection);
+ if (table->Footer() == layout_table_section_) {
mstensho (USE GERRIT) 2017/04/24 11:57:16 else if
+ PaintRepeatingFooterGroup(paint_info, paint_offset, CollapsedBorderValue(),
+ kPaintSection);
+ }
}
void TableSectionPainter::PaintSection(const PaintInfo& paint_info,
@@ -135,6 +176,10 @@ void TableSectionPainter::PaintCollapsedBorders(
if (table->Header() == layout_table_section_)
PaintRepeatingHeaderGroup(paint_info, paint_offset, current_border_value,
kPaintCollapsedBorders);
+ if (table->Footer() == layout_table_section_) {
mstensho (USE GERRIT) 2017/04/24 11:57:16 else if
+ PaintRepeatingFooterGroup(paint_info, paint_offset, current_border_value,
+ kPaintCollapsedBorders);
+ }
}
void TableSectionPainter::PaintCollapsedSectionBorders(

Powered by Google App Engine
This is Rietveld 408576698