Chromium Code Reviews| OLD | NEW |
|---|---|
| 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, 2013 Apple Inc. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 289 calcWidth[i] = m_width[i].percent() * | 289 calcWidth[i] = m_width[i].percent() * |
| 290 (tableLogicalWidth - totalFixedWidth) / totalPercent; | 290 (tableLogicalWidth - totalFixedWidth) / totalPercent; |
| 291 totalPercentWidth += calcWidth[i]; | 291 totalPercentWidth += calcWidth[i]; |
| 292 } | 292 } |
| 293 } | 293 } |
| 294 } | 294 } |
| 295 totalWidth = totalFixedWidth + totalPercentWidth; | 295 totalWidth = totalFixedWidth + totalPercentWidth; |
| 296 } | 296 } |
| 297 } else { | 297 } else { |
| 298 // Divide the remaining width among the auto columns. | 298 // Divide the remaining width among the auto columns. |
| 299 ASSERT(autoSpan >= numAuto); | 299 DCHECK_GE(autoSpan, numAuto); |
|
dgrogan
2016/11/22 00:35:31
The reproduction triggered this because autoSpan w
| |
| 300 int remainingWidth = tableLogicalWidth - totalFixedWidth - | 300 int remainingWidth = tableLogicalWidth - totalFixedWidth - |
| 301 totalPercentWidth - hspacing * (autoSpan - numAuto); | 301 totalPercentWidth - hspacing * (autoSpan - numAuto); |
| 302 int lastAuto = 0; | 302 int lastAuto = 0; |
| 303 for (unsigned i = 0; i < nEffCols; i++) { | 303 for (unsigned i = 0; i < nEffCols; i++) { |
| 304 if (m_width[i].isAuto()) { | 304 if (m_width[i].isAuto()) { |
| 305 unsigned span = m_table->spanOfEffectiveColumn(i); | 305 unsigned span = m_table->spanOfEffectiveColumn(i); |
| 306 int w = remainingWidth * span / autoSpan; | 306 int w = remainingWidth * span / autoSpan; |
|
dgrogan
2016/11/22 00:35:31
This is where the /0 happened.
| |
| 307 calcWidth[i] = w + hspacing * (span - 1); | 307 calcWidth[i] = w + hspacing * (span - 1); |
| 308 remainingWidth -= w; | 308 remainingWidth -= w; |
| 309 if (!remainingWidth) | 309 if (!remainingWidth) |
| 310 break; | 310 break; |
| 311 lastAuto = i; | 311 lastAuto = i; |
| 312 numAuto--; | 312 numAuto--; |
| 313 ASSERT(autoSpan >= span); | 313 DCHECK_GE(autoSpan, span); |
| 314 autoSpan -= span; | 314 autoSpan -= span; |
| 315 } | 315 } |
| 316 } | 316 } |
| 317 // Last one gets the remainder. | 317 // Last one gets the remainder. |
| 318 if (remainingWidth) | 318 if (remainingWidth) |
| 319 calcWidth[lastAuto] += remainingWidth; | 319 calcWidth[lastAuto] += remainingWidth; |
| 320 totalWidth = tableLogicalWidth; | 320 totalWidth = tableLogicalWidth; |
| 321 } | 321 } |
| 322 | 322 |
| 323 if (totalWidth < tableLogicalWidth) { | 323 if (totalWidth < tableLogicalWidth) { |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 346 void TableLayoutAlgorithmFixed::willChangeTableLayout() { | 346 void TableLayoutAlgorithmFixed::willChangeTableLayout() { |
| 347 // When switching table layout algorithm, we need to dirty the preferred | 347 // When switching table layout algorithm, we need to dirty the preferred |
| 348 // logical widths as we cleared the bits without computing them. | 348 // logical widths as we cleared the bits without computing them. |
| 349 // (see calcWidthArray above.) This optimization is preferred to always | 349 // (see calcWidthArray above.) This optimization is preferred to always |
| 350 // computing the logical widths we never intended to use. | 350 // computing the logical widths we never intended to use. |
| 351 m_table->recalcSectionsIfNeeded(); | 351 m_table->recalcSectionsIfNeeded(); |
| 352 m_table->markAllCellsWidthsDirtyAndOrNeedsLayout(LayoutTable::MarkDirtyOnly); | 352 m_table->markAllCellsWidthsDirtyAndOrNeedsLayout(LayoutTable::MarkDirtyOnly); |
| 353 } | 353 } |
| 354 | 354 |
| 355 } // namespace blink | 355 } // namespace blink |
| OLD | NEW |