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

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: Added Layout test Created 5 years, 9 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 // Our algorithm matches Firefox. Extra spanning height would be distributed Only in first percent height rows 306 // Our algorithm matches Firefox. Extra spanning height would be distributed Only in first percent height rows
307 // those total percent is 100. Other percent rows would be uneffected even e xtra spanning height is remain. 307 // those total percent is 100. Other percent rows would be uneffected even e xtra spanning height is remain.
308 int accumulatedPositionIncrease = 0; 308 int accumulatedPositionIncrease = 0;
309 for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) { 309 for (unsigned row = rowIndex; row < (rowIndex + rowSpan); row++) {
310 if (percent > 0 && extraRowSpanningHeight > 0) { 310 if (percent > 0 && extraRowSpanningHeight > 0) {
311 if (m_grid[row].logicalHeight.isPercent()) { 311 if (m_grid[row].logicalHeight.isPercent()) {
312 int toAdd = (tableHeight * m_grid[row].logicalHeight.percent() / 100) - rowsHeight[row - rowIndex]; 312 int toAdd = (tableHeight * m_grid[row].logicalHeight.percent() / 100) - rowsHeight[row - rowIndex];
313 // FIXME: Note that this is wrong if we have a percentage above 100% and may make us grow 313 // FIXME: Note that this is wrong if we have a percentage above 100% and may make us grow
314 // above the available space. 314 // above the available space.
315 315
316 toAdd = std::max(toAdd, 0);
esprehn 2015/03/26 08:23:11 How does toAdd become negative here?
a.suchit2 2015/03/26 09:38:35 If percent height is less than the rowHeight based
Julien - ping for review 2015/03/26 15:22:10 It's not the only place where we do something simi
316 toAdd = std::min(toAdd, extraRowSpanningHeight); 317 toAdd = std::min(toAdd, extraRowSpanningHeight);
317 accumulatedPositionIncrease += toAdd; 318 accumulatedPositionIncrease += toAdd;
318 extraRowSpanningHeight -= toAdd; 319 extraRowSpanningHeight -= toAdd;
319 percent -= m_grid[row].logicalHeight.percent(); 320 percent -= m_grid[row].logicalHeight.percent();
320 } 321 }
321 } 322 }
322 m_rowPos[row + 1] += accumulatedPositionIncrease; 323 m_rowPos[row + 1] += accumulatedPositionIncrease;
323 } 324 }
324 } 325 }
325 326
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). 1605 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691).
1605 if (!style()->isLeftToRightDirection()) 1606 if (!style()->isLeftToRightDirection())
1606 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing); 1607 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing);
1607 else 1608 else
1608 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); 1609 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing);
1609 1610
1610 cell->setLogicalLocation(cellLocation); 1611 cell->setLogicalLocation(cellLocation);
1611 } 1612 }
1612 1613
1613 } // namespace blink 1614 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698