OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/LayoutBox.h" | 5 #include "core/layout/LayoutBox.h" |
6 | 6 |
7 #include "core/html/HTMLElement.h" | 7 #include "core/html/HTMLElement.h" |
8 #include "core/layout/ImageQualityController.h" | 8 #include "core/layout/ImageQualityController.h" |
9 #include "core/layout/LayoutTestHelper.h" | 9 #include "core/layout/LayoutTestHelper.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 EXPECT_TRUE(target->HasControlClip()); | 225 EXPECT_TRUE(target->HasControlClip()); |
226 EXPECT_TRUE(target->HasClipRelatedProperty()); | 226 EXPECT_TRUE(target->HasClipRelatedProperty()); |
227 EXPECT_TRUE(target->ShouldClipOverflow()); | 227 EXPECT_TRUE(target->ShouldClipOverflow()); |
228 #if OS(MACOSX) | 228 #if OS(MACOSX) |
229 EXPECT_EQ(LayoutRect(0, 0, 100, 18), target->ClippingRect()); | 229 EXPECT_EQ(LayoutRect(0, 0, 100, 18), target->ClippingRect()); |
230 #else | 230 #else |
231 EXPECT_EQ(LayoutRect(2, 2, 96, 46), target->ClippingRect()); | 231 EXPECT_EQ(LayoutRect(2, 2, 96, 46), target->ClippingRect()); |
232 #endif | 232 #endif |
233 } | 233 } |
234 | 234 |
| 235 TEST_F(LayoutBoxTest, LocalVisualRectWithMask) { |
| 236 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 237 return; |
| 238 |
| 239 SetBodyInnerHTML( |
| 240 "<div id='target' style='-webkit-mask-image: url(#a);" |
| 241 " width: 100px; height: 100px; background: blue'>" |
| 242 " <div style='width: 300px; height: 10px; background: green'></div>" |
| 243 "</div>"); |
| 244 |
| 245 LayoutBox* target = ToLayoutBox(GetLayoutObjectByElementId("target")); |
| 246 EXPECT_TRUE(target->HasMask()); |
| 247 EXPECT_EQ(LayoutRect(0, 0, 300, 100), target->LocalVisualRect()); |
| 248 } |
| 249 |
| 250 TEST_F(LayoutBoxTest, LocalVisualRectWithMaskAndOverflowClip) { |
| 251 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 252 return; |
| 253 |
| 254 SetBodyInnerHTML( |
| 255 "<div id='target' style='-webkit-mask-image: url(#a); overflow: hidden;" |
| 256 " width: 100px; height: 100px; background: blue'>" |
| 257 " <div style='width: 300px; height: 10px; background: green'></div>" |
| 258 "</div>"); |
| 259 |
| 260 LayoutBox* target = ToLayoutBox(GetLayoutObjectByElementId("target")); |
| 261 EXPECT_TRUE(target->HasMask()); |
| 262 EXPECT_TRUE(target->HasOverflowClip()); |
| 263 EXPECT_EQ(LayoutRect(0, 0, 100, 100), target->LocalVisualRect()); |
| 264 } |
| 265 |
235 } // namespace blink | 266 } // namespace blink |
OLD | NEW |