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

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 7b57b188a566a6211eca57a5b517e129959dd3d8..817cf19ccebc027fc03d171d173802443b612237 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
@@ -57,6 +57,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),
@@ -777,9 +778,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());
+
+ 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTable.h ('k') | third_party/WebKit/Source/core/layout/LayoutTableCell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698