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

Side by Side Diff: Source/core/layout/LayoutTableSection.cpp

Issue 1023133002: Negative row height when cell has percentage height. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Test expected file updated Created 5 years, 5 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, 2008, 2009, 2010, 2013 Apple Inc. All r ights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2013 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 // those total percent is 100. Other percent rows would be uneffected even e xtra spanning height is remain. 315 // those total percent is 100. Other percent rows would be uneffected even e xtra spanning height is remain.
316 int accumulatedPositionIncrease = 0; 316 int accumulatedPositionIncrease = 0;
317 for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { 317 for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) {
318 if (percent > 0 && extraRowSpanningHeight > 0) { 318 if (percent > 0 && extraRowSpanningHeight > 0) {
319 // TODO(alancutter): Make this work correctly for calc lengths. 319 // TODO(alancutter): Make this work correctly for calc lengths.
320 if (m_grid[row].logicalHeight.hasPercent()) { 320 if (m_grid[row].logicalHeight.hasPercent()) {
321 int toAdd = (tableHeight * m_grid[row].logicalHeight.percent() / 100) - rowsHeight[row - rowIndex]; 321 int toAdd = (tableHeight * m_grid[row].logicalHeight.percent() / 100) - rowsHeight[row - rowIndex];
322 // FIXME: Note that this is wrong if we have a percentage above 100% and may make us grow 322 // FIXME: Note that this is wrong if we have a percentage above 100% and may make us grow
323 // above the available space. 323 // above the available space.
324 324
325 toAdd = std::max(toAdd, 0);
325 toAdd = std::min(toAdd, extraRowSpanningHeight); 326 toAdd = std::min(toAdd, extraRowSpanningHeight);
Julien - ping for review 2015/07/14 17:02:41 I think a single line would be better as it would
a.suchit 2015/07/20 06:54:09 Done.
326 accumulatedPositionIncrease += toAdd; 327 accumulatedPositionIncrease += toAdd;
327 extraRowSpanningHeight -= toAdd; 328 extraRowSpanningHeight -= toAdd;
328 percent -= m_grid[row].logicalHeight.percent(); 329 percent -= m_grid[row].logicalHeight.percent();
329 } 330 }
330 } 331 }
331 m_rowPos[row + 1] += accumulatedPositionIncrease; 332 m_rowPos[row + 1] += accumulatedPositionIncrease;
332 } 333 }
333 } 334 }
334 335
335 336
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1642 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). 1643 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691).
1643 if (!style()->isLeftToRightDirection()) 1644 if (!style()->isLeftToRightDirection())
1644 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing); 1645 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing);
1645 else 1646 else
1646 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); 1647 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing);
1647 1648
1648 cell->setLogicalLocation(cellLocation); 1649 cell->setLogicalLocation(cellLocation);
1649 } 1650 }
1650 1651
1651 } // namespace blink 1652 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698