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. | |
chrishtr
2016/09/09 20:32:14
s/could/need it/
Stephen Chennney
2016/09/09 20:56:11
Done.
| |
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. | |
244 // | |
245 // FIXME: it should also be possible to promote if the layer can | |
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()) { |
283 // TODO(schenney): We only need to promote when the clipParent is no t a descendant of the ancestor scroller, | |
284 // which we do not check for here. Hence we might be promoting needl essly. | |
287 unclippedDescendants.append(layer); | 285 unclippedDescendants.append(layer); |
286 } | |
288 } | 287 } |
289 | 288 |
290 const IntRect& absBounds = layer->clippedAbsoluteBoundingBox(); | 289 const IntRect& absBounds = layer->clippedAbsoluteBoundingBox(); |
291 absoluteDescendantBoundingBox = absBounds; | 290 absoluteDescendantBoundingBox = absBounds; |
292 | 291 |
293 if (currentRecursionData.m_testingOverlap && !requiresCompositingOrSquashing (directReasons)) | 292 if (currentRecursionData.m_testingOverlap && !requiresCompositingOrSquashing (directReasons)) |
294 overlapCompositingReason = overlapMap.overlapsLayers(absBounds) ? Compos itingReasonOverlap : CompositingReasonNone; | 293 overlapCompositingReason = overlapMap.overlapsLayers(absBounds) ? Compos itingReasonOverlap : CompositingReasonNone; |
295 | 294 |
296 reasonsToComposite |= overlapCompositingReason; | 295 reasonsToComposite |= overlapCompositingReason; |
297 | 296 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
448 overlapMap.finishCurrentOverlapTestingContext(); | 447 overlapMap.finishCurrentOverlapTestingContext(); |
449 | 448 |
450 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DT ransform(); | 449 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DT ransform(); |
451 } | 450 } |
452 | 451 |
453 // At this point we have finished collecting all reasons to composite this l ayer. | 452 // At this point we have finished collecting all reasons to composite this l ayer. |
454 layer->setCompositingReasons(reasonsToComposite); | 453 layer->setCompositingReasons(reasonsToComposite); |
455 } | 454 } |
456 | 455 |
457 } // namespace blink | 456 } // namespace blink |
OLD | NEW |