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 48aa589b5862e815fa464165e8e671569ecacc45..e6187313b5e266ad3bede8c282f9e65701e1004d 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), |
@@ -67,13 +68,11 @@ LayoutTableCell::LayoutTableCell(Element* element) |
} |
LayoutTableCell::CollapsedBorderValues::CollapsedBorderValues( |
- const LayoutTable& layoutTable, |
const CollapsedBorderValue& startBorder, |
const CollapsedBorderValue& endBorder, |
const CollapsedBorderValue& beforeBorder, |
const CollapsedBorderValue& afterBorder) |
- : m_layoutTable(layoutTable), |
- m_startBorder(startBorder), |
+ : m_startBorder(startBorder), |
m_endBorder(endBorder), |
m_beforeBorder(beforeBorder), |
m_afterBorder(afterBorder) {} |
@@ -86,11 +85,15 @@ void LayoutTableCell::CollapsedBorderValues::setCollapsedBorderValues( |
m_afterBorder = other.afterBorder(); |
} |
-String LayoutTableCell::CollapsedBorderValues::debugName() const { |
- return "CollapsedBorderValues"; |
+LayoutTableCell::CompositedTableCell::CompositedTableCell( |
+ const LayoutTable& layoutTable) |
+ : m_layoutTable(layoutTable) {} |
+ |
+String LayoutTableCell::CompositedTableCell::debugName() const { |
+ return "CompositedTableCell"; |
} |
-LayoutRect LayoutTableCell::CollapsedBorderValues::visualRect() const { |
+LayoutRect LayoutTableCell::CompositedTableCell::visualRect() const { |
return m_layoutTable.visualRect(); |
} |
@@ -462,6 +465,14 @@ int LayoutTableCell::cellBaselinePosition() const { |
return (borderBefore() + paddingBefore() + contentLogicalHeight()).toInt(); |
} |
+void LayoutTableCell::ensureIsReadyForPaintInvalidation() { |
+ if (usesTableAsAdditionalDisplayItemClient() && !m_compositedTableCell) { |
+ m_compositedTableCell = |
+ wrapUnique(new LayoutTableCell::CompositedTableCell(*table())); |
+ } |
+ LayoutBlockFlow::ensureIsReadyForPaintInvalidation(); |
+} |
+ |
void LayoutTableCell::styleDidChange(StyleDifference diff, |
const ComputedStyle* oldStyle) { |
DCHECK_EQ(style()->display(), EDisplay::TableCell); |
@@ -1294,7 +1305,7 @@ static void addBorderStyle(LayoutTable::CollapsedBorderValues& borderValues, |
void LayoutTableCell::collectBorderValues( |
LayoutTable::CollapsedBorderValues& borderValues) { |
CollapsedBorderValues newValues( |
- *table(), computeCollapsedStartBorder(), computeCollapsedEndBorder(), |
+ computeCollapsedStartBorder(), computeCollapsedEndBorder(), |
computeCollapsedBeforeBorder(), computeCollapsedAfterBorder()); |
bool changed = false; |
@@ -1307,7 +1318,7 @@ void LayoutTableCell::collectBorderValues( |
} else if (!m_collapsedBorderValues) { |
changed = true; |
m_collapsedBorderValues = wrapUnique(new CollapsedBorderValues( |
- *table(), newValues.startBorder(), newValues.endBorder(), |
+ newValues.startBorder(), newValues.endBorder(), |
newValues.beforeBorder(), newValues.afterBorder())); |
} else { |
// We check visuallyEquals so that the table cell is invalidated only if a |
@@ -1429,11 +1440,16 @@ bool LayoutTableCell::usesTableAsAdditionalDisplayItemClient() const { |
RuntimeEnabledFeatures::slimmingPaintV2Enabled(); |
} |
+const LayoutTableCell::CompositedTableCell* |
+LayoutTableCell::compositedTableCell() const { |
+ return m_compositedTableCell.get(); |
+} |
+ |
void LayoutTableCell::invalidateDisplayItemClients( |
PaintInvalidationReason reason) const { |
- if (m_collapsedBorderValues && usesTableAsAdditionalDisplayItemClient()) { |
+ if (usesTableAsAdditionalDisplayItemClient()) { |
wkorman
2016/11/01 21:14:48
Is it worth also making sure compositedTableCell()
Xianzhu
2016/11/01 21:28:14
DCHECK sgtm.
wkorman
2016/11/03 01:41:25
Done.
|
ObjectPaintInvalidator(*this).invalidateDisplayItemClient( |
- *m_collapsedBorderValues, reason); |
+ *compositedTableCell(), reason); |
} |
LayoutBlockFlow::invalidateDisplayItemClients(reason); |
} |