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 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 ClearPreferredLogicalWidthsDirty(); | 957 ClearPreferredLogicalWidthsDirty(); |
958 } | 958 } |
959 | 959 |
960 LayoutTableSection* LayoutTable::TopNonEmptySection() const { | 960 LayoutTableSection* LayoutTable::TopNonEmptySection() const { |
961 LayoutTableSection* section = TopSection(); | 961 LayoutTableSection* section = TopSection(); |
962 if (section && !section->NumRows()) | 962 if (section && !section->NumRows()) |
963 section = SectionBelow(section, kSkipEmptySections); | 963 section = SectionBelow(section, kSkipEmptySections); |
964 return section; | 964 return section; |
965 } | 965 } |
966 | 966 |
| 967 LayoutTableSection* LayoutTable::BottomNonEmptySection() const { |
| 968 LayoutTableSection* section = BottomSection(); |
| 969 if (section && !section->NumRows()) |
| 970 section = SectionAbove(section, kSkipEmptySections); |
| 971 return section; |
| 972 } |
| 973 |
967 void LayoutTable::SplitEffectiveColumn(unsigned index, unsigned first_span) { | 974 void LayoutTable::SplitEffectiveColumn(unsigned index, unsigned first_span) { |
968 // We split the column at |index|, taking |firstSpan| cells from the span. | 975 // We split the column at |index|, taking |firstSpan| cells from the span. |
969 DCHECK_GT(effective_columns_[index].span, first_span); | 976 DCHECK_GT(effective_columns_[index].span, first_span); |
970 effective_columns_.insert(index, first_span); | 977 effective_columns_.insert(index, first_span); |
971 effective_columns_[index + 1].span -= first_span; | 978 effective_columns_[index + 1].span -= first_span; |
972 | 979 |
973 // Propagate the change in our columns representation to the sections that | 980 // Propagate the change in our columns representation to the sections that |
974 // don't need cell recalc. If they do, they will be synced up directly with | 981 // don't need cell recalc. If they do, they will be synced up directly with |
975 // m_columns later. | 982 // m_columns later. |
976 for (LayoutObject* child = FirstChild(); child; | 983 for (LayoutObject* child = FirstChild(); child; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 col_and_col_group.adjoins_end_border_of_col_group = | 1083 col_and_col_group.adjoins_end_border_of_col_group = |
1077 is_at_end_edge && !col_and_col_group.col->NextSibling(); | 1084 is_at_end_edge && !col_and_col_group.col->NextSibling(); |
1078 } | 1085 } |
1079 } | 1086 } |
1080 return col_and_col_group; | 1087 return col_and_col_group; |
1081 } | 1088 } |
1082 } | 1089 } |
1083 return ColAndColGroup(); | 1090 return ColAndColGroup(); |
1084 } | 1091 } |
1085 | 1092 |
| 1093 // Maps LayoutTableCol => absoluteColumnIndex, |
| 1094 // an inverse of slowColElementAtAbsoluteColumn |
| 1095 unsigned LayoutTable::ColElementToAbsoluteColumn( |
| 1096 const LayoutTableCol* col_element) const { |
| 1097 unsigned col = 0; |
| 1098 for (LayoutTableCol* column_layout_object = FirstColumn(); |
| 1099 column_layout_object; |
| 1100 column_layout_object = column_layout_object->NextColumn()) { |
| 1101 if (column_layout_object == col_element) |
| 1102 break; |
| 1103 if (column_layout_object->IsTableColumnGroupWithColumnChildren()) { |
| 1104 // Do nothing, span will increase with children |
| 1105 } else { |
| 1106 col += column_layout_object->Span(); |
| 1107 } |
| 1108 } |
| 1109 return col; |
| 1110 } |
| 1111 |
1086 void LayoutTable::RecalcSections() const { | 1112 void LayoutTable::RecalcSections() const { |
1087 DCHECK(needs_section_recalc_); | 1113 DCHECK(needs_section_recalc_); |
1088 | 1114 |
1089 head_ = nullptr; | 1115 head_ = nullptr; |
1090 foot_ = nullptr; | 1116 foot_ = nullptr; |
1091 first_body_ = nullptr; | 1117 first_body_ = nullptr; |
1092 has_col_elements_ = false; | 1118 has_col_elements_ = false; |
1093 | 1119 |
1094 // We need to get valid pointers to caption, head, foot and first body again | 1120 // We need to get valid pointers to caption, head, foot and first body again |
1095 LayoutObject* next_sibling; | 1121 LayoutObject* next_sibling; |
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1737 } | 1763 } |
1738 | 1764 |
1739 LayoutUnit LayoutTable::PaddingRight() const { | 1765 LayoutUnit LayoutTable::PaddingRight() const { |
1740 if (CollapseBorders()) | 1766 if (CollapseBorders()) |
1741 return LayoutUnit(); | 1767 return LayoutUnit(); |
1742 | 1768 |
1743 return LayoutBlock::PaddingRight(); | 1769 return LayoutBlock::PaddingRight(); |
1744 } | 1770 } |
1745 | 1771 |
1746 } // namespace blink | 1772 } // namespace blink |
OLD | NEW |