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

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

Issue 264283002: Table with fixed layout behaves like auto layout when its width is set by js instead of css. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added API isTableLayoutFixed() in RenderStyle.h Created 6 years, 7 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 Apple Inc. All r ights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r ights reserved.
8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 RenderTable::~RenderTable() 77 RenderTable::~RenderTable()
78 { 78 {
79 } 79 }
80 80
81 void RenderTable::styleDidChange(StyleDifference diff, const RenderStyle* oldSty le) 81 void RenderTable::styleDidChange(StyleDifference diff, const RenderStyle* oldSty le)
82 { 82 {
83 RenderBlock::styleDidChange(diff, oldStyle); 83 RenderBlock::styleDidChange(diff, oldStyle);
84 propagateStyleToAnonymousChildren(); 84 propagateStyleToAnonymousChildren();
85 85
86 ETableLayout oldTableLayout = oldStyle ? oldStyle->tableLayout() : TAUTO;
87
88 // In the collapsed border model, there is no cell spacing. 86 // In the collapsed border model, there is no cell spacing.
89 m_hSpacing = collapseBorders() ? 0 : style()->horizontalBorderSpacing(); 87 m_hSpacing = collapseBorders() ? 0 : style()->horizontalBorderSpacing();
90 m_vSpacing = collapseBorders() ? 0 : style()->verticalBorderSpacing(); 88 m_vSpacing = collapseBorders() ? 0 : style()->verticalBorderSpacing();
91 m_columnPos[0] = m_hSpacing; 89 m_columnPos[0] = m_hSpacing;
92 90
93 if (!m_tableLayout || style()->tableLayout() != oldTableLayout) { 91 if (!m_tableLayout || style()->isTableLayoutFixed()) {
mstensho (USE GERRIT) 2014/05/06 19:29:07 Need to compare old fixedness against new, like it
94 if (m_tableLayout) 92 if (m_tableLayout)
95 m_tableLayout->willChangeTableLayout(); 93 m_tableLayout->willChangeTableLayout();
96 94
97 // According to the CSS2 spec, you only use fixed table layout if an 95 // According to the CSS2 spec, you only use fixed table layout if an
98 // explicit width is specified on the table. Auto width implies auto ta ble layout. 96 // explicit width is specified on the table. Auto width implies auto ta ble layout.
99 if (style()->tableLayout() == TFIXED && !style()->logicalWidth().isAuto( )) 97 if (style()->isTableLayoutFixed())
100 m_tableLayout = adoptPtr(new FixedTableLayout(this)); 98 m_tableLayout = adoptPtr(new FixedTableLayout(this));
101 else 99 else
102 m_tableLayout = adoptPtr(new AutoTableLayout(this)); 100 m_tableLayout = adoptPtr(new AutoTableLayout(this));
103 } 101 }
104 102
105 // If border was changed, invalidate collapsed borders cache. 103 // If border was changed, invalidate collapsed borders cache.
106 if (!needsLayout() && oldStyle && oldStyle->border() != style()->border()) 104 if (!needsLayout() && oldStyle && oldStyle->border() != style()->border())
107 invalidateCollapsedBorders(); 105 invalidateCollapsedBorders();
108 } 106 }
109 107
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCel l* cell) const 1455 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCel l* cell) const
1458 { 1456 {
1459 ASSERT(cell->isFirstOrLastCellInRow()); 1457 ASSERT(cell->isFirstOrLastCellInRow());
1460 if (hasSameDirectionAs(cell->row())) 1458 if (hasSameDirectionAs(cell->row()))
1461 return style()->borderEnd(); 1459 return style()->borderEnd();
1462 1460
1463 return style()->borderStart(); 1461 return style()->borderStart();
1464 } 1462 }
1465 1463
1466 } 1464 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698