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

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

Issue 151993004: 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: Created 6 years, 9 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-col-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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 updateFromElement(); 44 updateFromElement();
45 } 45 }
46 46
47 void RenderTableCol::styleDidChange(StyleDifference diff, const RenderStyle* old Style) 47 void RenderTableCol::styleDidChange(StyleDifference diff, const RenderStyle* old Style)
48 { 48 {
49 RenderBox::styleDidChange(diff, oldStyle); 49 RenderBox::styleDidChange(diff, oldStyle);
50 50
51 // If border was changed, notify table. 51 // If border was changed, notify table.
52 if (parent()) { 52 if (parent()) {
53 RenderTable* table = this->table(); 53 RenderTable* table = this->table();
54 if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout () && oldStyle && oldStyle->border() != style()->border()) 54 if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout () && oldStyle && oldStyle->border() != style()->border()) {
55 table->invalidateCollapsedBorders(); 55 table->invalidateCollapsedBorders();
56 } else if (oldStyle && oldStyle->logicalWidth() != style()->logicalWidth ()) {
57 unsigned nEffCols = table->numEffCols();
58 unsigned currentColumn = 0;
59 for (RenderTableCol* column = table->firstColumn()->nextColumn(); co lumn; column = column->nextColumn()) {
60 if (this == column)
61 break;
62 currentColumn += column->span();
63 }
Julien - ping for review 2014/03/06 00:54:47 This span computation code actually doesn't work,
64 for (RenderTableSection* section = table->topSection(); section; sec tion = table->sectionBelow(section)) {
65 unsigned currentColSpan = currentColumn + span();
66 for (unsigned j = currentColumn; j < currentColSpan && currentCo lSpan <= nEffCols; j++) {
67 for (unsigned i = 0; i < section->numRows(); i++) {
68 RenderTableCell* cell = section->primaryCellAt(i, j);
69 if (!cell)
70 continue;
71 cell->setPreferredLogicalWidthsDirty();
72 }
73 }
74 }
75 }
56 } 76 }
57 } 77 }
58 78
59 void RenderTableCol::updateFromElement() 79 void RenderTableCol::updateFromElement()
60 { 80 {
61 unsigned oldSpan = m_span; 81 unsigned oldSpan = m_span;
62 Node* n = node(); 82 Node* n = node();
63 if (n && (n->hasTagName(colTag) || n->hasTagName(colgroupTag))) { 83 if (n && (n->hasTagName(colTag) || n->hasTagName(colgroupTag))) {
64 HTMLTableColElement* tc = toHTMLTableColElement(n); 84 HTMLTableColElement* tc = toHTMLTableColElement(n);
65 m_span = tc->span(); 85 m_span = tc->span();
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 return style()->borderStart(); 194 return style()->borderStart();
175 } 195 }
176 196
177 const BorderValue& RenderTableCol::borderAdjoiningCellAfter(const RenderTableCel l* cell) const 197 const BorderValue& RenderTableCol::borderAdjoiningCellAfter(const RenderTableCel l* cell) const
178 { 198 {
179 ASSERT_UNUSED(cell, table()->colElement(cell->col() - 1) == this); 199 ASSERT_UNUSED(cell, table()->colElement(cell->col() - 1) == this);
180 return style()->borderEnd(); 200 return style()->borderEnd();
181 } 201 }
182 202
183 } 203 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/table/resize-table-width-using-col-width-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698