| 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 // Turn off the overlap map test if bleeding edge features are on. | 436 // Turn off the overlap map test if bleeding edge features are on. |
| 449 OverlapMap* overlapMap = 0; | 437 OverlapMap* overlapMap = 0; |
| 450 if (!RuntimeEnabledFeatures::bleedingEdgeFastPathsEnabled()) | 438 if (!RuntimeEnabledFeatures::bleedingEdgeFastPathsEnabled()) |
| 451 overlapMap = &overlapTestRequestMap; | 439 overlapMap = &overlapTestRequestMap; |
| 452 | 440 |
| 453 // FIXME: Passing these unclippedDescendants down and keeping track | 441 // FIXME: Passing these unclippedDescendants down and keeping track |
| 454 // of them dynamically, we are requiring a full tree walk. This | 442 // of them dynamically, we are requiring a full tree walk. This |
| 455 // should be removed as soon as proper overlap testing based on | 443 // should be removed as soon as proper overlap testing based on |
| 456 // scrolling and animation bounds is implemented (crbug.com/252472). | 444 // scrolling and animation bounds is implemented (crbug.com/252472). |
| 457 Vector<RenderLayer*> unclippedDescendants; | 445 Vector<RenderLayer*> unclippedDescendants; |
| 458 computeCompositingRequirements(0, updateRoot, overlapMap, recursionD
ata, saw3DTransform, unclippedDescendants); | 446 IntRect absoluteDecendantBoundingBox; |
| 447 computeCompositingRequirements(0, updateRoot, overlapMap, recursionD
ata, saw3DTransform, unclippedDescendants, absoluteDecendantBoundingBox); |
| 459 } | 448 } |
| 460 | 449 |
| 461 { | 450 { |
| 462 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::assignLayers
ToBackings"); | 451 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::assignLayers
ToBackings"); |
| 463 assignLayersToBackings(updateRoot, layersChanged); | 452 assignLayersToBackings(updateRoot, layersChanged); |
| 464 } | 453 } |
| 465 | 454 |
| 466 { | 455 { |
| 467 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::updateHasVis
ibleNonLayerContentLoop"); | 456 TRACE_EVENT0("blink_rendering", "RenderLayerCompositor::updateHasVis
ibleNonLayerContentLoop"); |
| 468 const FrameView::ScrollableAreaSet* scrollableAreas = m_renderView->
frameView()->scrollableAreas(); | 457 const FrameView::ScrollableAreaSet* scrollableAreas = m_renderView->
frameView()->scrollableAreas(); |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 for (RenderLayer* curr = layer->parent(); curr != 0; curr = curr->parent())
{ | 848 for (RenderLayer* curr = layer->parent(); curr != 0; curr = curr->parent())
{ |
| 860 if (curr->stackingNode()->isStackingContainer()) | 849 if (curr->stackingNode()->isStackingContainer()) |
| 861 return 0; | 850 return 0; |
| 862 | 851 |
| 863 if (curr->renderer()->hasClipOrOverflowClip()) | 852 if (curr->renderer()->hasClipOrOverflowClip()) |
| 864 return curr; | 853 return curr; |
| 865 } | 854 } |
| 866 return 0; | 855 return 0; |
| 867 } | 856 } |
| 868 | 857 |
| 869 void RenderLayerCompositor::addToOverlapMap(OverlapMap& overlapMap, RenderLayer*
layer, IntRect& layerBounds, bool& boundsComputed) | 858 void RenderLayerCompositor::addToOverlapMap(OverlapMap& overlapMap, RenderLayer*
layer, IntRect& layerBounds) |
| 870 { | 859 { |
| 871 if (layer->isRootLayer()) | 860 if (layer->isRootLayer()) |
| 872 return; | 861 return; |
| 873 | 862 |
| 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()); | 863 IntRect clipRect = pixelSnappedIntRect(layer->clipper().backgroundClipRect(C
lipRectsContext(rootRenderLayer(), AbsoluteClipRects)).rect()); |
| 885 clipRect.intersect(layerBounds); | 864 clipRect.intersect(layerBounds); |
| 886 overlapMap.add(layer, clipRect); | 865 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 } | 866 } |
| 913 | 867 |
| 914 // Recurse through the layers in z-index and overflow order (which is equivalen
t to painting order) | 868 // 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: | 869 // For the z-order children of a compositing layer: |
| 916 // If a child layers has a compositing layer, then all subsequent layers mu
st | 870 // If a child layers has a compositing layer, then all subsequent layers mu
st |
| 917 // be compositing in order to render above that layer. | 871 // be compositing in order to render above that layer. |
| 918 // | 872 // |
| 919 // If a child in the negative z-order list is compositing, then the layer i
tself | 873 // 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. | 874 // must be compositing so that its contents render over that child. |
| 921 // This implies that its positive z-index children must also be compositing
. | 875 // This implies that its positive z-index children must also be compositing
. |
| 922 // | 876 // |
| 923 void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor
Layer, RenderLayer* layer, OverlapMap* overlapMap, CompositingRecursionData& cur
rentRecursionData, bool& descendantHas3DTransform, Vector<RenderLayer*>& unclipp
edDescendants) | 877 void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor
Layer, RenderLayer* layer, OverlapMap* overlapMap, CompositingRecursionData& cur
rentRecursionData, bool& descendantHas3DTransform, Vector<RenderLayer*>& unclipp
edDescendants, IntRect& absoluteDecendantBoundingBox) |
| 924 { | 878 { |
| 925 layer->stackingNode()->updateLayerListsIfNeeded(); | 879 layer->stackingNode()->updateLayerListsIfNeeded(); |
| 926 | 880 |
| 927 if (overlapMap) | 881 if (overlapMap) |
| 928 overlapMap->geometryMap().pushMappingsToAncestor(layer, ancestorLayer); | 882 overlapMap->geometryMap().pushMappingsToAncestor(layer, ancestorLayer); |
| 929 | 883 |
| 930 // Clear the flag | 884 // Clear the flag |
| 931 layer->setHasCompositingDescendant(false); | 885 layer->setHasCompositingDescendant(false); |
| 932 layer->setHasNonCompositedChild(false); | 886 layer->setHasNonCompositedChild(false); |
| 933 | 887 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 | 924 |
| 971 // Remove irrelevant unclipped descendants in reverse order so our store
d | 925 // Remove irrelevant unclipped descendants in reverse order so our store
d |
| 972 // indices remain valid. | 926 // indices remain valid. |
| 973 for (size_t i = 0; i < unclippedDescendantsToRemove.size(); i++) | 927 for (size_t i = 0; i < unclippedDescendantsToRemove.size(); i++) |
| 974 unclippedDescendants.remove(unclippedDescendantsToRemove.at(unclippe
dDescendantsToRemove.size() - i - 1)); | 928 unclippedDescendants.remove(unclippedDescendantsToRemove.at(unclippe
dDescendantsToRemove.size() - i - 1)); |
| 975 | 929 |
| 976 if (reasonsToComposite & CompositingReasonOutOfFlowClipping) | 930 if (reasonsToComposite & CompositingReasonOutOfFlowClipping) |
| 977 unclippedDescendants.append(layer); | 931 unclippedDescendants.append(layer); |
| 978 } | 932 } |
| 979 | 933 |
| 980 bool haveComputedBounds = false; | |
| 981 IntRect absBounds; | 934 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. | 935 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())); | 936 absBounds = enclosingIntRect(overlapMap->geometryMap().absoluteRect(laye
r->overlapBounds())); |
| 986 | 937 // Setting the absBounds to 1x1 instead of 0x0 makes very little sense, |
| 987 // Empty rects never intersect, but we need them to for the purposes of
overlap testing. | 938 // but removing this code will make JSGameBench sad. |
| 939 // See https://codereview.chromium.org/13912020/ |
| 988 if (absBounds.isEmpty()) | 940 if (absBounds.isEmpty()) |
| 989 absBounds.setSize(IntSize(1, 1)); | 941 absBounds.setSize(IntSize(1, 1)); |
| 990 haveComputedBounds = true; | 942 } |
| 943 absoluteDecendantBoundingBox = absBounds; |
| 944 |
| 945 if (overlapMap && currentRecursionData.m_testingOverlap && !requiresComposit
ingOrSquashing(directReasons)) |
| 991 overlapCompositingReason = overlapMap->overlapsLayers(absBounds) ? Compo
sitingReasonOverlap : CompositingReasonNone; | 946 overlapCompositingReason = overlapMap->overlapsLayers(absBounds) ? Compo
sitingReasonOverlap : CompositingReasonNone; |
| 992 } | |
| 993 | 947 |
| 994 reasonsToComposite |= overlapCompositingReason; | 948 reasonsToComposite |= overlapCompositingReason; |
| 995 | 949 |
| 996 // If the layer is squashable, but would scroll differently than the | 950 // 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. | 951 // 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 | 952 // 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 | 953 // 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. | 954 // to be separately composited rather than squashed, anyway. |
| 1001 if (currentRecursionData.m_mostRecentCompositedLayer && requiresSquashing(re
asonsToComposite) | 955 if (currentRecursionData.m_mostRecentCompositedLayer && requiresSquashing(re
asonsToComposite) |
| 1002 && layer->scrollsWithRespectTo(currentRecursionData.m_mostRecentComposit
edLayer)) | 956 && layer->scrollsWithRespectTo(currentRecursionData.m_mostRecentComposit
edLayer)) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1028 #if !ASSERT_DISABLED | 982 #if !ASSERT_DISABLED |
| 1029 LayerListMutationDetector mutationChecker(layer->stackingNode()); | 983 LayerListMutationDetector mutationChecker(layer->stackingNode()); |
| 1030 #endif | 984 #endif |
| 1031 | 985 |
| 1032 bool anyDescendantHas3DTransform = false; | 986 bool anyDescendantHas3DTransform = false; |
| 1033 bool willHaveForegroundLayer = false; | 987 bool willHaveForegroundLayer = false; |
| 1034 | 988 |
| 1035 if (layer->stackingNode()->isStackingContainer()) { | 989 if (layer->stackingNode()->isStackingContainer()) { |
| 1036 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), Negativ
eZOrderChildren); | 990 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), Negativ
eZOrderChildren); |
| 1037 while (RenderLayerStackingNode* curNode = iterator.next()) { | 991 while (RenderLayerStackingNode* curNode = iterator.next()) { |
| 1038 computeCompositingRequirements(layer, curNode->layer(), overlapMap,
childRecursionData, anyDescendantHas3DTransform, unclippedDescendants); | 992 IntRect absoluteChildDecendantBoundingBox; |
| 993 computeCompositingRequirements(layer, curNode->layer(), overlapMap,
childRecursionData, anyDescendantHas3DTransform, unclippedDescendants, absoluteC
hildDecendantBoundingBox); |
| 994 absoluteDecendantBoundingBox.unite(absoluteChildDecendantBoundingBox
); |
| 1039 | 995 |
| 1040 // If we have to make a layer for this child, make one now so we can
have a contents layer | 996 // 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). | 997 // (since we need to ensure that the -ve z-order child renders under
neath our contents). |
| 1042 if (childRecursionData.m_subtreeIsCompositing) { | 998 if (childRecursionData.m_subtreeIsCompositing) { |
| 1043 reasonsToComposite |= CompositingReasonNegativeZIndexChildren; | 999 reasonsToComposite |= CompositingReasonNegativeZIndexChildren; |
| 1044 | 1000 |
| 1045 if (!willBeCompositedOrSquashed) { | 1001 if (!willBeCompositedOrSquashed) { |
| 1046 // make layer compositing | 1002 // make layer compositing |
| 1047 childRecursionData.m_compositingAncestor = layer; | 1003 childRecursionData.m_compositingAncestor = layer; |
| 1048 if (overlapMap) | 1004 if (overlapMap) |
| 1049 overlapMap->beginNewOverlapTestingContext(); | 1005 overlapMap->beginNewOverlapTestingContext(); |
| 1050 willBeCompositedOrSquashed = true; | 1006 willBeCompositedOrSquashed = true; |
| 1051 willHaveForegroundLayer = true; | 1007 willHaveForegroundLayer = true; |
| 1052 | 1008 |
| 1053 // FIXME: temporary solution for the first negative z-index
composited child: | 1009 // 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 | 1010 // 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. | 1011 // negative z-index child's bounds to the new overlap
context. |
| 1056 if (overlapMap) { | 1012 if (overlapMap) { |
| 1057 overlapMap->geometryMap().pushMappingsToAncestor(curNode
->layer(), layer); | 1013 overlapMap->geometryMap().pushMappingsToAncestor(curNode
->layer(), layer); |
| 1058 IntRect childAbsBounds = enclosingIntRect(overlapMap->ge
ometryMap().absoluteRect(curNode->layer()->overlapBounds())); | 1014 IntRect childAbsBounds = enclosingIntRect(overlapMap->ge
ometryMap().absoluteRect(curNode->layer()->overlapBounds())); |
| 1059 bool boundsComputed = true; | |
| 1060 overlapMap->beginNewOverlapTestingContext(); | 1015 overlapMap->beginNewOverlapTestingContext(); |
| 1061 addToOverlapMap(*overlapMap, curNode->layer(), childAbsB
ounds, boundsComputed); | 1016 addToOverlapMap(*overlapMap, curNode->layer(), childAbsB
ounds); |
| 1062 overlapMap->finishCurrentOverlapTestingContext(); | 1017 overlapMap->finishCurrentOverlapTestingContext(); |
| 1063 overlapMap->geometryMap().popMappingsToAncestor(layer); | 1018 overlapMap->geometryMap().popMappingsToAncestor(layer); |
| 1064 } | 1019 } |
| 1065 } | 1020 } |
| 1066 } | 1021 } |
| 1067 } | 1022 } |
| 1068 } | 1023 } |
| 1069 | 1024 |
| 1070 if (overlapMap && willHaveForegroundLayer) { | 1025 if (overlapMap && willHaveForegroundLayer) { |
| 1071 ASSERT(willBeCompositedOrSquashed); | 1026 ASSERT(willBeCompositedOrSquashed); |
| 1072 // A foreground layer effectively is a new backing for all subsequent ch
ildren, so | 1027 // 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 | 1028 // 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 | 1029 // the previous context that was accumulating rects for the negative z-i
ndex |
| 1075 // children, and start with a fresh new empty context. | 1030 // children, and start with a fresh new empty context. |
| 1076 overlapMap->finishCurrentOverlapTestingContext(); | 1031 overlapMap->finishCurrentOverlapTestingContext(); |
| 1077 overlapMap->beginNewOverlapTestingContext(); | 1032 overlapMap->beginNewOverlapTestingContext(); |
| 1078 // This layer is going to be composited, so children can safely ignore t
he fact that there's an | 1033 // 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 | 1034 // animation running behind this layer, meaning they can rely on the ove
rlap map testing again |
| 1080 childRecursionData.m_testingOverlap = true; | 1035 childRecursionData.m_testingOverlap = true; |
| 1081 } | 1036 } |
| 1082 | 1037 |
| 1083 if (requiresCompositing(reasonsToComposite)) { | 1038 if (requiresCompositing(reasonsToComposite)) { |
| 1084 currentRecursionData.m_mostRecentCompositedLayer = layer; | 1039 currentRecursionData.m_mostRecentCompositedLayer = layer; |
| 1085 childRecursionData.m_mostRecentCompositedLayer = layer; | 1040 childRecursionData.m_mostRecentCompositedLayer = layer; |
| 1086 } | 1041 } |
| 1087 | 1042 |
| 1088 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowC
hildren | PositiveZOrderChildren); | 1043 RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowC
hildren | PositiveZOrderChildren); |
| 1089 while (RenderLayerStackingNode* curNode = iterator.next()) | 1044 while (RenderLayerStackingNode* curNode = iterator.next()) { |
| 1090 computeCompositingRequirements(layer, curNode->layer(), overlapMap, chil
dRecursionData, anyDescendantHas3DTransform, unclippedDescendants); | 1045 IntRect absoluteChildDecendantBoundingBox; |
| 1046 computeCompositingRequirements(layer, curNode->layer(), overlapMap, chil
dRecursionData, anyDescendantHas3DTransform, unclippedDescendants, absoluteChild
DecendantBoundingBox); |
| 1047 absoluteDecendantBoundingBox.unite(absoluteChildDecendantBoundingBox); |
| 1048 } |
| 1091 | 1049 |
| 1092 currentRecursionData.m_mostRecentCompositedLayer = childRecursionData.m_most
RecentCompositedLayer; | 1050 currentRecursionData.m_mostRecentCompositedLayer = childRecursionData.m_most
RecentCompositedLayer; |
| 1093 | 1051 |
| 1094 // Now that the subtree has been traversed, we can check for compositing rea
sons that depended on the state of the subtree. | 1052 // Now that the subtree has been traversed, we can check for compositing rea
sons that depended on the state of the subtree. |
| 1095 | 1053 |
| 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). | 1054 // 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()) { | 1055 if (layer->isRootLayer()) { |
| 1098 if (inCompositingMode() && m_hasAcceleratedCompositing) | 1056 if (inCompositingMode() && m_hasAcceleratedCompositing) |
| 1099 willBeCompositedOrSquashed = true; | 1057 willBeCompositedOrSquashed = true; |
| 1100 } | 1058 } |
| 1101 | 1059 |
| 1102 // All layers (even ones that aren't being composited) need to get added to | 1060 // 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 | 1061 // 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. | 1062 // compositing ancestor's backing, and so are still considered for overlap. |
| 1105 if (overlapMap && childRecursionData.m_compositingAncestor && !childRecursio
nData.m_compositingAncestor->isRootLayer()) | 1063 if (overlapMap && childRecursionData.m_compositingAncestor && !childRecursio
nData.m_compositingAncestor->isRootLayer()) |
| 1106 addToOverlapMap(*overlapMap, layer, absBounds, haveComputedBounds); | 1064 addToOverlapMap(*overlapMap, layer, absBounds); |
| 1107 | 1065 |
| 1108 if (layer->stackingNode()->isStackingContext()) { | 1066 if (layer->stackingNode()->isStackingContext()) { |
| 1109 layer->setShouldIsolateCompositedDescendants(childRecursionData.m_hasUni
solatedCompositedBlendingDescendant); | 1067 layer->setShouldIsolateCompositedDescendants(childRecursionData.m_hasUni
solatedCompositedBlendingDescendant); |
| 1110 } else { | 1068 } else { |
| 1111 layer->setShouldIsolateCompositedDescendants(false); | 1069 layer->setShouldIsolateCompositedDescendants(false); |
| 1112 currentRecursionData.m_hasUnisolatedCompositedBlendingDescendant = child
RecursionData.m_hasUnisolatedCompositedBlendingDescendant; | 1070 currentRecursionData.m_hasUnisolatedCompositedBlendingDescendant = child
RecursionData.m_hasUnisolatedCompositedBlendingDescendant; |
| 1113 } | 1071 } |
| 1114 | 1072 |
| 1115 // Now check for reasons to become composited that depend on the state of de
scendant layers. | 1073 // 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); | 1074 CompositingReasons subtreeCompositingReasons = subtreeReasonsForCompositing(
layer->renderer(), childRecursionData.m_subtreeIsCompositing, anyDescendantHas3D
Transform); |
| 1117 reasonsToComposite |= subtreeCompositingReasons; | 1075 reasonsToComposite |= subtreeCompositingReasons; |
| 1118 if (!willBeCompositedOrSquashed && canBeComposited(layer) && requiresComposi
tingOrSquashing(subtreeCompositingReasons)) { | 1076 if (!willBeCompositedOrSquashed && canBeComposited(layer) && requiresComposi
tingOrSquashing(subtreeCompositingReasons)) { |
| 1119 childRecursionData.m_compositingAncestor = layer; | 1077 childRecursionData.m_compositingAncestor = layer; |
| 1120 if (overlapMap) { | 1078 if (overlapMap) { |
| 1121 // FIXME: this context push is effectively a no-op but needs to exis
t for | 1079 // 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 | 1080 // now, because the code is designed to push overlap information to
the |
| 1123 // second-from-top context of the stack. | 1081 // second-from-top context of the stack. |
| 1124 overlapMap->beginNewOverlapTestingContext(); | 1082 overlapMap->beginNewOverlapTestingContext(); |
| 1125 addToOverlapMapRecursive(*overlapMap, layer); | 1083 addToOverlapMap(*overlapMap, layer, absoluteDecendantBoundingBox); |
| 1126 } | 1084 } |
| 1127 willBeCompositedOrSquashed = true; | 1085 willBeCompositedOrSquashed = true; |
| 1128 } | 1086 } |
| 1129 | 1087 |
| 1130 // If the original layer is composited, the reflection needs to be, too. | 1088 // If the original layer is composited, the reflection needs to be, too. |
| 1131 if (layer->reflectionInfo()) { | 1089 if (layer->reflectionInfo()) { |
| 1132 // FIXME: Shouldn't we call computeCompositingRequirements to handle a r
eflection overlapping with another renderer? | 1090 // FIXME: Shouldn't we call computeCompositingRequirements to handle a r
eflection overlapping with another renderer? |
| 1133 CompositingReasons reflectionCompositingReason = willBeCompositedOrSquas
hed ? CompositingReasonReflectionOfCompositedParent : CompositingReasonNone; | 1091 CompositingReasons reflectionCompositingReason = willBeCompositedOrSquas
hed ? CompositingReasonReflectionOfCompositedParent : CompositingReasonNone; |
| 1134 layer->reflectionInfo()->reflectionLayer()->setCompositingReasons(layer-
>reflectionInfo()->reflectionLayer()->compositingReasons() | reflectionCompositi
ngReason); | 1092 layer->reflectionInfo()->reflectionLayer()->setCompositingReasons(layer-
>reflectionInfo()->reflectionLayer()->compositingReasons() | reflectionCompositi
ngReason); |
| 1135 } | 1093 } |
| (...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2405 } else if (graphicsLayer == m_scrollLayer.get()) { | 2363 } else if (graphicsLayer == m_scrollLayer.get()) { |
| 2406 name = "LocalFrame Scrolling Layer"; | 2364 name = "LocalFrame Scrolling Layer"; |
| 2407 } else { | 2365 } else { |
| 2408 ASSERT_NOT_REACHED(); | 2366 ASSERT_NOT_REACHED(); |
| 2409 } | 2367 } |
| 2410 | 2368 |
| 2411 return name; | 2369 return name; |
| 2412 } | 2370 } |
| 2413 | 2371 |
| 2414 } // namespace WebCore | 2372 } // namespace WebCore |
| OLD | NEW |