Chromium Code Reviews| OLD | NEW |
|---|---|
| 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, 2007, 2008, 2009, 2010, 2013 Apple Inc. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. |
| 8 * All rights reserved. | 8 * All rights reserved. |
| 9 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 9 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 10 * | 10 * |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 namespace blink { | 51 namespace blink { |
| 52 | 52 |
| 53 using namespace HTMLNames; | 53 using namespace HTMLNames; |
| 54 | 54 |
| 55 LayoutTable::LayoutTable(Element* element) | 55 LayoutTable::LayoutTable(Element* element) |
| 56 : LayoutBlock(element), | 56 : LayoutBlock(element), |
| 57 head_(nullptr), | 57 head_(nullptr), |
| 58 foot_(nullptr), | 58 foot_(nullptr), |
| 59 first_body_(nullptr), | 59 first_body_(nullptr), |
| 60 collapsed_borders_valid_(false), | 60 collapsed_borders_valid_(false), |
| 61 needs_invalidate_collapsed_borders_for_all_cells_(false), | |
| 61 has_col_elements_(false), | 62 has_col_elements_(false), |
| 62 needs_section_recalc_(false), | 63 needs_section_recalc_(false), |
| 63 column_logical_width_changed_(false), | 64 column_logical_width_changed_(false), |
| 64 column_layout_objects_valid_(false), | 65 column_layout_objects_valid_(false), |
| 65 no_cell_colspan_at_least_(0), | 66 no_cell_colspan_at_least_(0), |
| 66 h_spacing_(0), | 67 h_spacing_(0), |
| 67 v_spacing_(0), | 68 v_spacing_(0), |
| 68 border_start_(0), | 69 border_start_(0), |
| 69 border_end_(0) { | 70 border_end_(0) { |
| 70 DCHECK(!ChildrenInline()); | 71 DCHECK(!ChildrenInline()); |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 773 // to update the value as its used by flexbox layout. crbug.com/367324 | 774 // to update the value as its used by flexbox layout. crbug.com/367324 |
| 774 SetIntrinsicContentLogicalHeight(ContentLogicalHeight()); | 775 SetIntrinsicContentLogicalHeight(ContentLogicalHeight()); |
| 775 | 776 |
| 776 column_logical_width_changed_ = false; | 777 column_logical_width_changed_ = false; |
| 777 ClearNeedsLayout(); | 778 ClearNeedsLayout(); |
| 778 } | 779 } |
| 779 | 780 |
| 780 void LayoutTable::InvalidateCollapsedBorders() { | 781 void LayoutTable::InvalidateCollapsedBorders() { |
| 781 collapsed_borders_.clear(); | 782 collapsed_borders_.clear(); |
| 782 collapsed_borders_valid_ = false; | 783 collapsed_borders_valid_ = false; |
| 784 needs_invalidate_collapsed_borders_for_all_cells_ = true; | |
| 783 SetMayNeedPaintInvalidation(); | 785 SetMayNeedPaintInvalidation(); |
| 784 } | 786 } |
| 785 | 787 |
| 788 void LayoutTable::InvalidateCollapsedBordersForAllCellsIfNeeded() { | |
| 789 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
| |
| 790 | |
| 791 if (!needs_invalidate_collapsed_borders_for_all_cells_) | |
| 792 return; | |
| 793 needs_invalidate_collapsed_borders_for_all_cells_ = false; | |
| 794 | |
| 795 for (LayoutObject* section = FirstChild(); section; | |
| 796 section = section->NextSibling()) { | |
| 797 if (!section->IsTableSection()) | |
| 798 continue; | |
| 799 for (LayoutTableRow* row = ToLayoutTableSection(section)->FirstRow(); row; | |
| 800 row = row->NextRow()) { | |
| 801 for (LayoutTableCell* cell = row->FirstCell(); cell; | |
| 802 cell = cell->NextCell()) { | |
| 803 DCHECK_EQ(cell->Table(), this); | |
| 804 cell->InvalidateCollapsedBorderValues(); | |
| 805 } | |
| 806 } | |
| 807 } | |
| 808 } | |
| 809 | |
| 786 // Collect all the unique border values that we want to paint in a sorted list. | 810 // Collect all the unique border values that we want to paint in a sorted list. |
| 787 // During the collection, each cell saves its recalculated borders into the | 811 // During the collection, each cell saves its recalculated borders into the |
| 788 // cache of its containing section, and invalidates itself if any border | 812 // cache of its containing section, and invalidates itself if any border |
| 789 // changes. This method doesn't affect layout. | 813 // changes. This method doesn't affect layout. |
| 790 void LayoutTable::RecalcCollapsedBordersIfNeeded() { | 814 void LayoutTable::RecalcCollapsedBordersIfNeeded() { |
| 791 if (collapsed_borders_valid_ || !CollapseBorders()) | 815 if (collapsed_borders_valid_ || !CollapseBorders()) |
| 792 return; | 816 return; |
| 793 collapsed_borders_valid_ = true; | 817 collapsed_borders_valid_ = true; |
| 794 collapsed_borders_.clear(); | 818 collapsed_borders_.clear(); |
| 795 for (LayoutObject* section = FirstChild(); section; | 819 for (LayoutObject* section = FirstChild(); section; |
| (...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1738 } | 1762 } |
| 1739 | 1763 |
| 1740 LayoutUnit LayoutTable::PaddingRight() const { | 1764 LayoutUnit LayoutTable::PaddingRight() const { |
| 1741 if (CollapseBorders()) | 1765 if (CollapseBorders()) |
| 1742 return LayoutUnit(); | 1766 return LayoutUnit(); |
| 1743 | 1767 |
| 1744 return LayoutBlock::PaddingRight(); | 1768 return LayoutBlock::PaddingRight(); |
| 1745 } | 1769 } |
| 1746 | 1770 |
| 1747 } // namespace blink | 1771 } // namespace blink |
| OLD | NEW |