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

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

Issue 294783004: Use tighter typing in table rendering code (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix typo / bug and update copyrights 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 | Annotate | Revision Log
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, 2013 Apple Inc.
mstensho (USE GERRIT) 2014/05/20 09:34:39 I think this header should be left alone or replac
rune 2014/05/20 09:45:25 New files should use the three-line copyright abov
Inactive 2014/05/20 11:32:23 These are not new files so we cannot use the 3-lin
pdr. 2014/05/20 16:49:16 I think we should move this over as this patch doe
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 *
11 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details. 14 * Library General Public License for more details.
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 130 }
131 } 131 }
132 132
133 // Iterate over the first row in case some are unspecified. 133 // Iterate over the first row in case some are unspecified.
134 RenderTableSection* section = m_table->topNonEmptySection(); 134 RenderTableSection* section = m_table->topNonEmptySection();
135 if (!section) 135 if (!section)
136 return usedWidth; 136 return usedWidth;
137 137
138 unsigned currentColumn = 0; 138 unsigned currentColumn = 0;
139 139
140 RenderTableRow* firstRow = toRenderTableRow(section->firstChild()); 140 RenderTableRow* firstRow = section->firstRow();
141 for (RenderObject* child = firstRow->firstChild(); child; child = child->nex tSibling()) { 141 for (RenderTableCell* cell = firstRow->firstCell(); cell; cell = cell->nextC ell()) {
142 if (!child->isTableCell())
143 continue;
144
145 RenderTableCell* cell = toRenderTableCell(child);
146
147 Length logicalWidth = cell->styleOrColLogicalWidth(); 142 Length logicalWidth = cell->styleOrColLogicalWidth();
148 unsigned span = cell->colSpan(); 143 unsigned span = cell->colSpan();
149 int fixedBorderBoxLogicalWidth = 0; 144 int fixedBorderBoxLogicalWidth = 0;
150 // FIXME: Support other length types. If the width is non-auto, it shoul d probably just use 145 // FIXME: Support other length types. If the width is non-auto, it shoul d probably just use
151 // RenderBox::computeLogicalWidthUsing to compute the width. 146 // RenderBox::computeLogicalWidthUsing to compute the width.
152 if (logicalWidth.isFixed() && logicalWidth.isPositive()) { 147 if (logicalWidth.isFixed() && logicalWidth.isPositive()) {
153 fixedBorderBoxLogicalWidth = cell->adjustBorderBoxLogicalWidthForBox Sizing(logicalWidth.value()); 148 fixedBorderBoxLogicalWidth = cell->adjustBorderBoxLogicalWidthForBox Sizing(logicalWidth.value());
154 logicalWidth.setValue(fixedBorderBoxLogicalWidth); 149 logicalWidth.setValue(fixedBorderBoxLogicalWidth);
155 } 150 }
156 151
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 // When switching table layout algorithm, we need to dirty the preferred 318 // When switching table layout algorithm, we need to dirty the preferred
324 // logical widths as we cleared the bits without computing them. 319 // logical widths as we cleared the bits without computing them.
325 // (see calcWidthArray above.) This optimization is preferred to always 320 // (see calcWidthArray above.) This optimization is preferred to always
326 // computing the logical widths we never intended to use. 321 // computing the logical widths we never intended to use.
327 m_table->recalcSectionsIfNeeded(); 322 m_table->recalcSectionsIfNeeded();
328 for (RenderTableSection* section = m_table->topNonEmptySection(); section; s ection = m_table->sectionBelow(section)) { 323 for (RenderTableSection* section = m_table->topNonEmptySection(); section; s ection = m_table->sectionBelow(section)) {
329 for (unsigned i = 0; i < section->numRows(); i++) { 324 for (unsigned i = 0; i < section->numRows(); i++) {
330 RenderTableRow* row = section->rowRendererAt(i); 325 RenderTableRow* row = section->rowRendererAt(i);
331 if (!row) 326 if (!row)
332 continue; 327 continue;
333 for (RenderObject* cell = row->firstChild(); cell; cell = cell->next Sibling()) { 328 for (RenderTableCell* cell = row->firstCell(); cell; cell = cell->ne xtCell())
334 if (!cell->isTableCell())
335 continue;
336 cell->setPreferredLogicalWidthsDirty(); 329 cell->setPreferredLogicalWidthsDirty();
337 }
338 } 330 }
339 } 331 }
340 } 332 }
341 333
342 } // namespace WebCore 334 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698