Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Unified Diff: third_party/WebKit/Source/core/layout/LayoutTableCell.cpp

Issue 2469903002: Use appropriate background object visual rect for composited table cell backgrounds. (Closed)
Patch Set: Include row background client when invalidating. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}

Powered by Google App Engine
This is Rietveld 408576698