Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/paint/TableSectionPainter.h" | 5 #include "core/paint/TableSectionPainter.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutTableCell.h" | 7 #include "core/layout/LayoutTableCell.h" |
| 8 #include "core/layout/LayoutTableCol.h" | 8 #include "core/layout/LayoutTableCol.h" |
| 9 #include "core/layout/LayoutTableRow.h" | 9 #include "core/layout/LayoutTableRow.h" |
| 10 #include "core/paint/BoxClipper.h" | 10 #include "core/paint/BoxClipper.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 if (!layout_table_section_.IsRepeatingHeaderGroup()) | 26 if (!layout_table_section_.IsRepeatingHeaderGroup()) |
| 27 return; | 27 return; |
| 28 | 28 |
| 29 LayoutTable* table = layout_table_section_.Table(); | 29 LayoutTable* table = layout_table_section_.Table(); |
| 30 LayoutPoint pagination_offset = paint_offset; | 30 LayoutPoint pagination_offset = paint_offset; |
| 31 LayoutUnit page_height = table->PageLogicalHeightForOffset(LayoutUnit()); | 31 LayoutUnit page_height = table->PageLogicalHeightForOffset(LayoutUnit()); |
| 32 | 32 |
| 33 LayoutUnit header_group_offset = table->BlockOffsetToFirstRepeatableHeader(); | 33 LayoutUnit header_group_offset = table->BlockOffsetToFirstRepeatableHeader(); |
| 34 // The header may have a pagination strut before it so we need to account for | 34 // The header may have a pagination strut before it so we need to account for |
| 35 // that when establishing its position. | 35 // that when establishing its position. |
| 36 LayoutUnit strut_on_first_row; | |
| 36 if (LayoutTableRow* row = layout_table_section_.FirstRow()) | 37 if (LayoutTableRow* row = layout_table_section_.FirstRow()) |
| 37 header_group_offset += row->PaginationStrut(); | 38 strut_on_first_row = row->PaginationStrut(); |
| 39 header_group_offset += strut_on_first_row; | |
| 38 LayoutUnit offset_to_next_page = | 40 LayoutUnit offset_to_next_page = |
| 39 page_height - IntMod(header_group_offset, page_height); | 41 page_height - IntMod(header_group_offset, page_height); |
| 40 // Move paginationOffset to the top of the next page. | 42 // Move paginationOffset to the top of the next page. |
| 41 pagination_offset.Move(LayoutUnit(), offset_to_next_page); | 43 pagination_offset.Move(LayoutUnit(), offset_to_next_page); |
| 42 // Now move paginationOffset to the top of the page the cull rect starts on. | 44 // Now move paginationOffset to the top of the page the cull rect starts on. |
| 43 if (paint_info.GetCullRect().rect_.Y() > pagination_offset.Y()) { | 45 if (paint_info.GetCullRect().rect_.Y() > pagination_offset.Y()) { |
| 44 pagination_offset.Move(LayoutUnit(), | 46 pagination_offset.Move(LayoutUnit(), |
| 45 page_height * ((paint_info.GetCullRect().rect_.Y() - | 47 page_height * ((paint_info.GetCullRect().rect_.Y() - |
| 46 pagination_offset.Y()) / | 48 pagination_offset.Y()) / |
| 47 page_height) | 49 page_height) |
| 48 .ToInt()); | 50 .ToInt()); |
| 49 } | 51 } |
| 50 | 52 |
| 51 // We only want to consider pages where we going to paint a row, so exclude | 53 // We only want to consider pages where we going to paint a row, so exclude |
| 52 // captions and border spacing from the table. | 54 // captions and border spacing from the table. |
| 53 LayoutRect sections_rect(LayoutPoint(), table->Size()); | 55 LayoutRect sections_rect(LayoutPoint(), table->Size()); |
| 54 table->SubtractCaptionRect(sections_rect); | 56 table->SubtractCaptionRect(sections_rect); |
| 55 LayoutUnit total_height_of_rows = | 57 LayoutUnit total_height_of_rows = |
| 56 sections_rect.Height() - table->VBorderSpacing(); | 58 sections_rect.Height() - table->VBorderSpacing(); |
| 57 LayoutUnit bottom_bound = | 59 LayoutUnit bottom_bound = |
| 58 std::min(LayoutUnit(paint_info.GetCullRect().rect_.MaxY()), | 60 std::min(LayoutUnit(paint_info.GetCullRect().rect_.MaxY()), |
| 59 paint_offset.Y() + total_height_of_rows); | 61 paint_offset.Y() + total_height_of_rows); |
| 60 | 62 |
| 61 while (pagination_offset.Y() < bottom_bound) { | 63 while (pagination_offset.Y() < bottom_bound) { |
| 64 LayoutPoint nested_offset = | |
| 65 pagination_offset + | |
| 66 LayoutPoint(LayoutUnit(), table->RowOffsetFromRepeatingHeader() - | |
|
mstensho (USE GERRIT)
2017/05/22 10:40:44
If we really want to re-introduce nesting:
Thanks
rhogan
2017/05/22 18:06:04
Done.
| |
| 67 layout_table_section_.LogicalHeight() + | |
| 68 strut_on_first_row); | |
| 62 if (item_to_paint == kPaintCollapsedBorders) { | 69 if (item_to_paint == kPaintCollapsedBorders) { |
| 63 PaintCollapsedSectionBorders(paint_info, pagination_offset, | 70 PaintCollapsedSectionBorders(paint_info, nested_offset, |
| 64 current_border_value); | 71 current_border_value); |
| 65 } else { | 72 } else { |
| 66 PaintSection(paint_info, pagination_offset); | 73 PaintSection(paint_info, nested_offset); |
| 67 } | 74 } |
| 68 pagination_offset.Move(0, page_height.ToInt()); | 75 pagination_offset.Move(0, page_height.ToInt()); |
| 69 } | 76 } |
| 70 } | 77 } |
| 71 | 78 |
| 72 void TableSectionPainter::Paint(const PaintInfo& paint_info, | 79 void TableSectionPainter::Paint(const PaintInfo& paint_info, |
| 73 const LayoutPoint& paint_offset) { | 80 const LayoutPoint& paint_offset) { |
| 74 ObjectPainter(layout_table_section_) | 81 ObjectPainter(layout_table_section_) |
| 75 .CheckPaintOffset(paint_info, paint_offset); | 82 .CheckPaintOffset(paint_info, paint_offset); |
| 76 PaintSection(paint_info, paint_offset); | 83 PaintSection(paint_info, paint_offset); |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 373 const PaintInfo& paint_info_for_cells, | 380 const PaintInfo& paint_info_for_cells, |
| 374 const LayoutPoint& paint_offset) { | 381 const LayoutPoint& paint_offset) { |
| 375 if (!cell.HasSelfPaintingLayer() && !cell.Row()->HasSelfPaintingLayer()) { | 382 if (!cell.HasSelfPaintingLayer() && !cell.Row()->HasSelfPaintingLayer()) { |
| 376 LayoutPoint cell_point = | 383 LayoutPoint cell_point = |
| 377 layout_table_section_.FlipForWritingModeForChild(&cell, paint_offset); | 384 layout_table_section_.FlipForWritingModeForChild(&cell, paint_offset); |
| 378 cell.Paint(paint_info_for_cells, cell_point); | 385 cell.Paint(paint_info_for_cells, cell_point); |
| 379 } | 386 } |
| 380 } | 387 } |
| 381 | 388 |
| 382 } // namespace blink | 389 } // namespace blink |
| OLD | NEW |