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_hasCompositedBlendingDescendants(false) | |
enne (OOO)
2013/11/11 21:52:46
Can you rename this to make it more clear? At firs
rosca
2013/11/12 20:27:07
I think hasUnisolatedCompositedBlendingDescendant
| |
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_hasCompositedBlendingDescendants(other.m_hasCompositedBlendingDescen dants) | |
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_hasCompositedBlendingDescendants; | |
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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
902 if (inCompositingMode() && m_hasAcceleratedCompositing) | 905 if (inCompositingMode() && m_hasAcceleratedCompositing) |
903 willBeComposited = true; | 906 willBeComposited = true; |
904 } | 907 } |
905 | 908 |
906 // All layers (even ones that aren't being composited) need to get added to | 909 // All layers (even ones that aren't being composited) need to get added to |
907 // the overlap map. Layers that are not separately composited will paint int o their | 910 // the overlap map. Layers that are not separately composited will paint int o their |
908 // compositing ancestor's backing, and so are still considered for overlap. | 911 // compositing ancestor's backing, and so are still considered for overlap. |
909 if (overlapMap && childRecursionData.m_compositingAncestor && !childRecursio nData.m_compositingAncestor->isRootLayer()) | 912 if (overlapMap && childRecursionData.m_compositingAncestor && !childRecursio nData.m_compositingAncestor->isRootLayer()) |
910 addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds); | 913 addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds); |
911 | 914 |
915 layer->setRequiresIsolationForCompositedStackingContext(childRecursionData.m _hasCompositedBlendingDescendants); | |
916 | |
917 if (layer->requiresIsolationForCompositedStackingContext() && !layer->stacki ngNode()->isStackingContext()) | |
918 currentRecursionData.m_hasCompositedBlendingDescendants = true; | |
919 | |
912 // Now check for reasons to become composited that depend on the state of de scendant layers. | 920 // Now check for reasons to become composited that depend on the state of de scendant layers. |
913 CompositingReasons subtreeCompositingReasons = subtreeReasonsForCompositing( layer->renderer(), childRecursionData.m_subtreeIsCompositing, anyDescendantHas3D Transform); | 921 CompositingReasons subtreeCompositingReasons = subtreeReasonsForCompositing( layer->renderer(), childRecursionData.m_subtreeIsCompositing, anyDescendantHas3D Transform); |
914 reasonsToComposite |= subtreeCompositingReasons; | 922 reasonsToComposite |= subtreeCompositingReasons; |
915 if (!willBeComposited && canBeComposited(layer) && requiresCompositing(subtr eeCompositingReasons)) { | 923 if (!willBeComposited && canBeComposited(layer) && requiresCompositing(subtr eeCompositingReasons)) { |
916 childRecursionData.m_compositingAncestor = layer; | 924 childRecursionData.m_compositingAncestor = layer; |
917 if (overlapMap) { | 925 if (overlapMap) { |
918 // FIXME: this context push is effectively a no-op but needs to exis t for | 926 // FIXME: this context push is effectively a no-op but needs to exis t for |
919 // now, because the code is designed to push overlap information to the | 927 // now, because the code is designed to push overlap information to the |
920 // second-from-top context of the stack. | 928 // second-from-top context of the stack. |
921 overlapMap->beginNewOverlapTestingContext(); | 929 overlapMap->beginNewOverlapTestingContext(); |
922 addToOverlapMapRecursive(*overlapMap, layer); | 930 addToOverlapMapRecursive(*overlapMap, layer); |
923 } | 931 } |
924 willBeComposited = true; | 932 willBeComposited = true; |
925 } | 933 } |
926 | 934 |
927 // If the original layer is composited, the reflection needs to be, too. | 935 // If the original layer is composited, the reflection needs to be, too. |
928 if (layer->reflectionInfo()) { | 936 if (layer->reflectionInfo()) { |
929 // FIXME: Shouldn't we call computeCompositingRequirements to handle a r eflection overlapping with another renderer? | 937 // FIXME: Shouldn't we call computeCompositingRequirements to handle a r eflection overlapping with another renderer? |
930 CompositingReasons reflectionCompositingReason = willBeComposited ? Comp ositingReasonReflectionOfCompositedParent : CompositingReasonNone; | 938 CompositingReasons reflectionCompositingReason = willBeComposited ? Comp ositingReasonReflectionOfCompositedParent : CompositingReasonNone; |
931 layer->reflectionInfo()->reflectionLayer()->setCompositingReasons(layer- >reflectionInfo()->reflectionLayer()->compositingReasons() | reflectionCompositi ngReason); | 939 layer->reflectionInfo()->reflectionLayer()->setCompositingReasons(layer- >reflectionInfo()->reflectionLayer()->compositingReasons() | reflectionCompositi ngReason); |
932 } | 940 } |
933 | 941 |
934 // Subsequent layers in the parent's stacking context may also need to compo site. | 942 // Subsequent layers in the parent's stacking context may also need to compo site. |
935 if (childRecursionData.m_subtreeIsCompositing) | 943 if (childRecursionData.m_subtreeIsCompositing) |
936 currentRecursionData.m_subtreeIsCompositing = true; | 944 currentRecursionData.m_subtreeIsCompositing = true; |
937 | 945 |
946 if (willBeComposited && layer->hasBlendMode()) | |
947 currentRecursionData.m_hasCompositedBlendingDescendants = true; | |
948 | |
938 // Set the flag to say that this SC has compositing children. | 949 // Set the flag to say that this SC has compositing children. |
939 layer->setHasCompositingDescendant(childRecursionData.m_subtreeIsCompositing ); | 950 layer->setHasCompositingDescendant(childRecursionData.m_subtreeIsCompositing ); |
940 | 951 |
941 // Turn overlap testing off for later layers if it's already off, or if we h ave an animating transform. | 952 // Turn overlap testing off for later layers if it's already off, or if we h ave an animating transform. |
942 // 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 | 953 // 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 |
943 // we know for sure the animation is contained inside the clipping rectangle , which is already added to the overlap map. | 954 // we know for sure the animation is contained inside the clipping rectangle , which is already added to the overlap map. |
944 bool isCompositedClippingLayer = canBeComposited(layer) && (reasonsToComposi te & CompositingReasonClipsCompositingDescendants); | 955 bool isCompositedClippingLayer = canBeComposited(layer) && (reasonsToComposi te & CompositingReasonClipsCompositingDescendants); |
945 if ((!childRecursionData.m_testingOverlap && !isCompositedClippingLayer) || isRunningAcceleratedTransformAnimation(layer->renderer())) | 956 if ((!childRecursionData.m_testingOverlap && !isCompositedClippingLayer) || isRunningAcceleratedTransformAnimation(layer->renderer())) |
946 currentRecursionData.m_testingOverlap = false; | 957 currentRecursionData.m_testingOverlap = false; |
947 | 958 |
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1705 CompositingReasons subtreeReasons = CompositingReasonNone; | 1716 CompositingReasons subtreeReasons = CompositingReasonNone; |
1706 | 1717 |
1707 // 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. | 1718 // 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. |
1708 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer(); | 1719 RenderLayer* layer = toRenderBoxModelObject(renderer)->layer(); |
1709 | 1720 |
1710 // When a layer has composited descendants, some effects, like 2d transforms , filters, masks etc must be implemented | 1721 // When a layer has composited descendants, some effects, like 2d transforms , filters, masks etc must be implemented |
1711 // via compositing so that they also apply to those composited descdendants. | 1722 // via compositing so that they also apply to those composited descdendants. |
1712 if (hasCompositedDescendants) { | 1723 if (hasCompositedDescendants) { |
1713 if (layer->transform()) | 1724 if (layer->transform()) |
1714 subtreeReasons |= CompositingReasonTransformWithCompositedDescendant s; | 1725 subtreeReasons |= CompositingReasonTransformWithCompositedDescendant s; |
1726 if (layer->requiresIsolationForCompositedStackingContext() && layer->sta ckingNode()->isStackingContext()) | |
enne (OOO)
2013/11/11 21:52:46
It's a little awkward to set a "requires ... for s
rosca
2013/11/12 20:27:07
Yes, done. In this case I think it's more appropri
| |
1727 subtreeReasons |= CompositingReasonIsolateCompositedDescendants; | |
1715 | 1728 |
1716 // If the implementation of createsGroup changes, we need to be aware of that in this part of code. | 1729 // If the implementation of createsGroup changes, we need to be aware of that in this part of code. |
1717 ASSERT((renderer->isTransparent() || renderer->hasMask() || renderer->ha sFilter() || renderer->hasBlendMode()) == renderer->createsGroup()); | 1730 ASSERT((renderer->isTransparent() || renderer->hasMask() || renderer->ha sFilter() || renderer->hasBlendMode()) == renderer->createsGroup()); |
1718 if (renderer->isTransparent()) | 1731 if (renderer->isTransparent()) |
1719 subtreeReasons |= CompositingReasonOpacityWithCompositedDescendants; | 1732 subtreeReasons |= CompositingReasonOpacityWithCompositedDescendants; |
1720 if (renderer->hasMask()) | 1733 if (renderer->hasMask()) |
1721 subtreeReasons |= CompositingReasonMaskWithCompositedDescendants; | 1734 subtreeReasons |= CompositingReasonMaskWithCompositedDescendants; |
1722 if (renderer->hasFilter()) | 1735 if (renderer->hasFilter()) |
1723 subtreeReasons |= CompositingReasonFilterWithCompositedDescendants; | 1736 subtreeReasons |= CompositingReasonFilterWithCompositedDescendants; |
1724 if (renderer->hasBlendMode()) | 1737 if (renderer->hasBlendMode()) |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2449 } else if (graphicsLayer == m_scrollLayer.get()) { | 2462 } else if (graphicsLayer == m_scrollLayer.get()) { |
2450 name = "Frame Scrolling Layer"; | 2463 name = "Frame Scrolling Layer"; |
2451 } else { | 2464 } else { |
2452 ASSERT_NOT_REACHED(); | 2465 ASSERT_NOT_REACHED(); |
2453 } | 2466 } |
2454 | 2467 |
2455 return name; | 2468 return name; |
2456 } | 2469 } |
2457 | 2470 |
2458 } // namespace WebCore | 2471 } // namespace WebCore |
OLD | NEW |