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/LayoutTreeAsText.h" | 6 #include "core/layout/LayoutTreeAsText.h" |
7 #include "core/layout/api/LayoutViewItem.h" | 7 #include "core/layout/api/LayoutViewItem.h" |
8 #include "core/paint/ObjectPaintProperties.h" | 8 #include "core/paint/ObjectPaintProperties.h" |
9 #include "platform/graphics/paint/GeometryMapper.h" | 9 #include "platform/graphics/paint/GeometryMapper.h" |
10 #include "platform/graphics/paint/TransformPaintPropertyNode.h" | 10 #include "platform/graphics/paint/TransformPaintPropertyNode.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 EXPECT_EQ(FloatRoundedRect(0, 0, 800, 600), frameView->contentClip()->clipRe
ct()); | 160 EXPECT_EQ(FloatRoundedRect(0, 0, 800, 600), frameView->contentClip()->clipRe
ct()); |
161 EXPECT_EQ(frameView->rootClip(), frameView->contentClip()->parent()); | 161 EXPECT_EQ(frameView->rootClip(), frameView->contentClip()->parent()); |
162 EXPECT_EQ(nullptr, frameView->rootClip()->parent()); | 162 EXPECT_EQ(nullptr, frameView->rootClip()->parent()); |
163 | 163 |
164 LayoutViewItem layoutViewItem = document().layoutViewItem(); | 164 LayoutViewItem layoutViewItem = document().layoutViewItem(); |
165 const ObjectPaintProperties* layoutViewProperties = layoutViewItem.objectPai
ntProperties(); | 165 const ObjectPaintProperties* layoutViewProperties = layoutViewItem.objectPai
ntProperties(); |
166 EXPECT_EQ(nullptr, layoutViewProperties->scrollTranslation()); | 166 EXPECT_EQ(nullptr, layoutViewProperties->scrollTranslation()); |
167 CHECK_EXACT_VISUAL_RECT(document().body()->layoutObject(), frameView->layout
View()); | 167 CHECK_EXACT_VISUAL_RECT(document().body()->layoutObject(), frameView->layout
View()); |
168 } | 168 } |
169 | 169 |
170 // TODO(trchen): Settings::rootLayerScrolls cannot be switched after main frame
being created. | |
171 // Need to set it during test setup. Besides that, the test still won't work bec
ause | |
172 // root layer scrolling mode is not compatible with SPv2 at this moment. | |
173 // (Duplicate display item ID for FrameView and LayoutView.) | |
174 TEST_F(PaintPropertyTreeBuilderTest, DISABLED_FrameScrollingRootLayerScrolls) | |
175 { | |
176 document().settings()->setRootLayerScrolls(true); | |
177 | |
178 setBodyInnerHTML("<style> body { height: 10000px; } </style>"); | |
179 | |
180 document().domWindow()->scrollTo(0, 100); | |
181 | |
182 FrameView* frameView = document().view(); | |
183 frameView->updateAllLifecyclePhases(); | |
184 EXPECT_EQ(TransformationMatrix(), frameView->preTranslation()->matrix()); | |
185 EXPECT_EQ(nullptr, frameView->preTranslation()->parent()); | |
186 EXPECT_EQ(TransformationMatrix(), frameView->scrollTranslation()->matrix()); | |
187 EXPECT_EQ(frameView->preTranslation(), frameView->scrollTranslation()->paren
t()); | |
188 | |
189 LayoutViewItem layoutViewItem = document().layoutViewItem(); | |
190 const ObjectPaintProperties* layoutViewProperties = layoutViewItem.objectPai
ntProperties(); | |
191 EXPECT_EQ(TransformationMatrix().translate(0, -100), layoutViewProperties->s
crollTranslation()->matrix()); | |
192 EXPECT_EQ(frameView->scrollTranslation(), layoutViewProperties->scrollTransl
ation()->parent()); | |
193 CHECK_EXACT_VISUAL_RECT(document().body()->layoutObject(), frameView->layout
View()); | |
194 } | |
195 | |
196 TEST_F(PaintPropertyTreeBuilderTest, Perspective) | 170 TEST_F(PaintPropertyTreeBuilderTest, Perspective) |
197 { | 171 { |
198 loadTestData("perspective.html"); | 172 loadTestData("perspective.html"); |
199 | 173 |
200 Element* perspective = document().getElementById("perspective"); | 174 Element* perspective = document().getElementById("perspective"); |
201 const ObjectPaintProperties* perspectiveProperties = perspective->layoutObje
ct()->objectPaintProperties(); | 175 const ObjectPaintProperties* perspectiveProperties = perspective->layoutObje
ct()->objectPaintProperties(); |
202 EXPECT_EQ(TransformationMatrix().applyPerspective(100), perspectivePropertie
s->perspective()->matrix()); | 176 EXPECT_EQ(TransformationMatrix().applyPerspective(100), perspectivePropertie
s->perspective()->matrix()); |
203 // The perspective origin is the center of the border box plus accumulated p
aint offset. | 177 // The perspective origin is the center of the border box plus accumulated p
aint offset. |
204 EXPECT_EQ(FloatPoint3D(250, 250, 0), perspectiveProperties->perspective()->o
rigin()); | 178 EXPECT_EQ(FloatPoint3D(250, 250, 0), perspectiveProperties->perspective()->o
rigin()); |
205 EXPECT_EQ(document().view()->scrollTranslation(), perspectiveProperties->per
spective()->parent()); | 179 EXPECT_EQ(document().view()->scrollTranslation(), perspectiveProperties->per
spective()->parent()); |
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1534 EXPECT_EQ(cProperties, c->layoutObject()->objectPaintProperties()); | 1508 EXPECT_EQ(cProperties, c->layoutObject()->objectPaintProperties()); |
1535 EXPECT_EQ(cTransformNode, cProperties->transform()); | 1509 EXPECT_EQ(cTransformNode, cProperties->transform()); |
1536 EXPECT_EQ(bTransformNode, cTransformNode->parent()); | 1510 EXPECT_EQ(bTransformNode, cTransformNode->parent()); |
1537 | 1511 |
1538 CHECK_EXACT_VISUAL_RECT(a->layoutObject(), frameView->layoutView()); | 1512 CHECK_EXACT_VISUAL_RECT(a->layoutObject(), frameView->layoutView()); |
1539 CHECK_EXACT_VISUAL_RECT(b->layoutObject(), frameView->layoutView()); | 1513 CHECK_EXACT_VISUAL_RECT(b->layoutObject(), frameView->layoutView()); |
1540 CHECK_EXACT_VISUAL_RECT(c->layoutObject(), frameView->layoutView()); | 1514 CHECK_EXACT_VISUAL_RECT(c->layoutObject(), frameView->layoutView()); |
1541 } | 1515 } |
1542 | 1516 |
1543 } // namespace blink | 1517 } // namespace blink |
OLD | NEW |