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, 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 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 setInline(false); // our object is not Inline | 46 setInline(false); // our object is not Inline |
| 47 } | 47 } |
| 48 | 48 |
| 49 void LayoutTableRow::willBeRemovedFromTree() | 49 void LayoutTableRow::willBeRemovedFromTree() |
| 50 { | 50 { |
| 51 LayoutTableBoxComponent::willBeRemovedFromTree(); | 51 LayoutTableBoxComponent::willBeRemovedFromTree(); |
| 52 | 52 |
| 53 section()->setNeedsCellRecalc(); | 53 section()->setNeedsCellRecalc(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 static bool borderWidthChanged(const ComputedStyle* oldStyle, const ComputedStyl e* newStyle) | |
| 57 { | |
| 58 return oldStyle->borderLeftWidth() != newStyle->borderLeftWidth() | |
| 59 || oldStyle->borderTopWidth() != newStyle->borderTopWidth() | |
| 60 || oldStyle->borderRightWidth() != newStyle->borderRightWidth() | |
| 61 || oldStyle->borderBottomWidth() != newStyle->borderBottomWidth(); | |
| 62 } | |
| 63 | |
| 64 void LayoutTableRow::styleDidChange(StyleDifference diff, const ComputedStyle* o ldStyle) | 56 void LayoutTableRow::styleDidChange(StyleDifference diff, const ComputedStyle* o ldStyle) |
| 65 { | 57 { |
| 66 ASSERT(style()->display() == TABLE_ROW); | 58 ASSERT(style()->display() == TABLE_ROW); |
| 67 | 59 |
| 68 LayoutTableBoxComponent::styleDidChange(diff, oldStyle); | 60 LayoutTableBoxComponent::styleDidChange(diff, oldStyle); |
| 69 propagateStyleToAnonymousChildren(); | 61 propagateStyleToAnonymousChildren(); |
| 70 | 62 |
| 71 if (section() && oldStyle && style()->logicalHeight() != oldStyle->logicalHe ight()) | 63 if (section() && oldStyle && style()->logicalHeight() != oldStyle->logicalHe ight()) |
| 72 section()->rowLogicalHeightChanged(this); | 64 section()->rowLogicalHeightChanged(this); |
| 73 | 65 |
| 74 // If border was changed, notify table. | 66 // If border was changed, notify table. |
| 75 if (parent()) { | 67 if (parent()) { |
| 76 LayoutTable* table = this->table(); | 68 LayoutTable* table = this->table(); |
| 77 if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout () && oldStyle && oldStyle->border() != style()->border()) | 69 if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout () && oldStyle && oldStyle->border() != style()->border()) |
| 78 table->invalidateCollapsedBorders(); | 70 table->invalidateCollapsedBorders(); |
| 79 | 71 |
| 80 if (table && oldStyle && diff.needsFullLayout() && needsLayout() && tabl e->collapseBorders() && borderWidthChanged(oldStyle, style())) { | 72 if (table && oldStyle && diff.needsFullLayout() && needsLayout() && tabl e->collapseBorders() && borderWidthChanged(oldStyle, style())) { |
| 81 // If the border width changes on a row, we need to make sure the ce lls in the row know to lay out again. | 73 // If the border width changes on a row, we need to make sure the ce lls in the row know to lay out again. |
| 82 // This only happens when borders are collapsed, since they end up a ffecting the border sides of the cell | 74 // This only happens when borders are collapsed, since they end up a ffecting the border sides of the cell |
| 83 // itself. | 75 // itself. |
| 84 for (LayoutBox* childBox = firstChildBox(); childBox; childBox = chi ldBox->nextSiblingBox()) { | 76 for (LayoutBox* childBox = firstChildBox(); childBox; childBox = chi ldBox->nextSiblingBox()) { |
| 85 if (!childBox->isTableCell()) | 77 if (!childBox->isTableCell()) |
| 86 continue; | 78 continue; |
| 79 // TODO(dgrogan) Changing this to setNeedsLayout doesn't cause | |
|
dgrogan
2016/06/10 22:51:11
eae@, I'm getting diminishing returns trying to un
| |
| 80 // any layout tests to fail. Isn't setChildNeedsLayout more | |
| 81 // expensive? If setNeedsLayout is insufficient, add a layout | |
| 82 // test demonstrating so. | |
| 87 childBox->setChildNeedsLayout(); | 83 childBox->setChildNeedsLayout(); |
| 88 childBox->setPreferredLogicalWidthsDirty(MarkOnlyThis); | 84 childBox->setPreferredLogicalWidthsDirty(MarkOnlyThis); |
| 89 } | 85 } |
| 90 // Most table componenents can rely on LayoutObject::styleDidChange | 86 // Most table componenents can rely on LayoutObject::styleDidChange |
| 91 // to mark the container chain dirty. But LayoutTableSection seems | 87 // to mark the container chain dirty. But LayoutTableSection seems |
| 92 // to never clear its dirty bit, which stops the propagation. So | 88 // to never clear its dirty bit, which stops the propagation. So |
| 93 // anything under LayoutTableSection has to restart the propagation | 89 // anything under LayoutTableSection has to restart the propagation |
| 94 // at the table. | 90 // at the table. |
| 95 // TODO(dgrogan): Make LayoutTableSection clear its dirty bit. | 91 // TODO(dgrogan): Make LayoutTableSection clear its dirty bit. |
| 96 table->setPreferredLogicalWidthsDirty(); | 92 table->setPreferredLogicalWidthsDirty(); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 260 // The cell and the row share the section's coordinate system. However | 256 // The cell and the row share the section's coordinate system. However |
| 261 // the visual overflow should be determined in the coordinate system of | 257 // the visual overflow should be determined in the coordinate system of |
| 262 // the row, that's why we shift it below. | 258 // the row, that's why we shift it below. |
| 263 LayoutUnit cellOffsetLogicalTopDifference = cell->location().y() - location( ).y(); | 259 LayoutUnit cellOffsetLogicalTopDifference = cell->location().y() - location( ).y(); |
| 264 cellVisualOverflowRect.move(LayoutUnit(), cellOffsetLogicalTopDifference); | 260 cellVisualOverflowRect.move(LayoutUnit(), cellOffsetLogicalTopDifference); |
| 265 | 261 |
| 266 addContentsVisualOverflow(cellVisualOverflowRect); | 262 addContentsVisualOverflow(cellVisualOverflowRect); |
| 267 } | 263 } |
| 268 | 264 |
| 269 } // namespace blink | 265 } // namespace blink |
| OLD | NEW |