| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 if (hasCompositedDescendants) { | 156 if (hasCompositedDescendants) { |
| 157 subtreeReasons |= layer->potentialCompositingReasonsFromStyle() & Compos
itingReasonComboCompositedDescendants; | 157 subtreeReasons |= layer->potentialCompositingReasonsFromStyle() & Compos
itingReasonComboCompositedDescendants; |
| 158 | 158 |
| 159 if (layer->shouldIsolateCompositedDescendants()) { | 159 if (layer->shouldIsolateCompositedDescendants()) { |
| 160 ASSERT(layer->stackingNode()->isStackingContext()); | 160 ASSERT(layer->stackingNode()->isStackingContext()); |
| 161 subtreeReasons |= CompositingReasonIsolateCompositedDescendants; | 161 subtreeReasons |= CompositingReasonIsolateCompositedDescendants; |
| 162 } | 162 } |
| 163 | 163 |
| 164 // FIXME: This should move into CompositingReasonFinder::potentialCompos
itingReasonsFromStyle, but | 164 // FIXME: This should move into CompositingReasonFinder::potentialCompos
itingReasonsFromStyle, but |
| 165 // theres a poor interaction with LayoutTextControlSingleLine, which set
s this hasOverflowClip directly. | 165 // theres a poor interaction with LayoutTextControlSingleLine, which set
s this hasOverflowClip directly. |
| 166 if (layer->renderer()->hasClipOrOverflowClip()) | 166 if (layer->layoutObject()->hasClipOrOverflowClip()) |
| 167 subtreeReasons |= CompositingReasonClipsCompositingDescendants; | 167 subtreeReasons |= CompositingReasonClipsCompositingDescendants; |
| 168 } | 168 } |
| 169 | 169 |
| 170 // A layer with preserve-3d or perspective only needs to be composited if th
ere are descendant layers that | 170 // A layer with preserve-3d or perspective only needs to be composited if th
ere are descendant layers that |
| 171 // will be affected by the preserve-3d or perspective. | 171 // will be affected by the preserve-3d or perspective. |
| 172 if (has3DTransformedDescendants) | 172 if (has3DTransformedDescendants) |
| 173 subtreeReasons |= layer->potentialCompositingReasonsFromStyle() & Compos
itingReasonCombo3DDescendants; | 173 subtreeReasons |= layer->potentialCompositingReasonsFromStyle() & Compos
itingReasonCombo3DDescendants; |
| 174 | 174 |
| 175 return subtreeReasons; | 175 return subtreeReasons; |
| 176 } | 176 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 210 |
| 211 layer->stackingNode()->updateLayerListsIfNeeded(); | 211 layer->stackingNode()->updateLayerListsIfNeeded(); |
| 212 | 212 |
| 213 CompositingReasons reasonsToComposite = CompositingReasonNone; | 213 CompositingReasons reasonsToComposite = CompositingReasonNone; |
| 214 CompositingReasons directReasons = m_compositingReasonFinder.directReasons(l
ayer); | 214 CompositingReasons directReasons = m_compositingReasonFinder.directReasons(l
ayer); |
| 215 | 215 |
| 216 // Video is special. It's the only Layer type that can both have | 216 // Video is special. It's the only Layer type that can both have |
| 217 // Layer children and whose children can't use its backing to render | 217 // Layer children and whose children can't use its backing to render |
| 218 // into. These children (the controls) always need to be promoted into their | 218 // into. These children (the controls) always need to be promoted into their |
| 219 // own layers to draw on top of the accelerated video. | 219 // own layers to draw on top of the accelerated video. |
| 220 if (currentRecursionData.m_compositingAncestor && currentRecursionData.m_com
positingAncestor->renderer()->isVideo()) | 220 if (currentRecursionData.m_compositingAncestor && currentRecursionData.m_com
positingAncestor->layoutObject()->isVideo()) |
| 221 directReasons |= CompositingReasonVideoOverlay; | 221 directReasons |= CompositingReasonVideoOverlay; |
| 222 | 222 |
| 223 if (compositor->canBeComposited(layer)) { | 223 if (compositor->canBeComposited(layer)) { |
| 224 reasonsToComposite |= directReasons; | 224 reasonsToComposite |= directReasons; |
| 225 | 225 |
| 226 if (layer->isRootLayer() && compositor->rootShouldAlwaysComposite()) | 226 if (layer->isRootLayer() && compositor->rootShouldAlwaysComposite()) |
| 227 reasonsToComposite |= CompositingReasonRoot; | 227 reasonsToComposite |= CompositingReasonRoot; |
| 228 | 228 |
| 229 if (reasonsToComposite && layer->scrollsOverflow() && !layer->needsCompo
sitedScrolling()) { | 229 if (reasonsToComposite && layer->scrollsOverflow() && !layer->needsCompo
sitedScrolling()) { |
| 230 // We will only set needsCompositedScrolling if we don't care about | 230 // We will only set needsCompositedScrolling if we don't care about |
| (...skipping 19 matching lines...) Expand all Loading... |
| 250 CompositingReasons overlapCompositingReason = currentRecursionData.m_subtree
IsCompositing ? CompositingReasonAssumedOverlap : CompositingReasonNone; | 250 CompositingReasons overlapCompositingReason = currentRecursionData.m_subtree
IsCompositing ? CompositingReasonAssumedOverlap : CompositingReasonNone; |
| 251 | 251 |
| 252 if (m_layoutView.compositor()->preferCompositingToLCDTextEnabled()) { | 252 if (m_layoutView.compositor()->preferCompositingToLCDTextEnabled()) { |
| 253 Vector<size_t> unclippedDescendantsToRemove; | 253 Vector<size_t> unclippedDescendantsToRemove; |
| 254 for (size_t i = 0; i < unclippedDescendants.size(); i++) { | 254 for (size_t i = 0; i < unclippedDescendants.size(); i++) { |
| 255 Layer* unclippedDescendant = unclippedDescendants.at(i); | 255 Layer* unclippedDescendant = unclippedDescendants.at(i); |
| 256 // If we've reached the containing block of one of the unclipped | 256 // If we've reached the containing block of one of the unclipped |
| 257 // descendants, that element is no longer relevant to whether or not
we | 257 // descendants, that element is no longer relevant to whether or not
we |
| 258 // should opt in. Unfortunately we can't easily remove from the list | 258 // should opt in. Unfortunately we can't easily remove from the list |
| 259 // while we're iterating, so we have to store it for later removal. | 259 // while we're iterating, so we have to store it for later removal. |
| 260 if (unclippedDescendant->renderer()->containingBlock() == layer->ren
derer()) { | 260 if (unclippedDescendant->layoutObject()->containingBlock() == layer-
>layoutObject()) { |
| 261 unclippedDescendantsToRemove.append(i); | 261 unclippedDescendantsToRemove.append(i); |
| 262 continue; | 262 continue; |
| 263 } | 263 } |
| 264 if (layer->scrollsWithRespectTo(unclippedDescendant)) | 264 if (layer->scrollsWithRespectTo(unclippedDescendant)) |
| 265 reasonsToComposite |= CompositingReasonAssumedOverlap; | 265 reasonsToComposite |= CompositingReasonAssumedOverlap; |
| 266 } | 266 } |
| 267 | 267 |
| 268 // Remove irrelevant unclipped descendants in reverse order so our store
d | 268 // Remove irrelevant unclipped descendants in reverse order so our store
d |
| 269 // indices remain valid. | 269 // indices remain valid. |
| 270 for (size_t i = 0; i < unclippedDescendantsToRemove.size(); i++) | 270 for (size_t i = 0; i < unclippedDescendantsToRemove.size(); i++) |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 reasonsToComposite |= layer->potentialCompositingReasonsFromStyle()
& CompositingReasonInlineTransform; | 410 reasonsToComposite |= layer->potentialCompositingReasonsFromStyle()
& CompositingReasonInlineTransform; |
| 411 | 411 |
| 412 // If the original layer is composited, the reflection needs to be, too. | 412 // If the original layer is composited, the reflection needs to be, too. |
| 413 if (layer->reflectionInfo()) { | 413 if (layer->reflectionInfo()) { |
| 414 // FIXME: Shouldn't we call computeCompositingRequirements to handle
a reflection overlapping with another renderer? | 414 // FIXME: Shouldn't we call computeCompositingRequirements to handle
a reflection overlapping with another renderer? |
| 415 Layer* reflectionLayer = layer->reflectionInfo()->reflectionLayer(); | 415 Layer* reflectionLayer = layer->reflectionInfo()->reflectionLayer(); |
| 416 CompositingReasons reflectionCompositingReason = willBeCompositedOrS
quashed ? CompositingReasonReflectionOfCompositedParent : CompositingReasonNone; | 416 CompositingReasons reflectionCompositingReason = willBeCompositedOrS
quashed ? CompositingReasonReflectionOfCompositedParent : CompositingReasonNone; |
| 417 reflectionLayer->setCompositingReasons(reflectionCompositingReason,
CompositingReasonReflectionOfCompositedParent); | 417 reflectionLayer->setCompositingReasons(reflectionCompositingReason,
CompositingReasonReflectionOfCompositedParent); |
| 418 } | 418 } |
| 419 | 419 |
| 420 if (willBeCompositedOrSquashed && layer->renderer()->style()->hasBlendMo
de()) | 420 if (willBeCompositedOrSquashed && layer->layoutObject()->style()->hasBle
ndMode()) |
| 421 currentRecursionData.m_hasUnisolatedCompositedBlendingDescendant = t
rue; | 421 currentRecursionData.m_hasUnisolatedCompositedBlendingDescendant = t
rue; |
| 422 | 422 |
| 423 // Turn overlap testing off for later layers if it's already off, or if
we have an animating transform. | 423 // Turn overlap testing off for later layers if it's already off, or if
we have an animating transform. |
| 424 // Note that if the layer clips its descendants, there's no reason to pr
opagate the child animation to the parent layers. That's because | 424 // Note that if the layer clips its descendants, there's no reason to pr
opagate the child animation to the parent layers. That's because |
| 425 // we know for sure the animation is contained inside the clipping recta
ngle, which is already added to the overlap map. | 425 // we know for sure the animation is contained inside the clipping recta
ngle, which is already added to the overlap map. |
| 426 bool isCompositedClippingLayer = compositor->canBeComposited(layer) && (
reasonsToComposite & CompositingReasonClipsCompositingDescendants); | 426 bool isCompositedClippingLayer = compositor->canBeComposited(layer) && (
reasonsToComposite & CompositingReasonClipsCompositingDescendants); |
| 427 bool isCompositedWithInlineTransform = reasonsToComposite & CompositingR
easonInlineTransform; | 427 bool isCompositedWithInlineTransform = reasonsToComposite & CompositingR
easonInlineTransform; |
| 428 if ((!childRecursionData.m_testingOverlap && !isCompositedClippingLayer)
|| layer->renderer()->style()->hasCurrentTransformAnimation() || isCompositedWi
thInlineTransform) | 428 if ((!childRecursionData.m_testingOverlap && !isCompositedClippingLayer)
|| layer->layoutObject()->style()->hasCurrentTransformAnimation() || isComposit
edWithInlineTransform) |
| 429 currentRecursionData.m_testingOverlap = false; | 429 currentRecursionData.m_testingOverlap = false; |
| 430 | 430 |
| 431 if (childRecursionData.m_compositingAncestor == layer) | 431 if (childRecursionData.m_compositingAncestor == layer) |
| 432 overlapMap.finishCurrentOverlapTestingContext(); | 432 overlapMap.finishCurrentOverlapTestingContext(); |
| 433 | 433 |
| 434 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DT
ransform(); | 434 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DT
ransform(); |
| 435 } | 435 } |
| 436 | 436 |
| 437 // At this point we have finished collecting all reasons to composite this l
ayer. | 437 // At this point we have finished collecting all reasons to composite this l
ayer. |
| 438 layer->setCompositingReasons(reasonsToComposite); | 438 layer->setCompositingReasons(reasonsToComposite); |
| 439 | 439 |
| 440 } | 440 } |
| 441 | 441 |
| 442 } // namespace blink | 442 } // namespace blink |
| OLD | NEW |