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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
112 public: | 112 public: |
113 OverlapMap() | 113 OverlapMap() |
114 : m_geometryMap(UseTransforms) | 114 : m_geometryMap(UseTransforms) |
115 { | 115 { |
116 // Begin by assuming the root layer will be composited so that there | 116 // Begin by assuming the root layer will be composited so that there |
117 // is something on the stack. The root layer should also never get a | 117 // is something on the stack. The root layer should also never get a |
118 // finishCurrentOverlapTestingContext() call. | 118 // finishCurrentOverlapTestingContext() call. |
119 beginNewOverlapTestingContext(); | 119 beginNewOverlapTestingContext(); |
120 } | 120 } |
121 | 121 |
122 void add(const RenderLayer* layer, const IntRect& bounds) | 122 void add(const IntRect& bounds) |
123 { | 123 { |
124 // Layers do not contribute to overlap immediately--instead, they will | 124 // Layers do not contribute to overlap immediately--instead, they will |
125 // contribute to overlap as soon as they have been recursively processed | 125 // contribute to overlap as soon as they have been recursively processed |
126 // and popped off the stack. | 126 // and popped off the stack. |
127 ASSERT(m_overlapStack.size() >= 2); | 127 ASSERT(m_overlapStack.size() >= 2); |
128 m_overlapStack[m_overlapStack.size() - 2].add(bounds); | 128 m_overlapStack[m_overlapStack.size() - 2].add(bounds); |
129 m_layers.add(layer); | |
130 } | |
131 | |
132 bool contains(const RenderLayer* layer) | |
133 { | |
134 return m_layers.contains(layer); | |
135 } | 129 } |
136 | 130 |
137 bool overlapsLayers(const IntRect& bounds) const | 131 bool overlapsLayers(const IntRect& bounds) const |
138 { | 132 { |
139 return m_overlapStack.last().overlapsLayers(bounds); | 133 return m_overlapStack.last().overlapsLayers(bounds); |
140 } | 134 } |
141 | 135 |
142 bool isEmpty() | |
143 { | |
144 return m_layers.isEmpty(); | |
145 } | |
146 | |
147 void beginNewOverlapTestingContext() | 136 void beginNewOverlapTestingContext() |
148 { | 137 { |
149 // This effectively creates a new "clean slate" for overlap state. | 138 // This effectively creates a new "clean slate" for overlap state. |
150 // This is used when we know that a subtree or remaining set of | 139 // This is used when we know that a subtree or remaining set of |
151 // siblings does not need to check overlap with things behind it. | 140 // siblings does not need to check overlap with things behind it. |
152 m_overlapStack.append(OverlapMapContainer()); | 141 m_overlapStack.append(OverlapMapContainer()); |
153 } | 142 } |
154 | 143 |
155 void finishCurrentOverlapTestingContext() | 144 void finishCurrentOverlapTestingContext() |
156 { | 145 { |
157 // The overlap information on the top of the stack is still necessary | 146 // The overlap information on the top of the stack is still necessary |
158 // for checking overlap of any layers outside this context that may | 147 // for checking overlap of any layers outside this context that may |
159 // overlap things from inside this context. Therefore, we must merge | 148 // overlap things from inside this context. Therefore, we must merge |
160 // the information from the top of the stack before popping the stack. | 149 // the information from the top of the stack before popping the stack. |
161 // | 150 // |
162 // FIXME: we may be able to avoid this deep copy by rearranging how | 151 // FIXME: we may be able to avoid this deep copy by rearranging how |
163 // overlapMap state is managed. | 152 // overlapMap state is managed. |
164 m_overlapStack[m_overlapStack.size() - 2].unite(m_overlapStack.last()); | 153 m_overlapStack[m_overlapStack.size() - 2].unite(m_overlapStack.last()); |
165 m_overlapStack.removeLast(); | 154 m_overlapStack.removeLast(); |
166 } | 155 } |
167 | 156 |
168 RenderGeometryMap& geometryMap() { return m_geometryMap; } | 157 RenderGeometryMap& geometryMap() { return m_geometryMap; } |
169 | 158 |
170 private: | 159 private: |
171 Vector<OverlapMapContainer> m_overlapStack; | 160 Vector<OverlapMapContainer> m_overlapStack; |
172 HashSet<const RenderLayer*> m_layers; | |
173 RenderGeometryMap m_geometryMap; | 161 RenderGeometryMap m_geometryMap; |
174 }; | 162 }; |
175 | 163 |
176 struct CompositingRecursionData { | 164 struct CompositingRecursionData { |
177 CompositingRecursionData(RenderLayer* compAncestor, RenderLayer* mostRecentC ompositedLayer, bool testOverlap) | 165 CompositingRecursionData(RenderLayer* compAncestor, RenderLayer* mostRecentC ompositedLayer, bool testOverlap) |
178 : m_compositingAncestor(compAncestor) | 166 : m_compositingAncestor(compAncestor) |
179 , m_mostRecentCompositedLayer(mostRecentCompositedLayer) | 167 , m_mostRecentCompositedLayer(mostRecentCompositedLayer) |
180 , m_subtreeIsCompositing(false) | 168 , m_subtreeIsCompositing(false) |
181 , m_hasUnisolatedCompositedBlendingDescendant(false) | 169 , m_hasUnisolatedCompositedBlendingDescendant(false) |
182 , m_testingOverlap(testOverlap) | 170 , m_testingOverlap(testOverlap) |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
859 for (RenderLayer* curr = layer->parent(); curr != 0; curr = curr->parent()) { | 847 for (RenderLayer* curr = layer->parent(); curr != 0; curr = curr->parent()) { |
860 if (curr->stackingNode()->isStackingContainer()) | 848 if (curr->stackingNode()->isStackingContainer()) |
861 return 0; | 849 return 0; |
862 | 850 |
863 if (curr->renderer()->hasClipOrOverflowClip()) | 851 if (curr->renderer()->hasClipOrOverflowClip()) |
864 return curr; | 852 return curr; |
865 } | 853 } |
866 return 0; | 854 return 0; |
867 } | 855 } |
868 | 856 |
869 void RenderLayerCompositor::addToOverlapMap(OverlapMap& overlapMap, RenderLayer* layer, IntRect& layerBounds, bool& boundsComputed) | 857 void RenderLayerCompositor::addToOverlapMap(OverlapMap& overlapMap, RenderLayer* layer, IntRect& layerBounds) |
enne (OOO)
2014/02/28 00:50:13
<333
| |
870 { | 858 { |
871 if (layer->isRootLayer()) | 859 if (layer->isRootLayer()) |
872 return; | 860 return; |
873 | 861 |
874 if (!boundsComputed) { | |
875 // FIXME: If this layer's overlap bounds include its children, we don't need to add its | |
876 // children's bounds to the overlap map. | |
877 layerBounds = enclosingIntRect(overlapMap.geometryMap().absoluteRect(lay er->overlapBounds())); | |
878 // Empty rects never intersect, but we need them to for the purposes of overlap testing. | |
879 if (layerBounds.isEmpty()) | |
880 layerBounds.setSize(IntSize(1, 1)); | |
881 boundsComputed = true; | |
882 } | |
883 | |
884 IntRect clipRect = pixelSnappedIntRect(layer->clipper().backgroundClipRect(C lipRectsContext(rootRenderLayer(), AbsoluteClipRects)).rect()); | 862 IntRect clipRect = pixelSnappedIntRect(layer->clipper().backgroundClipRect(C lipRectsContext(rootRenderLayer(), AbsoluteClipRects)).rect()); |
885 clipRect.intersect(layerBounds); | 863 clipRect.intersect(layerBounds); |
886 overlapMap.add(layer, clipRect); | 864 overlapMap.add(clipRect); |
887 } | |
888 | |
889 void RenderLayerCompositor::addToOverlapMapRecursive(OverlapMap& overlapMap, Ren derLayer* layer, RenderLayer* ancestorLayer) | |
890 { | |
891 if (!canBeComposited(layer) || overlapMap.contains(layer)) | |
892 return; | |
893 | |
894 // A null ancestorLayer is an indication that 'layer' has already been pushe d. | |
895 if (ancestorLayer) | |
896 overlapMap.geometryMap().pushMappingsToAncestor(layer, ancestorLayer); | |
897 | |
898 IntRect bounds; | |
899 bool haveComputedBounds = false; | |
900 addToOverlapMap(overlapMap, layer, bounds, haveComputedBounds); | |
901 | |
902 #if !ASSERT_DISABLED | |
903 LayerListMutationDetector mutationChecker(layer->stackingNode()); | |
904 #endif | |
905 | |
906 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), AllChildren ); | |
907 while (RenderLayerStackingNode* curNode = iterator.next()) | |
908 addToOverlapMapRecursive(overlapMap, curNode->layer(), layer); | |
909 | |
910 if (ancestorLayer) | |
911 overlapMap.geometryMap().popMappingsToAncestor(ancestorLayer); | |
912 } | 865 } |
913 | 866 |
914 // Recurse through the layers in z-index and overflow order (which is equivalen t to painting order) | 867 // Recurse through the layers in z-index and overflow order (which is equivalen t to painting order) |
915 // For the z-order children of a compositing layer: | 868 // For the z-order children of a compositing layer: |
916 // If a child layers has a compositing layer, then all subsequent layers mu st | 869 // If a child layers has a compositing layer, then all subsequent layers mu st |
917 // be compositing in order to render above that layer. | 870 // be compositing in order to render above that layer. |
918 // | 871 // |
919 // If a child in the negative z-order list is compositing, then the layer i tself | 872 // If a child in the negative z-order list is compositing, then the layer i tself |
920 // must be compositing so that its contents render over that child. | 873 // must be compositing so that its contents render over that child. |
921 // This implies that its positive z-index children must also be compositing . | 874 // This implies that its positive z-index children must also be compositing . |
922 // | 875 // |
923 void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor Layer, RenderLayer* layer, OverlapMap* overlapMap, CompositingRecursionData& cur rentRecursionData, bool& descendantHas3DTransform, Vector<RenderLayer*>& unclipp edDescendants) | 876 IntRect RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ances torLayer, RenderLayer* layer, OverlapMap* overlapMap, CompositingRecursionData& currentRecursionData, bool& descendantHas3DTransform, Vector<RenderLayer*>& uncl ippedDescendants) |
enne (OOO)
2014/02/28 00:50:13
Could you return this rect via CompositingRecursio
abarth-chromium
2014/02/28 02:22:08
Unfortunately, we can't do that because all the re
| |
924 { | 877 { |
925 layer->stackingNode()->updateLayerListsIfNeeded(); | 878 layer->stackingNode()->updateLayerListsIfNeeded(); |
926 | 879 |
927 if (overlapMap) | 880 if (overlapMap) |
928 overlapMap->geometryMap().pushMappingsToAncestor(layer, ancestorLayer); | 881 overlapMap->geometryMap().pushMappingsToAncestor(layer, ancestorLayer); |
929 | 882 |
930 // Clear the flag | 883 // Clear the flag |
931 layer->setHasCompositingDescendant(false); | 884 layer->setHasCompositingDescendant(false); |
932 layer->setHasNonCompositedChild(false); | 885 layer->setHasNonCompositedChild(false); |
933 | 886 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
970 | 923 |
971 // Remove irrelevant unclipped descendants in reverse order so our store d | 924 // Remove irrelevant unclipped descendants in reverse order so our store d |
972 // indices remain valid. | 925 // indices remain valid. |
973 for (size_t i = 0; i < unclippedDescendantsToRemove.size(); i++) | 926 for (size_t i = 0; i < unclippedDescendantsToRemove.size(); i++) |
974 unclippedDescendants.remove(unclippedDescendantsToRemove.at(unclippe dDescendantsToRemove.size() - i - 1)); | 927 unclippedDescendants.remove(unclippedDescendantsToRemove.at(unclippe dDescendantsToRemove.size() - i - 1)); |
975 | 928 |
976 if (reasonsToComposite & CompositingReasonOutOfFlowClipping) | 929 if (reasonsToComposite & CompositingReasonOutOfFlowClipping) |
977 unclippedDescendants.append(layer); | 930 unclippedDescendants.append(layer); |
978 } | 931 } |
979 | 932 |
980 bool haveComputedBounds = false; | |
981 IntRect absBounds; | 933 IntRect absBounds; |
982 // If we know for sure the layer is going to be composited, don't bother loo king it up in the overlap map. | 934 if (overlapMap && !layer->isRootLayer()) { |
983 if (overlapMap && !overlapMap->isEmpty() && currentRecursionData.m_testingOv erlap && !requiresCompositingOrSquashing(directReasons)) { | |
984 // If we're testing for overlap, we only need to composite if we overlap something that is already composited. | |
985 absBounds = enclosingIntRect(overlapMap->geometryMap().absoluteRect(laye r->overlapBounds())); | 935 absBounds = enclosingIntRect(overlapMap->geometryMap().absoluteRect(laye r->overlapBounds())); |
986 | |
987 // Empty rects never intersect, but we need them to for the purposes of overlap testing. | |
enne (OOO)
2014/02/28 00:50:13
Can you leave a comment here to https://codereview
abarth-chromium
2014/02/28 02:22:08
Sure.
| |
988 if (absBounds.isEmpty()) | 936 if (absBounds.isEmpty()) |
989 absBounds.setSize(IntSize(1, 1)); | 937 absBounds.setSize(IntSize(1, 1)); |
990 haveComputedBounds = true; | 938 } |
939 IntRect absoluteDecendantBoundingBox = absBounds; | |
940 | |
941 if (overlapMap && currentRecursionData.m_testingOverlap && !requiresComposit ingOrSquashing(directReasons)) | |
991 overlapCompositingReason = overlapMap->overlapsLayers(absBounds) ? Compo sitingReasonOverlap : CompositingReasonNone; | 942 overlapCompositingReason = overlapMap->overlapsLayers(absBounds) ? Compo sitingReasonOverlap : CompositingReasonNone; |
992 } | |
993 | 943 |
994 reasonsToComposite |= overlapCompositingReason; | 944 reasonsToComposite |= overlapCompositingReason; |
995 | 945 |
996 // If the layer is squashable, but would scroll differently than the | 946 // If the layer is squashable, but would scroll differently than the |
997 // most recent backing that it would squash onto, then don't squash it. | 947 // most recent backing that it would squash onto, then don't squash it. |
998 // Note that this happens before we know all possible compositing reasons | 948 // Note that this happens before we know all possible compositing reasons |
999 // for this layer, but it's OK because we're just forcing the layer conserva tively | 949 // for this layer, but it's OK because we're just forcing the layer conserva tively |
1000 // to be separately composited rather than squashed, anyway. | 950 // to be separately composited rather than squashed, anyway. |
1001 if (currentRecursionData.m_mostRecentCompositedLayer && requiresSquashing(re asonsToComposite) | 951 if (currentRecursionData.m_mostRecentCompositedLayer && requiresSquashing(re asonsToComposite) |
1002 && layer->scrollsWithRespectTo(currentRecursionData.m_mostRecentComposit edLayer)) | 952 && layer->scrollsWithRespectTo(currentRecursionData.m_mostRecentComposit edLayer)) |
(...skipping 25 matching lines...) Expand all Loading... | |
1028 #if !ASSERT_DISABLED | 978 #if !ASSERT_DISABLED |
1029 LayerListMutationDetector mutationChecker(layer->stackingNode()); | 979 LayerListMutationDetector mutationChecker(layer->stackingNode()); |
1030 #endif | 980 #endif |
1031 | 981 |
1032 bool anyDescendantHas3DTransform = false; | 982 bool anyDescendantHas3DTransform = false; |
1033 bool willHaveForegroundLayer = false; | 983 bool willHaveForegroundLayer = false; |
1034 | 984 |
1035 if (layer->stackingNode()->isStackingContainer()) { | 985 if (layer->stackingNode()->isStackingContainer()) { |
1036 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), Negativ eZOrderChildren); | 986 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), Negativ eZOrderChildren); |
1037 while (RenderLayerStackingNode* curNode = iterator.next()) { | 987 while (RenderLayerStackingNode* curNode = iterator.next()) { |
1038 computeCompositingRequirements(layer, curNode->layer(), overlapMap, childRecursionData, anyDescendantHas3DTransform, unclippedDescendants); | 988 absoluteDecendantBoundingBox.unite(computeCompositingRequirements(la yer, curNode->layer(), overlapMap, childRecursionData, anyDescendantHas3DTransfo rm, unclippedDescendants)); |
1039 | 989 |
1040 // If we have to make a layer for this child, make one now so we can have a contents layer | 990 // If we have to make a layer for this child, make one now so we can have a contents layer |
1041 // (since we need to ensure that the -ve z-order child renders under neath our contents). | 991 // (since we need to ensure that the -ve z-order child renders under neath our contents). |
1042 if (childRecursionData.m_subtreeIsCompositing) { | 992 if (childRecursionData.m_subtreeIsCompositing) { |
1043 reasonsToComposite |= CompositingReasonNegativeZIndexChildren; | 993 reasonsToComposite |= CompositingReasonNegativeZIndexChildren; |
1044 | 994 |
1045 if (!willBeCompositedOrSquashed) { | 995 if (!willBeCompositedOrSquashed) { |
1046 // make layer compositing | 996 // make layer compositing |
1047 childRecursionData.m_compositingAncestor = layer; | 997 childRecursionData.m_compositingAncestor = layer; |
1048 if (overlapMap) | 998 if (overlapMap) |
1049 overlapMap->beginNewOverlapTestingContext(); | 999 overlapMap->beginNewOverlapTestingContext(); |
1050 willBeCompositedOrSquashed = true; | 1000 willBeCompositedOrSquashed = true; |
1051 willHaveForegroundLayer = true; | 1001 willHaveForegroundLayer = true; |
1052 | 1002 |
1053 // FIXME: temporary solution for the first negative z-index composited child: | 1003 // FIXME: temporary solution for the first negative z-index composited child: |
1054 // re-compute the absBounds for the child so that we can add the | 1004 // re-compute the absBounds for the child so that we can add the |
1055 // negative z-index child's bounds to the new overlap context. | 1005 // negative z-index child's bounds to the new overlap context. |
1056 if (overlapMap) { | 1006 if (overlapMap) { |
1057 overlapMap->geometryMap().pushMappingsToAncestor(curNode ->layer(), layer); | 1007 overlapMap->geometryMap().pushMappingsToAncestor(curNode ->layer(), layer); |
1058 IntRect childAbsBounds = enclosingIntRect(overlapMap->ge ometryMap().absoluteRect(curNode->layer()->overlapBounds())); | 1008 IntRect childAbsBounds = enclosingIntRect(overlapMap->ge ometryMap().absoluteRect(curNode->layer()->overlapBounds())); |
1059 bool boundsComputed = true; | |
1060 overlapMap->beginNewOverlapTestingContext(); | 1009 overlapMap->beginNewOverlapTestingContext(); |
1061 addToOverlapMap(*overlapMap, curNode->layer(), childAbsB ounds, boundsComputed); | 1010 addToOverlapMap(*overlapMap, curNode->layer(), childAbsB ounds); |
1062 overlapMap->finishCurrentOverlapTestingContext(); | 1011 overlapMap->finishCurrentOverlapTestingContext(); |
1063 overlapMap->geometryMap().popMappingsToAncestor(layer); | 1012 overlapMap->geometryMap().popMappingsToAncestor(layer); |
1064 } | 1013 } |
1065 } | 1014 } |
1066 } | 1015 } |
1067 } | 1016 } |
1068 } | 1017 } |
1069 | 1018 |
1070 if (overlapMap && willHaveForegroundLayer) { | 1019 if (overlapMap && willHaveForegroundLayer) { |
1071 ASSERT(willBeCompositedOrSquashed); | 1020 ASSERT(willBeCompositedOrSquashed); |
1072 // A foreground layer effectively is a new backing for all subsequent ch ildren, so | 1021 // A foreground layer effectively is a new backing for all subsequent ch ildren, so |
1073 // we don't need to test for overlap with anything behind this. So, we c an finish | 1022 // we don't need to test for overlap with anything behind this. So, we c an finish |
1074 // the previous context that was accumulating rects for the negative z-i ndex | 1023 // the previous context that was accumulating rects for the negative z-i ndex |
1075 // children, and start with a fresh new empty context. | 1024 // children, and start with a fresh new empty context. |
1076 overlapMap->finishCurrentOverlapTestingContext(); | 1025 overlapMap->finishCurrentOverlapTestingContext(); |
1077 overlapMap->beginNewOverlapTestingContext(); | 1026 overlapMap->beginNewOverlapTestingContext(); |
1078 // This layer is going to be composited, so children can safely ignore t he fact that there's an | 1027 // This layer is going to be composited, so children can safely ignore t he fact that there's an |
1079 // animation running behind this layer, meaning they can rely on the ove rlap map testing again | 1028 // animation running behind this layer, meaning they can rely on the ove rlap map testing again |
1080 childRecursionData.m_testingOverlap = true; | 1029 childRecursionData.m_testingOverlap = true; |
1081 } | 1030 } |
1082 | 1031 |
1083 if (requiresCompositing(reasonsToComposite)) { | 1032 if (requiresCompositing(reasonsToComposite)) { |
1084 currentRecursionData.m_mostRecentCompositedLayer = layer; | 1033 currentRecursionData.m_mostRecentCompositedLayer = layer; |
1085 childRecursionData.m_mostRecentCompositedLayer = layer; | 1034 childRecursionData.m_mostRecentCompositedLayer = layer; |
1086 } | 1035 } |
1087 | 1036 |
1088 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowC hildren | PositiveZOrderChildren); | 1037 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowC hildren | PositiveZOrderChildren); |
1089 while (RenderLayerStackingNode* curNode = iterator.next()) | 1038 while (RenderLayerStackingNode* curNode = iterator.next()) |
1090 computeCompositingRequirements(layer, curNode->layer(), overlapMap, chil dRecursionData, anyDescendantHas3DTransform, unclippedDescendants); | 1039 absoluteDecendantBoundingBox.unite(computeCompositingRequirements(layer, curNode->layer(), overlapMap, childRecursionData, anyDescendantHas3DTransform, unclippedDescendants)); |
1091 | 1040 |
1092 currentRecursionData.m_mostRecentCompositedLayer = childRecursionData.m_most RecentCompositedLayer; | 1041 currentRecursionData.m_mostRecentCompositedLayer = childRecursionData.m_most RecentCompositedLayer; |
1093 | 1042 |
1094 // Now that the subtree has been traversed, we can check for compositing rea sons that depended on the state of the subtree. | 1043 // Now that the subtree has been traversed, we can check for compositing rea sons that depended on the state of the subtree. |
1095 | 1044 |
1096 // If we entered compositing mode during the recursion, the root will also n eed to be composited (as long as accelerated compositing is enabled). | 1045 // If we entered compositing mode during the recursion, the root will also n eed to be composited (as long as accelerated compositing is enabled). |
1097 if (layer->isRootLayer()) { | 1046 if (layer->isRootLayer()) { |
1098 if (inCompositingMode() && m_hasAcceleratedCompositing) | 1047 if (inCompositingMode() && m_hasAcceleratedCompositing) |
1099 willBeCompositedOrSquashed = true; | 1048 willBeCompositedOrSquashed = true; |
1100 } | 1049 } |
1101 | 1050 |
1102 // All layers (even ones that aren't being composited) need to get added to | 1051 // All layers (even ones that aren't being composited) need to get added to |
1103 // the overlap map. Layers that are not separately composited will paint int o their | 1052 // the overlap map. Layers that are not separately composited will paint int o their |
1104 // compositing ancestor's backing, and so are still considered for overlap. | 1053 // compositing ancestor's backing, and so are still considered for overlap. |
1105 if (overlapMap && childRecursionData.m_compositingAncestor && !childRecursio nData.m_compositingAncestor->isRootLayer()) | 1054 if (overlapMap && childRecursionData.m_compositingAncestor && !childRecursio nData.m_compositingAncestor->isRootLayer()) |
1106 addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds); | 1055 addToOverlapMap(*overlapMap, layer, absBounds); |
1107 | 1056 |
1108 if (layer->stackingNode()->isStackingContext()) { | 1057 if (layer->stackingNode()->isStackingContext()) { |
1109 layer->setShouldIsolateCompositedDescendants(childRecursionData.m_hasUni solatedCompositedBlendingDescendant); | 1058 layer->setShouldIsolateCompositedDescendants(childRecursionData.m_hasUni solatedCompositedBlendingDescendant); |
1110 } else { | 1059 } else { |
1111 layer->setShouldIsolateCompositedDescendants(false); | 1060 layer->setShouldIsolateCompositedDescendants(false); |
1112 currentRecursionData.m_hasUnisolatedCompositedBlendingDescendant = child RecursionData.m_hasUnisolatedCompositedBlendingDescendant; | 1061 currentRecursionData.m_hasUnisolatedCompositedBlendingDescendant = child RecursionData.m_hasUnisolatedCompositedBlendingDescendant; |
1113 } | 1062 } |
1114 | 1063 |
1115 // Now check for reasons to become composited that depend on the state of de scendant layers. | 1064 // Now check for reasons to become composited that depend on the state of de scendant layers. |
1116 CompositingReasons subtreeCompositingReasons = subtreeReasonsForCompositing( layer->renderer(), childRecursionData.m_subtreeIsCompositing, anyDescendantHas3D Transform); | 1065 CompositingReasons subtreeCompositingReasons = subtreeReasonsForCompositing( layer->renderer(), childRecursionData.m_subtreeIsCompositing, anyDescendantHas3D Transform); |
1117 reasonsToComposite |= subtreeCompositingReasons; | 1066 reasonsToComposite |= subtreeCompositingReasons; |
1118 if (!willBeCompositedOrSquashed && canBeComposited(layer) && requiresComposi tingOrSquashing(subtreeCompositingReasons)) { | 1067 if (!willBeCompositedOrSquashed && canBeComposited(layer) && requiresComposi tingOrSquashing(subtreeCompositingReasons)) { |
1119 childRecursionData.m_compositingAncestor = layer; | 1068 childRecursionData.m_compositingAncestor = layer; |
1120 if (overlapMap) { | 1069 if (overlapMap) { |
1121 // FIXME: this context push is effectively a no-op but needs to exis t for | 1070 // FIXME: this context push is effectively a no-op but needs to exis t for |
1122 // now, because the code is designed to push overlap information to the | 1071 // now, because the code is designed to push overlap information to the |
1123 // second-from-top context of the stack. | 1072 // second-from-top context of the stack. |
1124 overlapMap->beginNewOverlapTestingContext(); | 1073 overlapMap->beginNewOverlapTestingContext(); |
1125 addToOverlapMapRecursive(*overlapMap, layer); | 1074 addToOverlapMap(*overlapMap, layer, absoluteDecendantBoundingBox); |
1126 } | 1075 } |
1127 willBeCompositedOrSquashed = true; | 1076 willBeCompositedOrSquashed = true; |
1128 } | 1077 } |
1129 | 1078 |
1130 // If the original layer is composited, the reflection needs to be, too. | 1079 // If the original layer is composited, the reflection needs to be, too. |
1131 if (layer->reflectionInfo()) { | 1080 if (layer->reflectionInfo()) { |
1132 // FIXME: Shouldn't we call computeCompositingRequirements to handle a r eflection overlapping with another renderer? | 1081 // FIXME: Shouldn't we call computeCompositingRequirements to handle a r eflection overlapping with another renderer? |
1133 CompositingReasons reflectionCompositingReason = willBeCompositedOrSquas hed ? CompositingReasonReflectionOfCompositedParent : CompositingReasonNone; | 1082 CompositingReasons reflectionCompositingReason = willBeCompositedOrSquas hed ? CompositingReasonReflectionOfCompositedParent : CompositingReasonNone; |
1134 layer->reflectionInfo()->reflectionLayer()->setCompositingReasons(layer- >reflectionInfo()->reflectionLayer()->compositingReasons() | reflectionCompositi ngReason); | 1083 layer->reflectionInfo()->reflectionLayer()->setCompositingReasons(layer- >reflectionInfo()->reflectionLayer()->compositingReasons() | reflectionCompositi ngReason); |
1135 } | 1084 } |
1136 | 1085 |
1086 | |
1137 // Subsequent layers in the parent's stacking context may also need to compo site. | 1087 // Subsequent layers in the parent's stacking context may also need to compo site. |
1138 if (childRecursionData.m_subtreeIsCompositing) | 1088 if (childRecursionData.m_subtreeIsCompositing) |
1139 currentRecursionData.m_subtreeIsCompositing = true; | 1089 currentRecursionData.m_subtreeIsCompositing = true; |
1140 | 1090 |
1141 if (willBeCompositedOrSquashed && layer->blendInfo().hasBlendMode()) | 1091 if (willBeCompositedOrSquashed && layer->blendInfo().hasBlendMode()) |
1142 currentRecursionData.m_hasUnisolatedCompositedBlendingDescendant = true; | 1092 currentRecursionData.m_hasUnisolatedCompositedBlendingDescendant = true; |
1143 | 1093 |
1144 // Set the flag to say that this SC has compositing children. | 1094 // Set the flag to say that this SC has compositing children. |
1145 layer->setHasCompositingDescendant(childRecursionData.m_subtreeIsCompositing ); | 1095 layer->setHasCompositingDescendant(childRecursionData.m_subtreeIsCompositing ); |
1146 | 1096 |
(...skipping 26 matching lines...) Expand all Loading... | |
1173 // At this point we have finished collecting all reasons to composite this l ayer. | 1123 // At this point we have finished collecting all reasons to composite this l ayer. |
1174 layer->setCompositingReasons(reasonsToComposite); | 1124 layer->setCompositingReasons(reasonsToComposite); |
1175 | 1125 |
1176 if (!willBeCompositedOrSquashed && layer->parent()) | 1126 if (!willBeCompositedOrSquashed && layer->parent()) |
1177 layer->parent()->setHasNonCompositedChild(true); | 1127 layer->parent()->setHasNonCompositedChild(true); |
1178 | 1128 |
1179 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DTrans form(); | 1129 descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DTrans form(); |
1180 | 1130 |
1181 if (overlapMap) | 1131 if (overlapMap) |
1182 overlapMap->geometryMap().popMappingsToAncestor(ancestorLayer); | 1132 overlapMap->geometryMap().popMappingsToAncestor(ancestorLayer); |
1133 | |
1134 return absoluteDecendantBoundingBox; | |
1183 } | 1135 } |
1184 | 1136 |
1185 void RenderLayerCompositor::SquashingState::updateSquashingStateForNewMapping(Co mpositedLayerMappingPtr newCompositedLayerMapping, bool hasNewCompositedLayerMap ping, IntPoint newOffsetFromAbsoluteForSquashingCLM) | 1137 void RenderLayerCompositor::SquashingState::updateSquashingStateForNewMapping(Co mpositedLayerMappingPtr newCompositedLayerMapping, bool hasNewCompositedLayerMap ping, IntPoint newOffsetFromAbsoluteForSquashingCLM) |
1186 { | 1138 { |
1187 // The most recent backing is done accumulating any more squashing layers. | 1139 // The most recent backing is done accumulating any more squashing layers. |
1188 if (hasMostRecentMapping) | 1140 if (hasMostRecentMapping) |
1189 mostRecentMapping->finishAccumulatingSquashingLayers(nextSquashedLayerIn dex); | 1141 mostRecentMapping->finishAccumulatingSquashingLayers(nextSquashedLayerIn dex); |
1190 | 1142 |
1191 nextSquashedLayerIndex = 0; | 1143 nextSquashedLayerIndex = 0; |
1192 mostRecentMapping = newCompositedLayerMapping; | 1144 mostRecentMapping = newCompositedLayerMapping; |
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2416 } else if (graphicsLayer == m_scrollLayer.get()) { | 2368 } else if (graphicsLayer == m_scrollLayer.get()) { |
2417 name = "LocalFrame Scrolling Layer"; | 2369 name = "LocalFrame Scrolling Layer"; |
2418 } else { | 2370 } else { |
2419 ASSERT_NOT_REACHED(); | 2371 ASSERT_NOT_REACHED(); |
2420 } | 2372 } |
2421 | 2373 |
2422 return name; | 2374 return name; |
2423 } | 2375 } |
2424 | 2376 |
2425 } // namespace WebCore | 2377 } // namespace WebCore |
OLD | NEW |