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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
229 if (currentRecursionData.m_hasCompositedScrollingAncestor && layer->layoutOb ject()->styleRef().hasViewportConstrainedPosition()) | 229 if (currentRecursionData.m_hasCompositedScrollingAncestor && layer->layoutOb ject()->styleRef().hasViewportConstrainedPosition()) |
230 directReasons |= CompositingReasonPositionFixed; | 230 directReasons |= CompositingReasonPositionFixed; |
231 | 231 |
232 bool canBeComposited = compositor->canBeComposited(layer); | 232 bool canBeComposited = compositor->canBeComposited(layer); |
233 if (canBeComposited) { | 233 if (canBeComposited) { |
234 reasonsToComposite |= directReasons; | 234 reasonsToComposite |= directReasons; |
235 | 235 |
236 if (layer->isRootLayer() && compositor->rootShouldAlwaysComposite()) | 236 if (layer->isRootLayer() && compositor->rootShouldAlwaysComposite()) |
237 reasonsToComposite |= CompositingReasonRoot; | 237 reasonsToComposite |= CompositingReasonRoot; |
238 | 238 |
239 // Add CompositingReasonOverflowScrollingTouch for layers that do not al ready have it but could. | |
240 // Note that m_compositingReasonFinder.directReasons(layer) already incl udes CompositingReasonOverflowScrollingTouch for | |
241 // anything that has layer->needsCompositedScrolling() true. That is, fo r cases where we explicitly decide not to have LCD | |
242 // text or cases where the layer will still support LCD text even if the layer is composited. | |
239 if (reasonsToComposite && layer->scrollsOverflow() && !layer->needsCompo sitedScrolling()) { | 243 if (reasonsToComposite && layer->scrollsOverflow() && !layer->needsCompo sitedScrolling()) { |
240 // We will only set needsCompositedScrolling if we don't care about | 244 // We can get here for a scroller that will be composited for some o ther reason and hence will already |
241 // the LCD text hit, we may be able to switch to the compositor | 245 // use grayscale AA text. We recheck for needsCompositedScrolling ig noring LCD to correctly add the |
242 // driven path if we're alread composited for other reasons and are | 246 // CompositingReasonOverflowScrollingTouch reason to layers that can support it with grayscale AA text. |
243 // therefore using grayscale AA. | |
Stephen Chennney
2016/09/07 20:38:40
Clarified the meaning of this comment.
| |
244 // | |
245 // FIXME: it should also be possible to promote if the layer can | |
Stephen Chennney
2016/09/07 20:38:40
This FIXME is redundant in that we have patches in
| |
246 // still use LCD text when promoted, but detecting when the | |
247 // compositor can do this is tricky. Currently, the layer must be | |
248 // both opaque and may only have an integer translation as its | |
249 // transform. Both opacity and screen space transform are inherited | |
250 // properties, so this cannot be determined from local information. | |
251 layer->getScrollableArea()->updateNeedsCompositedScrolling(PaintLaye rScrollableArea::IgnoreLCDText); | 247 layer->getScrollableArea()->updateNeedsCompositedScrolling(PaintLaye rScrollableArea::IgnoreLCDText); |
252 if (layer->needsCompositedScrolling()) | 248 if (layer->needsCompositedScrolling()) |
253 reasonsToComposite |= CompositingReasonOverflowScrollingTouch; | 249 reasonsToComposite |= CompositingReasonOverflowScrollingTouch; |
254 } | 250 } |
255 } | 251 } |
256 | 252 |
257 if ((reasonsToComposite & CompositingReasonOverflowScrollingTouch) && !layer ->isRootLayer()) | 253 if ((reasonsToComposite & CompositingReasonOverflowScrollingTouch) && !layer ->isRootLayer()) |
258 currentRecursionData.m_hasCompositedScrollingAncestor = true; | 254 currentRecursionData.m_hasCompositedScrollingAncestor = true; |
259 | 255 |
260 // Next, accumulate reasons related to overlap. | 256 // Next, accumulate reasons related to overlap. |
(...skipping 15 matching lines...) Expand all Loading... | |
276 } | 272 } |
277 if (layer->scrollsWithRespectTo(unclippedDescendant)) | 273 if (layer->scrollsWithRespectTo(unclippedDescendant)) |
278 reasonsToComposite |= CompositingReasonAssumedOverlap; | 274 reasonsToComposite |= CompositingReasonAssumedOverlap; |
279 } | 275 } |
280 | 276 |
281 // Remove irrelevant unclipped descendants in reverse order so our store d | 277 // Remove irrelevant unclipped descendants in reverse order so our store d |
282 // indices remain valid. | 278 // indices remain valid. |
283 for (size_t i = 0; i < unclippedDescendantsToRemove.size(); i++) | 279 for (size_t i = 0; i < unclippedDescendantsToRemove.size(); i++) |
284 unclippedDescendants.remove(unclippedDescendantsToRemove.at(unclippe dDescendantsToRemove.size() - i - 1)); | 280 unclippedDescendants.remove(unclippedDescendantsToRemove.at(unclippe dDescendantsToRemove.size() - i - 1)); |
285 | 281 |
286 if (reasonsToComposite & CompositingReasonOutOfFlowClipping) | 282 if (layer->clipParent()) { |
chrishtr
2016/09/07 20:38:07
What went wrong exactly that it had to move from C
Stephen Chennney
2016/09/07 20:38:40
This check was previously in CompositingReasonsFin
flackr
2016/09/07 20:57:06
I'm not sure this is correct, it seems to me this
Stephen Chennney
2016/09/07 21:08:19
Maybe the logic covers that. We're only here if cu
flackr
2016/09/07 22:38:41
Adding it here causes a promotion of the current l
| |
283 reasonsToComposite |= CompositingReasonOutOfFlowClipping; | |
287 unclippedDescendants.append(layer); | 284 unclippedDescendants.append(layer); |
285 } | |
288 } | 286 } |
289 | 287 |
290 const IntRect& absBounds = layer->clippedAbsoluteBoundingBox(); | 288 const IntRect& absBounds = layer->clippedAbsoluteBoundingBox(); |
291 absoluteDescendantBoundingBox = absBounds; | 289 absoluteDescendantBoundingBox = absBounds; |
292 | 290 |
293 if (currentRecursionData.m_testingOverlap && !requiresCompositingOrSquashing (directReasons)) | 291 if (currentRecursionData.m_testingOverlap && !requiresCompositingOrSquashing (directReasons)) |
294 overlapCompositingReason = overlapMap.overlapsLayers(absBounds) ? Compos itingReasonOverlap : CompositingReasonNone; | 292 overlapCompositingReason = overlapMap.overlapsLayers(absBounds) ? Compos itingReasonOverlap : CompositingReasonNone; |
295 | 293 |
296 reasonsToComposite |= overlapCompositingReason; | 294 reasonsToComposite |= overlapCompositingReason; |
297 | 295 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
448 overlapMap.finishCurrentOverlapTestingContext(); | 446 overlapMap.finishCurrentOverlapTestingContext(); |
449 | 447 |
450 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DT ransform(); | 448 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DT ransform(); |
451 } | 449 } |
452 | 450 |
453 // At this point we have finished collecting all reasons to composite this l ayer. | 451 // At this point we have finished collecting all reasons to composite this l ayer. |
454 layer->setCompositingReasons(reasonsToComposite); | 452 layer->setCompositingReasons(reasonsToComposite); |
455 } | 453 } |
456 | 454 |
457 } // namespace blink | 455 } // namespace blink |
OLD | NEW |