Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTableCol.cpp

Issue 2149953004: [css-tables] Set needsLayout on cells when column border width changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/table/change-col-border-width-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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, 2009 Apple Inc. All rights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
8 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 8 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 updateFromElement(); 43 updateFromElement();
44 } 44 }
45 45
46 void LayoutTableCol::styleDidChange(StyleDifference diff, const ComputedStyle* o ldStyle) 46 void LayoutTableCol::styleDidChange(StyleDifference diff, const ComputedStyle* o ldStyle)
47 { 47 {
48 LayoutTableBoxComponent::styleDidChange(diff, oldStyle); 48 LayoutTableBoxComponent::styleDidChange(diff, oldStyle);
49 49
50 if (LayoutTable* table = this->table()) { 50 if (LayoutTable* table = this->table()) {
51 if (!oldStyle) 51 if (!oldStyle)
52 return; 52 return;
53
54 // TODO(dgrogan): Is the "else" necessary for correctness or just a brit tle optimization? The optimization would be:
55 // if the first branch is taken then the next one can't be, so don't eve n check its condition.
53 if (!table->selfNeedsLayout() && !table->normalChildNeedsLayout() && old Style->border() != style()->border()) { 56 if (!table->selfNeedsLayout() && !table->normalChildNeedsLayout() && old Style->border() != style()->border()) {
54 // If border was changed, notify table. 57 // If border was changed, notify table.
55 table->invalidateCollapsedBorders(); 58 table->invalidateCollapsedBorders();
56 } else if (oldStyle->logicalWidth() != style()->logicalWidth()) { 59 } else if ((oldStyle->logicalWidth() != style()->logicalWidth()) || (dif f.needsFullLayout() && needsLayout() && table->collapseBorders() && oldStyle->bo rder().sizeEquals(style()->border()))) {
57 // FIXME : setPreferredLogicalWidthsDirty is done for all cells as o f now. 60 // TODO(dgrogan): Move second clause above to LayoutTableBoxComponen t for re-use.
58 // Need to find a better way so that only the cells which are change d by 61 // TODO(dgrogan): Optimization opportunities:
59 // the col width should have preferred logical widths recomputed. 62 // (1) Only mark cells which are affected by this col, not every cel l in the table.
63 // (2) If only the col width changes and its border width doesn't, d o the cells need to be marked as
64 // needing layout or just given dirty widths?
60 for (LayoutObject* child = table->children()->firstChild(); child; c hild = child->nextSibling()) { 65 for (LayoutObject* child = table->children()->firstChild(); child; c hild = child->nextSibling()) {
61 if (!child->isTableSection()) 66 if (!child->isTableSection())
62 continue; 67 continue;
63 LayoutTableSection* section = toLayoutTableSection(child); 68 LayoutTableSection* section = toLayoutTableSection(child);
64 for (LayoutTableRow* row = section->firstRow(); row; row = row-> nextRow()) { 69 section->markAllCellsWidthsDirtyAndOrNeedsLayout(LayoutTableSect ion::MarkDirtyAndNeedsLayout);
65 for (LayoutTableCell* cell = row->firstCell(); cell; cell = cell->nextCell())
66 cell->setPreferredLogicalWidthsDirty();
67 }
68 } 70 }
69 } 71 }
70 } 72 }
71 } 73 }
72 74
73 void LayoutTableCol::updateFromElement() 75 void LayoutTableCol::updateFromElement()
74 { 76 {
75 unsigned oldSpan = m_span; 77 unsigned oldSpan = m_span;
76 Node* n = node(); 78 Node* n = node();
77 if (isHTMLTableColElement(n)) { 79 if (isHTMLTableColElement(n)) {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 return style()->borderStart(); 189 return style()->borderStart();
188 } 190 }
189 191
190 const BorderValue& LayoutTableCol::borderAdjoiningCellAfter(const LayoutTableCel l* cell) const 192 const BorderValue& LayoutTableCol::borderAdjoiningCellAfter(const LayoutTableCel l* cell) const
191 { 193 {
192 ASSERT_UNUSED(cell, table()->colElementAtAbsoluteColumn(cell->absoluteColumn Index() - 1).innermostColOrColGroup() == this); 194 ASSERT_UNUSED(cell, table()->colElementAtAbsoluteColumn(cell->absoluteColumn Index() - 1).innermostColOrColGroup() == this);
193 return style()->borderEnd(); 195 return style()->borderEnd();
194 } 196 }
195 197
196 } // namespace blink 198 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/table/change-col-border-width-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698