| 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) { | 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 |
| OLD | NEW |