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

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

Issue 2013693002: [css-tables] Set table and cell widths dirty when section border changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add optional param and remove new layout test 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
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, 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
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) Add a layout test showing that setChildNeedsLay out is needed instead of setNeedsLayout.
dgrogan 2016/07/01 20:02:26 I failed to generate one :( But this patch can lan
eae 2016/07/01 22:20:25 Sadness. Let's try to create one together at some
87 childBox->setChildNeedsLayout(); 80 childBox->setChildNeedsLayout();
88 childBox->setPreferredLogicalWidthsDirty(MarkOnlyThis); 81 childBox->setPreferredLogicalWidthsDirty(MarkOnlyThis);
89 } 82 }
90 // Most table componenents can rely on LayoutObject::styleDidChange 83 // Most table componenents can rely on LayoutObject::styleDidChange
91 // to mark the container chain dirty. But LayoutTableSection seems 84 // to mark the container chain dirty. But LayoutTableSection seems
92 // to never clear its dirty bit, which stops the propagation. So 85 // to never clear its dirty bit, which stops the propagation. So
93 // anything under LayoutTableSection has to restart the propagation 86 // anything under LayoutTableSection has to restart the propagation
94 // at the table. 87 // at the table.
95 // TODO(dgrogan): Make LayoutTableSection clear its dirty bit. 88 // TODO(dgrogan): Make LayoutTableSection clear its dirty bit.
96 table->setPreferredLogicalWidthsDirty(); 89 table->setPreferredLogicalWidthsDirty();
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // The cell and the row share the section's coordinate system. However 253 // The cell and the row share the section's coordinate system. However
261 // the visual overflow should be determined in the coordinate system of 254 // the visual overflow should be determined in the coordinate system of
262 // the row, that's why we shift it below. 255 // the row, that's why we shift it below.
263 LayoutUnit cellOffsetLogicalTopDifference = cell->location().y() - location( ).y(); 256 LayoutUnit cellOffsetLogicalTopDifference = cell->location().y() - location( ).y();
264 cellVisualOverflowRect.move(LayoutUnit(), cellOffsetLogicalTopDifference); 257 cellVisualOverflowRect.move(LayoutUnit(), cellOffsetLogicalTopDifference);
265 258
266 addContentsVisualOverflow(cellVisualOverflowRect); 259 addContentsVisualOverflow(cellVisualOverflowRect);
267 } 260 }
268 261
269 } // namespace blink 262 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698