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

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

Issue 2839263002: Don't promote position: fixed elements with composited descendants if they don't scroll (Closed)
Patch Set: Also rename the expected file 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 static bool RequiresCompositingOrSquashing(CompositingReasons reasons) { 159 static bool RequiresCompositingOrSquashing(CompositingReasons reasons) {
160 #if DCHECK_IS_ON() 160 #if DCHECK_IS_ON()
161 bool fast_answer = reasons != kCompositingReasonNone; 161 bool fast_answer = reasons != kCompositingReasonNone;
162 bool slow_answer = RequiresCompositing(reasons) || RequiresSquashing(reasons); 162 bool slow_answer = RequiresCompositing(reasons) || RequiresSquashing(reasons);
163 DCHECK_EQ(slow_answer, fast_answer); 163 DCHECK_EQ(slow_answer, fast_answer);
164 #endif 164 #endif
165 return reasons != kCompositingReasonNone; 165 return reasons != kCompositingReasonNone;
166 } 166 }
167 167
168 static CompositingReasons SubtreeReasonsForCompositing( 168 static CompositingReasons SubtreeReasonsForCompositing(
169 const CompositingReasonFinder& compositing_reason_finder,
169 PaintLayer* layer, 170 PaintLayer* layer,
170 bool has_composited_descendants, 171 bool has_composited_descendants,
171 bool has3d_transformed_descendants) { 172 bool has3d_transformed_descendants) {
172 CompositingReasons subtree_reasons = kCompositingReasonNone; 173 CompositingReasons subtree_reasons = kCompositingReasonNone;
173 174
174 // When a layer has composited descendants, some effects, like 2d transforms, 175 // When a layer has composited descendants, some effects, like 2d transforms,
175 // filters, masks etc must be implemented via compositing so that they also 176 // filters, masks etc must be implemented via compositing so that they also
176 // apply to those composited descendants. 177 // apply to those composited descendants.
177 if (has_composited_descendants) { 178 if (has_composited_descendants) {
178 subtree_reasons |= layer->PotentialCompositingReasonsFromStyle() & 179 subtree_reasons |= layer->PotentialCompositingReasonsFromStyle() &
179 kCompositingReasonComboCompositedDescendants; 180 kCompositingReasonComboCompositedDescendants;
180 181
181 if (layer->ShouldIsolateCompositedDescendants()) { 182 if (layer->ShouldIsolateCompositedDescendants()) {
182 DCHECK(layer->StackingNode()->IsStackingContext()); 183 DCHECK(layer->StackingNode()->IsStackingContext());
183 subtree_reasons |= kCompositingReasonIsolateCompositedDescendants; 184 subtree_reasons |= kCompositingReasonIsolateCompositedDescendants;
184 } 185 }
185 186
186 // FIXME: This should move into 187 // FIXME: This should move into
187 // CompositingReasonFinder::potentialCompositingReasonsFromStyle, but theres 188 // CompositingReasonFinder::potentialCompositingReasonsFromStyle, but theres
188 // a poor interaction with LayoutTextControlSingleLine, which sets this 189 // a poor interaction with LayoutTextControlSingleLine, which sets this
189 // hasOverflowClip directly. 190 // hasOverflowClip directly.
190 if (layer->GetLayoutObject().HasClipRelatedProperty()) 191 if (layer->GetLayoutObject().HasClipRelatedProperty())
191 subtree_reasons |= kCompositingReasonClipsCompositingDescendants; 192 subtree_reasons |= kCompositingReasonClipsCompositingDescendants;
192 193
193 if (layer->GetLayoutObject().Style()->GetPosition() == EPosition::kFixed) 194 const bool ignore_lcd_text = true;
flackr 2017/04/27 14:48:47 nit: Couldn't hurt to add a comment that we ignore
smcgruer 2017/04/27 14:53:30 Done.
195 if (layer->GetLayoutObject().Style()->GetPosition() == EPosition::kFixed &&
flackr 2017/04/27 14:48:46 I assume the check for EPosition::kFixed goes away
smcgruer 2017/04/27 14:53:30 Yep, the other patch will be reduced to removing t
196 compositing_reason_finder.RequiresCompositingForScrollDependentPosition(
197 layer, ignore_lcd_text)) {
194 subtree_reasons |= 198 subtree_reasons |=
195 kCompositingReasonPositionFixedWithCompositedDescendants; 199 kCompositingReasonPositionFixedWithCompositedDescendants;
200 }
196 } 201 }
197 202
198 // A layer with preserve-3d or perspective only needs to be composited if 203 // A layer with preserve-3d or perspective only needs to be composited if
199 // there are descendant layers that will be affected by the preserve-3d or 204 // there are descendant layers that will be affected by the preserve-3d or
200 // perspective. 205 // perspective.
201 if (has3d_transformed_descendants) { 206 if (has3d_transformed_descendants) {
202 subtree_reasons |= layer->PotentialCompositingReasonsFromStyle() & 207 subtree_reasons |= layer->PotentialCompositingReasonsFromStyle() &
203 kCompositingReasonCombo3DDescendants; 208 kCompositingReasonCombo3DDescendants;
204 } 209 }
205 210
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 // into their compositing ancestor's backing, and so are still considered 495 // into their compositing ancestor's backing, and so are still considered
491 // for overlap. 496 // for overlap.
492 if (child_recursion_data.compositing_ancestor_ && 497 if (child_recursion_data.compositing_ancestor_ &&
493 !child_recursion_data.compositing_ancestor_->IsRootLayer()) 498 !child_recursion_data.compositing_ancestor_->IsRootLayer())
494 overlap_map.Add(layer, abs_bounds, !has_composited_scrolling_ancestor); 499 overlap_map.Add(layer, abs_bounds, !has_composited_scrolling_ancestor);
495 500
496 // Now check for reasons to become composited that depend on the state of 501 // Now check for reasons to become composited that depend on the state of
497 // descendant layers. 502 // descendant layers.
498 CompositingReasons subtree_compositing_reasons = 503 CompositingReasons subtree_compositing_reasons =
499 SubtreeReasonsForCompositing( 504 SubtreeReasonsForCompositing(
500 layer, child_recursion_data.subtree_is_compositing_, 505 compositing_reason_finder_, layer,
506 child_recursion_data.subtree_is_compositing_,
501 any_descendant_has3d_transform); 507 any_descendant_has3d_transform);
502 reasons_to_composite |= subtree_compositing_reasons; 508 reasons_to_composite |= subtree_compositing_reasons;
503 if (!will_be_composited_or_squashed && can_be_composited && 509 if (!will_be_composited_or_squashed && can_be_composited &&
504 RequiresCompositingOrSquashing(subtree_compositing_reasons)) { 510 RequiresCompositingOrSquashing(subtree_compositing_reasons)) {
505 child_recursion_data.compositing_ancestor_ = layer; 511 child_recursion_data.compositing_ancestor_ = layer;
506 // FIXME: this context push is effectively a no-op but needs to exist for 512 // FIXME: this context push is effectively a no-op but needs to exist for
507 // now, because the code is designed to push overlap information to the 513 // now, because the code is designed to push overlap information to the
508 // second-from-top context of the stack. 514 // second-from-top context of the stack.
509 overlap_map.BeginNewOverlapTestingContext(); 515 overlap_map.BeginNewOverlapTestingContext();
510 overlap_map.Add(layer, absolute_descendant_bounding_box, 516 overlap_map.Add(layer, absolute_descendant_bounding_box,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 descendant_has3d_transform |= 554 descendant_has3d_transform |=
549 any_descendant_has3d_transform || layer->Has3DTransform(); 555 any_descendant_has3d_transform || layer->Has3DTransform();
550 } 556 }
551 557
552 // At this point we have finished collecting all reasons to composite this 558 // At this point we have finished collecting all reasons to composite this
553 // layer. 559 // layer.
554 layer->SetCompositingReasons(reasons_to_composite); 560 layer->SetCompositingReasons(reasons_to_composite);
555 } 561 }
556 562
557 } // namespace blink 563 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698