Commit b7c6ace4 authored by ojan@chromium.org's avatar ojan@chromium.org

Make OverlapMap a reference. We never actually pass null.

Review URL: https://codereview.chromium.org/208943005

git-svn-id: svn://svn.chromium.org/blink/trunk@169903 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 714beabe
...@@ -506,7 +506,7 @@ void RenderLayerCompositor::updateCompositingLayersInternal() ...@@ -506,7 +506,7 @@ void RenderLayerCompositor::updateCompositingLayersInternal()
// scrolling and animation bounds is implemented (crbug.com/252472). // scrolling and animation bounds is implemented (crbug.com/252472).
Vector<RenderLayer*> unclippedDescendants; Vector<RenderLayer*> unclippedDescendants;
IntRect absoluteDecendantBoundingBox; IntRect absoluteDecendantBoundingBox;
computeCompositingRequirements(0, updateRoot, &overlapTestRequestMap, recursionData, saw3DTransform, unclippedDescendants, absoluteDecendantBoundingBox); computeCompositingRequirements(0, updateRoot, overlapTestRequestMap, recursionData, saw3DTransform, unclippedDescendants, absoluteDecendantBoundingBox);
#if !ASSERT_DISABLED #if !ASSERT_DISABLED
assertNeedsRecomputeBoundsBitsCleared(updateRoot); assertNeedsRecomputeBoundsBitsCleared(updateRoot);
#endif #endif
...@@ -934,12 +934,11 @@ void RenderLayerCompositor::addToOverlapMap(OverlapMap& overlapMap, RenderLayer* ...@@ -934,12 +934,11 @@ void RenderLayerCompositor::addToOverlapMap(OverlapMap& overlapMap, RenderLayer*
// must be compositing so that its contents render over that child. // must be compositing so that its contents render over that child.
// This implies that its positive z-index children must also be compositing. // This implies that its positive z-index children must also be compositing.
// //
void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer* layer, OverlapMap* overlapMap, CompositingRecursionData& currentRecursionData, bool& descendantHas3DTransform, Vector<RenderLayer*>& unclippedDescendants, IntRect& absoluteDecendantBoundingBox) void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer* layer, OverlapMap& overlapMap, CompositingRecursionData& currentRecursionData, bool& descendantHas3DTransform, Vector<RenderLayer*>& unclippedDescendants, IntRect& absoluteDecendantBoundingBox)
{ {
layer->stackingNode()->updateLayerListsIfNeeded(); layer->stackingNode()->updateLayerListsIfNeeded();
if (overlapMap) overlapMap.geometryMap().pushMappingsToAncestor(layer, ancestorLayer);
overlapMap->geometryMap().pushMappingsToAncestor(layer, ancestorLayer);
// Clear the flag // Clear the flag
layer->setHasCompositingDescendant(false); layer->setHasCompositingDescendant(false);
...@@ -992,11 +991,11 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor ...@@ -992,11 +991,11 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor
} }
IntRect absBounds; IntRect absBounds;
if (overlapMap && !layer->isRootLayer()) { if (!layer->isRootLayer()) {
if (currentRecursionData.m_recomputeLayerBoundsUpdateType == ForceUpdate || layer->needsToRecomputeBounds()) { if (currentRecursionData.m_recomputeLayerBoundsUpdateType == ForceUpdate || layer->needsToRecomputeBounds()) {
// FIXME: If the absolute bounds didn't change, then we don't need to ForceUpdate descendant RenderLayers. // FIXME: If the absolute bounds didn't change, then we don't need to ForceUpdate descendant RenderLayers.
currentRecursionData.m_recomputeLayerBoundsUpdateType = ForceUpdate; currentRecursionData.m_recomputeLayerBoundsUpdateType = ForceUpdate;
absBounds = enclosingIntRect(overlapMap->geometryMap().absoluteRect(layer->overlapBounds())); absBounds = enclosingIntRect(overlapMap.geometryMap().absoluteRect(layer->overlapBounds()));
layer->setAbsoluteBoundingBox(absBounds); layer->setAbsoluteBoundingBox(absBounds);
} else { } else {
absBounds = layer->absoluteBoundingBox(); absBounds = layer->absoluteBoundingBox();
...@@ -1010,8 +1009,8 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor ...@@ -1010,8 +1009,8 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor
absoluteDecendantBoundingBox = absBounds; absoluteDecendantBoundingBox = absBounds;
if (overlapMap && currentRecursionData.m_testingOverlap && !requiresCompositingOrSquashing(directReasons)) if (currentRecursionData.m_testingOverlap && !requiresCompositingOrSquashing(directReasons))
overlapCompositingReason = overlapMap->overlapsLayers(absBounds) ? CompositingReasonOverlap : CompositingReasonNone; overlapCompositingReason = overlapMap.overlapsLayers(absBounds) ? CompositingReasonOverlap : CompositingReasonNone;
reasonsToComposite |= overlapCompositingReason; reasonsToComposite |= overlapCompositingReason;
...@@ -1031,8 +1030,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor ...@@ -1031,8 +1030,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor
// Here we know that all children and the layer's own contents can blindly paint into // Here we know that all children and the layer's own contents can blindly paint into
// this layer's backing, until a descendant is composited. So, we don't need to check // this layer's backing, until a descendant is composited. So, we don't need to check
// for overlap with anything behind this layer. // for overlap with anything behind this layer.
if (overlapMap) overlapMap.beginNewOverlapTestingContext();
overlapMap->beginNewOverlapTestingContext();
// This layer is going to be composited, so children can safely ignore the fact that there's an // This layer is going to be composited, so children can safely ignore the fact that there's an
// animation running behind this layer, meaning they can rely on the overlap map testing again. // animation running behind this layer, meaning they can rely on the overlap map testing again.
childRecursionData.m_testingOverlap = true; childRecursionData.m_testingOverlap = true;
...@@ -1060,36 +1058,33 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor ...@@ -1060,36 +1058,33 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor
if (!willBeCompositedOrSquashed) { if (!willBeCompositedOrSquashed) {
// make layer compositing // make layer compositing
childRecursionData.m_compositingAncestor = layer; childRecursionData.m_compositingAncestor = layer;
if (overlapMap) overlapMap.beginNewOverlapTestingContext();
overlapMap->beginNewOverlapTestingContext();
willBeCompositedOrSquashed = true; willBeCompositedOrSquashed = true;
willHaveForegroundLayer = true; willHaveForegroundLayer = true;
// FIXME: temporary solution for the first negative z-index composited child: // FIXME: temporary solution for the first negative z-index composited child:
// re-compute the absBounds for the child so that we can add the // re-compute the absBounds for the child so that we can add the
// negative z-index child's bounds to the new overlap context. // negative z-index child's bounds to the new overlap context.
if (overlapMap) { overlapMap.geometryMap().pushMappingsToAncestor(curNode->layer(), layer);
overlapMap->geometryMap().pushMappingsToAncestor(curNode->layer(), layer);
// The above call to computeCompositinRequirements will have already updated this layer's absolute bounding box. // The above call to computeCompositinRequirements will have already updated this layer's absolute bounding box.
overlapMap->beginNewOverlapTestingContext(); overlapMap.beginNewOverlapTestingContext();
ASSERT(!curNode->layer()->needsToRecomputeBounds()); ASSERT(!curNode->layer()->needsToRecomputeBounds());
addToOverlapMap(*overlapMap, curNode->layer(), curNode->layer()->absoluteBoundingBox()); addToOverlapMap(overlapMap, curNode->layer(), curNode->layer()->absoluteBoundingBox());
overlapMap->finishCurrentOverlapTestingContext(); overlapMap.finishCurrentOverlapTestingContext();
overlapMap->geometryMap().popMappingsToAncestor(layer); overlapMap.geometryMap().popMappingsToAncestor(layer);
}
} }
} }
} }
} }
if (overlapMap && willHaveForegroundLayer) { if (willHaveForegroundLayer) {
ASSERT(willBeCompositedOrSquashed); ASSERT(willBeCompositedOrSquashed);
// A foreground layer effectively is a new backing for all subsequent children, so // A foreground layer effectively is a new backing for all subsequent children, so
// we don't need to test for overlap with anything behind this. So, we can finish // we don't need to test for overlap with anything behind this. So, we can finish
// the previous context that was accumulating rects for the negative z-index // the previous context that was accumulating rects for the negative z-index
// children, and start with a fresh new empty context. // children, and start with a fresh new empty context.
overlapMap->finishCurrentOverlapTestingContext(); overlapMap.finishCurrentOverlapTestingContext();
overlapMap->beginNewOverlapTestingContext(); overlapMap.beginNewOverlapTestingContext();
// This layer is going to be composited, so children can safely ignore the fact that there's an // This layer is going to be composited, so children can safely ignore the fact that there's an
// animation running behind this layer, meaning they can rely on the overlap map testing again // animation running behind this layer, meaning they can rely on the overlap map testing again
childRecursionData.m_testingOverlap = true; childRecursionData.m_testingOverlap = true;
...@@ -1120,8 +1115,8 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor ...@@ -1120,8 +1115,8 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor
// All layers (even ones that aren't being composited) need to get added to // All layers (even ones that aren't being composited) need to get added to
// the overlap map. Layers that are not separately composited will paint into their // the overlap map. Layers that are not separately composited will paint into their
// compositing ancestor's backing, and so are still considered for overlap. // compositing ancestor's backing, and so are still considered for overlap.
if (overlapMap && childRecursionData.m_compositingAncestor && !childRecursionData.m_compositingAncestor->isRootLayer()) if (childRecursionData.m_compositingAncestor && !childRecursionData.m_compositingAncestor->isRootLayer())
addToOverlapMap(*overlapMap, layer, absBounds); addToOverlapMap(overlapMap, layer, absBounds);
if (layer->stackingNode()->isStackingContext()) { if (layer->stackingNode()->isStackingContext()) {
layer->setShouldIsolateCompositedDescendants(childRecursionData.m_hasUnisolatedCompositedBlendingDescendant); layer->setShouldIsolateCompositedDescendants(childRecursionData.m_hasUnisolatedCompositedBlendingDescendant);
...@@ -1135,13 +1130,11 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor ...@@ -1135,13 +1130,11 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor
reasonsToComposite |= subtreeCompositingReasons; reasonsToComposite |= subtreeCompositingReasons;
if (!willBeCompositedOrSquashed && canBeComposited(layer) && requiresCompositingOrSquashing(subtreeCompositingReasons)) { if (!willBeCompositedOrSquashed && canBeComposited(layer) && requiresCompositingOrSquashing(subtreeCompositingReasons)) {
childRecursionData.m_compositingAncestor = layer; childRecursionData.m_compositingAncestor = layer;
if (overlapMap) {
// FIXME: this context push is effectively a no-op but needs to exist for // FIXME: this context push is effectively a no-op but needs to exist for
// now, because the code is designed to push overlap information to the // now, because the code is designed to push overlap information to the
// second-from-top context of the stack. // second-from-top context of the stack.
overlapMap->beginNewOverlapTestingContext(); overlapMap.beginNewOverlapTestingContext();
addToOverlapMap(*overlapMap, layer, absoluteDecendantBoundingBox); addToOverlapMap(overlapMap, layer, absoluteDecendantBoundingBox);
}
willBeCompositedOrSquashed = true; willBeCompositedOrSquashed = true;
} }
...@@ -1171,8 +1164,8 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor ...@@ -1171,8 +1164,8 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor
if ((!childRecursionData.m_testingOverlap && !isCompositedClippingLayer) || isRunningAcceleratedTransformAnimation(layer->renderer())) if ((!childRecursionData.m_testingOverlap && !isCompositedClippingLayer) || isRunningAcceleratedTransformAnimation(layer->renderer()))
currentRecursionData.m_testingOverlap = false; currentRecursionData.m_testingOverlap = false;
if (overlapMap && childRecursionData.m_compositingAncestor == layer && !layer->isRootLayer()) if (childRecursionData.m_compositingAncestor == layer && !layer->isRootLayer())
overlapMap->finishCurrentOverlapTestingContext(); overlapMap.finishCurrentOverlapTestingContext();
if (layer->isRootLayer()) { if (layer->isRootLayer()) {
// The root layer needs to be composited if anything else in the tree is composited. // The root layer needs to be composited if anything else in the tree is composited.
...@@ -1197,9 +1190,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor ...@@ -1197,9 +1190,7 @@ void RenderLayerCompositor::computeCompositingRequirements(RenderLayer* ancestor
layer->parent()->setHasNonCompositedChild(true); layer->parent()->setHasNonCompositedChild(true);
descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DTransform(); descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DTransform();
overlapMap.geometryMap().popMappingsToAncestor(ancestorLayer);
if (overlapMap)
overlapMap->geometryMap().popMappingsToAncestor(ancestorLayer);
} }
void RenderLayerCompositor::SquashingState::updateSquashingStateForNewMapping(CompositedLayerMappingPtr newCompositedLayerMapping, bool hasNewCompositedLayerMapping, LayoutPoint newOffsetFromAbsoluteForSquashingCLM, RenderLayer* newClippingAncestorForMostRecentMapping) void RenderLayerCompositor::SquashingState::updateSquashingStateForNewMapping(CompositedLayerMappingPtr newCompositedLayerMapping, bool hasNewCompositedLayerMapping, LayoutPoint newOffsetFromAbsoluteForSquashingCLM, RenderLayer* newClippingAncestorForMostRecentMapping)
......
...@@ -275,7 +275,7 @@ private: ...@@ -275,7 +275,7 @@ private:
// finish all deferred work. // finish all deferred work.
static void finishCompositingUpdateForFrameTree(LocalFrame*); static void finishCompositingUpdateForFrameTree(LocalFrame*);
void computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer*, OverlapMap*, struct CompositingRecursionData&, bool& descendantHas3DTransform, Vector<RenderLayer*>& unclippedDescendants, IntRect& absoluteDecendantBoundingBox); void computeCompositingRequirements(RenderLayer* ancestorLayer, RenderLayer*, OverlapMap&, struct CompositingRecursionData&, bool& descendantHas3DTransform, Vector<RenderLayer*>& unclippedDescendants, IntRect& absoluteDecendantBoundingBox);
// Defines which RenderLayers will paint into which composited backings, by allocating and destroying CompositedLayerMappings as needed. // Defines which RenderLayers will paint into which composited backings, by allocating and destroying CompositedLayerMappings as needed.
void assignLayersToBackings(RenderLayer*, bool& layersChanged); void assignLayersToBackings(RenderLayer*, bool& layersChanged);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment