| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/layout/LayoutTableSection.h" | 5 #include "core/layout/LayoutTableSection.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutTableCell.h" | 7 #include "core/layout/LayoutTableCell.h" |
| 8 #include "core/layout/LayoutTestHelper.h" | 8 #include "core/layout/LayoutTestHelper.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 | 367 |
| 368 // Big sections with too many overflowing cells are forced to use the full | 368 // Big sections with too many overflowing cells are forced to use the full |
| 369 // paint path. | 369 // paint path. |
| 370 EXPECT_TRUE(big_section->HasOverflowingCell()); | 370 EXPECT_TRUE(big_section->HasOverflowingCell()); |
| 371 EXPECT_EQ(0u, big_section->OverflowingCells().size()); | 371 EXPECT_EQ(0u, big_section->OverflowingCells().size()); |
| 372 big_section->DirtiedRowsAndEffectiveColumns(paint_rect, rows, columns); | 372 big_section->DirtiedRowsAndEffectiveColumns(paint_rect, rows, columns); |
| 373 EXPECT_EQ(big_section->FullSectionRowSpan(), rows); | 373 EXPECT_EQ(big_section->FullSectionRowSpan(), rows); |
| 374 EXPECT_EQ(big_section->FullTableEffectiveColumnSpan(), columns); | 374 EXPECT_EQ(big_section->FullTableEffectiveColumnSpan(), columns); |
| 375 } | 375 } |
| 376 | 376 |
| 377 TEST_F(LayoutTableSectionTest, OuterBorder) { | |
| 378 SetBodyInnerHTML( | |
| 379 "<table style='border-collapse: collapse'>" | |
| 380 " <thead id='section1'" | |
| 381 " style='border-top: hidden; border-bottom: 8px solid;" | |
| 382 " border-left: hidden; border-right: 10px solid'>" | |
| 383 " <tr><td>A</td><td>B</td></tr>" | |
| 384 " </thead>" | |
| 385 " <tbody id='section2' style='border: 10px solid'>" | |
| 386 " <tr>" | |
| 387 " <td style='border: hidden'>C</td>" | |
| 388 " <td style='border: hidden'>D</td>" | |
| 389 " </tr>" | |
| 390 " </tbody>" | |
| 391 " <tfoot id='section3' style='border: 10px solid'>" | |
| 392 " <tr>" | |
| 393 " <td style='border-top: 15px solid;" | |
| 394 " border-left: 21px solid'>E</td>" | |
| 395 " <td style='border-bottom: 19px solid;" | |
| 396 " border-right: 25px solid'>F</td>" | |
| 397 " </tr>" | |
| 398 " </tfoot>" | |
| 399 "</table>"); | |
| 400 | |
| 401 auto* section1 = GetSectionByElementId("section1"); | |
| 402 EXPECT_EQ(-1, section1->OuterBorderBefore()); | |
| 403 EXPECT_EQ(4, section1->OuterBorderAfter()); | |
| 404 EXPECT_EQ(-1, section1->OuterBorderStart()); | |
| 405 EXPECT_EQ(5, section1->OuterBorderEnd()); | |
| 406 | |
| 407 // All cells have hidden border. | |
| 408 auto* section2 = GetSectionByElementId("section2"); | |
| 409 EXPECT_EQ(-1, section2->OuterBorderBefore()); | |
| 410 EXPECT_EQ(-1, section2->OuterBorderAfter()); | |
| 411 EXPECT_EQ(-1, section2->OuterBorderStart()); | |
| 412 EXPECT_EQ(-1, section2->OuterBorderEnd()); | |
| 413 | |
| 414 // Cells have wider borders. | |
| 415 auto* section3 = GetSectionByElementId("section3"); | |
| 416 // Cell E's border-top won. | |
| 417 EXPECT_EQ(7, section3->OuterBorderBefore()); | |
| 418 // Cell F's border-bottom won. | |
| 419 EXPECT_EQ(10, section3->OuterBorderAfter()); | |
| 420 // Cell E's border-left won. | |
| 421 EXPECT_EQ(10, section3->OuterBorderStart()); | |
| 422 // Cell F's border-bottom won. | |
| 423 EXPECT_EQ(13, section3->OuterBorderEnd()); | |
| 424 } | |
| 425 | |
| 426 TEST_F(LayoutTableSectionTest, OuterBorderWithCol) { | |
| 427 SetBodyInnerHTML( | |
| 428 "<table style='border-collapse: collapse'>" | |
| 429 " <colgroup>" | |
| 430 " <col colspan='2000' style='border: 10px solid'>" | |
| 431 " <col colspan='2000' style='border: 20px solid'>" | |
| 432 " <thead id='section1' style='border: hidden'>" | |
| 433 " <tr>" | |
| 434 " <td colspan='2000'>A</td>" | |
| 435 " <td colspan='2000'>B</td>" | |
| 436 " </tr>" | |
| 437 " </thead>" | |
| 438 " <tbody id='section2' style='border: 10px solid'>" | |
| 439 " <tr>" | |
| 440 " <td colspan='2000' style='border: hidden'>C</td>" | |
| 441 " <td colspan='2000' style='border: hidden'>D</td>" | |
| 442 " </tr>" | |
| 443 " </tbody>" | |
| 444 " <tfoot id='section3'>" | |
| 445 " <tr>" | |
| 446 " <td colspan='2000' style='border: 12px solid'>E</td>" | |
| 447 " <td colspan='2000' style='border: 16px solid'>F</td>" | |
| 448 " </tr>" | |
| 449 " </tfoot>" | |
| 450 "</table>"); | |
| 451 | |
| 452 // Section has hidden border. | |
| 453 auto* section1 = GetSectionByElementId("section1"); | |
| 454 EXPECT_EQ(-1, section1->OuterBorderBefore()); | |
| 455 EXPECT_EQ(-1, section1->OuterBorderAfter()); | |
| 456 EXPECT_EQ(-1, section1->OuterBorderStart()); | |
| 457 EXPECT_EQ(-1, section1->OuterBorderEnd()); | |
| 458 | |
| 459 // All cells have hidden border. | |
| 460 auto* section2 = GetSectionByElementId("section2"); | |
| 461 EXPECT_EQ(-1, section2->OuterBorderBefore()); | |
| 462 EXPECT_EQ(-1, section2->OuterBorderAfter()); | |
| 463 EXPECT_EQ(-1, section2->OuterBorderStart()); | |
| 464 EXPECT_EQ(-1, section2->OuterBorderEnd()); | |
| 465 | |
| 466 // Combined cell and col borders. | |
| 467 auto* section3 = GetSectionByElementId("section3"); | |
| 468 // This is wrong. Should use cell border instead of the col border. | |
| 469 EXPECT_EQ(10, section3->OuterBorderBefore()); | |
| 470 // Col 2's border-bottom won. | |
| 471 EXPECT_EQ(10, section3->OuterBorderAfter()); | |
| 472 // Cell E's border-left won. | |
| 473 EXPECT_EQ(6, section3->OuterBorderStart()); | |
| 474 // Col 2's border-right won. | |
| 475 EXPECT_EQ(10, section3->OuterBorderEnd()); | |
| 476 } | |
| 477 | |
| 478 } // anonymous namespace | 377 } // anonymous namespace |
| 479 | 378 |
| 480 } // namespace blink | 379 } // namespace blink |
| OLD | NEW |