OLD | NEW |
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 Loading... |
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) { | |
275 ScopedCompositeFixedPositionForTest compositeFixedPosition(true); | |
276 | |
277 setBodyInnerHTML( | |
278 "<style>.scroller { overflow: scroll; height: 200px; width: 100px; }" | |
279 ".container { height: 500px; }" | |
280 ".opaque { background-color: white; contain: paint; }" | |
281 "#outerSticky { height: 50px; position: sticky; top: 0px; }" | |
282 "#innerSticky { height: 20px; position: sticky; top: 25px; }</style>" | |
283 "<div class='scroller'>" | |
284 " <div class='container'>" | |
285 " <div id='outerSticky' class='opaque'>" | |
286 " <div id='innerSticky' class='opaque'></div>" | |
287 " </div>" | |
288 " </div>" | |
289 "</div>"); | |
290 document().view()->updateAllLifecyclePhases(); | |
291 | |
292 Element* outerSticky = document().getElementById("outerSticky"); | |
293 PaintLayer* outerStickyLayer = | |
294 toLayoutBoxModelObject(outerSticky->layoutObject())->layer(); | |
295 ASSERT_TRUE(outerStickyLayer); | |
296 | |
297 Element* innerSticky = document().getElementById("innerSticky"); | |
298 PaintLayer* innerStickyLayer = | |
299 toLayoutBoxModelObject(innerSticky->layoutObject())->layer(); | |
300 ASSERT_TRUE(innerStickyLayer); | |
301 | |
302 EXPECT_EQ(PaintsIntoOwnBacking, outerStickyLayer->compositingState()); | |
303 EXPECT_EQ(NotComposited, innerStickyLayer->compositingState()); | |
304 } | |
305 | |
306 } // namespace blink | 274 } // namespace blink |
OLD | NEW |