| 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..43866261da363c5231d0decbb9091690951f2de9 100644
|
| --- a/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
|
| +++ b/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "core/paint/TableSectionPainter.h"
|
|
|
| +#include <algorithm>
|
| #include "core/layout/LayoutTableCell.h"
|
| #include "core/layout/LayoutTableCol.h"
|
| #include "core/layout/LayoutTableRow.h"
|
| @@ -13,15 +14,15 @@
|
| #include "core/paint/ObjectPainter.h"
|
| #include "core/paint/PaintInfo.h"
|
| #include "core/paint/TableCellPainter.h"
|
| +#include "core/paint/TableCollapsedBorderPainter.h"
|
| #include "core/paint/TableRowPainter.h"
|
| -#include <algorithm>
|
|
|
| namespace blink {
|
|
|
| void TableSectionPainter::PaintRepeatingHeaderGroup(
|
| const PaintInfo& paint_info,
|
| const LayoutPoint& paint_offset,
|
| - const CollapsedBorderValue& current_border_value,
|
| + TableCollapsedBorderPainter& previous_painter,
|
| ItemToPaint item_to_paint) {
|
| if (!layout_table_section_.IsRepeatingHeaderGroup())
|
| return;
|
| @@ -61,7 +62,7 @@ void TableSectionPainter::PaintRepeatingHeaderGroup(
|
| while (pagination_offset.Y() < bottom_bound) {
|
| if (item_to_paint == kPaintCollapsedBorders) {
|
| PaintCollapsedSectionBorders(paint_info, pagination_offset,
|
| - current_border_value);
|
| + previous_painter);
|
| } else {
|
| PaintSection(paint_info, pagination_offset);
|
| }
|
| @@ -75,9 +76,11 @@ void TableSectionPainter::Paint(const PaintInfo& paint_info,
|
| .CheckPaintOffset(paint_info, paint_offset);
|
| PaintSection(paint_info, paint_offset);
|
| LayoutTable* table = layout_table_section_.Table();
|
| - if (table->Header() == layout_table_section_)
|
| - PaintRepeatingHeaderGroup(paint_info, paint_offset, CollapsedBorderValue(),
|
| + if (table->Header() == layout_table_section_) {
|
| + TableCollapsedBorderPainter old_painter;
|
| + PaintRepeatingHeaderGroup(paint_info, paint_offset, old_painter,
|
| kPaintSection);
|
| + }
|
| }
|
|
|
| void TableSectionPainter::PaintSection(const PaintInfo& paint_info,
|
| @@ -129,59 +132,39 @@ static inline bool CompareCellPositionsWithOverflowingCells(
|
| void TableSectionPainter::PaintCollapsedBorders(
|
| const PaintInfo& paint_info,
|
| const LayoutPoint& paint_offset,
|
| - const CollapsedBorderValue& current_border_value) {
|
| - PaintCollapsedSectionBorders(paint_info, paint_offset, current_border_value);
|
| + TableCollapsedBorderPainter& previous_painter) {
|
| + PaintCollapsedSectionBorders(paint_info, paint_offset, previous_painter);
|
| LayoutTable* table = layout_table_section_.Table();
|
| if (table->Header() == layout_table_section_)
|
| - PaintRepeatingHeaderGroup(paint_info, paint_offset, current_border_value,
|
| + PaintRepeatingHeaderGroup(paint_info, paint_offset, previous_painter,
|
| kPaintCollapsedBorders);
|
| }
|
|
|
| void TableSectionPainter::PaintCollapsedSectionBorders(
|
| const PaintInfo& paint_info,
|
| const LayoutPoint& paint_offset,
|
| - const CollapsedBorderValue& current_border_value) {
|
| + TableCollapsedBorderPainter& previous_painter) {
|
| if (!layout_table_section_.NumRows() ||
|
| !layout_table_section_.Table()->EffectiveColumns().size())
|
| return;
|
| -
|
| LayoutPoint adjusted_paint_offset =
|
| paint_offset + layout_table_section_.Location();
|
| - BoxClipper box_clipper(layout_table_section_, paint_info,
|
| - adjusted_paint_offset, kForceContentsClip);
|
| -
|
| - LayoutRect local_visual_rect = LayoutRect(paint_info.GetCullRect().rect_);
|
| - local_visual_rect.MoveBy(-adjusted_paint_offset);
|
| -
|
| + BoxClipper boxClipper(layout_table_section_, paint_info,
|
| + adjusted_paint_offset, kForceContentsClip);
|
| + LayoutRect local_paint_invalidation_rect =
|
| + LayoutRect(paint_info.GetCullRect().rect_);
|
| + local_paint_invalidation_rect.MoveBy(-adjusted_paint_offset);
|
| LayoutRect table_aligned_rect =
|
| layout_table_section_.LogicalRectForWritingModeAndDirection(
|
| - local_visual_rect);
|
| -
|
| + local_paint_invalidation_rect);
|
| CellSpan dirtied_rows = layout_table_section_.DirtiedRows(table_aligned_rect);
|
| - CellSpan dirtied_columns =
|
| + CellSpan dirtied_eff_columns =
|
| layout_table_section_.DirtiedEffectiveColumns(table_aligned_rect);
|
|
|
| - if (dirtied_columns.Start() >= dirtied_columns.end())
|
| - return;
|
| -
|
| - // Collapsed borders are painted from the bottom right to the top left so that
|
| - // precedence due to cell position is respected.
|
| - for (unsigned r = dirtied_rows.end(); r > dirtied_rows.Start(); r--) {
|
| - unsigned row = r - 1;
|
| - unsigned n_cols = layout_table_section_.NumCols(row);
|
| - for (unsigned c = std::min(dirtied_columns.end(), n_cols);
|
| - c > dirtied_columns.Start(); c--) {
|
| - unsigned col = c - 1;
|
| - if (const LayoutTableCell* cell =
|
| - layout_table_section_.OriginatingCellAt(row, col)) {
|
| - LayoutPoint cell_point =
|
| - layout_table_section_.FlipForWritingModeForChild(
|
| - cell, adjusted_paint_offset);
|
| - TableCellPainter(*cell).PaintCollapsedBorders(paint_info, cell_point,
|
| - current_border_value);
|
| - }
|
| - }
|
| - }
|
| + TableCollapsedBorderPainter painter(&layout_table_section_);
|
| + painter.PaintBorders(paint_info, paint_offset, dirtied_rows,
|
| + dirtied_eff_columns, previous_painter);
|
| + previous_painter = painter;
|
| }
|
|
|
| void TableSectionPainter::PaintObject(const PaintInfo& paint_info,
|
|
|