OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 auto* row2 = GetRowByElementId("row2"); | 147 auto* row2 = GetRowByElementId("row2"); |
148 EXPECT_EQ(LayoutRect(0, -10, 440, 220), row2->ContentsVisualOverflowRect()); | 148 EXPECT_EQ(LayoutRect(0, -10, 440, 220), row2->ContentsVisualOverflowRect()); |
149 EXPECT_EQ(LayoutRect(0, 0, 450, 210), row2->SelfVisualOverflowRect()); | 149 EXPECT_EQ(LayoutRect(0, 0, 450, 210), row2->SelfVisualOverflowRect()); |
150 | 150 |
151 auto* row3 = GetRowByElementId("row3"); | 151 auto* row3 = GetRowByElementId("row3"); |
152 EXPECT_EQ(LayoutRect(), row3->ContentsVisualOverflowRect()); | 152 EXPECT_EQ(LayoutRect(), row3->ContentsVisualOverflowRect()); |
153 EXPECT_EQ(LayoutRect(0, 0, 450, 100), row3->SelfVisualOverflowRect()); | 153 EXPECT_EQ(LayoutRect(0, 0, 450, 100), row3->SelfVisualOverflowRect()); |
154 } | 154 } |
155 | 155 |
| 156 TEST_F(LayoutTableRowTest, VisualOverflowWithCollapsedBorders) { |
| 157 SetBodyInnerHTML( |
| 158 "<style>" |
| 159 " table { border-collapse: collapse }" |
| 160 " td { border: 0px solid blue; padding: 0 }" |
| 161 " div { width: 100px; height: 100px }" |
| 162 "</style>" |
| 163 "<table>" |
| 164 " <tr id='row'>" |
| 165 " <td style='border-bottom-width: 10px;" |
| 166 " outline: 3px solid blue'><div></div></td>" |
| 167 " <td style='border-width: 3px 15px'><div></div></td>" |
| 168 " </tr>" |
| 169 "</table>"); |
| 170 |
| 171 auto* row = GetRowByElementId("row"); |
| 172 |
| 173 // The row's self visual overflow covers the collapsed borders. |
| 174 LayoutRect expected_self_visual_overflow = row->BorderBoxRect(); |
| 175 expected_self_visual_overflow.ExpandEdges(LayoutUnit(1), LayoutUnit(8), |
| 176 LayoutUnit(5), LayoutUnit(0)); |
| 177 EXPECT_EQ(expected_self_visual_overflow, row->SelfVisualOverflowRect()); |
| 178 |
| 179 // The row's visual overflow covers self visual overflow and visual overflows |
| 180 // of all cells. |
| 181 LayoutRect expected_visual_overflow = row->BorderBoxRect(); |
| 182 expected_visual_overflow.ExpandEdges(LayoutUnit(3), LayoutUnit(8), |
| 183 LayoutUnit(5), LayoutUnit(3)); |
| 184 EXPECT_EQ(expected_visual_overflow, row->VisualOverflowRect()); |
| 185 } |
| 186 |
156 TEST_F(LayoutTableRowTest, LayoutOverflow) { | 187 TEST_F(LayoutTableRowTest, LayoutOverflow) { |
157 SetBodyInnerHTML( | 188 SetBodyInnerHTML( |
158 "<table style='border-spacing: 0'>" | 189 "<table style='border-spacing: 0'>" |
159 " <tr id='row'>" | 190 " <tr id='row'>" |
160 " <td style='100px; height: 100px; padding: 0'>" | 191 " <td style='100px; height: 100px; padding: 0'>" |
161 " <div style='position: relative; top: 50px; left: 50px;" | 192 " <div style='position: relative; top: 50px; left: 50px;" |
162 " width: 100px; height: 100px'></div>" | 193 " width: 100px; height: 100px'></div>" |
163 " </td>" | 194 " </td>" |
164 " </tr>" | 195 " </tr>" |
165 "</table>"); | 196 "</table>"); |
166 | 197 |
167 EXPECT_EQ(LayoutRect(0, 0, 150, 150), | 198 EXPECT_EQ(LayoutRect(0, 0, 150, 150), |
168 GetRowByElementId("row")->LayoutOverflowRect()); | 199 GetRowByElementId("row")->LayoutOverflowRect()); |
169 } | 200 } |
170 | 201 |
171 } // anonymous namespace | 202 } // anonymous namespace |
172 | 203 |
173 } // namespace blink | 204 } // namespace blink |
OLD | NEW |