void LayoutTableCol::styleDidChange(StyleDifference diff, const ComputedStyle* oldStyle) { LayoutBox::styleDidChange(diff, oldStyle); // If border was changed, notify table. if (parent()) { LayoutTable* table = this->table(); if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout() && oldStyle && oldStyle->border() != style()->border()) { table->invalidateCollapsedBorders(); } else if (oldStyle && oldStyle->logicalWidth() != style()->logicalWidth()) { // FIXME : setPreferredLogicalWidthsDirty is done for all cells as of now. // Need to find a better way so that only the cells which are changed by // the col width should have preferred logical widths recomputed. for (LayoutObject* child = table->children()->firstChild(); child; child = child->nextSibling()) { if (!child->isTableSection()) continue; LayoutTableSection* section = toLayoutTableSection(child); for (LayoutTableRow* row = section->firstRow(); row; row = row->nextRow()) { for (LayoutTableCell* cell = row->firstCell(); cell; cell = cell->nextCell()) cell->setPreferredLogicalWidthsDirty(); } } } } }
void TableLayoutAlgorithmFixed::willChangeTableLayout() { // When switching table layout algorithm, we need to dirty the preferred // logical widths as we cleared the bits without computing them. // (see calcWidthArray above.) This optimization is preferred to always // computing the logical widths we never intended to use. m_table->recalcSectionsIfNeeded(); for (LayoutTableSection* section = m_table->topNonEmptySection(); section; section = m_table->sectionBelow(section)) { for (unsigned i = 0; i < section->numRows(); i++) { LayoutTableRow* row = section->rowLayoutObjectAt(i); if (!row) continue; for (LayoutTableCell* cell = row->firstCell(); cell; cell = cell->nextCell()) cell->setPreferredLogicalWidthsDirty(); } } }