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, 2008, 2009, 2010, 2013 Apple Inc. All r
ights reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2013 Apple Inc. All r
ights 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 , m_hasMultipleCellLevels(false) | 91 , m_hasMultipleCellLevels(false) |
92 { | 92 { |
93 // init LayoutObject attributes | 93 // init LayoutObject attributes |
94 setInline(false); // our object is not Inline | 94 setInline(false); // our object is not Inline |
95 } | 95 } |
96 | 96 |
97 LayoutTableSection::~LayoutTableSection() | 97 LayoutTableSection::~LayoutTableSection() |
98 { | 98 { |
99 } | 99 } |
100 | 100 |
101 void LayoutTableSection::styleDidChange(StyleDifference diff, const LayoutStyle*
oldStyle) | 101 void LayoutTableSection::styleDidChange(StyleDifference diff, const ComputedStyl
e* oldStyle) |
102 { | 102 { |
103 LayoutBox::styleDidChange(diff, oldStyle); | 103 LayoutBox::styleDidChange(diff, oldStyle); |
104 propagateStyleToAnonymousChildren(); | 104 propagateStyleToAnonymousChildren(); |
105 | 105 |
106 // If border was changed, notify table. | 106 // If border was changed, notify table. |
107 LayoutTable* table = this->table(); | 107 LayoutTable* table = this->table(); |
108 if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout() &
& oldStyle && oldStyle->border() != style()->border()) | 108 if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout() &
& oldStyle && oldStyle->border() != style()->border()) |
109 table->invalidateCollapsedBorders(); | 109 table->invalidateCollapsedBorders(); |
110 } | 110 } |
111 | 111 |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 if (rb.style() == BHIDDEN) | 1142 if (rb.style() == BHIDDEN) |
1143 return -1; | 1143 return -1; |
1144 if (rb.style() > BHIDDEN && rb.width() > borderWidth) | 1144 if (rb.style() > BHIDDEN && rb.width() > borderWidth) |
1145 borderWidth = rb.width(); | 1145 borderWidth = rb.width(); |
1146 | 1146 |
1147 bool allHidden = true; | 1147 bool allHidden = true; |
1148 for (unsigned c = 0; c < totalCols; c++) { | 1148 for (unsigned c = 0; c < totalCols; c++) { |
1149 const CellStruct& current = cellAt(side == BorderBefore ? 0 : m_grid.siz
e() - 1, c); | 1149 const CellStruct& current = cellAt(side == BorderBefore ? 0 : m_grid.siz
e() - 1, c); |
1150 if (current.inColSpan || !current.hasCells()) | 1150 if (current.inColSpan || !current.hasCells()) |
1151 continue; | 1151 continue; |
1152 const LayoutStyle& primaryCellStyle = current.primaryCell()->styleRef(); | 1152 const ComputedStyle& primaryCellStyle = current.primaryCell()->styleRef(
); |
1153 const BorderValue& cb = side == BorderBefore ? primaryCellStyle.borderBe
fore() : primaryCellStyle.borderAfter(); // FIXME: Make this work with perpendic
ular and flipped cells. | 1153 const BorderValue& cb = side == BorderBefore ? primaryCellStyle.borderBe
fore() : primaryCellStyle.borderAfter(); // FIXME: Make this work with perpendic
ular and flipped cells. |
1154 // FIXME: Don't repeat for the same col group | 1154 // FIXME: Don't repeat for the same col group |
1155 LayoutTableCol* colGroup = table()->colElement(c); | 1155 LayoutTableCol* colGroup = table()->colElement(c); |
1156 if (colGroup) { | 1156 if (colGroup) { |
1157 const BorderValue& gb = side == BorderBefore ? colGroup->style()->bo
rderBefore() : colGroup->style()->borderAfter(); | 1157 const BorderValue& gb = side == BorderBefore ? colGroup->style()->bo
rderBefore() : colGroup->style()->borderAfter(); |
1158 if (gb.style() == BHIDDEN || cb.style() == BHIDDEN) | 1158 if (gb.style() == BHIDDEN || cb.style() == BHIDDEN) |
1159 continue; | 1159 continue; |
1160 allHidden = false; | 1160 allHidden = false; |
1161 if (gb.style() > BHIDDEN && gb.width() > borderWidth) | 1161 if (gb.style() > BHIDDEN && gb.width() > borderWidth) |
1162 borderWidth = gb.width(); | 1162 borderWidth = gb.width(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 if (gb.style() > BHIDDEN && gb.width() > borderWidth) | 1200 if (gb.style() > BHIDDEN && gb.width() > borderWidth) |
1201 borderWidth = gb.width(); | 1201 borderWidth = gb.width(); |
1202 } | 1202 } |
1203 | 1203 |
1204 bool allHidden = true; | 1204 bool allHidden = true; |
1205 for (unsigned r = 0; r < m_grid.size(); r++) { | 1205 for (unsigned r = 0; r < m_grid.size(); r++) { |
1206 const CellStruct& current = cellAt(r, colIndex); | 1206 const CellStruct& current = cellAt(r, colIndex); |
1207 if (!current.hasCells()) | 1207 if (!current.hasCells()) |
1208 continue; | 1208 continue; |
1209 // FIXME: Don't repeat for the same cell | 1209 // FIXME: Don't repeat for the same cell |
1210 const LayoutStyle& primaryCellStyle = current.primaryCell()->styleRef(); | 1210 const ComputedStyle& primaryCellStyle = current.primaryCell()->styleRef(
); |
1211 const LayoutStyle& primaryCellParentStyle = current.primaryCell()->paren
t()->styleRef(); | 1211 const ComputedStyle& primaryCellParentStyle = current.primaryCell()->par
ent()->styleRef(); |
1212 const BorderValue& cb = side == BorderStart ? primaryCellStyle.borderSta
rt() : primaryCellStyle.borderEnd(); // FIXME: Make this work with perpendicular
and flipped cells. | 1212 const BorderValue& cb = side == BorderStart ? primaryCellStyle.borderSta
rt() : primaryCellStyle.borderEnd(); // FIXME: Make this work with perpendicular
and flipped cells. |
1213 const BorderValue& rb = side == BorderStart ? primaryCellParentStyle.bor
derStart() : primaryCellParentStyle.borderEnd(); | 1213 const BorderValue& rb = side == BorderStart ? primaryCellParentStyle.bor
derStart() : primaryCellParentStyle.borderEnd(); |
1214 if (cb.style() == BHIDDEN || rb.style() == BHIDDEN) | 1214 if (cb.style() == BHIDDEN || rb.style() == BHIDDEN) |
1215 continue; | 1215 continue; |
1216 allHidden = false; | 1216 allHidden = false; |
1217 if (cb.style() > BHIDDEN && cb.width() > borderWidth) | 1217 if (cb.style() > BHIDDEN && cb.width() > borderWidth) |
1218 borderWidth = cb.width(); | 1218 borderWidth = cb.width(); |
1219 if (rb.style() > BHIDDEN && rb.width() > borderWidth) | 1219 if (rb.style() > BHIDDEN && rb.width() > borderWidth) |
1220 borderWidth = rb.width(); | 1220 borderWidth = rb.width(); |
1221 } | 1221 } |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 CollapsedBorderValue& LayoutTableSection::cachedCollapsedBorder(const LayoutTabl
eCell* cell, CollapsedBorderSide side) | 1586 CollapsedBorderValue& LayoutTableSection::cachedCollapsedBorder(const LayoutTabl
eCell* cell, CollapsedBorderSide side) |
1587 { | 1587 { |
1588 ASSERT(table()->collapseBorders()); | 1588 ASSERT(table()->collapseBorders()); |
1589 HashMap<pair<const LayoutTableCell*, int>, CollapsedBorderValue>::iterator i
t = m_cellsCollapsedBorders.find(std::make_pair(cell, side)); | 1589 HashMap<pair<const LayoutTableCell*, int>, CollapsedBorderValue>::iterator i
t = m_cellsCollapsedBorders.find(std::make_pair(cell, side)); |
1590 ASSERT_WITH_SECURITY_IMPLICATION(it != m_cellsCollapsedBorders.end()); | 1590 ASSERT_WITH_SECURITY_IMPLICATION(it != m_cellsCollapsedBorders.end()); |
1591 return it->value; | 1591 return it->value; |
1592 } | 1592 } |
1593 | 1593 |
1594 LayoutTableSection* LayoutTableSection::createAnonymousWithParentRenderer(const
LayoutObject* parent) | 1594 LayoutTableSection* LayoutTableSection::createAnonymousWithParentRenderer(const
LayoutObject* parent) |
1595 { | 1595 { |
1596 RefPtr<LayoutStyle> newStyle = LayoutStyle::createAnonymousStyleWithDisplay(
parent->styleRef(), TABLE_ROW_GROUP); | 1596 RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisp
lay(parent->styleRef(), TABLE_ROW_GROUP); |
1597 LayoutTableSection* newSection = new LayoutTableSection(0); | 1597 LayoutTableSection* newSection = new LayoutTableSection(0); |
1598 newSection->setDocumentForAnonymous(&parent->document()); | 1598 newSection->setDocumentForAnonymous(&parent->document()); |
1599 newSection->setStyle(newStyle.release()); | 1599 newSection->setStyle(newStyle.release()); |
1600 return newSection; | 1600 return newSection; |
1601 } | 1601 } |
1602 | 1602 |
1603 void LayoutTableSection::setLogicalPositionForCell(LayoutTableCell* cell, unsign
ed effectiveColumn) const | 1603 void LayoutTableSection::setLogicalPositionForCell(LayoutTableCell* cell, unsign
ed effectiveColumn) const |
1604 { | 1604 { |
1605 LayoutPoint cellLocation(0, m_rowPos[cell->rowIndex()]); | 1605 LayoutPoint cellLocation(0, m_rowPos[cell->rowIndex()]); |
1606 int horizontalBorderSpacing = table()->hBorderSpacing(); | 1606 int horizontalBorderSpacing = table()->hBorderSpacing(); |
1607 | 1607 |
1608 // FIXME: The table's direction should determine our row's direction, not th
e section's (see bug 96691). | 1608 // FIXME: The table's direction should determine our row's direction, not th
e section's (see bug 96691). |
1609 if (!style()->isLeftToRightDirection()) | 1609 if (!style()->isLeftToRightDirection()) |
1610 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta
ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] +
horizontalBorderSpacing); | 1610 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta
ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] +
horizontalBorderSpacing); |
1611 else | 1611 else |
1612 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont
alBorderSpacing); | 1612 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont
alBorderSpacing); |
1613 | 1613 |
1614 cell->setLogicalLocation(cellLocation); | 1614 cell->setLogicalLocation(cellLocation); |
1615 } | 1615 } |
1616 | 1616 |
1617 } // namespace blink | 1617 } // namespace blink |
OLD | NEW |