Chromium Code Reviews| 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 e348496498c32d2cae0c4eeea0f1d30f0d812b3b..d8f181579980fb5568a132a75e6a3f5d684cfd98 100644 |
| --- a/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp |
| +++ b/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp |
| @@ -7,9 +7,11 @@ |
| #include "core/layout/LayoutTableCell.h" |
| #include "core/layout/LayoutTableCol.h" |
| #include "core/layout/LayoutTableRow.h" |
| +#include "core/layout/LayoutView.h" |
| #include "core/paint/BoxClipper.h" |
| #include "core/paint/ObjectPainter.h" |
| #include "core/paint/PaintInfo.h" |
| +#include "core/paint/PaintLayer.h" |
| #include "core/paint/TableCellPainter.h" |
| #include "core/paint/TableRowPainter.h" |
| #include <algorithm> |
| @@ -33,8 +35,44 @@ inline const LayoutTableCell* TableSectionPainter::primaryCellToPaint(unsigned r |
| return cell; |
| } |
| +void TableSectionPainter::paintRepeatingHeaderGroup(const PaintInfo& paintInfo, const LayoutPoint& paintOffset, const CollapsedBorderValue& currentBorderValue, ItemToPaint itemToPaint) |
| +{ |
| + if (m_layoutTableSection.getPaginationBreakability() == LayoutBox::AllowAnyBreaks) |
| + return; |
| + // TODO(rhogan): Should we paint a header repeatedly if it's self-painting? |
| + if (m_layoutTableSection.hasSelfPaintingLayer()) |
| + return; |
| + LayoutTable* table = m_layoutTableSection.table(); |
| + LayoutUnit pageHeight = table->pageLogicalHeightForOffset(LayoutUnit()); |
| + if (!pageHeight) |
| + return; |
| + |
| + LayoutPoint paginationOffset = paintOffset; |
| + // Move paginationOffset to the top of the second page. |
| + paginationOffset.move(0, pageHeight - table->pageLogicalOffset()); |
| + // Now move paginationOffset to the top of the page the cull rect starts on. |
| + if (paintInfo.cullRect().m_rect.y() > paginationOffset.y()) |
| + paginationOffset.move(0, pageHeight * static_cast<int>((paintInfo.cullRect().m_rect.y() - paginationOffset.y()) / pageHeight)); |
| + LayoutUnit bottomBound = std::min(LayoutUnit(paintInfo.cullRect().m_rect.maxY()), paintOffset.y() + table->logicalHeight()); |
| + while (paginationOffset.y() < bottomBound) { |
| + if (itemToPaint == PaintCollapsedBorders) |
| + paintCollapsedSectionBorders(paintInfo.forDescendants(), paginationOffset, currentBorderValue); |
|
Xianzhu
2016/06/03 18:45:41
Remove .forDescendants() because the method is sti
|
| + else |
| + paintSection(paintInfo.forDescendants(), paginationOffset); |
|
Xianzhu
2016/06/03 18:45:41
Ditto.
|
| + paginationOffset.move(0, pageHeight); |
| + } |
| +} |
| + |
| void TableSectionPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
| { |
| + paintSection(paintInfo, paintOffset); |
| + LayoutTable* table = m_layoutTableSection.table(); |
| + if (table->header() == m_layoutTableSection) |
| + paintRepeatingHeaderGroup(paintInfo, paintOffset, CollapsedBorderValue(), PaintChild); |
| +} |
| + |
| +void TableSectionPainter::paintSection(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
| +{ |
| DCHECK(!m_layoutTableSection.needsLayout()); |
| // avoid crashing on bugs that cause us to paint with dirty layout |
| if (m_layoutTableSection.needsLayout()) |
| @@ -76,6 +114,14 @@ static inline bool compareCellPositionsWithOverflowingCells(LayoutTableCell* ele |
| void TableSectionPainter::paintCollapsedBorders(const PaintInfo& paintInfo, const LayoutPoint& paintOffset, const CollapsedBorderValue& currentBorderValue) |
| { |
| + paintCollapsedSectionBorders(paintInfo, paintOffset, currentBorderValue); |
| + LayoutTable* table = m_layoutTableSection.table(); |
| + if (table->header() == m_layoutTableSection) |
| + paintRepeatingHeaderGroup(paintInfo, paintOffset, currentBorderValue, PaintCollapsedBorders); |
| +} |
| + |
| +void TableSectionPainter::paintCollapsedSectionBorders(const PaintInfo& paintInfo, const LayoutPoint& paintOffset, const CollapsedBorderValue& currentBorderValue) |
| +{ |
| if (!m_layoutTableSection.numRows() || !m_layoutTableSection.table()->effectiveColumns().size()) |
| return; |