| OLD | NEW |
| 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, 2007, 2008, 2009 Apple Inc. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. |
| 8 * All rights reserved. | 8 * All rights reserved. |
| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 m_cellWidthChanged(false), | 61 m_cellWidthChanged(false), |
| 62 m_intrinsicPaddingBefore(0), | 62 m_intrinsicPaddingBefore(0), |
| 63 m_intrinsicPaddingAfter(0) { | 63 m_intrinsicPaddingAfter(0) { |
| 64 // We only update the flags when notified of DOM changes in | 64 // We only update the flags when notified of DOM changes in |
| 65 // colSpanOrRowSpanChanged() so we need to set their initial values here in | 65 // colSpanOrRowSpanChanged() so we need to set their initial values here in |
| 66 // case something asks for colSpan()/rowSpan() before then. | 66 // case something asks for colSpan()/rowSpan() before then. |
| 67 updateColAndRowSpanFlags(); | 67 updateColAndRowSpanFlags(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 LayoutTableCell::CollapsedBorderValues::CollapsedBorderValues( | 70 LayoutTableCell::CollapsedBorderValues::CollapsedBorderValues( |
| 71 const LayoutTable& layoutTable, | 71 const LayoutTableCell& layoutTableCell, |
| 72 const CollapsedBorderValue& startBorder, | 72 const CollapsedBorderValue& startBorder, |
| 73 const CollapsedBorderValue& endBorder, | 73 const CollapsedBorderValue& endBorder, |
| 74 const CollapsedBorderValue& beforeBorder, | 74 const CollapsedBorderValue& beforeBorder, |
| 75 const CollapsedBorderValue& afterBorder) | 75 const CollapsedBorderValue& afterBorder) |
| 76 : m_layoutTable(layoutTable), | 76 : m_layoutTableCell(layoutTableCell), |
| 77 m_startBorder(startBorder), | 77 m_startBorder(startBorder), |
| 78 m_endBorder(endBorder), | 78 m_endBorder(endBorder), |
| 79 m_beforeBorder(beforeBorder), | 79 m_beforeBorder(beforeBorder), |
| 80 m_afterBorder(afterBorder) {} | 80 m_afterBorder(afterBorder) {} |
| 81 | 81 |
| 82 void LayoutTableCell::CollapsedBorderValues::setCollapsedBorderValues( | 82 void LayoutTableCell::CollapsedBorderValues::setCollapsedBorderValues( |
| 83 const CollapsedBorderValues& other) { | 83 const CollapsedBorderValues& other) { |
| 84 m_startBorder = other.startBorder(); | 84 m_startBorder = other.startBorder(); |
| 85 m_endBorder = other.endBorder(); | 85 m_endBorder = other.endBorder(); |
| 86 m_beforeBorder = other.beforeBorder(); | 86 m_beforeBorder = other.beforeBorder(); |
| 87 m_afterBorder = other.afterBorder(); | 87 m_afterBorder = other.afterBorder(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 String LayoutTableCell::CollapsedBorderValues::debugName() const { | 90 String LayoutTableCell::CollapsedBorderValues::debugName() const { |
| 91 return "CollapsedBorderValues"; | 91 return "CollapsedBorderValues"; |
| 92 } | 92 } |
| 93 | 93 |
| 94 LayoutRect LayoutTableCell::CollapsedBorderValues::visualRect() const { | 94 LayoutRect LayoutTableCell::CollapsedBorderValues::visualRect() const { |
| 95 return m_layoutTable.visualRect(); | 95 return m_layoutTableCell.table()->visualRect(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void LayoutTableCell::willBeRemovedFromTree() { | 98 void LayoutTableCell::willBeRemovedFromTree() { |
| 99 LayoutBlockFlow::willBeRemovedFromTree(); | 99 LayoutBlockFlow::willBeRemovedFromTree(); |
| 100 | 100 |
| 101 section()->setNeedsCellRecalc(); | 101 section()->setNeedsCellRecalc(); |
| 102 | 102 |
| 103 // When borders collapse, removing a cell can affect the the width of | 103 // When borders collapse, removing a cell can affect the the width of |
| 104 // neighboring cells. | 104 // neighboring cells. |
| 105 LayoutTable* enclosingTable = table(); | 105 LayoutTable* enclosingTable = table(); |
| (...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1311 for (size_t i = 0; i < count; ++i) { | 1311 for (size_t i = 0; i < count; ++i) { |
| 1312 if (borderValues[i].isSameIgnoringColor(borderValue)) | 1312 if (borderValues[i].isSameIgnoringColor(borderValue)) |
| 1313 return; | 1313 return; |
| 1314 } | 1314 } |
| 1315 borderValues.append(borderValue); | 1315 borderValues.append(borderValue); |
| 1316 } | 1316 } |
| 1317 | 1317 |
| 1318 void LayoutTableCell::collectBorderValues( | 1318 void LayoutTableCell::collectBorderValues( |
| 1319 LayoutTable::CollapsedBorderValues& borderValues) { | 1319 LayoutTable::CollapsedBorderValues& borderValues) { |
| 1320 CollapsedBorderValues newValues( | 1320 CollapsedBorderValues newValues( |
| 1321 *table(), computeCollapsedStartBorder(), computeCollapsedEndBorder(), | 1321 *this, computeCollapsedStartBorder(), computeCollapsedEndBorder(), |
| 1322 computeCollapsedBeforeBorder(), computeCollapsedAfterBorder()); | 1322 computeCollapsedBeforeBorder(), computeCollapsedAfterBorder()); |
| 1323 | 1323 |
| 1324 bool changed = false; | 1324 bool changed = false; |
| 1325 if (!newValues.startBorder().isVisible() && | 1325 if (!newValues.startBorder().isVisible() && |
| 1326 !newValues.endBorder().isVisible() && | 1326 !newValues.endBorder().isVisible() && |
| 1327 !newValues.beforeBorder().isVisible() && | 1327 !newValues.beforeBorder().isVisible() && |
| 1328 !newValues.afterBorder().isVisible()) { | 1328 !newValues.afterBorder().isVisible()) { |
| 1329 changed = !!m_collapsedBorderValues; | 1329 changed = !!m_collapsedBorderValues; |
| 1330 m_collapsedBorderValues = nullptr; | 1330 m_collapsedBorderValues = nullptr; |
| 1331 } else if (!m_collapsedBorderValues) { | 1331 } else if (!m_collapsedBorderValues) { |
| 1332 changed = true; | 1332 changed = true; |
| 1333 m_collapsedBorderValues = wrapUnique(new CollapsedBorderValues( | 1333 m_collapsedBorderValues = wrapUnique(new CollapsedBorderValues( |
| 1334 *table(), newValues.startBorder(), newValues.endBorder(), | 1334 *this, newValues.startBorder(), newValues.endBorder(), |
| 1335 newValues.beforeBorder(), newValues.afterBorder())); | 1335 newValues.beforeBorder(), newValues.afterBorder())); |
| 1336 } else { | 1336 } else { |
| 1337 // We check visuallyEquals so that the table cell is invalidated only if a | 1337 // We check visuallyEquals so that the table cell is invalidated only if a |
| 1338 // changed collapsed border is visible in the first place. | 1338 // changed collapsed border is visible in the first place. |
| 1339 changed = !m_collapsedBorderValues->startBorder().visuallyEquals( | 1339 changed = !m_collapsedBorderValues->startBorder().visuallyEquals( |
| 1340 newValues.startBorder()) || | 1340 newValues.startBorder()) || |
| 1341 !m_collapsedBorderValues->endBorder().visuallyEquals( | 1341 !m_collapsedBorderValues->endBorder().visuallyEquals( |
| 1342 newValues.endBorder()) || | 1342 newValues.endBorder()) || |
| 1343 !m_collapsedBorderValues->beforeBorder().visuallyEquals( | 1343 !m_collapsedBorderValues->beforeBorder().visuallyEquals( |
| 1344 newValues.beforeBorder()) || | 1344 newValues.beforeBorder()) || |
| 1345 !m_collapsedBorderValues->afterBorder().visuallyEquals( | 1345 !m_collapsedBorderValues->afterBorder().visuallyEquals( |
| 1346 newValues.afterBorder()); | 1346 newValues.afterBorder()); |
| 1347 if (changed) | 1347 if (changed) |
| 1348 m_collapsedBorderValues->setCollapsedBorderValues(newValues); | 1348 m_collapsedBorderValues->setCollapsedBorderValues(newValues); |
| 1349 } | 1349 } |
| 1350 | 1350 |
| 1351 // If collapsed borders changed, invalidate the cell's display item client on | 1351 // If collapsed borders changed, invalidate the cell's display item client on |
| 1352 // the table's backing. | 1352 // the table's backing. |
| 1353 // TODO(crbug.com/451090#c5): Need a way to invalidate/repaint the borders | 1353 // TODO(crbug.com/451090#c5): Need a way to invalidate/repaint the borders |
| 1354 // only. | 1354 // only. |
| 1355 if (changed) | 1355 if (changed) { |
| 1356 ObjectPaintInvalidator(*table()) | 1356 ObjectPaintInvalidator(*table()) |
| 1357 .slowSetPaintingLayerNeedsRepaintAndInvalidateDisplayItemClient( | 1357 .slowSetPaintingLayerNeedsRepaintAndInvalidateDisplayItemClient( |
| 1358 *this, PaintInvalidationStyleChange); | 1358 *this, PaintInvalidationStyleChange); |
| 1359 } |
| 1359 | 1360 |
| 1360 addBorderStyle(borderValues, newValues.startBorder()); | 1361 addBorderStyle(borderValues, newValues.startBorder()); |
| 1361 addBorderStyle(borderValues, newValues.endBorder()); | 1362 addBorderStyle(borderValues, newValues.endBorder()); |
| 1362 addBorderStyle(borderValues, newValues.beforeBorder()); | 1363 addBorderStyle(borderValues, newValues.beforeBorder()); |
| 1363 addBorderStyle(borderValues, newValues.afterBorder()); | 1364 addBorderStyle(borderValues, newValues.afterBorder()); |
| 1364 } | 1365 } |
| 1365 | 1366 |
| 1366 void LayoutTableCell::sortBorderValues( | 1367 void LayoutTableCell::sortBorderValues( |
| 1367 LayoutTable::CollapsedBorderValues& borderValues) { | 1368 LayoutTable::CollapsedBorderValues& borderValues) { |
| 1368 std::sort(borderValues.begin(), borderValues.end(), compareBorders); | 1369 std::sort(borderValues.begin(), borderValues.end(), compareBorders); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1477 cb->adjustChildDebugRect(rect); | 1478 cb->adjustChildDebugRect(rect); |
| 1478 | 1479 |
| 1479 return rect; | 1480 return rect; |
| 1480 } | 1481 } |
| 1481 | 1482 |
| 1482 void LayoutTableCell::adjustChildDebugRect(LayoutRect& r) const { | 1483 void LayoutTableCell::adjustChildDebugRect(LayoutRect& r) const { |
| 1483 r.move(0, -intrinsicPaddingBefore()); | 1484 r.move(0, -intrinsicPaddingBefore()); |
| 1484 } | 1485 } |
| 1485 | 1486 |
| 1486 } // namespace blink | 1487 } // namespace blink |
| OLD | NEW |