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

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: Modified the API name in RenderStyle.h and other modifications as per review comments. 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; 86 bool fixedTableLayout = oldStyle ? oldStyle->isFixedTableLayout() : false;
mstensho (USE GERRIT) 2014/05/07 19:12:28 Nit: I'd just say "oldStyle && oldStyle->isFixedTa
87 87
88 // In the collapsed border model, there is no cell spacing. 88 // In the collapsed border model, there is no cell spacing.
89 m_hSpacing = collapseBorders() ? 0 : style()->horizontalBorderSpacing(); 89 m_hSpacing = collapseBorders() ? 0 : style()->horizontalBorderSpacing();
90 m_vSpacing = collapseBorders() ? 0 : style()->verticalBorderSpacing(); 90 m_vSpacing = collapseBorders() ? 0 : style()->verticalBorderSpacing();
91 m_columnPos[0] = m_hSpacing; 91 m_columnPos[0] = m_hSpacing;
92 92
93 if (!m_tableLayout || style()->tableLayout() != oldTableLayout) { 93 if (!m_tableLayout || style()->isFixedTableLayout() != fixedTableLayout) {
94 if (m_tableLayout) 94 if (m_tableLayout)
95 m_tableLayout->willChangeTableLayout(); 95 m_tableLayout->willChangeTableLayout();
96 96
97 // According to the CSS2 spec, you only use fixed table layout if an 97 // 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. 98 // explicit width is specified on the table. Auto width implies auto ta ble layout.
99 if (style()->tableLayout() == TFIXED && !style()->logicalWidth().isAuto( )) 99 if (style()->isFixedTableLayout())
100 m_tableLayout = adoptPtr(new FixedTableLayout(this)); 100 m_tableLayout = adoptPtr(new FixedTableLayout(this));
101 else 101 else
102 m_tableLayout = adoptPtr(new AutoTableLayout(this)); 102 m_tableLayout = adoptPtr(new AutoTableLayout(this));
103 } 103 }
104 104
105 // If border was changed, invalidate collapsed borders cache. 105 // If border was changed, invalidate collapsed borders cache.
106 if (!needsLayout() && oldStyle && oldStyle->border() != style()->border()) 106 if (!needsLayout() && oldStyle && oldStyle->border() != style()->border())
107 invalidateCollapsedBorders(); 107 invalidateCollapsedBorders();
108 } 108 }
109 109
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCel l* cell) const 1457 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCel l* cell) const
1458 { 1458 {
1459 ASSERT(cell->isFirstOrLastCellInRow()); 1459 ASSERT(cell->isFirstOrLastCellInRow());
1460 if (hasSameDirectionAs(cell->row())) 1460 if (hasSameDirectionAs(cell->row()))
1461 return style()->borderEnd(); 1461 return style()->borderEnd();
1462 1462
1463 return style()->borderStart(); 1463 return style()->borderStart();
1464 } 1464 }
1465 1465
1466 } 1466 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698