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

Side by Side Diff: Source/WebCore/rendering/FixedTableLayout.cpp

Issue 10479019: Merge 118819 - REGRESSION(r111742): box-sizing: border-box doesn't work on fixed table layout (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1132/
Patch Set: Created 8 years, 6 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 | « no previous file | 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) 2002 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2002 Lars Knoll (knoll@kde.org)
3 * (C) 2002 Dirk Mueller (mueller@kde.org) 3 * (C) 2002 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License. 9 * version 2 of the License.
10 * 10 *
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 m_width[currentEffectiveColumn] *= spanInCurrentEffectiveColumn; 136 m_width[currentEffectiveColumn] *= spanInCurrentEffectiveColumn;
137 usedWidth += effectiveColWidth * spanInCurrentEffectiveColumn; 137 usedWidth += effectiveColWidth * spanInCurrentEffectiveColumn;
138 } 138 }
139 span -= spanInCurrentEffectiveColumn; 139 span -= spanInCurrentEffectiveColumn;
140 currentEffectiveColumn++; 140 currentEffectiveColumn++;
141 } 141 }
142 } 142 }
143 143
144 // Iterate over the first row in case some are unspecified. 144 // Iterate over the first row in case some are unspecified.
145 RenderTableSection* section = m_table->topNonEmptySection(); 145 RenderTableSection* section = m_table->topNonEmptySection();
146 if (section) { 146 if (!section)
147 unsigned cCol = 0; 147 return usedWidth;
148 RenderObject* firstRow = section->firstChild();
149 RenderObject* child = firstRow->firstChild();
150 while (child) {
151 if (child->isTableCell()) {
152 RenderTableCell* cell = toRenderTableCell(child);
153 if (cell->preferredLogicalWidthsDirty())
154 cell->computePreferredLogicalWidths();
155 148
156 Length w = cell->styleOrColLogicalWidth(); 149 unsigned currentColumn = 0;
157 unsigned span = cell->colSpan(); 150
158 int effectiveColWidth = 0; 151 RenderObject* firstRow = section->firstChild();
159 if (w.isFixed() && w.isPositive()) { 152 for (RenderObject* child = firstRow->firstChild(); child; child = child->nex tSibling()) {
160 w.setValue(w.value() + cell->borderAndPaddingLogicalWidth()) ; 153 if (!child->isTableCell())
161 effectiveColWidth = w.value(); 154 continue;
162 } 155
163 156 RenderTableCell* cell = toRenderTableCell(child);
164 unsigned usedSpan = 0; 157 if (cell->preferredLogicalWidthsDirty())
165 unsigned i = 0; 158 cell->computePreferredLogicalWidths();
166 while (usedSpan < span && cCol + i < nEffCols) { 159
167 float eSpan = m_table->spanOfEffCol(cCol + i); 160 Length logicalWidth = cell->styleOrColLogicalWidth();
168 // Only set if no col element has already set it. 161 unsigned span = cell->colSpan();
169 if (m_width[cCol + i].isAuto() && w.type() != Auto) { 162 int fixedBorderBoxLogicalWidth = 0;
170 m_width[cCol + i] = w; 163 if (logicalWidth.isFixed() && logicalWidth.isPositive()) {
171 m_width[cCol + i] *= eSpan / span; 164 fixedBorderBoxLogicalWidth = cell->computeBorderBoxLogicalWidth(logi calWidth.value());
172 usedWidth += effectiveColWidth * eSpan / span; 165 logicalWidth.setValue(fixedBorderBoxLogicalWidth);
173 } 166 }
174 usedSpan += eSpan; 167
175 i++; 168 unsigned usedSpan = 0;
176 } 169 while (usedSpan < span && currentColumn < nEffCols) {
177 cCol += i; 170 float eSpan = m_table->spanOfEffCol(currentColumn);
171 // Only set if no col element has already set it.
172 if (m_width[currentColumn].isAuto() && logicalWidth.type() != Auto) {
173 m_width[currentColumn] = logicalWidth;
174 m_width[currentColumn] *= eSpan / span;
175 usedWidth += fixedBorderBoxLogicalWidth * eSpan / span;
178 } 176 }
179 child = child->nextSibling(); 177 usedSpan += eSpan;
178 ++currentColumn;
180 } 179 }
181 } 180 }
182 181
183 return usedWidth; 182 return usedWidth;
184 } 183 }
185 184
186 // Use a very large value (in effect infinite). But not too large! 185 // Use a very large value (in effect infinite). But not too large!
187 // numeric_limits<int>::max() will too easily overflow widths. 186 // numeric_limits<int>::max() will too easily overflow widths.
188 // Keep this in synch with BLOCK_MAX_WIDTH in RenderBlock.cpp 187 // Keep this in synch with BLOCK_MAX_WIDTH in RenderBlock.cpp
189 #define TABLE_MAX_WIDTH 15000 188 #define TABLE_MAX_WIDTH 15000
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 for (unsigned i = 0; i < nEffCols; i++) { 323 for (unsigned i = 0; i < nEffCols; i++) {
325 m_table->columnPositions()[i] = pos; 324 m_table->columnPositions()[i] = pos;
326 pos += calcWidth[i] + hspacing; 325 pos += calcWidth[i] + hspacing;
327 } 326 }
328 int colPositionsSize = m_table->columnPositions().size(); 327 int colPositionsSize = m_table->columnPositions().size();
329 if (colPositionsSize > 0) 328 if (colPositionsSize > 0)
330 m_table->columnPositions()[colPositionsSize - 1] = pos; 329 m_table->columnPositions()[colPositionsSize - 1] = pos;
331 } 330 }
332 331
333 } // namespace WebCore 332 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698