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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTable.h

Issue 2846563002: Optimize collapsed border calculation (step 1) (Closed)
Patch Set: - Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutTable.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 * (C) 1997 Torben Weis (weis@kde.org) 3 * (C) 1997 Torben Weis (weis@kde.org)
4 * (C) 1998 Waldo Bastian (bastian@kde.org) 4 * (C) 1998 Waldo Bastian (bastian@kde.org)
5 * (C) 1999 Lars Knoll (knoll@kde.org) 5 * (C) 1999 Lars Knoll (knoll@kde.org)
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 * (C) 1999 Antti Koivisto (koivisto@kde.org)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2009, 2010 Apple Inc. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2009, 2010 Apple Inc.
8 * All rights reserved. 8 * All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 LayoutTableCell* CellBelow(const LayoutTableCell*) const; 409 LayoutTableCell* CellBelow(const LayoutTableCell*) const;
410 LayoutTableCell* CellBefore(const LayoutTableCell*) const; 410 LayoutTableCell* CellBefore(const LayoutTableCell*) const;
411 LayoutTableCell* CellAfter(const LayoutTableCell*) const; 411 LayoutTableCell* CellAfter(const LayoutTableCell*) const;
412 412
413 using CollapsedBorderValues = Vector<CollapsedBorderValue>; 413 using CollapsedBorderValues = Vector<CollapsedBorderValue>;
414 const CollapsedBorderValues& CollapsedBorders() const { 414 const CollapsedBorderValues& CollapsedBorders() const {
415 DCHECK(collapsed_borders_valid_); 415 DCHECK(collapsed_borders_valid_);
416 return collapsed_borders_; 416 return collapsed_borders_;
417 } 417 }
418 void InvalidateCollapsedBorders(); 418 void InvalidateCollapsedBorders();
419 void InvalidateCollapsedBordersForAllCellsIfNeeded();
419 420
420 bool HasSections() const { return Header() || Footer() || FirstBody(); } 421 bool HasSections() const { return Header() || Footer() || FirstBody(); }
421 422
422 void RecalcSectionsIfNeeded() const { 423 void RecalcSectionsIfNeeded() const {
423 if (needs_section_recalc_) 424 if (needs_section_recalc_)
424 RecalcSections(); 425 RecalcSections();
425 } 426 }
426 427
427 static LayoutTable* CreateAnonymousWithParent(const LayoutObject*); 428 static LayoutTable* CreateAnonymousWithParent(const LayoutObject*);
428 LayoutBox* CreateAnonymousBoxWithSameTypeAs( 429 LayoutBox* CreateAnonymousBoxWithSameTypeAs(
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 std::unique_ptr<TableLayoutAlgorithm> table_layout_; 582 std::unique_ptr<TableLayoutAlgorithm> table_layout_;
582 583
583 // A sorted list of all unique border values that we want to paint. 584 // A sorted list of all unique border values that we want to paint.
584 // 585 //
585 // Collapsed borders are SUPER EXPENSIVE to compute. The reason is that we 586 // Collapsed borders are SUPER EXPENSIVE to compute. The reason is that we
586 // need to compare a cells border against all the adjoining cells, rows, 587 // need to compare a cells border against all the adjoining cells, rows,
587 // row groups, column, column groups and table. Thus we cache them in this 588 // row groups, column, column groups and table. Thus we cache them in this
588 // field. 589 // field.
589 CollapsedBorderValues collapsed_borders_; 590 CollapsedBorderValues collapsed_borders_;
590 bool collapsed_borders_valid_ : 1; 591 bool collapsed_borders_valid_ : 1;
592 bool needs_invalidate_collapsed_borders_for_all_cells_ : 1;
591 593
592 mutable bool has_col_elements_ : 1; 594 mutable bool has_col_elements_ : 1;
593 mutable bool needs_section_recalc_ : 1; 595 mutable bool needs_section_recalc_ : 1;
594 596
595 bool column_logical_width_changed_ : 1; 597 bool column_logical_width_changed_ : 1;
596 mutable bool column_layout_objects_valid_ : 1; 598 mutable bool column_layout_objects_valid_ : 1;
597 mutable unsigned no_cell_colspan_at_least_; 599 mutable unsigned no_cell_colspan_at_least_;
598 unsigned CalcNoCellColspanAtLeast() const { 600 unsigned CalcNoCellColspanAtLeast() const {
599 for (unsigned c = 0; c < NumEffectiveColumns(); c++) { 601 for (unsigned c = 0; c < NumEffectiveColumns(); c++) {
600 if (effective_columns_[c].span > 1) 602 if (effective_columns_[c].span > 1)
(...skipping 19 matching lines...) Expand all
620 if (first_body_) 622 if (first_body_)
621 return first_body_; 623 return first_body_;
622 return foot_; 624 return foot_;
623 } 625 }
624 626
625 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTable, IsTable()); 627 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTable, IsTable());
626 628
627 } // namespace blink 629 } // namespace blink
628 630
629 #endif // LayoutTable_h 631 #endif // LayoutTable_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutTable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698