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