Chromium Code Reviews| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 , m_hasMultipleCellLevels(false) | 109 , m_hasMultipleCellLevels(false) |
| 110 { | 110 { |
| 111 // init LayoutObject attributes | 111 // init LayoutObject attributes |
| 112 setInline(false); // our object is not Inline | 112 setInline(false); // our object is not Inline |
| 113 } | 113 } |
| 114 | 114 |
| 115 LayoutTableSection::~LayoutTableSection() | 115 LayoutTableSection::~LayoutTableSection() |
| 116 { | 116 { |
| 117 } | 117 } |
| 118 | 118 |
| 119 // TODO(dgrogan): Where should this go? It is duplicated in LayoutTableRow.cpp. | |
|
mstensho (USE GERRIT)
2016/05/25 12:18:28
There's a common LayoutTableBoxComponent base clas
dgrogan
2016/05/25 20:01:09
Yes, good call.
| |
| 120 static bool borderWidthChanged(const ComputedStyle* oldStyle, const ComputedStyl e* newStyle) | |
| 121 { | |
| 122 return oldStyle->borderLeftWidth() != newStyle->borderLeftWidth() | |
| 123 || oldStyle->borderTopWidth() != newStyle->borderTopWidth() | |
| 124 || oldStyle->borderRightWidth() != newStyle->borderRightWidth() | |
| 125 || oldStyle->borderBottomWidth() != newStyle->borderBottomWidth(); | |
| 126 } | |
| 127 | |
| 119 void LayoutTableSection::styleDidChange(StyleDifference diff, const ComputedStyl e* oldStyle) | 128 void LayoutTableSection::styleDidChange(StyleDifference diff, const ComputedStyl e* oldStyle) |
| 120 { | 129 { |
| 121 LayoutTableBoxComponent::styleDidChange(diff, oldStyle); | 130 LayoutTableBoxComponent::styleDidChange(diff, oldStyle); |
| 122 propagateStyleToAnonymousChildren(); | 131 propagateStyleToAnonymousChildren(); |
| 123 | 132 |
| 124 // If border was changed, notify table. | 133 // If border was changed, notify table. |
| 125 LayoutTable* table = this->table(); | 134 LayoutTable* table = this->table(); |
| 126 if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout() & & oldStyle && oldStyle->border() != style()->border()) | 135 if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout() & & oldStyle && oldStyle->border() != style()->border()) |
| 127 table->invalidateCollapsedBorders(); | 136 table->invalidateCollapsedBorders(); |
| 137 | |
| 138 // TODO(dgrogan): Do we need to setPreferredLogicalWidthsDirty even when !di ff.needsFullLayout()? | |
|
mstensho (USE GERRIT)
2016/05/25 12:18:28
Can we really schedule for layout as part of prefe
dgrogan
2016/05/25 20:01:09
This reasoning makes sense to me. I just didn't kn
| |
| 139 if (table && oldStyle && diff.needsFullLayout() && needsLayout() && table->c ollapseBorders() && borderWidthChanged(oldStyle, style())) { | |
| 140 table->setPreferredLogicalWidthsDirty(MarkOnlyThis); | |
| 141 for (unsigned r = 0; r < m_grid.size(); ++r) { | |
| 142 LayoutTableRow* rowLayoutObject = m_grid[r].rowLayoutObject; | |
| 143 if (!rowLayoutObject) | |
| 144 continue; | |
| 145 for (LayoutBox* childBox = rowLayoutObject->firstChildBox(); childBo x; childBox = childBox->nextSiblingBox()) { | |
| 146 if (!childBox->isTableCell()) | |
| 147 continue; | |
| 148 childBox->setPreferredLogicalWidthsDirty(MarkOnlyThis); | |
|
mstensho (USE GERRIT)
2016/05/25 12:18:28
Why MarkOnlyThis? If that's not necessary (or even
dgrogan
2016/05/25 20:01:09
The idea was that it was an optimization: parents
mstensho (USE GERRIT)
2016/05/26 18:08:48
Yes, I really think the parents DO need their pref
dgrogan
2016/05/27 00:21:38
You're right, LayoutObject::styleDidChange marks t
| |
| 149 } | |
| 150 } | |
| 151 } | |
| 128 } | 152 } |
| 129 | 153 |
| 130 void LayoutTableSection::willBeRemovedFromTree() | 154 void LayoutTableSection::willBeRemovedFromTree() |
| 131 { | 155 { |
| 132 LayoutTableBoxComponent::willBeRemovedFromTree(); | 156 LayoutTableBoxComponent::willBeRemovedFromTree(); |
| 133 | 157 |
| 134 // Preventively invalidate our cells as we may be re-inserted into | 158 // Preventively invalidate our cells as we may be re-inserted into |
| 135 // a new table which would require us to rebuild our structure. | 159 // a new table which would require us to rebuild our structure. |
| 136 setNeedsCellRecalc(); | 160 setNeedsCellRecalc(); |
| 137 } | 161 } |
| (...skipping 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1664 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). | 1688 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). |
| 1665 if (!style()->isLeftToRightDirection()) | 1689 if (!style()->isLeftToRightDirection()) |
| 1666 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[table() ->numEffectiveColumns()] - table()->effectiveColumnPositions()[table()->absolute ColumnToEffectiveColumn(cell->absoluteColumnIndex() + cell->colSpan())] + horizo ntalBorderSpacing)); | 1690 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[table() ->numEffectiveColumns()] - table()->effectiveColumnPositions()[table()->absolute ColumnToEffectiveColumn(cell->absoluteColumnIndex() + cell->colSpan())] + horizo ntalBorderSpacing)); |
| 1667 else | 1691 else |
| 1668 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[effecti veColumn] + horizontalBorderSpacing)); | 1692 cellLocation.setX(LayoutUnit(table()->effectiveColumnPositions()[effecti veColumn] + horizontalBorderSpacing)); |
| 1669 | 1693 |
| 1670 cell->setLogicalLocation(cellLocation); | 1694 cell->setLogicalLocation(cellLocation); |
| 1671 } | 1695 } |
| 1672 | 1696 |
| 1673 } // namespace blink | 1697 } // namespace blink |
| OLD | NEW |