| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 EXPECT_FALSE( | 204 EXPECT_FALSE( |
| 205 CompositingReasonFinder::requiresCompositingForTransformAnimation( | 205 CompositingReasonFinder::requiresCompositingForTransformAnimation( |
| 206 *style)); | 206 *style)); |
| 207 | 207 |
| 208 style->setHasCurrentTransformAnimation(true); | 208 style->setHasCurrentTransformAnimation(true); |
| 209 style->setIsRunningTransformAnimationOnCompositor(true); | 209 style->setIsRunningTransformAnimationOnCompositor(true); |
| 210 EXPECT_TRUE(CompositingReasonFinder::requiresCompositingForTransformAnimation( | 210 EXPECT_TRUE(CompositingReasonFinder::requiresCompositingForTransformAnimation( |
| 211 *style)); | 211 *style)); |
| 212 } | 212 } |
| 213 | 213 |
| 214 TEST_F(CompositingReasonFinderTest, RequiresCompositingForEffectAnimation) { |
| 215 RefPtr<ComputedStyle> style = ComputedStyle::create(); |
| 216 |
| 217 style->setSubtreeWillChangeContents(false); |
| 218 |
| 219 // In the interest of brevity, for each side of subtreeWillChangeContents() |
| 220 // code path we only check that any one of the effect related animation flags |
| 221 // being set produces true, rather than every permutation. |
| 222 |
| 223 style->setHasCurrentOpacityAnimation(false); |
| 224 style->setHasCurrentFilterAnimation(false); |
| 225 style->setHasCurrentBackdropFilterAnimation(false); |
| 226 EXPECT_FALSE( |
| 227 CompositingReasonFinder::requiresCompositingForEffectAnimation(*style)); |
| 228 |
| 229 style->setHasCurrentOpacityAnimation(true); |
| 230 style->setHasCurrentFilterAnimation(false); |
| 231 style->setHasCurrentBackdropFilterAnimation(false); |
| 232 EXPECT_TRUE( |
| 233 CompositingReasonFinder::requiresCompositingForEffectAnimation(*style)); |
| 234 |
| 235 style->setHasCurrentOpacityAnimation(false); |
| 236 style->setHasCurrentFilterAnimation(true); |
| 237 style->setHasCurrentBackdropFilterAnimation(false); |
| 238 EXPECT_TRUE( |
| 239 CompositingReasonFinder::requiresCompositingForEffectAnimation(*style)); |
| 240 |
| 241 style->setHasCurrentOpacityAnimation(false); |
| 242 style->setHasCurrentFilterAnimation(false); |
| 243 style->setHasCurrentBackdropFilterAnimation(true); |
| 244 EXPECT_TRUE( |
| 245 CompositingReasonFinder::requiresCompositingForEffectAnimation(*style)); |
| 246 |
| 247 // Check the other side of subtreeWillChangeContents. |
| 248 style->setSubtreeWillChangeContents(true); |
| 249 style->setHasCurrentOpacityAnimation(false); |
| 250 style->setHasCurrentFilterAnimation(false); |
| 251 style->setHasCurrentBackdropFilterAnimation(false); |
| 252 EXPECT_FALSE( |
| 253 CompositingReasonFinder::requiresCompositingForEffectAnimation(*style)); |
| 254 |
| 255 style->setIsRunningOpacityAnimationOnCompositor(true); |
| 256 style->setIsRunningFilterAnimationOnCompositor(false); |
| 257 style->setIsRunningBackdropFilterAnimationOnCompositor(false); |
| 258 EXPECT_TRUE( |
| 259 CompositingReasonFinder::requiresCompositingForEffectAnimation(*style)); |
| 260 |
| 261 style->setIsRunningOpacityAnimationOnCompositor(false); |
| 262 style->setIsRunningFilterAnimationOnCompositor(true); |
| 263 style->setIsRunningBackdropFilterAnimationOnCompositor(false); |
| 264 EXPECT_TRUE( |
| 265 CompositingReasonFinder::requiresCompositingForEffectAnimation(*style)); |
| 266 |
| 267 style->setIsRunningOpacityAnimationOnCompositor(false); |
| 268 style->setIsRunningFilterAnimationOnCompositor(false); |
| 269 style->setIsRunningBackdropFilterAnimationOnCompositor(true); |
| 270 EXPECT_TRUE( |
| 271 CompositingReasonFinder::requiresCompositingForEffectAnimation(*style)); |
| 272 } |
| 273 |
| 214 } // namespace blink | 274 } // namespace blink |
| OLD | NEW |