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

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

Issue 2153283002: [css-tables] Clean up code that detects significant border changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove /*static*/ 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 section()->setNeedsCellRecalc(); 53 section()->setNeedsCellRecalc();
54 } 54 }
55 55
56 void LayoutTableRow::styleDidChange(StyleDifference diff, const ComputedStyle* o ldStyle) 56 void LayoutTableRow::styleDidChange(StyleDifference diff, const ComputedStyle* o ldStyle)
57 { 57 {
58 ASSERT(style()->display() == TABLE_ROW); 58 ASSERT(style()->display() == TABLE_ROW);
59 59
60 LayoutTableBoxComponent::styleDidChange(diff, oldStyle); 60 LayoutTableBoxComponent::styleDidChange(diff, oldStyle);
61 propagateStyleToAnonymousChildren(); 61 propagateStyleToAnonymousChildren();
62 62
63 if (section() && oldStyle && style()->logicalHeight() != oldStyle->logicalHe ight()) 63 if (!oldStyle)
64 return;
65
66 if (section() && style()->logicalHeight() != oldStyle->logicalHeight())
64 section()->rowLogicalHeightChanged(this); 67 section()->rowLogicalHeightChanged(this);
65 68
66 // If border was changed, notify table. 69 if (!parent())
67 if (parent()) { 70 return;
68 LayoutTable* table = this->table(); 71 LayoutTable* table = this->table();
69 if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout () && oldStyle && oldStyle->border() != style()->border()) 72 if (!table)
70 table->invalidateCollapsedBorders(); 73 return;
71 74
72 if (table && oldStyle && diff.needsFullLayout() && needsLayout() && tabl e->collapseBorders() && oldStyle->border().sizeEquals(style()->border())) { 75 if (!table->selfNeedsLayout() && !table->normalChildNeedsLayout() && oldStyl e->border() != style()->border())
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. 76 table->invalidateCollapsedBorders();
74 // This only happens when borders are collapsed, since they end up a ffecting the border sides of the cell 77
75 // itself. 78 if (LayoutTableBoxComponent::doCellsHaveDirtyWidth(*this, *table, diff, *old Style)) {
76 for (LayoutBox* childBox = firstChildBox(); childBox; childBox = chi ldBox->nextSiblingBox()) { 79 // If the border width changes on a row, we need to make sure the cells in the row know to lay out again.
77 if (!childBox->isTableCell()) 80 // This only happens when borders are collapsed, since they end up affec ting the border sides of the cell
78 continue; 81 // itself.
79 // TODO(dgrogan) Add a layout test showing that setChildNeedsLay out is needed instead of setNeedsLayout. 82 for (LayoutBox* childBox = firstChildBox(); childBox; childBox = childBo x->nextSiblingBox()) {
80 childBox->setChildNeedsLayout(); 83 if (!childBox->isTableCell())
81 childBox->setPreferredLogicalWidthsDirty(MarkOnlyThis); 84 continue;
82 } 85 // TODO(dgrogan) Add a layout test showing that setChildNeedsLayout is needed instead of setNeedsLayout.
83 // Most table componenents can rely on LayoutObject::styleDidChange 86 childBox->setChildNeedsLayout();
84 // to mark the container chain dirty. But LayoutTableSection seems 87 childBox->setPreferredLogicalWidthsDirty(MarkOnlyThis);
85 // to never clear its dirty bit, which stops the propagation. So
86 // anything under LayoutTableSection has to restart the propagation
87 // at the table.
88 // TODO(dgrogan): Make LayoutTableSection clear its dirty bit.
89 table->setPreferredLogicalWidthsDirty();
90 } 88 }
89 // Most table componenents can rely on LayoutObject::styleDidChange
90 // to mark the container chain dirty. But LayoutTableSection seems
91 // to never clear its dirty bit, which stops the propagation. So
92 // anything under LayoutTableSection has to restart the propagation
93 // at the table.
94 // TODO(dgrogan): Make LayoutTableSection clear its dirty bit.
95 table->setPreferredLogicalWidthsDirty();
91 } 96 }
92 } 97 }
93 98
94 const BorderValue& LayoutTableRow::borderAdjoiningStartCell(const LayoutTableCel l* cell) const 99 const BorderValue& LayoutTableRow::borderAdjoiningStartCell(const LayoutTableCel l* cell) const
95 { 100 {
96 ASSERT_UNUSED(cell, cell->isFirstOrLastCellInRow()); 101 ASSERT_UNUSED(cell, cell->isFirstOrLastCellInRow());
97 // FIXME: https://webkit.org/b/79272 - Add support for mixed directionality at the cell level. 102 // FIXME: https://webkit.org/b/79272 - Add support for mixed directionality at the cell level.
98 return style()->borderStart(); 103 return style()->borderStart();
99 } 104 }
100 105
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 // The cell and the row share the section's coordinate system. However 265 // The cell and the row share the section's coordinate system. However
261 // the visual overflow should be determined in the coordinate system of 266 // the visual overflow should be determined in the coordinate system of
262 // the row, that's why we shift it below. 267 // the row, that's why we shift it below.
263 LayoutUnit cellOffsetLogicalTopDifference = cell->location().y() - location( ).y(); 268 LayoutUnit cellOffsetLogicalTopDifference = cell->location().y() - location( ).y();
264 cellVisualOverflowRect.move(LayoutUnit(), cellOffsetLogicalTopDifference); 269 cellVisualOverflowRect.move(LayoutUnit(), cellOffsetLogicalTopDifference);
265 270
266 addContentsVisualOverflow(cellVisualOverflowRect); 271 addContentsVisualOverflow(cellVisualOverflowRect);
267 } 272 }
268 273
269 } // namespace blink 274 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTableCol.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutTableSection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698