| Index: third_party/WebKit/Source/core/layout/LayoutTable.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.cpp b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
|
| index 38961ef6b09c737491c0767b5d21aab5a27c0e4a..cb5e35e05e2623f9f55d59fc36f126bdd99f786d 100644
|
| --- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
|
| @@ -42,6 +42,7 @@
|
| #include "core/layout/TextAutosizer.h"
|
| #include "core/paint/BoxPainter.h"
|
| #include "core/paint/PaintLayer.h"
|
| +#include "core/paint/TablePaintInvalidator.h"
|
| #include "core/paint/TablePainter.h"
|
| #include "core/style/StyleInheritedData.h"
|
| #include "wtf/PtrUtil.h"
|
| @@ -1422,63 +1423,23 @@ const BorderValue& LayoutTable::tableEndBorderAdjoiningCell(const LayoutTableCel
|
| return style()->borderStart();
|
| }
|
|
|
| -PaintInvalidationReason LayoutTable::invalidatePaintIfNeeded(const PaintInvalidationState& paintInvalidationState)
|
| +void LayoutTable::ensureIsReadyForPaintInvalidation()
|
| {
|
| - // Information of collapsed borders doesn't affect layout and are for painting only.
|
| - // Do it now instead of during painting to invalidate table cells if needed.
|
| + LayoutBlock::ensureIsReadyForPaintInvalidation();
|
| recalcCollapsedBordersIfNeeded();
|
| +}
|
| +
|
| +PaintInvalidationReason LayoutTable::invalidatePaintIfNeeded(const PaintInvalidationState& paintInvalidationState)
|
| +{
|
| if (collapseBorders() && !m_collapsedBorders.isEmpty())
|
| paintInvalidationState.paintingLayer().setNeedsPaintPhaseDescendantBlockBackgrounds();
|
|
|
| return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState);
|
| }
|
|
|
| -void LayoutTable::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationState& childPaintInvalidationState)
|
| +PaintInvalidationReason LayoutTable::invalidatePaintIfNeeded(const PaintInvalidatorContext& context) const
|
| {
|
| - // Table cells paint background from the containing column group, column, section and row.
|
| - // If background of any of them changed, we need to invalidate all affected cells.
|
| - // Here use shouldDoFullPaintInvalidation() as a broader condition of background change.
|
| -
|
| - // If any col changed background, we'll check all cells for background changes.
|
| - bool hasColChangedBackground = false;
|
| - for (LayoutTableCol* col = firstColumn(); col; col = col->nextColumn()) {
|
| - if (col->backgroundChangedSinceLastPaintInvalidation()) {
|
| - hasColChangedBackground = true;
|
| - break;
|
| - }
|
| - }
|
| - for (LayoutObject* child = firstChild(); child; child = child->nextSibling()) {
|
| - if (!child->isTableSection())
|
| - continue;
|
| - LayoutTableSection* section = toLayoutTableSection(child);
|
| - if (!hasColChangedBackground && !section->shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState())
|
| - continue;
|
| - for (LayoutTableRow* row = section->firstRow(); row; row = row->nextRow()) {
|
| - if (!hasColChangedBackground && !section->backgroundChangedSinceLastPaintInvalidation() && !row->backgroundChangedSinceLastPaintInvalidation())
|
| - continue;
|
| - for (LayoutTableCell* cell = row->firstCell(); cell; cell = cell->nextCell()) {
|
| - bool invalidated = false;
|
| - // Table cells paint container's background on the container's backing instead of its own (if any),
|
| - // so we must invalidate it by the containers.
|
| - if (section->backgroundChangedSinceLastPaintInvalidation()) {
|
| - section->slowSetPaintingLayerNeedsRepaintAndInvalidateDisplayItemClient(*cell, PaintInvalidationStyleChange);
|
| - invalidated = true;
|
| - } else if (hasColChangedBackground) {
|
| - ColAndColGroup colAndColGroup = colElementAtAbsoluteColumn(cell->absoluteColumnIndex());
|
| - LayoutTableCol* column = colAndColGroup.col;
|
| - LayoutTableCol* columnGroup = colAndColGroup.colgroup;
|
| - if ((columnGroup && columnGroup->backgroundChangedSinceLastPaintInvalidation())
|
| - || (column && column->backgroundChangedSinceLastPaintInvalidation())) {
|
| - section->slowSetPaintingLayerNeedsRepaintAndInvalidateDisplayItemClient(*cell, PaintInvalidationStyleChange);
|
| - invalidated = true;
|
| - }
|
| - }
|
| - if ((!invalidated || row->hasSelfPaintingLayer()) && row->backgroundChangedSinceLastPaintInvalidation())
|
| - row->slowSetPaintingLayerNeedsRepaintAndInvalidateDisplayItemClient(*cell, PaintInvalidationStyleChange);
|
| - }
|
| - }
|
| - }
|
| - LayoutBlock::invalidatePaintOfSubtreesIfNeeded(childPaintInvalidationState);
|
| + return TablePaintInvalidator(*this, context).invalidatePaintIfNeeded();
|
| }
|
|
|
| LayoutUnit LayoutTable::paddingTop() const
|
|
|