Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(572)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp

Issue 1662483002: Introduce RenderingTest::getLayoutObjectByElementId(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 EXPECT_EQ(layoutObject->containingBlock(), bodyLayoutObject); 106 EXPECT_EQ(layoutObject->containingBlock(), bodyLayoutObject);
107 } 107 }
108 108
109 TEST_F(LayoutObjectTest, MapToVisibleRectInContainerSpace) 109 TEST_F(LayoutObjectTest, MapToVisibleRectInContainerSpace)
110 { 110 {
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(document().getElementById("container" )->layoutObject()); 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 text->mapToVisibleRectInAncestorSpace(container, rect, nullptr);
122 EXPECT_TRUE(rect == LayoutRect(0, 10, 20, 20)); 122 EXPECT_TRUE(rect == LayoutRect(0, 10, 20, 20));
123 } 123 }
124 124
125 } // namespace blink 125 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698