| 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 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 private: | 170 private: |
| 171 Vector<OverlapMapContainer> m_overlapStack; | 171 Vector<OverlapMapContainer> m_overlapStack; |
| 172 HashSet<const RenderLayer*> m_layers; | 172 HashSet<const RenderLayer*> m_layers; |
| 173 RenderGeometryMap m_geometryMap; | 173 RenderGeometryMap m_geometryMap; |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 struct CompositingRecursionData { | 176 struct CompositingRecursionData { |
| 177 CompositingRecursionData(RenderLayer* compAncestor, bool testOverlap) | 177 CompositingRecursionData(RenderLayer* compAncestor, bool testOverlap) |
| 178 : m_compositingAncestor(compAncestor) | 178 : m_compositingAncestor(compAncestor) |
| 179 , m_subtreeIsCompositing(false) | 179 , m_subtreeIsCompositing(false) |
| 180 , m_hasUnisolatedCompositedBlendingDescendant(false) |
| 180 , m_testingOverlap(testOverlap) | 181 , m_testingOverlap(testOverlap) |
| 181 #ifndef NDEBUG | 182 #ifndef NDEBUG |
| 182 , m_depth(0) | 183 , m_depth(0) |
| 183 #endif | 184 #endif |
| 184 { | 185 { |
| 185 } | 186 } |
| 186 | 187 |
| 187 CompositingRecursionData(const CompositingRecursionData& other) | 188 CompositingRecursionData(const CompositingRecursionData& other) |
| 188 : m_compositingAncestor(other.m_compositingAncestor) | 189 : m_compositingAncestor(other.m_compositingAncestor) |
| 189 , m_subtreeIsCompositing(other.m_subtreeIsCompositing) | 190 , m_subtreeIsCompositing(other.m_subtreeIsCompositing) |
| 191 , m_hasUnisolatedCompositedBlendingDescendant(other.m_hasUnisolatedCompo
sitedBlendingDescendant) |
| 190 , m_testingOverlap(other.m_testingOverlap) | 192 , m_testingOverlap(other.m_testingOverlap) |
| 191 #ifndef NDEBUG | 193 #ifndef NDEBUG |
| 192 , m_depth(other.m_depth + 1) | 194 , m_depth(other.m_depth + 1) |
| 193 #endif | 195 #endif |
| 194 { | 196 { |
| 195 } | 197 } |
| 196 | 198 |
| 197 RenderLayer* m_compositingAncestor; | 199 RenderLayer* m_compositingAncestor; |
| 198 bool m_subtreeIsCompositing; | 200 bool m_subtreeIsCompositing; |
| 201 bool m_hasUnisolatedCompositedBlendingDescendant; |
| 199 bool m_testingOverlap; | 202 bool m_testingOverlap; |
| 200 #ifndef NDEBUG | 203 #ifndef NDEBUG |
| 201 int m_depth; | 204 int m_depth; |
| 202 #endif | 205 #endif |
| 203 }; | 206 }; |
| 204 | 207 |
| 205 | 208 |
| 206 RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView) | 209 RenderLayerCompositor::RenderLayerCompositor(RenderView* renderView) |
| 207 : m_renderView(renderView) | 210 : m_renderView(renderView) |
| 208 , m_hasAcceleratedCompositing(true) | 211 , m_hasAcceleratedCompositing(true) |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 if (inCompositingMode() && m_hasAcceleratedCompositing) | 903 if (inCompositingMode() && m_hasAcceleratedCompositing) |
| 901 willBeComposited = true; | 904 willBeComposited = true; |
| 902 } | 905 } |
| 903 | 906 |
| 904 // All layers (even ones that aren't being composited) need to get added to | 907 // All layers (even ones that aren't being composited) need to get added to |
| 905 // the overlap map. Layers that are not separately composited will paint int
o their | 908 // the overlap map. Layers that are not separately composited will paint int
o their |
| 906 // compositing ancestor's backing, and so are still considered for overlap. | 909 // compositing ancestor's backing, and so are still considered for overlap. |
| 907 if (overlapMap && childRecursionData.m_compositingAncestor && !childRecursio
nData.m_compositingAncestor->isRootLayer()) | 910 if (overlapMap && childRecursionData.m_compositingAncestor && !childRecursio
nData.m_compositingAncestor->isRootLayer()) |
| 908 addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds); | 911 addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds); |
| 909 | 912 |
| 913 if (layer->stackingNode()->isStackingContext()) |
| 914 layer->setShouldIsolateCompositedDescendants(childRecursionData.m_hasUni
solatedCompositedBlendingDescendant); |
| 915 else |
| 916 currentRecursionData.m_hasUnisolatedCompositedBlendingDescendant = child
RecursionData.m_hasUnisolatedCompositedBlendingDescendant; |
| 917 |
| 910 // Now check for reasons to become composited that depend on the state of de
scendant layers. | 918 // Now check for reasons to become composited that depend on the state of de
scendant layers. |
| 911 CompositingReasons subtreeCompositingReasons = subtreeReasonsForCompositing(
layer->renderer(), childRecursionData.m_subtreeIsCompositing, anyDescendantHas3D
Transform); | 919 CompositingReasons subtreeCompositingReasons = subtreeReasonsForCompositing(
layer->renderer(), childRecursionData.m_subtreeIsCompositing, anyDescendantHas3D
Transform); |
| 912 reasonsToComposite |= subtreeCompositingReasons; | 920 reasonsToComposite |= subtreeCompositingReasons; |
| 913 if (!willBeComposited && canBeComposited(layer) && requiresCompositing(subtr
eeCompositingReasons)) { | 921 if (!willBeComposited && canBeComposited(layer) && requiresCompositing(subtr
eeCompositingReasons)) { |
| 914 childRecursionData.m_compositingAncestor = layer; | 922 childRecursionData.m_compositingAncestor = layer; |
| 915 if (overlapMap) { | 923 if (overlapMap) { |
| 916 // FIXME: this context push is effectively a no-op but needs to exis
t for | 924 // FIXME: this context push is effectively a no-op but needs to exis
t for |
| 917 // now, because the code is designed to push overlap information to
the | 925 // now, because the code is designed to push overlap information to
the |
| 918 // second-from-top context of the stack. | 926 // second-from-top context of the stack. |
| 919 overlapMap->beginNewOverlapTestingContext(); | 927 overlapMap->beginNewOverlapTestingContext(); |
| 920 addToOverlapMapRecursive(*overlapMap, layer); | 928 addToOverlapMapRecursive(*overlapMap, layer); |
| 921 } | 929 } |
| 922 willBeComposited = true; | 930 willBeComposited = true; |
| 923 } | 931 } |
| 924 | 932 |
| 925 // If the original layer is composited, the reflection needs to be, too. | 933 // If the original layer is composited, the reflection needs to be, too. |
| 926 if (layer->reflectionInfo()) { | 934 if (layer->reflectionInfo()) { |
| 927 // FIXME: Shouldn't we call computeCompositingRequirements to handle a r
eflection overlapping with another renderer? | 935 // FIXME: Shouldn't we call computeCompositingRequirements to handle a r
eflection overlapping with another renderer? |
| 928 CompositingReasons reflectionCompositingReason = willBeComposited ? Comp
ositingReasonReflectionOfCompositedParent : CompositingReasonNone; | 936 CompositingReasons reflectionCompositingReason = willBeComposited ? Comp
ositingReasonReflectionOfCompositedParent : CompositingReasonNone; |
| 929 layer->reflectionInfo()->reflectionLayer()->setCompositingReasons(layer-
>reflectionInfo()->reflectionLayer()->compositingReasons() | reflectionCompositi
ngReason); | 937 layer->reflectionInfo()->reflectionLayer()->setCompositingReasons(layer-
>reflectionInfo()->reflectionLayer()->compositingReasons() | reflectionCompositi
ngReason); |
| 930 } | 938 } |
| 931 | 939 |
| 932 // Subsequent layers in the parent's stacking context may also need to compo
site. | 940 // Subsequent layers in the parent's stacking context may also need to compo
site. |
| 933 if (childRecursionData.m_subtreeIsCompositing) | 941 if (childRecursionData.m_subtreeIsCompositing) |
| 934 currentRecursionData.m_subtreeIsCompositing = true; | 942 currentRecursionData.m_subtreeIsCompositing = true; |
| 935 | 943 |
| 944 if (willBeComposited && layer->hasBlendMode()) |
| 945 currentRecursionData.m_hasUnisolatedCompositedBlendingDescendant = true; |
| 946 |
| 936 // Set the flag to say that this SC has compositing children. | 947 // Set the flag to say that this SC has compositing children. |
| 937 layer->setHasCompositingDescendant(childRecursionData.m_subtreeIsCompositing
); | 948 layer->setHasCompositingDescendant(childRecursionData.m_subtreeIsCompositing
); |
| 938 | 949 |
| 939 // Turn overlap testing off for later layers if it's already off, or if we h
ave an animating transform. | 950 // Turn overlap testing off for later layers if it's already off, or if we h
ave an animating transform. |
| 940 // Note that if the layer clips its descendants, there's no reason to propag
ate the child animation to the parent layers. That's because | 951 // Note that if the layer clips its descendants, there's no reason to propag
ate the child animation to the parent layers. That's because |
| 941 // we know for sure the animation is contained inside the clipping rectangle
, which is already added to the overlap map. | 952 // we know for sure the animation is contained inside the clipping rectangle
, which is already added to the overlap map. |
| 942 bool isCompositedClippingLayer = canBeComposited(layer) && (reasonsToComposi
te & CompositingReasonClipsCompositingDescendants); | 953 bool isCompositedClippingLayer = canBeComposited(layer) && (reasonsToComposi
te & CompositingReasonClipsCompositingDescendants); |
| 943 if ((!childRecursionData.m_testingOverlap && !isCompositedClippingLayer) ||
isRunningAcceleratedTransformAnimation(layer->renderer())) | 954 if ((!childRecursionData.m_testingOverlap && !isCompositedClippingLayer) ||
isRunningAcceleratedTransformAnimation(layer->renderer())) |
| 944 currentRecursionData.m_testingOverlap = false; | 955 currentRecursionData.m_testingOverlap = false; |
| 945 | 956 |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1701 | 1712 |
| 1702 // FIXME: this seems to be a potentially different layer than the layer for
which this was called. May not be an error, but is very confusing. | 1713 // FIXME: this seems to be a potentially different layer than the layer for
which this was called. May not be an error, but is very confusing. |
| 1703 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer(); | 1714 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer(); |
| 1704 | 1715 |
| 1705 // When a layer has composited descendants, some effects, like 2d transforms
, filters, masks etc must be implemented | 1716 // When a layer has composited descendants, some effects, like 2d transforms
, filters, masks etc must be implemented |
| 1706 // via compositing so that they also apply to those composited descdendants. | 1717 // via compositing so that they also apply to those composited descdendants. |
| 1707 if (hasCompositedDescendants) { | 1718 if (hasCompositedDescendants) { |
| 1708 if (layer->transform()) | 1719 if (layer->transform()) |
| 1709 subtreeReasons |= CompositingReasonTransformWithCompositedDescendant
s; | 1720 subtreeReasons |= CompositingReasonTransformWithCompositedDescendant
s; |
| 1710 | 1721 |
| 1722 if (layer->shouldIsolateCompositedDescendants()) { |
| 1723 ASSERT(layer->stackingNode()->isStackingContext()); |
| 1724 subtreeReasons |= CompositingReasonIsolateCompositedDescendants; |
| 1725 } |
| 1726 |
| 1711 // If the implementation of createsGroup changes, we need to be aware of
that in this part of code. | 1727 // If the implementation of createsGroup changes, we need to be aware of
that in this part of code. |
| 1712 ASSERT((renderer->isTransparent() || renderer->hasMask() || renderer->ha
sFilter() || renderer->hasBlendMode()) == renderer->createsGroup()); | 1728 ASSERT((renderer->isTransparent() || renderer->hasMask() || renderer->ha
sFilter() || renderer->hasBlendMode()) == renderer->createsGroup()); |
| 1713 if (renderer->isTransparent()) | 1729 if (renderer->isTransparent()) |
| 1714 subtreeReasons |= CompositingReasonOpacityWithCompositedDescendants; | 1730 subtreeReasons |= CompositingReasonOpacityWithCompositedDescendants; |
| 1715 if (renderer->hasMask()) | 1731 if (renderer->hasMask()) |
| 1716 subtreeReasons |= CompositingReasonMaskWithCompositedDescendants; | 1732 subtreeReasons |= CompositingReasonMaskWithCompositedDescendants; |
| 1717 if (renderer->hasFilter()) | 1733 if (renderer->hasFilter()) |
| 1718 subtreeReasons |= CompositingReasonFilterWithCompositedDescendants; | 1734 subtreeReasons |= CompositingReasonFilterWithCompositedDescendants; |
| 1719 if (renderer->hasBlendMode()) | 1735 if (renderer->hasBlendMode()) |
| 1720 subtreeReasons |= CompositingReasonBlendingWithCompositedDescendants
; | 1736 subtreeReasons |= CompositingReasonBlendingWithCompositedDescendants
; |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2444 } else if (graphicsLayer == m_scrollLayer.get()) { | 2460 } else if (graphicsLayer == m_scrollLayer.get()) { |
| 2445 name = "Frame Scrolling Layer"; | 2461 name = "Frame Scrolling Layer"; |
| 2446 } else { | 2462 } else { |
| 2447 ASSERT_NOT_REACHED(); | 2463 ASSERT_NOT_REACHED(); |
| 2448 } | 2464 } |
| 2449 | 2465 |
| 2450 return name; | 2466 return name; |
| 2451 } | 2467 } |
| 2452 | 2468 |
| 2453 } // namespace WebCore | 2469 } // namespace WebCore |
| OLD | NEW |