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.
All rights reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc.
All rights reserved. |
8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 o = o->previousSibling(); | 114 o = o->previousSibling(); |
115 if (!o) | 115 if (!o) |
116 ptr = 0; | 116 ptr = 0; |
117 } | 117 } |
118 | 118 |
119 static inline bool needsTableSection(LayoutObject* object) | 119 static inline bool needsTableSection(LayoutObject* object) |
120 { | 120 { |
121 // Return true if 'object' can't exist in an anonymous table without being | 121 // Return true if 'object' can't exist in an anonymous table without being |
122 // wrapped in a table section box. | 122 // wrapped in a table section box. |
123 EDisplay display = object->style()->display(); | 123 EDisplay display = object->style()->display(); |
124 return display != TABLE_CAPTION && display != TABLE_COLUMN_GROUP && display
!= TABLE_COLUMN; | 124 return display != EDisplay::TableCaption && display != EDisplay::TableColumn
Group && display != EDisplay::TableColumn; |
125 } | 125 } |
126 | 126 |
127 void LayoutTable::addChild(LayoutObject* child, LayoutObject* beforeChild) | 127 void LayoutTable::addChild(LayoutObject* child, LayoutObject* beforeChild) |
128 { | 128 { |
129 bool wrapInAnonymousSection = !child->isOutOfFlowPositioned(); | 129 bool wrapInAnonymousSection = !child->isOutOfFlowPositioned(); |
130 | 130 |
131 if (child->isTableCaption()) { | 131 if (child->isTableCaption()) { |
132 wrapInAnonymousSection = false; | 132 wrapInAnonymousSection = false; |
133 } else if (child->isLayoutTableCol()) { | 133 } else if (child->isLayoutTableCol()) { |
134 m_hasColElements = true; | 134 m_hasColElements = true; |
135 wrapInAnonymousSection = false; | 135 wrapInAnonymousSection = false; |
136 } else if (child->isTableSection()) { | 136 } else if (child->isTableSection()) { |
137 switch (child->style()->display()) { | 137 switch (child->style()->display()) { |
138 case TABLE_HEADER_GROUP: | 138 case EDisplay::TableHeaderGroup: |
139 resetSectionPointerIfNotBefore(m_head, beforeChild); | 139 resetSectionPointerIfNotBefore(m_head, beforeChild); |
140 if (!m_head) { | 140 if (!m_head) { |
141 m_head = toLayoutTableSection(child); | 141 m_head = toLayoutTableSection(child); |
142 } else { | 142 } else { |
143 resetSectionPointerIfNotBefore(m_firstBody, beforeChild); | 143 resetSectionPointerIfNotBefore(m_firstBody, beforeChild); |
144 if (!m_firstBody) | 144 if (!m_firstBody) |
145 m_firstBody = toLayoutTableSection(child); | 145 m_firstBody = toLayoutTableSection(child); |
146 } | 146 } |
147 wrapInAnonymousSection = false; | 147 wrapInAnonymousSection = false; |
148 break; | 148 break; |
149 case TABLE_FOOTER_GROUP: | 149 case EDisplay::TableFooterGroup: |
150 resetSectionPointerIfNotBefore(m_foot, beforeChild); | 150 resetSectionPointerIfNotBefore(m_foot, beforeChild); |
151 if (!m_foot) { | 151 if (!m_foot) { |
152 m_foot = toLayoutTableSection(child); | 152 m_foot = toLayoutTableSection(child); |
153 wrapInAnonymousSection = false; | 153 wrapInAnonymousSection = false; |
154 break; | 154 break; |
155 } | 155 } |
156 // Fall through. | 156 // Fall through. |
157 case TABLE_ROW_GROUP: | 157 case EDisplay::TableRowGroup: |
158 resetSectionPointerIfNotBefore(m_firstBody, beforeChild); | 158 resetSectionPointerIfNotBefore(m_firstBody, beforeChild); |
159 if (!m_firstBody) | 159 if (!m_firstBody) |
160 m_firstBody = toLayoutTableSection(child); | 160 m_firstBody = toLayoutTableSection(child); |
161 wrapInAnonymousSection = false; | 161 wrapInAnonymousSection = false; |
162 break; | 162 break; |
163 default: | 163 default: |
164 ASSERT_NOT_REACHED(); | 164 ASSERT_NOT_REACHED(); |
165 } | 165 } |
166 } else { | 166 } else { |
167 wrapInAnonymousSection = true; | 167 wrapInAnonymousSection = true; |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 m_foot = nullptr; | 899 m_foot = nullptr; |
900 m_firstBody = nullptr; | 900 m_firstBody = nullptr; |
901 m_hasColElements = false; | 901 m_hasColElements = false; |
902 m_noCellColspanAtLeast = calcNoCellColspanAtLeast(); | 902 m_noCellColspanAtLeast = calcNoCellColspanAtLeast(); |
903 | 903 |
904 // We need to get valid pointers to caption, head, foot and first body again | 904 // We need to get valid pointers to caption, head, foot and first body again |
905 LayoutObject* nextSibling; | 905 LayoutObject* nextSibling; |
906 for (LayoutObject* child = firstChild(); child; child = nextSibling) { | 906 for (LayoutObject* child = firstChild(); child; child = nextSibling) { |
907 nextSibling = child->nextSibling(); | 907 nextSibling = child->nextSibling(); |
908 switch (child->style()->display()) { | 908 switch (child->style()->display()) { |
909 case TABLE_COLUMN: | 909 case EDisplay::TableColumn: |
910 case TABLE_COLUMN_GROUP: | 910 case EDisplay::TableColumnGroup: |
911 m_hasColElements = true; | 911 m_hasColElements = true; |
912 break; | 912 break; |
913 case TABLE_HEADER_GROUP: | 913 case EDisplay::TableHeaderGroup: |
914 if (child->isTableSection()) { | 914 if (child->isTableSection()) { |
915 LayoutTableSection* section = toLayoutTableSection(child); | 915 LayoutTableSection* section = toLayoutTableSection(child); |
916 if (!m_head) | 916 if (!m_head) |
917 m_head = section; | 917 m_head = section; |
918 else if (!m_firstBody) | 918 else if (!m_firstBody) |
919 m_firstBody = section; | 919 m_firstBody = section; |
920 section->recalcCellsIfNeeded(); | 920 section->recalcCellsIfNeeded(); |
921 } | 921 } |
922 break; | 922 break; |
923 case TABLE_FOOTER_GROUP: | 923 case EDisplay::TableFooterGroup: |
924 if (child->isTableSection()) { | 924 if (child->isTableSection()) { |
925 LayoutTableSection* section = toLayoutTableSection(child); | 925 LayoutTableSection* section = toLayoutTableSection(child); |
926 if (!m_foot) | 926 if (!m_foot) |
927 m_foot = section; | 927 m_foot = section; |
928 else if (!m_firstBody) | 928 else if (!m_firstBody) |
929 m_firstBody = section; | 929 m_firstBody = section; |
930 section->recalcCellsIfNeeded(); | 930 section->recalcCellsIfNeeded(); |
931 } | 931 } |
932 break; | 932 break; |
933 case TABLE_ROW_GROUP: | 933 case EDisplay::TableRowGroup: |
934 if (child->isTableSection()) { | 934 if (child->isTableSection()) { |
935 LayoutTableSection* section = toLayoutTableSection(child); | 935 LayoutTableSection* section = toLayoutTableSection(child); |
936 if (!m_firstBody) | 936 if (!m_firstBody) |
937 m_firstBody = section; | 937 m_firstBody = section; |
938 section->recalcCellsIfNeeded(); | 938 section->recalcCellsIfNeeded(); |
939 } | 939 } |
940 break; | 940 break; |
941 default: | 941 default: |
942 break; | 942 break; |
943 } | 943 } |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1411 updateHitTestResult(result, flipForWritingMode(locationInContainer.point
() - toLayoutSize(adjustedLocation))); | 1411 updateHitTestResult(result, flipForWritingMode(locationInContainer.point
() - toLayoutSize(adjustedLocation))); |
1412 if (result.addNodeToListBasedTestResult(node(), locationInContainer, bou
ndsRect) == StopHitTesting) | 1412 if (result.addNodeToListBasedTestResult(node(), locationInContainer, bou
ndsRect) == StopHitTesting) |
1413 return true; | 1413 return true; |
1414 } | 1414 } |
1415 | 1415 |
1416 return false; | 1416 return false; |
1417 } | 1417 } |
1418 | 1418 |
1419 LayoutTable* LayoutTable::createAnonymousWithParent(const LayoutObject* parent) | 1419 LayoutTable* LayoutTable::createAnonymousWithParent(const LayoutObject* parent) |
1420 { | 1420 { |
1421 RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisp
lay(parent->styleRef(), parent->isLayoutInline() ? INLINE_TABLE : TABLE); | 1421 RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisp
lay(parent->styleRef(), parent->isLayoutInline() ? EDisplay::InlineTable : EDisp
lay::Table); |
1422 LayoutTable* newTable = new LayoutTable(nullptr); | 1422 LayoutTable* newTable = new LayoutTable(nullptr); |
1423 newTable->setDocumentForAnonymous(&parent->document()); | 1423 newTable->setDocumentForAnonymous(&parent->document()); |
1424 newTable->setStyle(newStyle.release()); | 1424 newTable->setStyle(newStyle.release()); |
1425 return newTable; | 1425 return newTable; |
1426 } | 1426 } |
1427 | 1427 |
1428 const BorderValue& LayoutTable::tableStartBorderAdjoiningCell(const LayoutTableC
ell* cell) const | 1428 const BorderValue& LayoutTable::tableStartBorderAdjoiningCell(const LayoutTableC
ell* cell) const |
1429 { | 1429 { |
1430 ASSERT(cell->isFirstOrLastCellInRow()); | 1430 ASSERT(cell->isFirstOrLastCellInRow()); |
1431 if (hasSameDirectionAs(cell->row())) | 1431 if (hasSameDirectionAs(cell->row())) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1488 | 1488 |
1489 LayoutUnit LayoutTable::paddingRight() const | 1489 LayoutUnit LayoutTable::paddingRight() const |
1490 { | 1490 { |
1491 if (collapseBorders()) | 1491 if (collapseBorders()) |
1492 return LayoutUnit(); | 1492 return LayoutUnit(); |
1493 | 1493 |
1494 return LayoutBlock::paddingRight(); | 1494 return LayoutBlock::paddingRight(); |
1495 } | 1495 } |
1496 | 1496 |
1497 } // namespace blink | 1497 } // namespace blink |
OLD | NEW |