| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 while (o && o != ptr) | 113 while (o && o != ptr) |
| 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 // Return true if 'object' can't exist in an anonymous table without being | 120 // Return true if 'object' can't exist in an anonymous table without being |
| 121 // wrapped in a table section box. | 121 // wrapped in a table section box. |
| 122 EDisplay display = object->style()->display(); | 122 EDisplay display = object->style()->display(); |
| 123 return display != EDisplay::TableCaption && | 123 return display != EDisplay::kTableCaption && |
| 124 display != EDisplay::TableColumnGroup && | 124 display != EDisplay::kTableColumnGroup && |
| 125 display != EDisplay::TableColumn; | 125 display != EDisplay::kTableColumn; |
| 126 } | 126 } |
| 127 | 127 |
| 128 void LayoutTable::addChild(LayoutObject* child, LayoutObject* beforeChild) { | 128 void LayoutTable::addChild(LayoutObject* child, LayoutObject* beforeChild) { |
| 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 EDisplay::TableHeaderGroup: | 138 case EDisplay::kTableHeaderGroup: |
| 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 EDisplay::TableFooterGroup: | 149 case EDisplay::kTableFooterGroup: |
| 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 EDisplay::TableRowGroup: | 157 case EDisplay::kTableRowGroup: |
| 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 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 m_head = nullptr; | 1074 m_head = nullptr; |
| 1075 m_foot = nullptr; | 1075 m_foot = nullptr; |
| 1076 m_firstBody = nullptr; | 1076 m_firstBody = nullptr; |
| 1077 m_hasColElements = false; | 1077 m_hasColElements = false; |
| 1078 | 1078 |
| 1079 // We need to get valid pointers to caption, head, foot and first body again | 1079 // We need to get valid pointers to caption, head, foot and first body again |
| 1080 LayoutObject* nextSibling; | 1080 LayoutObject* nextSibling; |
| 1081 for (LayoutObject* child = firstChild(); child; child = nextSibling) { | 1081 for (LayoutObject* child = firstChild(); child; child = nextSibling) { |
| 1082 nextSibling = child->nextSibling(); | 1082 nextSibling = child->nextSibling(); |
| 1083 switch (child->style()->display()) { | 1083 switch (child->style()->display()) { |
| 1084 case EDisplay::TableColumn: | 1084 case EDisplay::kTableColumn: |
| 1085 case EDisplay::TableColumnGroup: | 1085 case EDisplay::kTableColumnGroup: |
| 1086 m_hasColElements = true; | 1086 m_hasColElements = true; |
| 1087 break; | 1087 break; |
| 1088 case EDisplay::TableHeaderGroup: | 1088 case EDisplay::kTableHeaderGroup: |
| 1089 if (child->isTableSection()) { | 1089 if (child->isTableSection()) { |
| 1090 LayoutTableSection* section = toLayoutTableSection(child); | 1090 LayoutTableSection* section = toLayoutTableSection(child); |
| 1091 if (!m_head) | 1091 if (!m_head) |
| 1092 m_head = section; | 1092 m_head = section; |
| 1093 else if (!m_firstBody) | 1093 else if (!m_firstBody) |
| 1094 m_firstBody = section; | 1094 m_firstBody = section; |
| 1095 section->recalcCellsIfNeeded(); | 1095 section->recalcCellsIfNeeded(); |
| 1096 } | 1096 } |
| 1097 break; | 1097 break; |
| 1098 case EDisplay::TableFooterGroup: | 1098 case EDisplay::kTableFooterGroup: |
| 1099 if (child->isTableSection()) { | 1099 if (child->isTableSection()) { |
| 1100 LayoutTableSection* section = toLayoutTableSection(child); | 1100 LayoutTableSection* section = toLayoutTableSection(child); |
| 1101 if (!m_foot) | 1101 if (!m_foot) |
| 1102 m_foot = section; | 1102 m_foot = section; |
| 1103 else if (!m_firstBody) | 1103 else if (!m_firstBody) |
| 1104 m_firstBody = section; | 1104 m_firstBody = section; |
| 1105 section->recalcCellsIfNeeded(); | 1105 section->recalcCellsIfNeeded(); |
| 1106 } | 1106 } |
| 1107 break; | 1107 break; |
| 1108 case EDisplay::TableRowGroup: | 1108 case EDisplay::kTableRowGroup: |
| 1109 if (child->isTableSection()) { | 1109 if (child->isTableSection()) { |
| 1110 LayoutTableSection* section = toLayoutTableSection(child); | 1110 LayoutTableSection* section = toLayoutTableSection(child); |
| 1111 if (!m_firstBody) | 1111 if (!m_firstBody) |
| 1112 m_firstBody = section; | 1112 m_firstBody = section; |
| 1113 section->recalcCellsIfNeeded(); | 1113 section->recalcCellsIfNeeded(); |
| 1114 } | 1114 } |
| 1115 break; | 1115 break; |
| 1116 default: | 1116 default: |
| 1117 break; | 1117 break; |
| 1118 } | 1118 } |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 } | 1638 } |
| 1639 | 1639 |
| 1640 return false; | 1640 return false; |
| 1641 } | 1641 } |
| 1642 | 1642 |
| 1643 LayoutTable* LayoutTable::createAnonymousWithParent( | 1643 LayoutTable* LayoutTable::createAnonymousWithParent( |
| 1644 const LayoutObject* parent) { | 1644 const LayoutObject* parent) { |
| 1645 RefPtr<ComputedStyle> newStyle = | 1645 RefPtr<ComputedStyle> newStyle = |
| 1646 ComputedStyle::createAnonymousStyleWithDisplay( | 1646 ComputedStyle::createAnonymousStyleWithDisplay( |
| 1647 parent->styleRef(), | 1647 parent->styleRef(), |
| 1648 parent->isLayoutInline() ? EDisplay::InlineTable : EDisplay::Table); | 1648 parent->isLayoutInline() ? EDisplay::kInlineTable : EDisplay::kTable); |
| 1649 LayoutTable* newTable = new LayoutTable(nullptr); | 1649 LayoutTable* newTable = new LayoutTable(nullptr); |
| 1650 newTable->setDocumentForAnonymous(&parent->document()); | 1650 newTable->setDocumentForAnonymous(&parent->document()); |
| 1651 newTable->setStyle(std::move(newStyle)); | 1651 newTable->setStyle(std::move(newStyle)); |
| 1652 return newTable; | 1652 return newTable; |
| 1653 } | 1653 } |
| 1654 | 1654 |
| 1655 const BorderValue& LayoutTable::tableStartBorderAdjoiningCell( | 1655 const BorderValue& LayoutTable::tableStartBorderAdjoiningCell( |
| 1656 const LayoutTableCell* cell) const { | 1656 const LayoutTableCell* cell) const { |
| 1657 ASSERT(cell->isFirstOrLastCellInRow()); | 1657 ASSERT(cell->isFirstOrLastCellInRow()); |
| 1658 if (hasSameDirectionAs(cell->row())) | 1658 if (hasSameDirectionAs(cell->row())) |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1711 } | 1711 } |
| 1712 | 1712 |
| 1713 LayoutUnit LayoutTable::paddingRight() const { | 1713 LayoutUnit LayoutTable::paddingRight() const { |
| 1714 if (collapseBorders()) | 1714 if (collapseBorders()) |
| 1715 return LayoutUnit(); | 1715 return LayoutUnit(); |
| 1716 | 1716 |
| 1717 return LayoutBlock::paddingRight(); | 1717 return LayoutBlock::paddingRight(); |
| 1718 } | 1718 } |
| 1719 | 1719 |
| 1720 } // namespace blink | 1720 } // namespace blink |
| OLD | NEW |