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

Side by Side Diff: Source/core/rendering/RenderTableCol.cpp

Issue 208263013: Col width is not honored when dynamically updated and it would not make table narrower (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Modified test case and the table traversal. Created 5 years, 11 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 | « LayoutTests/fast/table/resize-table-width-using-multiple-col-span-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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 RenderBox::trace(visitor); 50 RenderBox::trace(visitor);
51 } 51 }
52 52
53 void RenderTableCol::styleDidChange(StyleDifference diff, const RenderStyle* old Style) 53 void RenderTableCol::styleDidChange(StyleDifference diff, const RenderStyle* old Style)
54 { 54 {
55 RenderBox::styleDidChange(diff, oldStyle); 55 RenderBox::styleDidChange(diff, oldStyle);
56 56
57 // If border was changed, notify table. 57 // If border was changed, notify table.
58 if (parent()) { 58 if (parent()) {
59 RenderTable* table = this->table(); 59 RenderTable* table = this->table();
60 if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout () && oldStyle && oldStyle->border() != style()->border()) 60 if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout () && oldStyle && oldStyle->border() != style()->border()) {
61 table->invalidateCollapsedBorders(); 61 table->invalidateCollapsedBorders();
62 } else if (oldStyle && oldStyle->logicalWidth() != style()->logicalWidth ()) {
63 // FIXME : setPreferredLogicalWidthsDirty is done for all cells as o f now.
64 // Need to find a better way so that only the cells which are change d by
65 // the col width should have preferred logical widths recomputed.
66 for (RenderObject* child = table->children()->firstChild(); child; c hild = child->nextSibling()) {
67 if (child->isRenderTableCol())
mstensho (USE GERRIT) 2015/01/12 14:00:09 Please change to "if (!child->isRenderTableSection
Gurpreet 2015/01/12 14:14:14 But the check if(!child->isRenderTableSection()) w
mstensho (USE GERRIT) 2015/01/12 16:07:51 You're right, of course. The code works correctly
68 continue;
69 if (child->isTableSection()) {
mstensho (USE GERRIT) 2015/01/12 14:00:09 So no need for this check if you do as I suggested
70 RenderTableSection* section = toRenderTableSection(child);
71 for (RenderTableRow* row = section->firstRow(); row; row = r ow->nextRow()) {
72 for (RenderTableCell* cell = row->firstCell(); cell; cel l = cell->nextCell())
73 cell->setPreferredLogicalWidthsDirty();
74 }
75 }
76 }
77 }
62 } 78 }
63 } 79 }
64 80
65 void RenderTableCol::updateFromElement() 81 void RenderTableCol::updateFromElement()
66 { 82 {
67 unsigned oldSpan = m_span; 83 unsigned oldSpan = m_span;
68 Node* n = node(); 84 Node* n = node();
69 if (isHTMLTableColElement(n)) { 85 if (isHTMLTableColElement(n)) {
70 HTMLTableColElement& tc = toHTMLTableColElement(*n); 86 HTMLTableColElement& tc = toHTMLTableColElement(*n);
71 m_span = tc.span(); 87 m_span = tc.span();
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 return style()->borderStart(); 196 return style()->borderStart();
181 } 197 }
182 198
183 const BorderValue& RenderTableCol::borderAdjoiningCellAfter(const RenderTableCel l* cell) const 199 const BorderValue& RenderTableCol::borderAdjoiningCellAfter(const RenderTableCel l* cell) const
184 { 200 {
185 ASSERT_UNUSED(cell, table()->colElement(cell->col() - 1) == this); 201 ASSERT_UNUSED(cell, table()->colElement(cell->col() - 1) == this);
186 return style()->borderEnd(); 202 return style()->borderEnd();
187 } 203 }
188 204
189 } 205 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/table/resize-table-width-using-multiple-col-span-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698