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

Side by Side Diff: Source/core/rendering/RenderTableSection.cpp

Issue 208263013: Col width is not honored when dynamically updated and it would not make table narrower (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Merged https://codereview.chromium.org/208263012/ to this patch. Created 6 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
« no previous file with comments | « Source/core/rendering/RenderTableSection.h ('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 Apple Inc. All rights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010 Apple Inc. All rights 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 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 1480
1481 void RenderTableSection::imageChanged(WrappedImagePtr, const IntRect*) 1481 void RenderTableSection::imageChanged(WrappedImagePtr, const IntRect*)
1482 { 1482 {
1483 // FIXME: Examine cells and repaint only the rect the image paints in. 1483 // FIXME: Examine cells and repaint only the rect the image paints in.
1484 repaint(); 1484 repaint();
1485 } 1485 }
1486 1486
1487 void RenderTableSection::recalcCells() 1487 void RenderTableSection::recalcCells()
1488 { 1488 {
1489 ASSERT(m_needsCellRecalc); 1489 ASSERT(m_needsCellRecalc);
1490 // We reset the flag here to ensure that |addCell| works. This is safe to do as 1490 // We reset the flag here to ensure that addCell() works. This is safe to do because we clear the grid
1491 // fillRowsWithDefaultStartingAtPosition makes sure we match the table's col umns 1491 // and update its dimensions to be consistent with the table's column repres entation before we rebuild
1492 // representation. 1492 // the grid using addCell().
1493 m_needsCellRecalc = false; 1493 m_needsCellRecalc = false;
1494 1494
1495 m_cCol = 0; 1495 m_cCol = 0;
1496 m_cRow = 0; 1496 m_cRow = 0;
1497 m_grid.clear(); 1497 m_grid.clear();
1498 1498
1499 for (RenderObject* row = firstChild(); row; row = row->nextSibling()) { 1499 for (RenderObject* row = firstChild(); row; row = row->nextSibling()) {
1500 if (row->isTableRow()) { 1500 if (row->isTableRow()) {
1501 unsigned insertionRow = m_cRow; 1501 unsigned insertionRow = m_cRow;
1502 m_cRow++; 1502 m_cRow++;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1534 if (!cell->isTableCell()) 1534 if (!cell->isTableCell())
1535 continue; 1535 continue;
1536 1536
1537 updateLogicalHeightForCell(m_grid[rowIndex], toRenderTableCell(cell)); 1537 updateLogicalHeightForCell(m_grid[rowIndex], toRenderTableCell(cell));
1538 } 1538 }
1539 } 1539 }
1540 1540
1541 void RenderTableSection::setNeedsCellRecalc() 1541 void RenderTableSection::setNeedsCellRecalc()
1542 { 1542 {
1543 m_needsCellRecalc = true; 1543 m_needsCellRecalc = true;
1544
1545 // Clear the grid now to ensure that we don't hold onto any stale pointers ( e.g. a cell renderer that is being removed).
1546 m_grid.clear();
Julien - ping for review 2014/03/29 01:04:21 As stated in codereview.chromium.org/208263012 (ba
1547
1544 if (RenderTable* t = table()) 1548 if (RenderTable* t = table())
1545 t->setNeedsSectionRecalc(); 1549 t->setNeedsSectionRecalc();
1546 } 1550 }
1547 1551
1548 unsigned RenderTableSection::numColumns() const 1552 unsigned RenderTableSection::numColumns() const
1549 { 1553 {
1554 ASSERT(!m_needsCellRecalc);
1550 unsigned result = 0; 1555 unsigned result = 0;
1551 1556
1552 for (unsigned r = 0; r < m_grid.size(); ++r) { 1557 for (unsigned r = 0; r < m_grid.size(); ++r) {
1553 for (unsigned c = result; c < table()->numEffCols(); ++c) { 1558 for (unsigned c = result; c < table()->numEffCols(); ++c) {
1554 const CellStruct& cell = cellAt(r, c); 1559 const CellStruct& cell = cellAt(r, c);
1555 if (cell.hasCells() || cell.inColSpan) 1560 if (cell.hasCells() || cell.inColSpan)
1556 result = c; 1561 result = c;
1557 } 1562 }
1558 } 1563 }
1559 1564
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1730 else 1735 else
1731 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing); 1736 cellLocation.setX(table()->columnPositions()[effectiveColumn] + horizont alBorderSpacing);
1732 1737
1733 cell->setLogicalLocation(cellLocation); 1738 cell->setLogicalLocation(cellLocation);
1734 1739
1735 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled()) 1740 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled())
1736 view()->addLayoutDelta(oldCellLocation - cell->location()); 1741 view()->addLayoutDelta(oldCellLocation - cell->location());
1737 } 1742 }
1738 1743
1739 } // namespace WebCore 1744 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderTableSection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698