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

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

Issue 2845613002: Fix the bug that sticky element may not be correctly invalidated due to non-promotion (Closed)
Patch Set: Update test due to spv2 failure Created 3 years, 7 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 /* 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 bool has_composited_scrolling_ancestor = 269 bool has_composited_scrolling_ancestor =
270 layer->AncestorScrollingLayer() && 270 layer->AncestorScrollingLayer() &&
271 (compositing_reason_finder_.DirectReasons(layer->AncestorScrollingLayer(), 271 (compositing_reason_finder_.DirectReasons(layer->AncestorScrollingLayer(),
272 false) & 272 false) &
273 kCompositingReasonOverflowScrollingTouch); 273 kCompositingReasonOverflowScrollingTouch);
274 274
275 // TODO(chrishtr): use |hasCompositedScrollingAncestor| instead. 275 // TODO(chrishtr): use |hasCompositedScrollingAncestor| instead.
276 const bool ignore_lcd_text = 276 const bool ignore_lcd_text =
277 current_recursion_data.has_composited_scrolling_ancestor_; 277 current_recursion_data.has_composited_scrolling_ancestor_;
278 direct_reasons |= 278 direct_reasons |=
279 compositing_reason_finder_.DirectReasons(layer, ignore_lcd_text); 279 compositing_reason_finder_.DirectReasons(layer, ignore_lcd_text);
flackr 2017/05/12 18:00:46 I think we should set ignore_lcd_text appropriatel
yigu 2017/05/17 19:39:06 Done.
280 280
281 bool can_be_composited = compositor->CanBeComposited(layer); 281 bool can_be_composited = compositor->CanBeComposited(layer);
282 if (can_be_composited) { 282 if (can_be_composited) {
283 reasons_to_composite |= direct_reasons; 283 reasons_to_composite |= direct_reasons;
284 284
285 if (layer->IsRootLayer() && compositor->RootShouldAlwaysComposite()) 285 if (layer->IsRootLayer() && compositor->RootShouldAlwaysComposite())
286 reasons_to_composite |= kCompositingReasonRoot; 286 reasons_to_composite |= kCompositingReasonRoot;
287 287
288 // Add CompositingReasonOverflowScrollingTouch for layers that do not 288 // Add CompositingReasonOverflowScrollingTouch for layers that do not
289 // already have it but need it. 289 // already have it but need it.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 } 365 }
366 366
367 reasons_to_composite |= overlap_compositing_reason; 367 reasons_to_composite |= overlap_compositing_reason;
368 368
369 // The children of this layer don't need to composite, unless there is 369 // The children of this layer don't need to composite, unless there is
370 // a compositing layer among them, so start by inheriting the compositing 370 // a compositing layer among them, so start by inheriting the compositing
371 // ancestor with m_subtreeIsCompositing set to false. 371 // ancestor with m_subtreeIsCompositing set to false.
372 RecursionData child_recursion_data = current_recursion_data; 372 RecursionData child_recursion_data = current_recursion_data;
373 child_recursion_data.subtree_is_compositing_ = false; 373 child_recursion_data.subtree_is_compositing_ = false;
374 374
375 if (layer->SticksToScroller() &&
376 layer->AncestorOverflowLayer()->ScrollsOverflow() &&
flackr 2017/05/12 18:00:46 This seems to be duplicating the promotion logic i
yigu 2017/05/17 19:39:05 Done.
377 current_recursion_data.compositing_ancestor_ &&
378 current_recursion_data.compositing_ancestor_->AncestorScrollingLayer() &&
379 // This is not exact and over-promotes sometimes if
380 // compositing_ancestor_ is not under the same scroller as the sticky
381 // element.
382 !current_recursion_data.compositing_ancestor_->AncestorScrollingLayer()
flackr 2017/05/12 18:00:46 If we have a composited ancestor scrolling layer t
yigu 2017/05/17 19:39:05 It's possible that a sticky element have a composi
383 ->IsRootLayer()) {
384 reasons_to_composite |= kCompositingReasonScrollDependentPosition;
385 }
386
375 bool will_be_composited_or_squashed = 387 bool will_be_composited_or_squashed =
376 can_be_composited && RequiresCompositingOrSquashing(reasons_to_composite); 388 can_be_composited && RequiresCompositingOrSquashing(reasons_to_composite);
377 if (will_be_composited_or_squashed) { 389 if (will_be_composited_or_squashed) {
378 // This layer now acts as the ancestor for kids. 390 // This layer now acts as the ancestor for kids.
379 child_recursion_data.compositing_ancestor_ = layer; 391 child_recursion_data.compositing_ancestor_ = layer;
380 392
381 // Here we know that all children and the layer's own contents can blindly 393 // 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 394 // 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. 395 // don't need to check for overlap with anything behind this layer.
384 overlap_map.BeginNewOverlapTestingContext(); 396 overlap_map.BeginNewOverlapTestingContext();
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 descendant_has3d_transform |= 568 descendant_has3d_transform |=
557 any_descendant_has3d_transform || layer->Has3DTransform(); 569 any_descendant_has3d_transform || layer->Has3DTransform();
558 } 570 }
559 571
560 // At this point we have finished collecting all reasons to composite this 572 // At this point we have finished collecting all reasons to composite this
561 // layer. 573 // layer.
562 layer->SetCompositingReasons(reasons_to_composite); 574 layer->SetCompositingReasons(reasons_to_composite);
563 } 575 }
564 576
565 } // namespace blink 577 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698