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..a6ef409483e03696790f83f504c25aff5bc5a423 100644 |
--- a/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp |
+++ b/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp |
@@ -33,13 +33,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; |
mstensho (USE GERRIT)
2017/05/08 13:56:00
Could you make "pagination" or at least "strut" pa
rhogan
2017/05/09 19:57:17
This isn't necessary anymore for some reason. ¯\_(
|
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 +58,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); |
while (pagination_offset.Y() < bottom_bound) { |
if (item_to_paint == kPaintCollapsedBorders) { |
@@ -69,15 +71,57 @@ 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()); |
+ // Include the top captions as we need top_offset to be |
mstensho (USE GERRIT)
2017/05/08 13:56:00
Include, as in exclude from subtraction? How about
rhogan
2017/05/09 19:57:17
Done.
|
+ // the offset from the top of table. |
+ table->SubtractCaptionRect(sections_rect, true); |
+ 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(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(); |
mstensho (USE GERRIT)
2017/05/08 13:56:00
Since the whole vector has already been made acces
rhogan
2017/05/09 19:57:17
Done.
|
+ if (!footer_position) |
mstensho (USE GERRIT)
2017/05/08 13:56:00
When is it 0?
rhogan
2017/05/09 19:57:17
We don't repeat the footer on every page. For exam
|
+ 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::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 +176,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( |