Index: third_party/WebKit/Source/core/layout/LayoutTableCell.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp |
index 75f5a01f2d23ddc9e31375b6f55e827be82b1a07..25922550148d51c135e0472a834c776347568204 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp |
@@ -46,7 +46,8 @@ using namespace HTMLNames; |
struct SameSizeAsLayoutTableCell : public LayoutBlockFlow { |
unsigned bitfields; |
int paddings[2]; |
- void* pointer; |
+ void* pointer1; |
+ void* pointer2; |
}; |
static_assert(sizeof(LayoutTableCell) == sizeof(SameSizeAsLayoutTableCell), |
@@ -463,6 +464,15 @@ int LayoutTableCell::cellBaselinePosition() const { |
return (borderBefore() + paddingBefore() + contentLogicalHeight()).toInt(); |
} |
+void LayoutTableCell::ensureIsReadyForPaintInvalidation() { |
+ if (!m_rowBackgroundDisplayItemClient && |
+ usesCompositedCellDisplayItemClients()) { |
+ m_rowBackgroundDisplayItemClient = |
+ wrapUnique(new LayoutTableCell::RowBackgroundDisplayItemClient(*row())); |
+ } |
+ LayoutBlockFlow::ensureIsReadyForPaintInvalidation(); |
+} |
+ |
void LayoutTableCell::styleDidChange(StyleDifference diff, |
const ComputedStyle* oldStyle) { |
DCHECK_EQ(style()->display(), EDisplay::TableCell); |
@@ -1422,19 +1432,41 @@ bool LayoutTableCell::backgroundIsKnownToBeOpaqueInRect( |
return LayoutBlockFlow::backgroundIsKnownToBeOpaqueInRect(localRect); |
} |
-bool LayoutTableCell::usesTableAsAdditionalDisplayItemClient() const { |
- // In certain cases such as collapsed borders for composited table cells we |
- // paint content for the cell into the table graphics layer backing and so |
- // must use the table's visual rect. |
+LayoutTableCell::RowBackgroundDisplayItemClient::RowBackgroundDisplayItemClient( |
+ const LayoutTableRow& layoutTableRow) |
+ : m_layoutTableRow(layoutTableRow) {} |
+ |
+String LayoutTableCell::RowBackgroundDisplayItemClient::debugName() const { |
+ return "RowBackground"; |
+} |
+ |
+LayoutRect LayoutTableCell::RowBackgroundDisplayItemClient::visualRect() const { |
+ return m_layoutTableRow.visualRect(); |
+} |
+ |
+bool LayoutTableCell::usesCompositedCellDisplayItemClients() const { |
wkorman
2016/11/03 01:41:25
This is a bit of a misnomer since it's also true f
Xianzhu
2016/11/03 03:06:48
I think this is OK. When we remove non-SPv2 code,
|
+ // Table cells are painted in two special ways that require the use of custom |
+ // display item clients when the cell is composited: |
+ // |
+ // 1. When painting row background we paint content for the cell into the |
+ // table row graphics layer backing and so must use the row's visual rect. |
+ // |
+ // 2. When painting collapsed borders we paint content for the cell into the |
+ // table graphics layer backing and so must use the table's visual rect. |
return (hasLayer() && layer()->compositingState() != NotComposited) || |
RuntimeEnabledFeatures::slimmingPaintV2Enabled(); |
} |
void LayoutTableCell::invalidateDisplayItemClients( |
PaintInvalidationReason reason) const { |
- if (m_collapsedBorderValues && usesTableAsAdditionalDisplayItemClient()) { |
- ObjectPaintInvalidator(*this).invalidateDisplayItemClient( |
- *m_collapsedBorderValues, reason); |
+ if (usesCompositedCellDisplayItemClients()) { |
+ ObjectPaintInvalidator invalidator(*this); |
+ DCHECK(m_rowBackgroundDisplayItemClient); |
+ if (m_collapsedBorderValues) { |
+ invalidator.invalidateDisplayItemClient(*m_collapsedBorderValues, reason); |
+ } |
+ invalidator.invalidateDisplayItemClient(*m_rowBackgroundDisplayItemClient, |
wkorman
2016/11/03 01:41:25
This wasn't necessary for all tests to pass but I
|
+ reason); |
} |
LayoutBlockFlow::invalidateDisplayItemClients(reason); |
} |