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/LayoutObject.h" | 5 #include "core/layout/LayoutObject.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutTestHelper.h" | 7 #include "core/layout/LayoutTestHelper.h" |
| 8 #include "core/layout/LayoutView.h" | 8 #include "core/layout/LayoutView.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 setBodyInnerHTML( | 111 setBodyInnerHTML( |
| 112 "<div id='container' style='overflow: scroll; will-change: transform; wi dth: 50px; height: 50px'>" | 112 "<div id='container' style='overflow: scroll; will-change: transform; wi dth: 50px; height: 50px'>" |
| 113 " <span><img style='width: 20px; height: 100px'></span>" | 113 " <span><img style='width: 20px; height: 100px'></span>" |
| 114 " text text text text text text text" | 114 " text text text text text text text" |
| 115 "</div>"); | 115 "</div>"); |
| 116 LayoutBlock* container = toLayoutBlock(getLayoutObjectByElementId("container ")); | 116 LayoutBlock* container = toLayoutBlock(getLayoutObjectByElementId("container ")); |
| 117 LayoutText* text = toLayoutText(container->lastChild()); | 117 LayoutText* text = toLayoutText(container->lastChild()); |
| 118 | 118 |
| 119 container->setScrollTop(LayoutUnit(50)); | 119 container->setScrollTop(LayoutUnit(50)); |
| 120 LayoutRect rect(0, 60, 20, 20); | 120 LayoutRect rect(0, 60, 20, 20); |
| 121 text->mapToVisibleRectInAncestorSpace(container, rect, nullptr); | 121 EXPECT_TRUE(text->mapToVisibleRectInAncestorSpace(container, rect, nullptr)) ; |
| 122 EXPECT_TRUE(rect == LayoutRect(0, 10, 20, 20)); | 122 EXPECT_TRUE(rect == LayoutRect(0, 10, 20, 20)); |
| 123 | |
| 124 rect = LayoutRect(0, 60, 20, 0); | |
| 125 EXPECT_TRUE(text->mapToVisibleRectInAncestorSpace(container, rect, nullptr, EdgeInclusive)); | |
| 126 EXPECT_TRUE(rect == LayoutRect(0, 10, 20, 0)); | |
|
chrishtr
2016/03/22 19:54:26
Why does this example yield a zero-area rect? Isn'
szager1
2016/03/23 23:26:59
No; the input rect has zero height, so the result
chrishtr
2016/03/24 21:18:43
?
| |
| 123 } | 127 } |
| 124 | 128 |
| 125 } // namespace blink | 129 } // namespace blink |
| OLD | NEW |