Chromium Code Reviews| 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 0fc9192c6c566f8e62a348534055b936b1872ee2..adbc5c2853a83521b56c62a6f719257a55b4fa40 100644 |
| --- a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp |
| +++ b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp |
| @@ -43,6 +43,7 @@ using namespace HTMLNames; |
| struct SameSizeAsLayoutTableCell : public LayoutBlockFlow { |
| unsigned bitfields; |
| int paddings[2]; |
| + void* pointer; |
| }; |
| static_assert(sizeof(LayoutTableCell) == sizeof(SameSizeAsLayoutTableCell), "LayoutTableCell should stay small"); |
| @@ -65,7 +66,6 @@ void LayoutTableCell::willBeRemovedFromTree() |
| LayoutBlockFlow::willBeRemovedFromTree(); |
| section()->setNeedsCellRecalc(); |
| - section()->removeCachedCollapsedBorders(this); |
| } |
| unsigned LayoutTableCell::parseColSpanFromDOM() const |
| @@ -908,25 +908,38 @@ static void addBorderStyle(LayoutTable::CollapsedBorderValues& borderValues, |
| void LayoutTableCell::collectBorderValues(LayoutTable::CollapsedBorderValues& borderValues) |
| { |
| - CollapsedBorderValue startBorder = computeCollapsedStartBorder(); |
| - CollapsedBorderValue endBorder = computeCollapsedEndBorder(); |
| - CollapsedBorderValue beforeBorder = computeCollapsedBeforeBorder(); |
| - CollapsedBorderValue afterBorder = computeCollapsedAfterBorder(); |
| - LayoutTableSection* section = this->section(); |
| - bool changed = section->setCachedCollapsedBorder(this, CBSStart, startBorder); |
| - changed |= section->setCachedCollapsedBorder(this, CBSEnd, endBorder); |
| - changed |= section->setCachedCollapsedBorder(this, CBSBefore, beforeBorder); |
| - changed |= section->setCachedCollapsedBorder(this, CBSAfter, afterBorder); |
| - |
| - // In slimming paint mode, we need to invalidate all cells with collapsed border changed. |
|
chrishtr
2016/05/05 15:31:36
Still gone?
Xianzhu
2016/05/05 17:38:49
It's now at new line 934-935.
|
| - // FIXME: Need a way to invalidate/repaint the borders only. crbug.com/451090#c5. |
| + CollapsedBorderValues newValues = { |
| + computeCollapsedStartBorder(), |
| + computeCollapsedEndBorder(), |
| + computeCollapsedBeforeBorder(), |
| + computeCollapsedAfterBorder() |
| + }; |
| + |
| + bool changed = false; |
| + if (!newValues.startBorder.isVisible() && !newValues.endBorder.isVisible() && !newValues.beforeBorder.isVisible() && !newValues.afterBorder.isVisible()) { |
| + changed = !!m_collapsedBorderValues; |
| + m_collapsedBorderValues = nullptr; |
| + } else if (!m_collapsedBorderValues) { |
| + changed = true; |
| + m_collapsedBorderValues = adoptPtr(new CollapsedBorderValues(newValues)); |
| + } else { |
| + changed = !m_collapsedBorderValues->startBorder.visuallyEquals(newValues.startBorder) |
|
chrishtr
2016/05/05 15:31:36
Add a comment that we check visuallyEquals so that
Xianzhu
2016/05/05 17:38:49
Done.
chrishtr
2016/05/05 17:42:12
Don't see the added comment in this patch set?
Xianzhu
2016/05/05 17:45:15
Sorry, didn't press <Enter> after git cl upload.
|
| + || !m_collapsedBorderValues->endBorder.visuallyEquals(newValues.endBorder) |
| + || !m_collapsedBorderValues->beforeBorder.visuallyEquals(newValues.beforeBorder) |
| + || !m_collapsedBorderValues->afterBorder.visuallyEquals(newValues.afterBorder); |
| + if (changed) |
| + *m_collapsedBorderValues = newValues; |
| + } |
| + |
| + // If collapsed borders changed, invalidate the cell's display item client on the table's backing. |
| + // TODO(crbug.com/451090#c5): Need a way to invalidate/repaint the borders only. |
| if (changed) |
| table()->invalidateDisplayItemClient(*this); |
| - addBorderStyle(borderValues, startBorder); |
| - addBorderStyle(borderValues, endBorder); |
| - addBorderStyle(borderValues, beforeBorder); |
| - addBorderStyle(borderValues, afterBorder); |
| + addBorderStyle(borderValues, newValues.startBorder); |
| + addBorderStyle(borderValues, newValues.endBorder); |
| + addBorderStyle(borderValues, newValues.beforeBorder); |
| + addBorderStyle(borderValues, newValues.afterBorder); |
| } |
| void LayoutTableCell::sortBorderValues(LayoutTable::CollapsedBorderValues& borderValues) |