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

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

Issue 2733633002: Handle nested position:sticky elements correctly (compositor) (Closed)
Patch Set: Revert float changes to unittests too Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/compositing/CompositingReasonFinder.h" 5 #include "core/layout/compositing/CompositingReasonFinder.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/layout/LayoutBlock.h" 8 #include "core/layout/LayoutBlock.h"
9 #include "core/layout/LayoutTestHelper.h" 9 #include "core/layout/LayoutTestHelper.h"
10 #include "core/paint/PaintLayer.h" 10 #include "core/paint/PaintLayer.h"
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 EXPECT_TRUE( 264 EXPECT_TRUE(
265 CompositingReasonFinder::requiresCompositingForEffectAnimation(*style)); 265 CompositingReasonFinder::requiresCompositingForEffectAnimation(*style));
266 266
267 style->setIsRunningOpacityAnimationOnCompositor(false); 267 style->setIsRunningOpacityAnimationOnCompositor(false);
268 style->setIsRunningFilterAnimationOnCompositor(false); 268 style->setIsRunningFilterAnimationOnCompositor(false);
269 style->setIsRunningBackdropFilterAnimationOnCompositor(true); 269 style->setIsRunningBackdropFilterAnimationOnCompositor(true);
270 EXPECT_TRUE( 270 EXPECT_TRUE(
271 CompositingReasonFinder::requiresCompositingForEffectAnimation(*style)); 271 CompositingReasonFinder::requiresCompositingForEffectAnimation(*style));
272 } 272 }
273 273
274 TEST_F(CompositingReasonFinderTest, DoNotCompositeNestedSticky) { 274 TEST_F(CompositingReasonFinderTest, CompositeNestedSticky) {
275 ScopedCompositeFixedPositionForTest compositeFixedPosition(true); 275 ScopedCompositeFixedPositionForTest compositeFixedPosition(true);
276 276
277 setBodyInnerHTML( 277 setBodyInnerHTML(
278 "<style>.scroller { overflow: scroll; height: 200px; width: 100px; }" 278 "<style>.scroller { overflow: scroll; height: 200px; width: 100px; }"
279 ".container { height: 500px; }" 279 ".container { height: 500px; }"
280 ".opaque { background-color: white; contain: paint; }" 280 ".opaque { background-color: white; contain: paint; }"
281 "#outerSticky { height: 50px; position: sticky; top: 0px; }" 281 "#outerSticky { height: 50px; position: sticky; top: 0px; }"
282 "#innerSticky { height: 20px; position: sticky; top: 25px; }</style>" 282 "#innerSticky { height: 20px; position: sticky; top: 25px; }</style>"
283 "<div class='scroller'>" 283 "<div class='scroller'>"
284 " <div class='container'>" 284 " <div class='container'>"
285 " <div id='outerSticky' class='opaque'>" 285 " <div id='outerSticky' class='opaque'>"
286 " <div id='innerSticky' class='opaque'></div>" 286 " <div id='innerSticky' class='opaque'></div>"
287 " </div>" 287 " </div>"
288 " </div>" 288 " </div>"
289 "</div>"); 289 "</div>");
290 document().view()->updateAllLifecyclePhases(); 290 document().view()->updateAllLifecyclePhases();
291 291
292 Element* outerSticky = document().getElementById("outerSticky"); 292 Element* outerSticky = document().getElementById("outerSticky");
293 PaintLayer* outerStickyLayer = 293 PaintLayer* outerStickyLayer =
294 toLayoutBoxModelObject(outerSticky->layoutObject())->layer(); 294 toLayoutBoxModelObject(outerSticky->layoutObject())->layer();
295 ASSERT_TRUE(outerStickyLayer); 295 ASSERT_TRUE(outerStickyLayer);
296 296
297 Element* innerSticky = document().getElementById("innerSticky"); 297 Element* innerSticky = document().getElementById("innerSticky");
298 PaintLayer* innerStickyLayer = 298 PaintLayer* innerStickyLayer =
299 toLayoutBoxModelObject(innerSticky->layoutObject())->layer(); 299 toLayoutBoxModelObject(innerSticky->layoutObject())->layer();
300 ASSERT_TRUE(innerStickyLayer); 300 ASSERT_TRUE(innerStickyLayer);
301 301
302 EXPECT_EQ(PaintsIntoOwnBacking, outerStickyLayer->compositingState()); 302 EXPECT_EQ(PaintsIntoOwnBacking, outerStickyLayer->compositingState());
303 EXPECT_EQ(NotComposited, innerStickyLayer->compositingState()); 303 EXPECT_EQ(PaintsIntoOwnBacking, innerStickyLayer->compositingState());
304 } 304 }
305 305
306 } // namespace blink 306 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698