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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 int total = nEffCols; | 326 int total = nEffCols; |
327 while (total) { | 327 while (total) { |
328 int w = remainingWidth / total; | 328 int w = remainingWidth / total; |
329 remainingWidth -= w; | 329 remainingWidth -= w; |
330 calcWidth[--total] += w; | 330 calcWidth[--total] += w; |
331 } | 331 } |
332 if (nEffCols > 0) | 332 if (nEffCols > 0) |
333 calcWidth[nEffCols - 1] += remainingWidth; | 333 calcWidth[nEffCols - 1] += remainingWidth; |
334 } | 334 } |
335 | 335 |
336 ASSERT(m_table->effectiveColumnPositions().size() == nEffCols + 1); | 336 DCHECK_EQ(m_table->effectiveColumnPositions().size(), nEffCols + 1); |
337 int pos = 0; | 337 int pos = 0; |
338 for (unsigned i = 0; i < nEffCols; i++) { | 338 for (unsigned i = 0; i < nEffCols; i++) { |
339 m_table->setEffectiveColumnPosition(i, pos); | 339 m_table->setEffectiveColumnPosition(i, pos); |
340 pos += calcWidth[i] + hspacing; | 340 pos += calcWidth[i] + hspacing; |
341 } | 341 } |
342 // The extra position is for the imaginary column after the last column. | 342 // The extra position is for the imaginary column after the last column. |
343 m_table->setEffectiveColumnPosition(nEffCols, pos); | 343 m_table->setEffectiveColumnPosition(nEffCols, pos); |
344 } | 344 } |
345 | 345 |
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 |