Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/LayoutTestHelper.h" | 5 #include "core/layout/LayoutTestHelper.h" |
| 6 #include "core/layout/LayoutView.h" | 6 #include "core/layout/LayoutView.h" |
| 7 #include "core/layout/PaintInvalidationState.h" | 7 #include "core/layout/PaintInvalidationState.h" |
| 8 #include "core/paint/PaintLayer.h" | 8 #include "core/paint/PaintLayer.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 690 | 690 |
| 691 LayoutRect targetVisualRect = target->localVisualRect(); | 691 LayoutRect targetVisualRect = target->localVisualRect(); |
| 692 EXPECT_EQ(LayoutRect(0, 0, 400, 400), targetVisualRect); | 692 EXPECT_EQ(LayoutRect(0, 0, 400, 400), targetVisualRect); |
| 693 LayoutRect rect = targetVisualRect; | 693 LayoutRect rect = targetVisualRect; |
| 694 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); | 694 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); |
| 695 EXPECT_EQ(LayoutRect(0, 0, 200, 200), rect); | 695 EXPECT_EQ(LayoutRect(0, 0, 200, 200), rect); |
| 696 checkPaintInvalidationStateRectMapping(rect, targetVisualRect, *target, | 696 checkPaintInvalidationStateRectMapping(rect, targetVisualRect, *target, |
| 697 layoutView(), layoutView()); | 697 layoutView(), layoutView()); |
| 698 } | 698 } |
| 699 | 699 |
| 700 TEST_F(VisualRectMappingTest, FloatUnderInline) { | |
| 701 setBodyInnerHTML( | |
| 702 "<span style='position: relative; top: 100px; left: 200px'>" | |
| 703 " <div id='target' style='float: left; width: 33px; height: 44px'>" | |
| 704 " </div>" | |
| 705 "</span>"); | |
| 706 | |
| 707 LayoutBox* target = toLayoutBox(getLayoutObjectByElementId("target")); | |
| 708 | |
| 709 LayoutRect targetVisualRect = target->localVisualRect(); | |
| 710 EXPECT_EQ(LayoutRect(0, 0, 33, 44), targetVisualRect); | |
| 711 LayoutRect rect = targetVisualRect; | |
| 712 EXPECT_TRUE(target->mapToVisualRectInAncestorSpace(&layoutView(), rect)); | |
| 713 EXPECT_EQ(LayoutRect(8, 8, 33, 44), rect); | |
|
chrishtr
2016/12/16 22:10:30
add * { margin: 0 } to get rid of the 8px
Xianzhu
2016/12/17 05:43:18
Added an position:absolute container to test we ac
| |
| 714 checkPaintInvalidationStateRectMapping(rect, targetVisualRect, *target, | |
| 715 layoutView(), layoutView()); | |
| 716 } | |
| 717 | |
| 700 } // namespace blink | 718 } // namespace blink |
| OLD | NEW |