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 cccc8fbb14f13db05f9aad24967cc044c0a3d93b..c0277f6ace51ff79410d36bc9e23a51df41ad1f3 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,7 +908,7 @@ void LayoutTableCell::paint(const PaintInfo& paintInfo, const LayoutPoint& paint |
static void addBorderStyle(LayoutTable::CollapsedBorderValues& borderValues, |
CollapsedBorderValue borderValue) |
{ |
- if (!borderValue.exists()) |
+ if (!borderValue.isVisible()) |
return; |
size_t count = borderValues.size(); |
for (size_t i = 0; i < count; ++i) { |
@@ -920,25 +920,36 @@ 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. |
- // FIXME: Need a way to invalidate/repaint the borders only. crbug.com/451090#c5. |
+ LayoutTableCell::CollapsedBorderValues newValues = { |
+ computeCollapsedStartBorder(), |
+ computeCollapsedEndBorder(), |
+ computeCollapsedBeforeBorder(), |
+ computeCollapsedAfterBorder() |
+ }; |
+ |
+ bool changed; |
+ if (!newValues.startBorder.isVisible() && !newValues.endBorder.isVisible() && !newValues.beforeBorder.isVisible() && !newValues.afterBorder.isVisible()) { |
Julien - ping for review
2016/01/08 14:18:15
How frequent is this case? It seems like a corner-
Xianzhu
2016/01/08 17:50:45
This optimization does improve performance of Perf
Julien - ping for review
2016/01/11 18:11:36
This really should have a comment about what it's
|
+ changed = m_collapsedBorderValues; |
+ m_collapsedBorderValues = nullptr; |
+ } else if (!m_collapsedBorderValues) { |
+ changed = true; |
Julien - ping for review
2016/01/08 14:18:15
Do we really need that for the first this code run
Xianzhu
2016/01/08 17:50:45
Sorry I'm not sure, do you mean I should comment o
Julien - ping for review
2016/01/11 18:11:36
m_collapsedBorderValue will be nullptr the first t
|
+ m_collapsedBorderValues = adoptPtr(new CollapsedBorderValues(newValues)); |
+ } else { |
+ changed = !m_collapsedBorderValues->startBorder.isEquivalentForPainting(newValues.startBorder) |
+ || !m_collapsedBorderValues->endBorder.isEquivalentForPainting(newValues.endBorder) |
+ || !m_collapsedBorderValues->beforeBorder.isEquivalentForPainting(newValues.beforeBorder) |
+ || !m_collapsedBorderValues->afterBorder.isEquivalentForPainting(newValues.afterBorder); |
+ if (changed) |
+ *m_collapsedBorderValues = newValues; |
+ } |
+ |
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); |
} |
static int compareBorderValuesForQSort(const void* pa, const void* pb) |