Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2014 Google Inc. All rights reserved. | 3 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 Vector<OverlapMapContainers> overlap_stack_; | 140 Vector<OverlapMapContainers> overlap_stack_; |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 class CompositingRequirementsUpdater::RecursionData { | 143 class CompositingRequirementsUpdater::RecursionData { |
| 144 public: | 144 public: |
| 145 explicit RecursionData(PaintLayer* compositing_ancestor) | 145 explicit RecursionData(PaintLayer* compositing_ancestor) |
| 146 : compositing_ancestor_(compositing_ancestor), | 146 : compositing_ancestor_(compositing_ancestor), |
| 147 subtree_is_compositing_(false), | 147 subtree_is_compositing_(false), |
| 148 has_unisolated_composited_blending_descendant_(false), | 148 has_unisolated_composited_blending_descendant_(false), |
| 149 testing_overlap_(true), | 149 testing_overlap_(true), |
| 150 has_composited_non_root_ancestor_(false), | |
| 150 has_composited_scrolling_ancestor_(false) {} | 151 has_composited_scrolling_ancestor_(false) {} |
| 151 | 152 |
| 152 PaintLayer* compositing_ancestor_; | 153 PaintLayer* compositing_ancestor_; |
| 153 bool subtree_is_compositing_; | 154 bool subtree_is_compositing_; |
| 154 bool has_unisolated_composited_blending_descendant_; | 155 bool has_unisolated_composited_blending_descendant_; |
| 155 bool testing_overlap_; | 156 bool testing_overlap_; |
| 157 // Ancestors may be composited but not have composited scrolling layer. | |
| 158 bool has_composited_non_root_ancestor_; | |
| 156 bool has_composited_scrolling_ancestor_; | 159 bool has_composited_scrolling_ancestor_; |
| 157 }; | 160 }; |
| 158 | 161 |
| 159 static bool RequiresCompositingOrSquashing(CompositingReasons reasons) { | 162 static bool RequiresCompositingOrSquashing(CompositingReasons reasons) { |
| 160 #if DCHECK_IS_ON() | 163 #if DCHECK_IS_ON() |
| 161 bool fast_answer = reasons != kCompositingReasonNone; | 164 bool fast_answer = reasons != kCompositingReasonNone; |
| 162 bool slow_answer = RequiresCompositing(reasons) || RequiresSquashing(reasons); | 165 bool slow_answer = RequiresCompositing(reasons) || RequiresSquashing(reasons); |
| 163 DCHECK_EQ(slow_answer, fast_answer); | 166 DCHECK_EQ(slow_answer, fast_answer); |
| 164 #endif | 167 #endif |
| 165 return reasons != kCompositingReasonNone; | 168 return reasons != kCompositingReasonNone; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 267 direct_reasons |= kCompositingReasonVideoOverlay; | 270 direct_reasons |= kCompositingReasonVideoOverlay; |
| 268 | 271 |
| 269 bool has_composited_scrolling_ancestor = | 272 bool has_composited_scrolling_ancestor = |
| 270 layer->AncestorScrollingLayer() && | 273 layer->AncestorScrollingLayer() && |
| 271 (compositing_reason_finder_.DirectReasons(layer->AncestorScrollingLayer(), | 274 (compositing_reason_finder_.DirectReasons(layer->AncestorScrollingLayer(), |
| 272 false) & | 275 false) & |
| 273 kCompositingReasonOverflowScrollingTouch); | 276 kCompositingReasonOverflowScrollingTouch); |
| 274 | 277 |
| 275 // TODO(chrishtr): use |hasCompositedScrollingAncestor| instead. | 278 // TODO(chrishtr): use |hasCompositedScrollingAncestor| instead. |
| 276 const bool ignore_lcd_text = | 279 const bool ignore_lcd_text = |
| 277 current_recursion_data.has_composited_scrolling_ancestor_; | 280 current_recursion_data.has_composited_scrolling_ancestor_ || |
| 281 (layer->SticksToScroller() && | |
|
flackr
2017/05/17 20:18:57
For clarity, can you calculate a named local bool
yigu
2017/05/18 18:00:35
Done.
| |
| 282 current_recursion_data.has_composited_non_root_ancestor_); | |
| 278 direct_reasons |= | 283 direct_reasons |= |
| 279 compositing_reason_finder_.DirectReasons(layer, ignore_lcd_text); | 284 compositing_reason_finder_.DirectReasons(layer, ignore_lcd_text); |
| 280 | 285 |
| 281 bool can_be_composited = compositor->CanBeComposited(layer); | 286 bool can_be_composited = compositor->CanBeComposited(layer); |
| 282 if (can_be_composited) { | 287 if (can_be_composited) { |
| 283 reasons_to_composite |= direct_reasons; | 288 reasons_to_composite |= direct_reasons; |
| 284 | 289 |
| 285 if (layer->IsRootLayer() && compositor->RootShouldAlwaysComposite()) | 290 if (layer->IsRootLayer() && compositor->RootShouldAlwaysComposite()) |
| 286 reasons_to_composite |= kCompositingReasonRoot; | 291 reasons_to_composite |= kCompositingReasonRoot; |
| 287 | 292 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 379 child_recursion_data.compositing_ancestor_ = layer; | 384 child_recursion_data.compositing_ancestor_ = layer; |
| 380 | 385 |
| 381 // Here we know that all children and the layer's own contents can blindly | 386 // Here we know that all children and the layer's own contents can blindly |
| 382 // paint into this layer's backing, until a descendant is composited. So, we | 387 // paint into this layer's backing, until a descendant is composited. So, we |
| 383 // don't need to check for overlap with anything behind this layer. | 388 // don't need to check for overlap with anything behind this layer. |
| 384 overlap_map.BeginNewOverlapTestingContext(); | 389 overlap_map.BeginNewOverlapTestingContext(); |
| 385 // This layer is going to be composited, so children can safely ignore the | 390 // This layer is going to be composited, so children can safely ignore the |
| 386 // fact that there's an animation running behind this layer, meaning they | 391 // fact that there's an animation running behind this layer, meaning they |
| 387 // can rely on the overlap map testing again. | 392 // can rely on the overlap map testing again. |
| 388 child_recursion_data.testing_overlap_ = true; | 393 child_recursion_data.testing_overlap_ = true; |
| 394 | |
| 395 // Tell the descendants they have composited non-root ancestor. | |
| 396 if (!layer->IsRootLayer()) | |
| 397 child_recursion_data.has_composited_non_root_ancestor_ = true; | |
|
flackr
2017/05/17 20:18:57
Couldn't we determine this by checking !child_recu
yigu
2017/05/18 18:00:35
Done.
| |
| 389 } | 398 } |
| 390 | 399 |
| 391 #if DCHECK_IS_ON() | 400 #if DCHECK_IS_ON() |
| 392 LayerListMutationDetector mutation_checker(layer->StackingNode()); | 401 LayerListMutationDetector mutation_checker(layer->StackingNode()); |
| 393 #endif | 402 #endif |
| 394 | 403 |
| 395 bool any_descendant_has3d_transform = false; | 404 bool any_descendant_has3d_transform = false; |
| 396 bool will_have_foreground_layer = false; | 405 bool will_have_foreground_layer = false; |
| 397 | 406 |
| 398 if (layer->StackingNode()->IsStackingContext()) { | 407 if (layer->StackingNode()->IsStackingContext()) { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 556 descendant_has3d_transform |= | 565 descendant_has3d_transform |= |
| 557 any_descendant_has3d_transform || layer->Has3DTransform(); | 566 any_descendant_has3d_transform || layer->Has3DTransform(); |
| 558 } | 567 } |
| 559 | 568 |
| 560 // At this point we have finished collecting all reasons to composite this | 569 // At this point we have finished collecting all reasons to composite this |
| 561 // layer. | 570 // layer. |
| 562 layer->SetCompositingReasons(reasons_to_composite); | 571 layer->SetCompositingReasons(reasons_to_composite); |
| 563 } | 572 } |
| 564 | 573 |
| 565 } // namespace blink | 574 } // namespace blink |
| OLD | NEW |