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

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: Rebase Created 5 years, 4 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
« no previous file with comments | « LayoutTests/fast/table/table-rowspan-row-height-less-than-content-height-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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::min(toAdd, extraRowSpanningHeight); 325 toAdd = std::max(std::min(toAdd, extraRowSpanningHeight), 0);
326 accumulatedPositionIncrease += toAdd; 326 accumulatedPositionIncrease += toAdd;
327 extraRowSpanningHeight -= toAdd; 327 extraRowSpanningHeight -= toAdd;
328 percent -= m_grid[row].logicalHeight.percent(); 328 percent -= m_grid[row].logicalHeight.percent();
329 } 329 }
330 } 330 }
331 m_rowPos[row + 1] += accumulatedPositionIncrease; 331 m_rowPos[row + 1] += accumulatedPositionIncrease;
332 } 332 }
333 } 333 }
334 334
335 335
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after
1637 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691). 1637 // FIXME: The table's direction should determine our row's direction, not th e section's (see bug 96691).
1638 if (!style()->isLeftToRightDirection()) 1638 if (!style()->isLeftToRightDirection())
1639 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing); 1639 cellLocation.setX(table()->columnPositions()[table()->numEffCols()] - ta ble()->columnPositions()[table()->colToEffCol(cell->col() + cell->colSpan())] + horizontalBorderSpacing);
1640 else 1640 else
1641 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); 1641 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing);
1642 1642
1643 cell->setLogicalLocation(cellLocation); 1643 cell->setLogicalLocation(cellLocation);
1644 } 1644 }
1645 1645
1646 } // namespace blink 1646 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/table/table-rowspan-row-height-less-than-content-height-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698