Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/LayoutTableSectionTest.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/LayoutTableSectionTest.cpp b/third_party/WebKit/Source/core/layout/LayoutTableSectionTest.cpp |
| index 905b8a1236a2fc34d647dd479212e89d6ae46a17..42b54ee75557605b398d5ac08aaac27fb2c1f97f 100644 |
| --- a/third_party/WebKit/Source/core/layout/LayoutTableSectionTest.cpp |
| +++ b/third_party/WebKit/Source/core/layout/LayoutTableSectionTest.cpp |
| @@ -11,7 +11,12 @@ namespace blink { |
| namespace { |
| -using LayoutTableSectionTest = RenderingTest; |
| +class LayoutTableSectionTest : public RenderingTest { |
| + protected: |
| + LayoutTableSection* GetSectionByElementId(const char* id) { |
| + return ToLayoutTableSection(GetLayoutObjectByElementId(id)); |
| + } |
| +}; |
| TEST_F(LayoutTableSectionTest, |
| BackgroundIsKnownToBeOpaqueWithLayerAndCollapsedBorder) { |
| @@ -23,8 +28,7 @@ TEST_F(LayoutTableSectionTest, |
| " </thead>" |
| "</table>"); |
| - LayoutTableSection* section = |
| - ToLayoutTableSection(GetLayoutObjectByElementId("section")); |
| + auto* section = GetSectionByElementId("section"); |
| EXPECT_TRUE(section); |
| EXPECT_FALSE( |
| section->BackgroundIsKnownToBeOpaqueInRect(LayoutRect(0, 0, 1, 1))); |
| @@ -38,8 +42,7 @@ TEST_F(LayoutTableSectionTest, BackgroundIsKnownToBeOpaqueWithBorderSpacing) { |
| " </thead>" |
| "</table>"); |
| - LayoutTableSection* section = |
| - ToLayoutTableSection(GetLayoutObjectByElementId("section")); |
| + auto* section = GetSectionByElementId("section"); |
| EXPECT_TRUE(section); |
| EXPECT_FALSE( |
| section->BackgroundIsKnownToBeOpaqueInRect(LayoutRect(0, 0, 1, 1))); |
| @@ -54,8 +57,7 @@ TEST_F(LayoutTableSectionTest, BackgroundIsKnownToBeOpaqueWithEmptyCell) { |
| " </thead>" |
| "</table>"); |
| - LayoutTableSection* section = |
| - ToLayoutTableSection(GetLayoutObjectByElementId("section")); |
| + auto* section = GetSectionByElementId("section"); |
| EXPECT_TRUE(section); |
| EXPECT_FALSE( |
| section->BackgroundIsKnownToBeOpaqueInRect(LayoutRect(0, 0, 1, 1))); |
| @@ -67,8 +69,7 @@ TEST_F(LayoutTableSectionTest, EmptySectionDirtiedRows) { |
| " <thead id='section'></thead>" |
| "</table>"); |
| - LayoutTableSection* section = |
| - ToLayoutTableSection(GetLayoutObjectByElementId("section")); |
| + auto* section = GetSectionByElementId("section"); |
| EXPECT_TRUE(section); |
| CellSpan cell_span = section->DirtiedRows(LayoutRect(50, 50, 100, 100)); |
| EXPECT_EQ(0u, cell_span.Start()); |
| @@ -81,8 +82,7 @@ TEST_F(LayoutTableSectionTest, EmptySectionDirtiedEffectiveColumns) { |
| " <thead id='section'></thead>" |
| "</table>"); |
| - LayoutTableSection* section = |
| - ToLayoutTableSection(GetLayoutObjectByElementId("section")); |
| + auto* section = GetSectionByElementId("section"); |
| EXPECT_TRUE(section); |
| CellSpan cell_span = |
| section->DirtiedEffectiveColumns(LayoutRect(50, 50, 100, 100)); |
| @@ -111,7 +111,7 @@ TEST_F(LayoutTableSectionTest, PrimaryCellAtAndOriginatingCellAt) { |
| // 0 1 |
| // 0 0,0(O) 0,1(O) |
| // 1 1,0(O) 1,0/0,1(S) |
| - auto* section = ToLayoutTableSection(GetLayoutObjectByElementId("section")); |
| + auto* section = GetSectionByElementId("section"); |
| auto* cell00 = GetLayoutObjectByElementId("cell00"); |
| auto* cell01 = GetLayoutObjectByElementId("cell01"); |
| auto* cell10 = GetLayoutObjectByElementId("cell10"); |
| @@ -154,7 +154,7 @@ TEST_F(LayoutTableSectionTest, DirtiedRowsAndDirtiedEffectiveColumnsWithSpans) { |
| // 0 0,0(O) 0,1(O) 0,2(O) |
| // 1 1,0(O) 1,0/0,1(S) 0,2(S) |
| // 2 2,0(O) 2,0(S) 2,0(S) |
| - auto* section = ToLayoutTableSection(GetLayoutObjectByElementId("section")); |
| + auto* section = GetSectionByElementId("section"); |
| // Cell 0,0 only. |
| auto span = section->DirtiedRows(LayoutRect(5, 5, 90, 90)); |
| @@ -211,6 +211,40 @@ TEST_F(LayoutTableSectionTest, DirtiedRowsAndDirtiedEffectiveColumnsWithSpans) { |
| EXPECT_EQ(3u, span.end()); |
| } |
| +TEST_F(LayoutTableSectionTest, VisualOverflowWithCollapedBorders) { |
|
wkorman
2017/05/08 17:51:23
Collaped -> Collapsed
Xianzhu
2017/05/09 03:55:43
Done.
|
| + SetBodyInnerHTML( |
| + "<style>" |
| + " table { border-collapse: collapse }" |
| + " td { border: 0px solid blue; padding: 0 }" |
| + " div { width: 100px; height: 100px }" |
| + "</style>" |
| + "<table>" |
| + " <tbody id='section'>" |
| + " <tr>" |
| + " <td style='border-bottom-width: 10px;" |
| + " outline: 3px solid blue'><div></div></td>" |
| + " <td style='border-width: 3px 15px'><div></div></td>" |
| + " </tr>" |
| + " <tr style='outline: 8px solid green'><td><div></div></td></tr>" |
| + " </tbody>" |
| + "</table>"); |
| + |
| + auto* section = GetSectionByElementId("section"); |
| + |
| + // The section's self visual overflow covers the collapsed borders. |
| + LayoutRect expected_self_visual_overflow = section->BorderBoxRect(); |
| + expected_self_visual_overflow.ExpandEdges(LayoutUnit(1), LayoutUnit(8), |
| + LayoutUnit(0), LayoutUnit(0)); |
| + EXPECT_EQ(expected_self_visual_overflow, section->SelfVisualOverflowRect()); |
| + |
| + // The section's visual overflow covers self visual overflow and visual |
| + // overflows rows. |
| + LayoutRect expected_visual_overflow = section->BorderBoxRect(); |
| + expected_visual_overflow.ExpandEdges(LayoutUnit(8), LayoutUnit(8), |
| + LayoutUnit(8), LayoutUnit(3)); |
| + EXPECT_EQ(expected_visual_overflow, section->VisualOverflowRect()); |
| +} |
| + |
| } // anonymous namespace |
| } // namespace blink |