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