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

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

Issue 1549693002: Optimize collapsed border painting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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 0fc9192c6c566f8e62a348534055b936b1872ee2..437575028d4bb0971f912383048749c23b11d469 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,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.
chrishtr 2016/05/04 23:24:18 This is obsolete due to other work?
Xianzhu 2016/05/05 00:15:50 No. Restored.
+ 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)
+ || !m_collapsedBorderValues->endBorder.visuallyEquals(newValues.endBorder)
+ || !m_collapsedBorderValues->beforeBorder.visuallyEquals(newValues.beforeBorder)
+ || !m_collapsedBorderValues->afterBorder.visuallyEquals(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);
}
void LayoutTableCell::sortBorderValues(LayoutTable::CollapsedBorderValues& borderValues)

Powered by Google App Engine
This is Rietveld 408576698