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

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

Issue 2846563002: Optimize collapsed border calculation (step 1) (Closed)
Patch Set: - Created 3 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/LayoutTable.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.cpp b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
index b5f782ce7e5ea2ea7db8a03b16dbb4fa1a97e6dc..c0bb217186c7c7920a379781fad95237bbd71264 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
@@ -58,6 +58,7 @@ LayoutTable::LayoutTable(Element* element)
foot_(nullptr),
first_body_(nullptr),
collapsed_borders_valid_(false),
+ needs_invalidate_collapsed_borders_for_all_cells_(false),
has_col_elements_(false),
needs_section_recalc_(false),
column_logical_width_changed_(false),
@@ -780,9 +781,32 @@ void LayoutTable::UpdateLayout() {
void LayoutTable::InvalidateCollapsedBorders() {
collapsed_borders_.clear();
collapsed_borders_valid_ = false;
+ needs_invalidate_collapsed_borders_for_all_cells_ = true;
SetMayNeedPaintInvalidation();
}
+void LayoutTable::InvalidateCollapsedBordersForAllCellsIfNeeded() {
+ DCHECK(CollapseBorders());
wkorman 2017/04/27 20:11:15 I was briefly confused with this vs. CollapsedBord
Xianzhu 2017/04/28 20:31:44 Created https://codereview.chromium.org/2850633003
+
+ if (!needs_invalidate_collapsed_borders_for_all_cells_)
+ return;
+ needs_invalidate_collapsed_borders_for_all_cells_ = false;
+
+ for (LayoutObject* section = FirstChild(); section;
+ section = section->NextSibling()) {
+ if (!section->IsTableSection())
+ continue;
+ for (LayoutTableRow* row = ToLayoutTableSection(section)->FirstRow(); row;
+ row = row->NextRow()) {
+ for (LayoutTableCell* cell = row->FirstCell(); cell;
+ cell = cell->NextCell()) {
+ DCHECK_EQ(cell->Table(), this);
+ cell->InvalidateCollapsedBorderValues();
+ }
+ }
+ }
+}
+
// Collect all the unique border values that we want to paint in a sorted list.
// During the collection, each cell saves its recalculated borders into the
// cache of its containing section, and invalidates itself if any border

Powered by Google App Engine
This is Rietveld 408576698