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 "config.h" | 5 #include "config.h" |
6 #include "core/layout/LayoutObject.h" | 6 #include "core/layout/LayoutObject.h" |
7 | 7 |
8 #include "core/layout/LayoutTestHelper.h" | 8 #include "core/layout/LayoutTestHelper.h" |
9 #include "core/layout/LayoutView.h" | 9 #include "core/layout/LayoutView.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 LayoutObject* layoutObject = bodyLayoutObject->slowFirstChild()->slowFirstCh
ild(); | 100 LayoutObject* layoutObject = bodyLayoutObject->slowFirstChild()->slowFirstCh
ild(); |
101 | 101 |
102 // Sanity check: Make sure we don't generate anonymous objects. | 102 // Sanity check: Make sure we don't generate anonymous objects. |
103 EXPECT_EQ(nullptr, bodyLayoutObject->slowFirstChild()->nextSibling()); | 103 EXPECT_EQ(nullptr, bodyLayoutObject->slowFirstChild()->nextSibling()); |
104 EXPECT_EQ(nullptr, layoutObject->slowFirstChild()); | 104 EXPECT_EQ(nullptr, layoutObject->slowFirstChild()); |
105 EXPECT_EQ(nullptr, layoutObject->nextSibling()); | 105 EXPECT_EQ(nullptr, layoutObject->nextSibling()); |
106 | 106 |
107 EXPECT_EQ(layoutObject->containingBlock(), bodyLayoutObject); | 107 EXPECT_EQ(layoutObject->containingBlock(), bodyLayoutObject); |
108 } | 108 } |
109 | 109 |
| 110 TEST_F(LayoutObjectTest, MapToVisibleRectInContainerSpace) |
| 111 { |
| 112 setBodyInnerHTML( |
| 113 "<div id='container' style='overflow: scroll; will-change: transform; wi
dth: 50px; height: 50px'>" |
| 114 " <span><img style='width: 20px; height: 100px'></span>" |
| 115 " text text text text text text text" |
| 116 "</div>"); |
| 117 LayoutBlock* container = toLayoutBlock(document().getElementById("container"
)->layoutObject()); |
| 118 LayoutText* text = toLayoutText(container->lastChild()); |
| 119 |
| 120 container->setScrollTop(50); |
| 121 LayoutRect rect(0, 60, 20, 20); |
| 122 text->mapToVisibleRectInContainerSpace(container, rect, nullptr); |
| 123 EXPECT_TRUE(rect == LayoutRect(0, 10, 20, 20)); |
| 124 } |
| 125 |
110 } | 126 } |
111 | 127 |
OLD | NEW |