| Index: third_party/WebKit/Source/core/layout/LayoutTableCol.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCol.cpp b/third_party/WebKit/Source/core/layout/LayoutTableCol.cpp
|
| index c5f256e701f39a32fc329c920355357966d9f7b2..d96fa37ddd097add46ebc219ae167a4e995248bb 100644
|
| --- a/third_party/WebKit/Source/core/layout/LayoutTableCol.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/LayoutTableCol.cpp
|
| @@ -45,29 +45,31 @@ LayoutTableCol::LayoutTableCol(Element* element)
|
|
|
| void LayoutTableCol::styleDidChange(StyleDifference diff, const ComputedStyle* oldStyle)
|
| {
|
| + DCHECK(style()->display() == TABLE_COLUMN || style()->display() == TABLE_COLUMN_GROUP);
|
| +
|
| LayoutTableBoxComponent::styleDidChange(diff, oldStyle);
|
|
|
| - if (LayoutTable* table = this->table()) {
|
| - if (!oldStyle)
|
| - return;
|
| -
|
| - // TODO(dgrogan): Is the "else" necessary for correctness or just a brittle optimization? The optimization would be:
|
| - // if the first branch is taken then the next one can't be, so don't even check its condition.
|
| - if (!table->selfNeedsLayout() && !table->normalChildNeedsLayout() && oldStyle->border() != style()->border()) {
|
| - // If border was changed, notify table.
|
| - table->invalidateCollapsedBorders();
|
| - } else if ((oldStyle->logicalWidth() != style()->logicalWidth()) || (diff.needsFullLayout() && needsLayout() && table->collapseBorders() && oldStyle->border().sizeEquals(style()->border()))) {
|
| - // TODO(dgrogan): Move second clause above to LayoutTableBoxComponent for re-use.
|
| - // TODO(dgrogan): Optimization opportunities:
|
| - // (1) Only mark cells which are affected by this col, not every cell in the table.
|
| - // (2) If only the col width changes and its border width doesn't, do the cells need to be marked as
|
| - // needing layout or just given dirty widths?
|
| - for (LayoutObject* child = table->children()->firstChild(); child; child = child->nextSibling()) {
|
| - if (!child->isTableSection())
|
| - continue;
|
| - LayoutTableSection* section = toLayoutTableSection(child);
|
| - section->markAllCellsWidthsDirtyAndOrNeedsLayout(LayoutTableSection::MarkDirtyAndNeedsLayout);
|
| - }
|
| + if (!oldStyle)
|
| + return;
|
| +
|
| + LayoutTable* table = this->table();
|
| + if (!table)
|
| + return;
|
| +
|
| + // TODO(dgrogan): Is the "else" necessary for correctness or just a brittle optimization? The optimization would be:
|
| + // if the first branch is taken then the next one can't be, so don't even check its condition.
|
| + if (!table->selfNeedsLayout() && !table->normalChildNeedsLayout() && oldStyle->border() != style()->border()) {
|
| + table->invalidateCollapsedBorders();
|
| + } else if ((oldStyle->logicalWidth() != style()->logicalWidth()) || LayoutTableBoxComponent::doCellsHaveDirtyWidth(*this, *table, diff, *oldStyle)) {
|
| + // TODO(dgrogan): Optimization opportunities:
|
| + // (1) Only mark cells which are affected by this col, not every cell in the table.
|
| + // (2) If only the col width changes and its border width doesn't, do the cells need to be marked as
|
| + // needing layout or just given dirty widths?
|
| + for (LayoutObject* child = table->children()->firstChild(); child; child = child->nextSibling()) {
|
| + if (!child->isTableSection())
|
| + continue;
|
| + LayoutTableSection* section = toLayoutTableSection(child);
|
| + section->markAllCellsWidthsDirtyAndOrNeedsLayout(LayoutTableSection::MarkDirtyAndNeedsLayout);
|
| }
|
| }
|
| }
|
|
|