| 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 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1345 | 1345 |
| 1346 int LayoutTableSection::CalcBlockDirectionOuterBorder( | 1346 int LayoutTableSection::CalcBlockDirectionOuterBorder( |
| 1347 BlockBorderSide side) const { | 1347 BlockBorderSide side) const { |
| 1348 if (!grid_.size() || !Table()->NumEffectiveColumns()) | 1348 if (!grid_.size() || !Table()->NumEffectiveColumns()) |
| 1349 return 0; | 1349 return 0; |
| 1350 | 1350 |
| 1351 int border_width = 0; | 1351 int border_width = 0; |
| 1352 | 1352 |
| 1353 const BorderValue& sb = | 1353 const BorderValue& sb = |
| 1354 side == kBorderBefore ? Style()->BorderBefore() : Style()->BorderAfter(); | 1354 side == kBorderBefore ? Style()->BorderBefore() : Style()->BorderAfter(); |
| 1355 if (sb.Style() == kBorderStyleHidden) | 1355 if (sb.Style() == EBorderStyle::kHidden) |
| 1356 return -1; | 1356 return -1; |
| 1357 if (sb.Style() > kBorderStyleHidden) | 1357 if (sb.Style() > EBorderStyle::kHidden) |
| 1358 border_width = sb.Width(); | 1358 border_width = sb.Width(); |
| 1359 | 1359 |
| 1360 const BorderValue& rb = side == kBorderBefore | 1360 const BorderValue& rb = side == kBorderBefore |
| 1361 ? FirstRow()->Style()->BorderBefore() | 1361 ? FirstRow()->Style()->BorderBefore() |
| 1362 : LastRow()->Style()->BorderAfter(); | 1362 : LastRow()->Style()->BorderAfter(); |
| 1363 if (rb.Style() == kBorderStyleHidden) | 1363 if (rb.Style() == EBorderStyle::kHidden) |
| 1364 return -1; | 1364 return -1; |
| 1365 if (rb.Style() > kBorderStyleHidden && rb.Width() > border_width) | 1365 if (rb.Style() > EBorderStyle::kHidden && rb.Width() > border_width) |
| 1366 border_width = rb.Width(); | 1366 border_width = rb.Width(); |
| 1367 | 1367 |
| 1368 bool all_hidden = true; | 1368 bool all_hidden = true; |
| 1369 unsigned r = side == kBorderBefore ? 0 : grid_.size() - 1; | 1369 unsigned r = side == kBorderBefore ? 0 : grid_.size() - 1; |
| 1370 unsigned n_cols = NumCols(r); | 1370 unsigned n_cols = NumCols(r); |
| 1371 for (unsigned c = 0; c < n_cols; c++) { | 1371 for (unsigned c = 0; c < n_cols; c++) { |
| 1372 const auto& grid_cell = GridCellAt(r, c); | 1372 const auto& grid_cell = GridCellAt(r, c); |
| 1373 if (grid_cell.InColSpan() || !grid_cell.HasCells()) | 1373 if (grid_cell.InColSpan() || !grid_cell.HasCells()) |
| 1374 continue; | 1374 continue; |
| 1375 const ComputedStyle& primary_cell_style = | 1375 const ComputedStyle& primary_cell_style = |
| 1376 grid_cell.PrimaryCell()->StyleRef(); | 1376 grid_cell.PrimaryCell()->StyleRef(); |
| 1377 // FIXME: Make this work with perpendicular and flipped cells. | 1377 // FIXME: Make this work with perpendicular and flipped cells. |
| 1378 const BorderValue& cb = side == kBorderBefore | 1378 const BorderValue& cb = side == kBorderBefore |
| 1379 ? primary_cell_style.BorderBefore() | 1379 ? primary_cell_style.BorderBefore() |
| 1380 : primary_cell_style.BorderAfter(); | 1380 : primary_cell_style.BorderAfter(); |
| 1381 // FIXME: Don't repeat for the same col group | 1381 // FIXME: Don't repeat for the same col group |
| 1382 LayoutTableCol* col = | 1382 LayoutTableCol* col = |
| 1383 Table()->ColElementAtAbsoluteColumn(c).InnermostColOrColGroup(); | 1383 Table()->ColElementAtAbsoluteColumn(c).InnermostColOrColGroup(); |
| 1384 if (col) { | 1384 if (col) { |
| 1385 const BorderValue& gb = side == kBorderBefore | 1385 const BorderValue& gb = side == kBorderBefore |
| 1386 ? col->Style()->BorderBefore() | 1386 ? col->Style()->BorderBefore() |
| 1387 : col->Style()->BorderAfter(); | 1387 : col->Style()->BorderAfter(); |
| 1388 if (gb.Style() == kBorderStyleHidden || cb.Style() == kBorderStyleHidden) | 1388 if (gb.Style() == EBorderStyle::kHidden || |
| 1389 cb.Style() == EBorderStyle::kHidden) |
| 1389 continue; | 1390 continue; |
| 1390 all_hidden = false; | 1391 all_hidden = false; |
| 1391 if (gb.Style() > kBorderStyleHidden && gb.Width() > border_width) | 1392 if (gb.Style() > EBorderStyle::kHidden && gb.Width() > border_width) |
| 1392 border_width = gb.Width(); | 1393 border_width = gb.Width(); |
| 1393 if (cb.Style() > kBorderStyleHidden && cb.Width() > border_width) | 1394 if (cb.Style() > EBorderStyle::kHidden && cb.Width() > border_width) |
| 1394 border_width = cb.Width(); | 1395 border_width = cb.Width(); |
| 1395 } else { | 1396 } else { |
| 1396 if (cb.Style() == kBorderStyleHidden) | 1397 if (cb.Style() == EBorderStyle::kHidden) |
| 1397 continue; | 1398 continue; |
| 1398 all_hidden = false; | 1399 all_hidden = false; |
| 1399 if (cb.Style() > kBorderStyleHidden && cb.Width() > border_width) | 1400 if (cb.Style() > EBorderStyle::kHidden && cb.Width() > border_width) |
| 1400 border_width = cb.Width(); | 1401 border_width = cb.Width(); |
| 1401 } | 1402 } |
| 1402 } | 1403 } |
| 1403 if (all_hidden) | 1404 if (all_hidden) |
| 1404 return -1; | 1405 return -1; |
| 1405 | 1406 |
| 1406 if (side == kBorderAfter) | 1407 if (side == kBorderAfter) |
| 1407 border_width++; // Distribute rounding error | 1408 border_width++; // Distribute rounding error |
| 1408 return border_width / 2; | 1409 return border_width / 2; |
| 1409 } | 1410 } |
| 1410 | 1411 |
| 1411 int LayoutTableSection::CalcInlineDirectionOuterBorder( | 1412 int LayoutTableSection::CalcInlineDirectionOuterBorder( |
| 1412 InlineBorderSide side) const { | 1413 InlineBorderSide side) const { |
| 1413 unsigned total_cols = Table()->NumEffectiveColumns(); | 1414 unsigned total_cols = Table()->NumEffectiveColumns(); |
| 1414 if (!grid_.size() || !total_cols) | 1415 if (!grid_.size() || !total_cols) |
| 1415 return 0; | 1416 return 0; |
| 1416 unsigned col_index = side == kBorderStart ? 0 : total_cols - 1; | 1417 unsigned col_index = side == kBorderStart ? 0 : total_cols - 1; |
| 1417 | 1418 |
| 1418 int border_width = 0; | 1419 int border_width = 0; |
| 1419 | 1420 |
| 1420 const BorderValue& sb = | 1421 const BorderValue& sb = |
| 1421 side == kBorderStart ? Style()->BorderStart() : Style()->BorderEnd(); | 1422 side == kBorderStart ? Style()->BorderStart() : Style()->BorderEnd(); |
| 1422 if (sb.Style() == kBorderStyleHidden) | 1423 if (sb.Style() == EBorderStyle::kHidden) |
| 1423 return -1; | 1424 return -1; |
| 1424 if (sb.Style() > kBorderStyleHidden) | 1425 if (sb.Style() > EBorderStyle::kHidden) |
| 1425 border_width = sb.Width(); | 1426 border_width = sb.Width(); |
| 1426 | 1427 |
| 1427 if (LayoutTableCol* col = Table() | 1428 if (LayoutTableCol* col = Table() |
| 1428 ->ColElementAtAbsoluteColumn(col_index) | 1429 ->ColElementAtAbsoluteColumn(col_index) |
| 1429 .InnermostColOrColGroup()) { | 1430 .InnermostColOrColGroup()) { |
| 1430 const BorderValue& gb = side == kBorderStart ? col->Style()->BorderStart() | 1431 const BorderValue& gb = side == kBorderStart ? col->Style()->BorderStart() |
| 1431 : col->Style()->BorderEnd(); | 1432 : col->Style()->BorderEnd(); |
| 1432 if (gb.Style() == kBorderStyleHidden) | 1433 if (gb.Style() == EBorderStyle::kHidden) |
| 1433 return -1; | 1434 return -1; |
| 1434 if (gb.Style() > kBorderStyleHidden && gb.Width() > border_width) | 1435 if (gb.Style() > EBorderStyle::kHidden && gb.Width() > border_width) |
| 1435 border_width = gb.Width(); | 1436 border_width = gb.Width(); |
| 1436 } | 1437 } |
| 1437 | 1438 |
| 1438 bool all_hidden = true; | 1439 bool all_hidden = true; |
| 1439 for (unsigned r = 0; r < grid_.size(); r++) { | 1440 for (unsigned r = 0; r < grid_.size(); r++) { |
| 1440 if (col_index >= NumCols(r)) | 1441 if (col_index >= NumCols(r)) |
| 1441 continue; | 1442 continue; |
| 1442 const auto& grid_cell = GridCellAt(r, col_index); | 1443 const auto& grid_cell = GridCellAt(r, col_index); |
| 1443 if (!grid_cell.HasCells()) | 1444 if (!grid_cell.HasCells()) |
| 1444 continue; | 1445 continue; |
| 1445 // FIXME: Don't repeat for the same cell | 1446 // FIXME: Don't repeat for the same cell |
| 1446 const ComputedStyle& primary_cell_style = | 1447 const ComputedStyle& primary_cell_style = |
| 1447 grid_cell.PrimaryCell()->StyleRef(); | 1448 grid_cell.PrimaryCell()->StyleRef(); |
| 1448 const ComputedStyle& primary_cell_parent_style = | 1449 const ComputedStyle& primary_cell_parent_style = |
| 1449 grid_cell.PrimaryCell()->Parent()->StyleRef(); | 1450 grid_cell.PrimaryCell()->Parent()->StyleRef(); |
| 1450 // FIXME: Make this work with perpendicular and flipped cells. | 1451 // FIXME: Make this work with perpendicular and flipped cells. |
| 1451 const BorderValue& cb = side == kBorderStart | 1452 const BorderValue& cb = side == kBorderStart |
| 1452 ? primary_cell_style.BorderStart() | 1453 ? primary_cell_style.BorderStart() |
| 1453 : primary_cell_style.BorderEnd(); | 1454 : primary_cell_style.BorderEnd(); |
| 1454 const BorderValue& rb = side == kBorderStart | 1455 const BorderValue& rb = side == kBorderStart |
| 1455 ? primary_cell_parent_style.BorderStart() | 1456 ? primary_cell_parent_style.BorderStart() |
| 1456 : primary_cell_parent_style.BorderEnd(); | 1457 : primary_cell_parent_style.BorderEnd(); |
| 1457 if (cb.Style() == kBorderStyleHidden || rb.Style() == kBorderStyleHidden) | 1458 if (cb.Style() == EBorderStyle::kHidden || |
| 1459 rb.Style() == EBorderStyle::kHidden) |
| 1458 continue; | 1460 continue; |
| 1459 all_hidden = false; | 1461 all_hidden = false; |
| 1460 if (cb.Style() > kBorderStyleHidden && cb.Width() > border_width) | 1462 if (cb.Style() > EBorderStyle::kHidden && cb.Width() > border_width) |
| 1461 border_width = cb.Width(); | 1463 border_width = cb.Width(); |
| 1462 if (rb.Style() > kBorderStyleHidden && rb.Width() > border_width) | 1464 if (rb.Style() > EBorderStyle::kHidden && rb.Width() > border_width) |
| 1463 border_width = rb.Width(); | 1465 border_width = rb.Width(); |
| 1464 } | 1466 } |
| 1465 if (all_hidden) | 1467 if (all_hidden) |
| 1466 return -1; | 1468 return -1; |
| 1467 | 1469 |
| 1468 if ((side == kBorderStart) != Table()->Style()->IsLeftToRightDirection()) | 1470 if ((side == kBorderStart) != Table()->Style()->IsLeftToRightDirection()) |
| 1469 border_width++; // Distribute rounding error | 1471 border_width++; // Distribute rounding error |
| 1470 return border_width / 2; | 1472 return border_width / 2; |
| 1471 } | 1473 } |
| 1472 | 1474 |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2139 bool LayoutTableSection::PaintedOutputOfObjectHasNoEffectRegardlessOfSize() | 2141 bool LayoutTableSection::PaintedOutputOfObjectHasNoEffectRegardlessOfSize() |
| 2140 const { | 2142 const { |
| 2141 // LayoutTableSection paints background from columns. | 2143 // LayoutTableSection paints background from columns. |
| 2142 if (Table()->HasColElements()) | 2144 if (Table()->HasColElements()) |
| 2143 return false; | 2145 return false; |
| 2144 return LayoutTableBoxComponent:: | 2146 return LayoutTableBoxComponent:: |
| 2145 PaintedOutputOfObjectHasNoEffectRegardlessOfSize(); | 2147 PaintedOutputOfObjectHasNoEffectRegardlessOfSize(); |
| 2146 } | 2148 } |
| 2147 | 2149 |
| 2148 } // namespace blink | 2150 } // namespace blink |
| OLD | NEW |