Chromium Code Reviews| 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 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1343 } | 1343 } |
| 1344 } | 1344 } |
| 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 EBorderStyle sbs = side == kBorderBefore ? Style()->BorderBeforeStyle() |
|
rune
2017/05/31 09:02:02
Could we use some more descriptive variable names
nainar
2017/05/31 09:31:57
I can try. Some suggestions:
sbs -> style_border
rune
2017/05/31 11:02:09
I think the s is for section (as in LayoutTableSec
nainar
2017/05/31 12:32:48
Done.
| |
| 1354 side == kBorderBefore ? Style()->BorderBefore() : Style()->BorderAfter(); | 1354 : Style()->BorderAfterStyle(); |
| 1355 if (sb.Style() == EBorderStyle::kHidden) | 1355 if (sbs == EBorderStyle::kHidden) |
| 1356 return -1; | 1356 return -1; |
| 1357 if (ComputedStyle::BorderStyleIsVisible(sb.Style())) | 1357 if (ComputedStyle::BorderStyleIsVisible(sbs)) { |
| 1358 border_width = sb.Width(); | 1358 border_width = side == kBorderBefore ? Style()->BorderBeforeWidth() |
| 1359 : Style()->BorderAfterWidth(); | |
| 1360 } | |
| 1359 | 1361 |
| 1360 const BorderValue& rb = side == kBorderBefore | 1362 EBorderStyle rbs = side == kBorderBefore |
|
nainar
2017/05/31 09:31:56
rbs -> row_border_style
nainar
2017/05/31 09:31:56
rbs -> row_border_style
rune
2017/05/31 11:02:10
Acknowledged.
nainar
2017/05/31 12:32:48
Done.
| |
| 1361 ? FirstRow()->Style()->BorderBefore() | 1363 ? FirstRow()->Style()->BorderBeforeStyle() |
| 1362 : LastRow()->Style()->BorderAfter(); | 1364 : LastRow()->Style()->BorderAfterStyle(); |
| 1363 if (rb.Style() == EBorderStyle::kHidden) | 1365 float rbw = side == kBorderBefore ? FirstRow()->Style()->BorderBeforeWidth() |
|
nainar
2017/05/31 09:31:56
rbw -> row_border_width
rune
2017/05/31 11:02:10
Acknowledged.
nainar
2017/05/31 12:32:48
Done
| |
| 1366 : LastRow()->Style()->BorderAfterWidth(); | |
| 1367 if (rbs == EBorderStyle::kHidden) | |
| 1364 return -1; | 1368 return -1; |
| 1365 if (ComputedStyle::BorderStyleIsVisible(rb.Style()) && | 1369 if (ComputedStyle::BorderStyleIsVisible(rbs) && rbw > border_width) |
| 1366 rb.Width() > border_width) | 1370 border_width = rbw; |
| 1367 border_width = rb.Width(); | |
| 1368 | |
| 1369 bool all_hidden = true; | 1371 bool all_hidden = true; |
| 1370 unsigned r = side == kBorderBefore ? 0 : grid_.size() - 1; | 1372 unsigned r = side == kBorderBefore ? 0 : grid_.size() - 1; |
| 1371 unsigned n_cols = NumCols(r); | 1373 unsigned n_cols = NumCols(r); |
| 1372 for (unsigned c = 0; c < n_cols; c++) { | 1374 for (unsigned c = 0; c < n_cols; c++) { |
| 1373 const auto& grid_cell = GridCellAt(r, c); | 1375 const auto& grid_cell = GridCellAt(r, c); |
| 1374 if (grid_cell.InColSpan() || !grid_cell.HasCells()) | 1376 if (grid_cell.InColSpan() || !grid_cell.HasCells()) |
| 1375 continue; | 1377 continue; |
| 1376 const ComputedStyle& primary_cell_style = | 1378 const ComputedStyle& primary_cell_style = |
| 1377 grid_cell.PrimaryCell()->StyleRef(); | 1379 grid_cell.PrimaryCell()->StyleRef(); |
| 1378 // FIXME: Make this work with perpendicular and flipped cells. | 1380 // FIXME: Make this work with perpendicular and flipped cells. |
| 1379 const BorderValue& cb = side == kBorderBefore | 1381 EBorderStyle cbs = side == kBorderBefore |
|
nainar
2017/05/31 09:31:56
cbs -> cell_border_style
rune
2017/05/31 11:02:09
Acknowledged.
nainar
2017/05/31 12:32:49
Done
| |
| 1380 ? primary_cell_style.BorderBefore() | 1382 ? primary_cell_style.BorderBeforeStyle() |
| 1381 : primary_cell_style.BorderAfter(); | 1383 : primary_cell_style.BorderAfterStyle(); |
| 1384 float cbw = side == kBorderBefore ? primary_cell_style.BorderBeforeWidth() | |
|
nainar
2017/05/31 09:31:56
cbw -> cell_border_width
rune
2017/05/31 11:02:09
Acknowledged.
nainar
2017/05/31 12:32:48
Done.
| |
| 1385 : primary_cell_style.BorderAfterWidth(); | |
| 1382 // FIXME: Don't repeat for the same col group | 1386 // FIXME: Don't repeat for the same col group |
| 1383 LayoutTableCol* col = | 1387 LayoutTableCol* col = |
| 1384 Table()->ColElementAtAbsoluteColumn(c).InnermostColOrColGroup(); | 1388 Table()->ColElementAtAbsoluteColumn(c).InnermostColOrColGroup(); |
| 1385 if (col) { | 1389 if (col) { |
| 1386 const BorderValue& gb = side == kBorderBefore | 1390 EBorderStyle gbs = side == kBorderBefore |
|
nainar
2017/05/31 09:31:56
gbs -> col_border_style
rune
2017/05/31 11:02:10
Acknowledged.
nainar
2017/05/31 12:32:48
Done
| |
| 1387 ? col->Style()->BorderBefore() | 1391 ? col->Style()->BorderBeforeStyle() |
| 1388 : col->Style()->BorderAfter(); | 1392 : col->Style()->BorderAfterStyle(); |
| 1389 if (gb.Style() == EBorderStyle::kHidden || | 1393 const float gbw = side == kBorderBefore |
|
nainar
2017/05/31 09:31:56
gbw -> col_border_width
rune
2017/05/31 11:02:09
Acknowledged.
nainar
2017/05/31 12:32:48
Done.
| |
| 1390 cb.Style() == EBorderStyle::kHidden) | 1394 ? col->Style()->BorderBeforeWidth() |
| 1395 : col->Style()->BorderAfterWidth(); | |
| 1396 if (gbs == EBorderStyle::kHidden || cbs == EBorderStyle::kHidden) | |
| 1391 continue; | 1397 continue; |
| 1392 all_hidden = false; | 1398 all_hidden = false; |
| 1393 if (ComputedStyle::BorderStyleIsVisible(gb.Style()) && | 1399 if (ComputedStyle::BorderStyleIsVisible(gbs) && gbw > border_width) |
| 1394 gb.Width() > border_width) | 1400 border_width = gbw; |
| 1395 border_width = gb.Width(); | 1401 if (ComputedStyle::BorderStyleIsVisible(cbs) && cbw > border_width) |
| 1396 if (ComputedStyle::BorderStyleIsVisible(cb.Style()) && | 1402 border_width = cbw; |
| 1397 cb.Width() > border_width) | |
| 1398 border_width = cb.Width(); | |
| 1399 } else { | 1403 } else { |
| 1400 if (cb.Style() == EBorderStyle::kHidden) | 1404 if (cbs == EBorderStyle::kHidden) |
| 1401 continue; | 1405 continue; |
| 1402 all_hidden = false; | 1406 all_hidden = false; |
| 1403 if (ComputedStyle::BorderStyleIsVisible(cb.Style()) && | 1407 if (ComputedStyle::BorderStyleIsVisible(cbs) && cbw > border_width) |
| 1404 cb.Width() > border_width) | 1408 border_width = cbw; |
| 1405 border_width = cb.Width(); | |
| 1406 } | 1409 } |
| 1407 } | 1410 } |
| 1408 if (all_hidden) | 1411 if (all_hidden) |
| 1409 return -1; | 1412 return -1; |
| 1410 | 1413 |
| 1411 if (side == kBorderAfter) | 1414 if (side == kBorderAfter) |
| 1412 border_width++; // Distribute rounding error | 1415 border_width++; // Distribute rounding error |
| 1413 return border_width / 2; | 1416 return border_width / 2; |
| 1414 } | 1417 } |
| 1415 | 1418 |
| 1416 int LayoutTableSection::CalcInlineDirectionOuterBorder( | 1419 int LayoutTableSection::CalcInlineDirectionOuterBorder( |
| 1417 InlineBorderSide side) const { | 1420 InlineBorderSide side) const { |
| 1418 unsigned total_cols = Table()->NumEffectiveColumns(); | 1421 unsigned total_cols = Table()->NumEffectiveColumns(); |
| 1419 if (!grid_.size() || !total_cols) | 1422 if (!grid_.size() || !total_cols) |
| 1420 return 0; | 1423 return 0; |
| 1421 unsigned col_index = side == kBorderStart ? 0 : total_cols - 1; | 1424 unsigned col_index = side == kBorderStart ? 0 : total_cols - 1; |
| 1422 | 1425 |
| 1423 int border_width = 0; | 1426 int border_width = 0; |
| 1424 | 1427 |
| 1425 const BorderValue& sb = | 1428 EBorderStyle sbs = side == kBorderStart ? Style()->BorderStartStyle() |
|
nainar
2017/05/31 09:31:56
sbs -> style_border_style
rune
2017/05/31 11:02:09
section_border_style?
nainar
2017/05/31 12:32:48
Done.
| |
| 1426 side == kBorderStart ? Style()->BorderStart() : Style()->BorderEnd(); | 1429 : Style()->BorderEndStyle(); |
| 1427 if (sb.Style() == EBorderStyle::kHidden) | 1430 const float sbw = side == kBorderStart ? Style()->BorderStartWidth() |
|
nainar
2017/05/31 09:31:56
sbw -> style_border_width
rune
2017/05/31 11:02:09
section_border_width?
nainar
2017/05/31 12:32:49
Done
| |
| 1431 : Style()->BorderEndWidth(); | |
| 1432 if (sbs == EBorderStyle::kHidden) | |
| 1428 return -1; | 1433 return -1; |
| 1429 if (ComputedStyle::BorderStyleIsVisible(sb.Style())) | 1434 if (ComputedStyle::BorderStyleIsVisible(sbs)) |
| 1430 border_width = sb.Width(); | 1435 border_width = sbw; |
| 1431 | 1436 |
| 1432 if (LayoutTableCol* col = Table() | 1437 if (LayoutTableCol* col = Table() |
| 1433 ->ColElementAtAbsoluteColumn(col_index) | 1438 ->ColElementAtAbsoluteColumn(col_index) |
| 1434 .InnermostColOrColGroup()) { | 1439 .InnermostColOrColGroup()) { |
| 1435 const BorderValue& gb = side == kBorderStart ? col->Style()->BorderStart() | 1440 EBorderStyle gbs = side == kBorderStart ? col->Style()->BorderStartStyle() |
|
nainar
2017/05/31 09:31:56
gbs -> col_border_style
rune
2017/05/31 11:02:09
Acknowledged.
nainar
2017/05/31 12:32:48
Done.
| |
| 1436 : col->Style()->BorderEnd(); | 1441 : col->Style()->BorderEndStyle(); |
| 1437 if (gb.Style() == EBorderStyle::kHidden) | 1442 const float gbw = side == kBorderStart ? col->Style()->BorderStartWidth() |
|
nainar
2017/05/31 09:31:56
gbw -> col_border_width
rune
2017/05/31 11:02:09
Acknowledged.
nainar
2017/05/31 12:32:48
Done
| |
| 1443 : col->Style()->BorderEndWidth(); | |
| 1444 if (gbs == EBorderStyle::kHidden) | |
| 1438 return -1; | 1445 return -1; |
| 1439 if (ComputedStyle::BorderStyleIsVisible(gb.Style()) && | 1446 if (ComputedStyle::BorderStyleIsVisible(gbs) && gbw > border_width) |
| 1440 gb.Width() > border_width) | 1447 border_width = gbw; |
| 1441 border_width = gb.Width(); | |
| 1442 } | 1448 } |
| 1443 | 1449 |
| 1444 bool all_hidden = true; | 1450 bool all_hidden = true; |
| 1445 for (unsigned r = 0; r < grid_.size(); r++) { | 1451 for (unsigned r = 0; r < grid_.size(); r++) { |
| 1446 if (col_index >= NumCols(r)) | 1452 if (col_index >= NumCols(r)) |
| 1447 continue; | 1453 continue; |
| 1448 const auto& grid_cell = GridCellAt(r, col_index); | 1454 const auto& grid_cell = GridCellAt(r, col_index); |
| 1449 if (!grid_cell.HasCells()) | 1455 if (!grid_cell.HasCells()) |
| 1450 continue; | 1456 continue; |
| 1451 // FIXME: Don't repeat for the same cell | 1457 // FIXME: Don't repeat for the same cell |
| 1452 const ComputedStyle& primary_cell_style = | 1458 const ComputedStyle& primary_cell_style = |
| 1453 grid_cell.PrimaryCell()->StyleRef(); | 1459 grid_cell.PrimaryCell()->StyleRef(); |
| 1454 const ComputedStyle& primary_cell_parent_style = | 1460 const ComputedStyle& primary_cell_parent_style = |
| 1455 grid_cell.PrimaryCell()->Parent()->StyleRef(); | 1461 grid_cell.PrimaryCell()->Parent()->StyleRef(); |
| 1456 // FIXME: Make this work with perpendicular and flipped cells. | 1462 // FIXME: Make this work with perpendicular and flipped cells. |
| 1457 const BorderValue& cb = side == kBorderStart | 1463 EBorderStyle cbs = side == kBorderStart |
|
nainar
2017/05/31 09:31:56
cbs -> cell_border_style
rune
2017/05/31 11:02:09
Acknowledged.
nainar
2017/05/31 12:32:48
Done.
| |
| 1458 ? primary_cell_style.BorderStart() | 1464 ? primary_cell_style.BorderStartStyle() |
| 1459 : primary_cell_style.BorderEnd(); | 1465 : primary_cell_style.BorderEndStyle(); |
| 1460 const BorderValue& rb = side == kBorderStart | 1466 EBorderStyle rbs = side == kBorderStart |
|
nainar
2017/05/31 09:31:57
rbs -> cell_parent_border_style
rune
2017/05/31 11:02:09
row_border_style?
nainar
2017/05/31 12:32:48
Done
| |
| 1461 ? primary_cell_parent_style.BorderStart() | 1467 ? primary_cell_parent_style.BorderStartStyle() |
| 1462 : primary_cell_parent_style.BorderEnd(); | 1468 : primary_cell_parent_style.BorderEndStyle(); |
| 1463 if (cb.Style() == EBorderStyle::kHidden || | 1469 const float cbw = side == kBorderStart |
|
nainar
2017/05/31 09:31:56
cbw -> cell_border_width
rune
2017/05/31 11:02:09
Acknowledged.
nainar
2017/05/31 12:32:48
Done
| |
| 1464 rb.Style() == EBorderStyle::kHidden) | 1470 ? primary_cell_style.BorderStartWidth() |
| 1471 : primary_cell_style.BorderEndWidth(); | |
| 1472 const float rbw = side == kBorderStart | |
|
nainar
2017/05/31 09:31:56
rbw -> cell_parent_border_width
rune
2017/05/31 11:02:09
row_border_width?
nainar
2017/05/31 12:32:48
Done
| |
| 1473 ? primary_cell_parent_style.BorderStartWidth() | |
| 1474 : primary_cell_parent_style.BorderEndWidth(); | |
| 1475 if (cbs == EBorderStyle::kHidden || rbs == EBorderStyle::kHidden) | |
| 1465 continue; | 1476 continue; |
| 1466 all_hidden = false; | 1477 all_hidden = false; |
| 1467 if (ComputedStyle::BorderStyleIsVisible(cb.Style()) && | 1478 if (ComputedStyle::BorderStyleIsVisible(cbs) && cbw > border_width) |
| 1468 cb.Width() > border_width) | 1479 border_width = cbw; |
| 1469 border_width = cb.Width(); | 1480 if (ComputedStyle::BorderStyleIsVisible(rbs) && rbw > border_width) |
| 1470 if (ComputedStyle::BorderStyleIsVisible(rb.Style()) && | 1481 border_width = rbw; |
| 1471 rb.Width() > border_width) | |
| 1472 border_width = rb.Width(); | |
| 1473 } | 1482 } |
| 1474 if (all_hidden) | 1483 if (all_hidden) |
| 1475 return -1; | 1484 return -1; |
| 1476 | 1485 |
| 1477 if ((side == kBorderStart) != Table()->Style()->IsLeftToRightDirection()) | 1486 if ((side == kBorderStart) != Table()->Style()->IsLeftToRightDirection()) |
| 1478 border_width++; // Distribute rounding error | 1487 border_width++; // Distribute rounding error |
| 1479 return border_width / 2; | 1488 return border_width / 2; |
| 1480 } | 1489 } |
| 1481 | 1490 |
| 1482 void LayoutTableSection::RecalcOuterBorder() { | 1491 void LayoutTableSection::RecalcOuterBorder() { |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2134 bool LayoutTableSection::PaintedOutputOfObjectHasNoEffectRegardlessOfSize() | 2143 bool LayoutTableSection::PaintedOutputOfObjectHasNoEffectRegardlessOfSize() |
| 2135 const { | 2144 const { |
| 2136 // LayoutTableSection paints background from columns. | 2145 // LayoutTableSection paints background from columns. |
| 2137 if (Table()->HasColElements()) | 2146 if (Table()->HasColElements()) |
| 2138 return false; | 2147 return false; |
| 2139 return LayoutTableBoxComponent:: | 2148 return LayoutTableBoxComponent:: |
| 2140 PaintedOutputOfObjectHasNoEffectRegardlessOfSize(); | 2149 PaintedOutputOfObjectHasNoEffectRegardlessOfSize(); |
| 2141 } | 2150 } |
| 2142 | 2151 |
| 2143 } // namespace blink | 2152 } // namespace blink |
| OLD | NEW |