| 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, 2008, 2009, 2010, 2013 Apple Inc. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2013 Apple Inc. |
| 8 * All rights reserved. | 8 * All rights reserved. |
| 9 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 9 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 10 * | 10 * |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 Table()->EffectiveColumns(); | 245 Table()->EffectiveColumns(); |
| 246 unsigned insertion_row = row->RowIndex(); | 246 unsigned insertion_row = row->RowIndex(); |
| 247 | 247 |
| 248 // ### mozilla still seems to do the old HTML way, even for strict DTD | 248 // ### mozilla still seems to do the old HTML way, even for strict DTD |
| 249 // (see the annotation on table cell layouting in the CSS specs and the | 249 // (see the annotation on table cell layouting in the CSS specs and the |
| 250 // testcase below: | 250 // testcase below: |
| 251 // <TABLE border> | 251 // <TABLE border> |
| 252 // <TR><TD>1 <TD rowspan="2">2 <TD>3 <TD>4 | 252 // <TR><TD>1 <TD rowspan="2">2 <TD>3 <TD>4 |
| 253 // <TR><TD colspan="2">5 | 253 // <TR><TD colspan="2">5 |
| 254 // </TABLE> | 254 // </TABLE> |
| 255 unsigned n_cols = NumCols(insertion_row); | 255 unsigned n_cols = NumEffectiveColumns(insertion_row); |
| 256 while (c_col_ < n_cols && (GridCellAt(insertion_row, c_col_).HasCells() || | 256 while (c_col_ < n_cols && (GridCellAt(insertion_row, c_col_).HasCells() || |
| 257 GridCellAt(insertion_row, c_col_).InColSpan())) | 257 GridCellAt(insertion_row, c_col_).InColSpan())) |
| 258 c_col_++; | 258 c_col_++; |
| 259 | 259 |
| 260 grid_[insertion_row].UpdateLogicalHeightForCell(cell); | 260 grid_[insertion_row].UpdateLogicalHeightForCell(cell); |
| 261 | 261 |
| 262 EnsureRows(insertion_row + r_span); | 262 EnsureRows(insertion_row + r_span); |
| 263 | 263 |
| 264 grid_[insertion_row].row = row; | 264 grid_[insertion_row].row = row; |
| 265 | 265 |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1134 } | 1134 } |
| 1135 row->SetLogicalHeight(row_logical_height); | 1135 row->SetLogicalHeight(row_logical_height); |
| 1136 row->UpdateAfterLayout(); | 1136 row->UpdateAfterLayout(); |
| 1137 } | 1137 } |
| 1138 } | 1138 } |
| 1139 | 1139 |
| 1140 // Vertically align and flex the cells in each row. | 1140 // Vertically align and flex the cells in each row. |
| 1141 for (unsigned r = 0; r < total_rows; r++) { | 1141 for (unsigned r = 0; r < total_rows; r++) { |
| 1142 LayoutTableRow* row = grid_[r].row; | 1142 LayoutTableRow* row = grid_[r].row; |
| 1143 | 1143 |
| 1144 unsigned n_cols = NumCols(r); | 1144 unsigned n_cols = NumEffectiveColumns(r); |
| 1145 for (unsigned c = 0; c < n_cols; c++) { | 1145 for (unsigned c = 0; c < n_cols; c++) { |
| 1146 LayoutTableCell* cell = OriginatingCellAt(r, c); | 1146 LayoutTableCell* cell = OriginatingCellAt(r, c); |
| 1147 if (!cell) | 1147 if (!cell) |
| 1148 continue; | 1148 continue; |
| 1149 | 1149 |
| 1150 int r_height; | 1150 int r_height; |
| 1151 int row_logical_top; | 1151 int row_logical_top; |
| 1152 unsigned row_span = std::max(1U, cell->RowSpan()); | 1152 unsigned row_span = std::max(1U, cell->RowSpan()); |
| 1153 unsigned end_row_index = std::min(r + row_span, total_rows) - 1; | 1153 unsigned end_row_index = std::min(r + row_span, total_rows) - 1; |
| 1154 LayoutTableRow* last_row_object = grid_[end_row_index].row; | 1154 LayoutTableRow* last_row_object = grid_[end_row_index].row; |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 ClearChildNeedsOverflowRecalcAfterStyleChange(); | 1308 ClearChildNeedsOverflowRecalcAfterStyleChange(); |
| 1309 unsigned total_rows = grid_.size(); | 1309 unsigned total_rows = grid_.size(); |
| 1310 bool children_overflow_changed = false; | 1310 bool children_overflow_changed = false; |
| 1311 for (unsigned r = 0; r < total_rows; r++) { | 1311 for (unsigned r = 0; r < total_rows; r++) { |
| 1312 LayoutTableRow* row_layouter = RowLayoutObjectAt(r); | 1312 LayoutTableRow* row_layouter = RowLayoutObjectAt(r); |
| 1313 if (!row_layouter || | 1313 if (!row_layouter || |
| 1314 !row_layouter->ChildNeedsOverflowRecalcAfterStyleChange()) | 1314 !row_layouter->ChildNeedsOverflowRecalcAfterStyleChange()) |
| 1315 continue; | 1315 continue; |
| 1316 row_layouter->ClearChildNeedsOverflowRecalcAfterStyleChange(); | 1316 row_layouter->ClearChildNeedsOverflowRecalcAfterStyleChange(); |
| 1317 bool row_children_overflow_changed = false; | 1317 bool row_children_overflow_changed = false; |
| 1318 unsigned n_cols = NumCols(r); | 1318 unsigned n_cols = NumEffectiveColumns(r); |
| 1319 for (unsigned c = 0; c < n_cols; c++) { | 1319 for (unsigned c = 0; c < n_cols; c++) { |
| 1320 auto* cell = OriginatingCellAt(r, c); | 1320 auto* cell = OriginatingCellAt(r, c); |
| 1321 if (!cell || !cell->NeedsOverflowRecalcAfterStyleChange()) | 1321 if (!cell || !cell->NeedsOverflowRecalcAfterStyleChange()) |
| 1322 continue; | 1322 continue; |
| 1323 row_children_overflow_changed |= cell->RecalcOverflowAfterStyleChange(); | 1323 row_children_overflow_changed |= cell->RecalcOverflowAfterStyleChange(); |
| 1324 } | 1324 } |
| 1325 if (row_children_overflow_changed) | 1325 if (row_children_overflow_changed) |
| 1326 row_layouter->ComputeOverflow(); | 1326 row_layouter->ComputeOverflow(); |
| 1327 children_overflow_changed |= row_children_overflow_changed; | 1327 children_overflow_changed |= row_children_overflow_changed; |
| 1328 } | 1328 } |
| 1329 if (children_overflow_changed) | 1329 if (children_overflow_changed) |
| 1330 ComputeOverflowFromDescendants(); | 1330 ComputeOverflowFromDescendants(); |
| 1331 return children_overflow_changed; | 1331 return children_overflow_changed; |
| 1332 } | 1332 } |
| 1333 | 1333 |
| 1334 void LayoutTableSection::MarkAllCellsWidthsDirtyAndOrNeedsLayout( | 1334 void LayoutTableSection::MarkAllCellsWidthsDirtyAndOrNeedsLayout( |
| 1335 LayoutTable::WhatToMarkAllCells what_to_mark) { | 1335 LayoutTable::WhatToMarkAllCells what_to_mark) { |
| 1336 for (LayoutTableRow* row = FirstRow(); row; row = row->NextRow()) { | 1336 for (LayoutTableRow* row = FirstRow(); row; row = row->NextRow()) { |
| 1337 for (LayoutTableCell* cell = row->FirstCell(); cell; | 1337 for (LayoutTableCell* cell = row->FirstCell(); cell; |
| 1338 cell = cell->NextCell()) { | 1338 cell = cell->NextCell()) { |
| 1339 cell->SetPreferredLogicalWidthsDirty(); | 1339 cell->SetPreferredLogicalWidthsDirty(); |
| 1340 if (what_to_mark == LayoutTable::kMarkDirtyAndNeedsLayout) | 1340 if (what_to_mark == LayoutTable::kMarkDirtyAndNeedsLayout) |
| 1341 cell->SetChildNeedsLayout(); | 1341 cell->SetChildNeedsLayout(); |
| 1342 } | 1342 } |
| 1343 } | 1343 } |
| 1344 } | 1344 } |
| 1345 | 1345 |
| 1346 int LayoutTableSection::CalcBlockDirectionOuterBorder( | 1346 int LayoutTableSection::CalcBlockDirectionOuterBorder( |
| 1347 BlockBorderSide side) const { | 1347 BlockBorderSide side) const { |
| 1348 // TODO(wangxianzhu): There are several issues in this function: |
| 1349 // 1. Row borders are not respected; |
| 1350 // 2. Column borders should be ignored if this section is not at the top or |
| 1351 // the bottom. |
| 1352 // 3. It's unnecessarily complex. |
| 1353 // I think we should just use cell's calculated collapsed border values to |
| 1354 // avoid all of the problems. |
| 1348 if (!grid_.size() || !Table()->NumEffectiveColumns()) | 1355 if (!grid_.size() || !Table()->NumEffectiveColumns()) |
| 1349 return 0; | 1356 return 0; |
| 1350 | 1357 |
| 1351 int border_width = 0; | 1358 int border_width = 0; |
| 1352 | 1359 |
| 1353 const BorderValue& sb = | 1360 const BorderValue& sb = |
| 1354 side == kBorderBefore ? Style()->BorderBefore() : Style()->BorderAfter(); | 1361 side == kBorderBefore ? Style()->BorderBefore() : Style()->BorderAfter(); |
| 1355 if (sb.Style() == EBorderStyle::kHidden) | 1362 if (sb.Style() == EBorderStyle::kHidden) |
| 1356 return -1; | 1363 return -1; |
| 1357 if (sb.Style() > EBorderStyle::kHidden) | 1364 if (sb.Style() > EBorderStyle::kHidden) |
| 1358 border_width = sb.Width(); | 1365 border_width = sb.Width(); |
| 1359 | 1366 |
| 1360 const BorderValue& rb = side == kBorderBefore | 1367 const BorderValue& rb = side == kBorderBefore |
| 1361 ? FirstRow()->Style()->BorderBefore() | 1368 ? FirstRow()->Style()->BorderBefore() |
| 1362 : LastRow()->Style()->BorderAfter(); | 1369 : LastRow()->Style()->BorderAfter(); |
| 1363 if (rb.Style() == EBorderStyle::kHidden) | 1370 if (rb.Style() == EBorderStyle::kHidden) |
| 1364 return -1; | 1371 return -1; |
| 1365 if (rb.Style() > EBorderStyle::kHidden && rb.Width() > border_width) | 1372 if (rb.Style() > EBorderStyle::kHidden && rb.Width() > border_width) |
| 1366 border_width = rb.Width(); | 1373 border_width = rb.Width(); |
| 1367 | 1374 |
| 1368 bool all_hidden = true; | 1375 bool all_hidden = true; |
| 1369 unsigned r = side == kBorderBefore ? 0 : grid_.size() - 1; | 1376 unsigned r = side == kBorderBefore ? 0 : grid_.size() - 1; |
| 1370 unsigned n_cols = NumCols(r); | 1377 unsigned n_cols = NumEffectiveColumns(r); |
| 1371 for (unsigned c = 0; c < n_cols; c++) { | 1378 for (unsigned c = 0; c < n_cols; c++) { |
| 1372 const auto& grid_cell = GridCellAt(r, c); | 1379 const auto& grid_cell = GridCellAt(r, c); |
| 1373 if (grid_cell.InColSpan() || !grid_cell.HasCells()) | 1380 if (grid_cell.InColSpan() || !grid_cell.HasCells()) |
| 1374 continue; | 1381 continue; |
| 1375 const ComputedStyle& primary_cell_style = | 1382 const ComputedStyle& primary_cell_style = |
| 1376 grid_cell.PrimaryCell()->StyleRef(); | 1383 grid_cell.PrimaryCell()->StyleRef(); |
| 1377 // FIXME: Make this work with perpendicular and flipped cells. | 1384 // FIXME: Make this work with perpendicular and flipped cells. |
| 1378 const BorderValue& cb = side == kBorderBefore | 1385 const BorderValue& cb = side == kBorderBefore |
| 1379 ? primary_cell_style.BorderBefore() | 1386 ? primary_cell_style.BorderBefore() |
| 1380 : primary_cell_style.BorderAfter(); | 1387 : primary_cell_style.BorderAfter(); |
| 1381 // FIXME: Don't repeat for the same col group | 1388 // FIXME: Don't repeat for the same col group |
| 1382 LayoutTableCol* col = | 1389 LayoutTableCol* col = |
| 1383 Table()->ColElementAtAbsoluteColumn(c).InnermostColOrColGroup(); | 1390 Table()->ColAndColGroupAtEffectiveColumn(c).InnermostColOrColGroup(); |
| 1384 if (col) { | 1391 if (col) { |
| 1385 const BorderValue& gb = side == kBorderBefore | 1392 const BorderValue& gb = side == kBorderBefore |
| 1386 ? col->Style()->BorderBefore() | 1393 ? col->Style()->BorderBefore() |
| 1387 : col->Style()->BorderAfter(); | 1394 : col->Style()->BorderAfter(); |
| 1388 if (gb.Style() == EBorderStyle::kHidden || | 1395 if (gb.Style() == EBorderStyle::kHidden || |
| 1389 cb.Style() == EBorderStyle::kHidden) | 1396 cb.Style() == EBorderStyle::kHidden) |
| 1390 continue; | 1397 continue; |
| 1391 all_hidden = false; | 1398 all_hidden = false; |
| 1392 if (gb.Style() > EBorderStyle::kHidden && gb.Width() > border_width) | 1399 if (gb.Style() > EBorderStyle::kHidden && gb.Width() > border_width) |
| 1393 border_width = gb.Width(); | 1400 border_width = gb.Width(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1419 int border_width = 0; | 1426 int border_width = 0; |
| 1420 | 1427 |
| 1421 const BorderValue& sb = | 1428 const BorderValue& sb = |
| 1422 side == kBorderStart ? Style()->BorderStart() : Style()->BorderEnd(); | 1429 side == kBorderStart ? Style()->BorderStart() : Style()->BorderEnd(); |
| 1423 if (sb.Style() == EBorderStyle::kHidden) | 1430 if (sb.Style() == EBorderStyle::kHidden) |
| 1424 return -1; | 1431 return -1; |
| 1425 if (sb.Style() > EBorderStyle::kHidden) | 1432 if (sb.Style() > EBorderStyle::kHidden) |
| 1426 border_width = sb.Width(); | 1433 border_width = sb.Width(); |
| 1427 | 1434 |
| 1428 if (LayoutTableCol* col = Table() | 1435 if (LayoutTableCol* col = Table() |
| 1429 ->ColElementAtAbsoluteColumn(col_index) | 1436 ->ColAndColGroupAtEffectiveColumn(col_index) |
| 1430 .InnermostColOrColGroup()) { | 1437 .InnermostColOrColGroup()) { |
| 1431 const BorderValue& gb = side == kBorderStart ? col->Style()->BorderStart() | 1438 const BorderValue& gb = side == kBorderStart ? col->Style()->BorderStart() |
| 1432 : col->Style()->BorderEnd(); | 1439 : col->Style()->BorderEnd(); |
| 1433 if (gb.Style() == EBorderStyle::kHidden) | 1440 if (gb.Style() == EBorderStyle::kHidden) |
| 1434 return -1; | 1441 return -1; |
| 1435 if (gb.Style() > EBorderStyle::kHidden && gb.Width() > border_width) | 1442 if (gb.Style() > EBorderStyle::kHidden && gb.Width() > border_width) |
| 1436 border_width = gb.Width(); | 1443 border_width = gb.Width(); |
| 1437 } | 1444 } |
| 1438 | 1445 |
| 1439 bool all_hidden = true; | 1446 bool all_hidden = true; |
| 1440 for (unsigned r = 0; r < grid_.size(); r++) { | 1447 for (unsigned r = 0; r < grid_.size(); r++) { |
| 1441 if (col_index >= NumCols(r)) | 1448 if (col_index >= NumEffectiveColumns(r)) |
| 1442 continue; | 1449 continue; |
| 1443 const auto& grid_cell = GridCellAt(r, col_index); | 1450 const auto& grid_cell = GridCellAt(r, col_index); |
| 1444 if (!grid_cell.HasCells()) | 1451 if (!grid_cell.HasCells()) |
| 1445 continue; | 1452 continue; |
| 1446 // FIXME: Don't repeat for the same cell | 1453 // FIXME: Don't repeat for the same cell |
| 1447 const ComputedStyle& primary_cell_style = | 1454 const ComputedStyle& primary_cell_style = |
| 1448 grid_cell.PrimaryCell()->StyleRef(); | 1455 grid_cell.PrimaryCell()->StyleRef(); |
| 1449 const ComputedStyle& primary_cell_parent_style = | 1456 const ComputedStyle& primary_cell_parent_style = |
| 1450 grid_cell.PrimaryCell()->Parent()->StyleRef(); | 1457 grid_cell.PrimaryCell()->Parent()->StyleRef(); |
| 1451 // FIXME: Make this work with perpendicular and flipped cells. | 1458 // FIXME: Make this work with perpendicular and flipped cells. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1556 | 1563 |
| 1557 rows.EnsureConsistency(grid_.size()); | 1564 rows.EnsureConsistency(grid_.size()); |
| 1558 columns.EnsureConsistency(Table()->NumEffectiveColumns()); | 1565 columns.EnsureConsistency(Table()->NumEffectiveColumns()); |
| 1559 | 1566 |
| 1560 if (!has_spanning_cells_) | 1567 if (!has_spanning_cells_) |
| 1561 return; | 1568 return; |
| 1562 | 1569 |
| 1563 if (rows.Start() > 0 && rows.Start() < grid_.size()) { | 1570 if (rows.Start() > 0 && rows.Start() < grid_.size()) { |
| 1564 // If there are any cells spanning into the first row, expand |rows| to | 1571 // If there are any cells spanning into the first row, expand |rows| to |
| 1565 // cover the cells. | 1572 // cover the cells. |
| 1566 unsigned n_cols = NumCols(rows.Start()); | 1573 unsigned n_cols = NumEffectiveColumns(rows.Start()); |
| 1567 unsigned smallest_row = rows.Start(); | 1574 unsigned smallest_row = rows.Start(); |
| 1568 for (unsigned c = columns.Start(); c < std::min(columns.End(), n_cols); | 1575 for (unsigned c = columns.Start(); c < std::min(columns.End(), n_cols); |
| 1569 ++c) { | 1576 ++c) { |
| 1570 for (const auto* cell : GridCellAt(rows.Start(), c).Cells()) { | 1577 for (const auto* cell : GridCellAt(rows.Start(), c).Cells()) { |
| 1571 smallest_row = std::min(smallest_row, cell->RowIndex()); | 1578 smallest_row = std::min(smallest_row, cell->RowIndex()); |
| 1572 if (!smallest_row) | 1579 if (!smallest_row) |
| 1573 break; | 1580 break; |
| 1574 } | 1581 } |
| 1575 } | 1582 } |
| 1576 rows = CellSpan(smallest_row, rows.End()); | 1583 rows = CellSpan(smallest_row, rows.End()); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1699 cell = cell->NextCell()) | 1706 cell = cell->NextCell()) |
| 1700 grid_[row_index].UpdateLogicalHeightForCell(cell); | 1707 grid_[row_index].UpdateLogicalHeightForCell(cell); |
| 1701 } | 1708 } |
| 1702 | 1709 |
| 1703 void LayoutTableSection::SetNeedsCellRecalc() { | 1710 void LayoutTableSection::SetNeedsCellRecalc() { |
| 1704 needs_cell_recalc_ = true; | 1711 needs_cell_recalc_ = true; |
| 1705 if (LayoutTable* t = Table()) | 1712 if (LayoutTable* t = Table()) |
| 1706 t->SetNeedsSectionRecalc(); | 1713 t->SetNeedsSectionRecalc(); |
| 1707 } | 1714 } |
| 1708 | 1715 |
| 1709 unsigned LayoutTableSection::NumEffectiveColumns() const { | 1716 unsigned LayoutTableSection::MaxNumEffectiveColumnsOfRows() const { |
| 1710 unsigned result = 0; | 1717 unsigned result = 0; |
| 1711 | 1718 |
| 1712 for (unsigned r = 0; r < grid_.size(); ++r) { | 1719 for (unsigned r = 0; r < grid_.size(); ++r) { |
| 1713 unsigned n_cols = NumCols(r); | 1720 unsigned n_cols = NumEffectiveColumns(r); |
| 1714 for (unsigned c = result; c < n_cols; ++c) { | 1721 for (unsigned c = result; c < n_cols; ++c) { |
| 1715 const auto& grid_cell = GridCellAt(r, c); | 1722 const auto& grid_cell = GridCellAt(r, c); |
| 1716 if (grid_cell.HasCells() || grid_cell.InColSpan()) | 1723 if (grid_cell.HasCells() || grid_cell.InColSpan()) |
| 1717 result = c; | 1724 result = c; |
| 1718 } | 1725 } |
| 1719 } | 1726 } |
| 1720 | 1727 |
| 1721 return result + 1; | 1728 return result + 1; |
| 1722 } | 1729 } |
| 1723 | 1730 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1749 const LayoutTableCell* LayoutTableSection::FirstRowCellAdjoiningTableEnd() | 1756 const LayoutTableCell* LayoutTableSection::FirstRowCellAdjoiningTableEnd() |
| 1750 const { | 1757 const { |
| 1751 unsigned adjoining_end_cell_column_index = | 1758 unsigned adjoining_end_cell_column_index = |
| 1752 HasSameDirectionAs(Table()) ? Table()->LastEffectiveColumnIndex() : 0; | 1759 HasSameDirectionAs(Table()) ? Table()->LastEffectiveColumnIndex() : 0; |
| 1753 return PrimaryCellAt(0, adjoining_end_cell_column_index); | 1760 return PrimaryCellAt(0, adjoining_end_cell_column_index); |
| 1754 } | 1761 } |
| 1755 | 1762 |
| 1756 LayoutTableCell* LayoutTableSection::OriginatingCellAt( | 1763 LayoutTableCell* LayoutTableSection::OriginatingCellAt( |
| 1757 unsigned row, | 1764 unsigned row, |
| 1758 unsigned effective_column) { | 1765 unsigned effective_column) { |
| 1759 if (effective_column >= NumCols(row)) | 1766 if (effective_column >= NumEffectiveColumns(row)) |
| 1760 return nullptr; | 1767 return nullptr; |
| 1761 auto& grid_cell = GridCellAt(row, effective_column); | 1768 auto& grid_cell = GridCellAt(row, effective_column); |
| 1762 if (grid_cell.InColSpan()) | 1769 if (grid_cell.InColSpan()) |
| 1763 return nullptr; | 1770 return nullptr; |
| 1764 if (auto* cell = grid_cell.PrimaryCell()) { | 1771 if (auto* cell = grid_cell.PrimaryCell()) { |
| 1765 if (cell->RowIndex() == row) | 1772 if (cell->RowIndex() == row) |
| 1766 return cell; | 1773 return cell; |
| 1767 } | 1774 } |
| 1768 return nullptr; | 1775 return nullptr; |
| 1769 } | 1776 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1845 hit_test_rect.MoveBy(-adjusted_location); | 1852 hit_test_rect.MoveBy(-adjusted_location); |
| 1846 | 1853 |
| 1847 LayoutRect table_aligned_rect = | 1854 LayoutRect table_aligned_rect = |
| 1848 LogicalRectForWritingModeAndDirection(hit_test_rect); | 1855 LogicalRectForWritingModeAndDirection(hit_test_rect); |
| 1849 CellSpan row_span = SpannedRows(table_aligned_rect); | 1856 CellSpan row_span = SpannedRows(table_aligned_rect); |
| 1850 CellSpan column_span = SpannedEffectiveColumns(table_aligned_rect); | 1857 CellSpan column_span = SpannedEffectiveColumns(table_aligned_rect); |
| 1851 | 1858 |
| 1852 // Now iterate over the spanned rows and columns. | 1859 // Now iterate over the spanned rows and columns. |
| 1853 for (unsigned hit_row = row_span.Start(); hit_row < row_span.End(); | 1860 for (unsigned hit_row = row_span.Start(); hit_row < row_span.End(); |
| 1854 ++hit_row) { | 1861 ++hit_row) { |
| 1855 unsigned n_cols = NumCols(hit_row); | 1862 unsigned n_cols = NumEffectiveColumns(hit_row); |
| 1856 for (unsigned hit_column = column_span.Start(); | 1863 for (unsigned hit_column = column_span.Start(); |
| 1857 hit_column < n_cols && hit_column < column_span.End(); ++hit_column) { | 1864 hit_column < n_cols && hit_column < column_span.End(); ++hit_column) { |
| 1858 auto& grid_cell = GridCellAt(hit_row, hit_column); | 1865 auto& grid_cell = GridCellAt(hit_row, hit_column); |
| 1859 | 1866 |
| 1860 // If the cell is empty, there's nothing to do | 1867 // If the cell is empty, there's nothing to do |
| 1861 if (!grid_cell.HasCells()) | 1868 if (!grid_cell.HasCells()) |
| 1862 continue; | 1869 continue; |
| 1863 | 1870 |
| 1864 for (unsigned i = grid_cell.Cells().size(); i;) { | 1871 for (unsigned i = grid_cell.Cells().size(); i;) { |
| 1865 --i; | 1872 --i; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1899 unsigned effective_column) const { | 1906 unsigned effective_column) const { |
| 1900 LayoutPoint cell_location(0, row_pos_[cell->RowIndex()]); | 1907 LayoutPoint cell_location(0, row_pos_[cell->RowIndex()]); |
| 1901 int horizontal_border_spacing = Table()->HBorderSpacing(); | 1908 int horizontal_border_spacing = Table()->HBorderSpacing(); |
| 1902 | 1909 |
| 1903 // FIXME: The table's direction should determine our row's direction, not the | 1910 // FIXME: The table's direction should determine our row's direction, not the |
| 1904 // section's (see bug 96691). | 1911 // section's (see bug 96691). |
| 1905 if (!Style()->IsLeftToRightDirection()) | 1912 if (!Style()->IsLeftToRightDirection()) |
| 1906 cell_location.SetX(LayoutUnit( | 1913 cell_location.SetX(LayoutUnit( |
| 1907 Table()->EffectiveColumnPositions()[Table()->NumEffectiveColumns()] - | 1914 Table()->EffectiveColumnPositions()[Table()->NumEffectiveColumns()] - |
| 1908 Table()->EffectiveColumnPositions() | 1915 Table()->EffectiveColumnPositions() |
| 1909 [Table()->AbsoluteColumnToEffectiveColumn( | 1916 [cell->EffectiveColumnIndexOfCellAfter()] + |
| 1910 cell->AbsoluteColumnIndex() + cell->ColSpan())] + | |
| 1911 horizontal_border_spacing)); | 1917 horizontal_border_spacing)); |
| 1912 else | 1918 else |
| 1913 cell_location.SetX( | 1919 cell_location.SetX( |
| 1914 LayoutUnit(Table()->EffectiveColumnPositions()[effective_column] + | 1920 LayoutUnit(Table()->EffectiveColumnPositions()[effective_column] + |
| 1915 horizontal_border_spacing)); | 1921 horizontal_border_spacing)); |
| 1916 | 1922 |
| 1917 cell->SetLogicalLocation(cell_location); | 1923 cell->SetLogicalLocation(cell_location); |
| 1918 } | 1924 } |
| 1919 | 1925 |
| 1920 void LayoutTableSection::RelayoutCellIfFlexed(LayoutTableCell& cell, | 1926 void LayoutTableSection::RelayoutCellIfFlexed(LayoutTableCell& cell, |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2120 rect.SetHeight(Table()->LogicalHeight()); | 2126 rect.SetHeight(Table()->LogicalHeight()); |
| 2121 transform_state.SetQuad(FloatQuad(rect)); | 2127 transform_state.SetQuad(FloatQuad(rect)); |
| 2122 } | 2128 } |
| 2123 return LayoutTableBoxComponent::MapToVisualRectInAncestorSpaceInternal( | 2129 return LayoutTableBoxComponent::MapToVisualRectInAncestorSpaceInternal( |
| 2124 ancestor, transform_state, flags); | 2130 ancestor, transform_state, flags); |
| 2125 } | 2131 } |
| 2126 | 2132 |
| 2127 bool LayoutTableSection::PaintedOutputOfObjectHasNoEffectRegardlessOfSize() | 2133 bool LayoutTableSection::PaintedOutputOfObjectHasNoEffectRegardlessOfSize() |
| 2128 const { | 2134 const { |
| 2129 // LayoutTableSection paints background from columns. | 2135 // LayoutTableSection paints background from columns. |
| 2130 if (Table()->HasColElements()) | 2136 if (Table()->HasColOrColGroups()) |
| 2131 return false; | 2137 return false; |
| 2132 return LayoutTableBoxComponent:: | 2138 return LayoutTableBoxComponent:: |
| 2133 PaintedOutputOfObjectHasNoEffectRegardlessOfSize(); | 2139 PaintedOutputOfObjectHasNoEffectRegardlessOfSize(); |
| 2134 } | 2140 } |
| 2135 | 2141 |
| 2136 } // namespace blink | 2142 } // namespace blink |
| OLD | NEW |