| Index: third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.cpp
|
| index b804e40dc567615791b155f1cad48df5b55a07f8..4cd7d2d38b8c6f4f876a1bb5dc3ae9c2c2350f78 100644
|
| --- a/third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.cpp
|
| @@ -146,8 +146,9 @@ static CompositingReasons subtreeReasonsForCompositing(
|
| bool has3DTransformedDescendants) {
|
| CompositingReasons subtreeReasons = CompositingReasonNone;
|
|
|
| - // When a layer has composited descendants, some effects, like 2d transforms, filters, masks etc must be implemented
|
| - // via compositing so that they also apply to those composited descendants.
|
| + // When a layer has composited descendants, some effects, like 2d transforms,
|
| + // filters, masks etc must be implemented via compositing so that they also
|
| + // apply to those composited descendants.
|
| if (hasCompositedDescendants) {
|
| subtreeReasons |= layer->potentialCompositingReasonsFromStyle() &
|
| CompositingReasonComboCompositedDescendants;
|
| @@ -157,8 +158,10 @@ static CompositingReasons subtreeReasonsForCompositing(
|
| subtreeReasons |= CompositingReasonIsolateCompositedDescendants;
|
| }
|
|
|
| - // FIXME: This should move into CompositingReasonFinder::potentialCompositingReasonsFromStyle, but
|
| - // theres a poor interaction with LayoutTextControlSingleLine, which sets this hasOverflowClip directly.
|
| + // FIXME: This should move into
|
| + // CompositingReasonFinder::potentialCompositingReasonsFromStyle, but theres
|
| + // a poor interaction with LayoutTextControlSingleLine, which sets this
|
| + // hasOverflowClip directly.
|
| if (layer->layoutObject()->hasClipRelatedProperty())
|
| subtreeReasons |= CompositingReasonClipsCompositingDescendants;
|
|
|
| @@ -166,8 +169,9 @@ static CompositingReasons subtreeReasonsForCompositing(
|
| subtreeReasons |= CompositingReasonPositionFixedWithCompositedDescendants;
|
| }
|
|
|
| - // A layer with preserve-3d or perspective only needs to be composited if there are descendant layers that
|
| - // will be affected by the preserve-3d or perspective.
|
| + // A layer with preserve-3d or perspective only needs to be composited if
|
| + // there are descendant layers that will be affected by the preserve-3d or
|
| + // perspective.
|
| if (has3DTransformedDescendants)
|
| subtreeReasons |= layer->potentialCompositingReasonsFromStyle() &
|
| CompositingReasonCombo3DDescendants;
|
| @@ -186,8 +190,10 @@ CompositingRequirementsUpdater::~CompositingRequirementsUpdater() {}
|
| void CompositingRequirementsUpdater::update(PaintLayer* root) {
|
| TRACE_EVENT0("blink", "CompositingRequirementsUpdater::updateRecursive");
|
|
|
| - // Go through the layers in presentation order, so that we can compute which Layers need compositing layers.
|
| - // FIXME: we could maybe do this and the hierarchy update in one pass, but the parenting logic would be more complex.
|
| + // Go through the layers in presentation order, so that we can compute which
|
| + // Layers need compositing layers.
|
| + // FIXME: we could maybe do this and the hierarchy update in one pass, but the
|
| + // parenting logic would be more complex.
|
| RecursionData recursionData(root);
|
| OverlapMap overlapTestRequestMap;
|
| bool saw3DTransform = false;
|
| @@ -237,15 +243,20 @@ void CompositingRequirementsUpdater::updateRecursive(
|
| if (layer->isRootLayer() && compositor->rootShouldAlwaysComposite())
|
| reasonsToComposite |= CompositingReasonRoot;
|
|
|
| - // Add CompositingReasonOverflowScrollingTouch for layers that do not already have it but need it.
|
| - // Note that m_compositingReasonFinder.directReasons(layer) already includes CompositingReasonOverflowScrollingTouch for
|
| - // anything that has layer->needsCompositedScrolling() true. That is, for cases where we explicitly decide not to have LCD
|
| - // text or cases where the layer will still support LCD text even if the layer is composited.
|
| + // Add CompositingReasonOverflowScrollingTouch for layers that do not
|
| + // already have it but need it.
|
| + // Note that m_compositingReasonFinder.directReasons(layer) already includes
|
| + // CompositingReasonOverflowScrollingTouch for anything that has
|
| + // layer->needsCompositedScrolling() true. That is, for cases where we
|
| + // explicitly decide not to have LCD text or cases where the layer will
|
| + // still support LCD text even if the layer is composited.
|
| if (reasonsToComposite && layer->scrollsOverflow() &&
|
| !layer->needsCompositedScrolling()) {
|
| - // We can get here for a scroller that will be composited for some other reason and hence will already
|
| - // use grayscale AA text. We recheck for needsCompositedScrolling ignoring LCD to correctly add the
|
| - // CompositingReasonOverflowScrollingTouch reason to layers that can support it with grayscale AA text.
|
| + // We can get here for a scroller that will be composited for some other
|
| + // reason and hence will already use grayscale AA text. We recheck for
|
| + // needsCompositedScrolling ignoring LCD to correctly add the
|
| + // CompositingReasonOverflowScrollingTouch reason to layers that can
|
| + // support it with grayscale AA text.
|
| layer->getScrollableArea()->updateNeedsCompositedScrolling(
|
| PaintLayerScrollableArea::IgnoreLCDText);
|
| if (layer->needsCompositedScrolling())
|
| @@ -258,8 +269,9 @@ void CompositingRequirementsUpdater::updateRecursive(
|
| currentRecursionData.m_hasCompositedScrollingAncestor = true;
|
|
|
| // Next, accumulate reasons related to overlap.
|
| - // If overlap testing is used, this reason will be overridden. If overlap testing is not
|
| - // used, we must assume we overlap if there is anything composited behind us in paint-order.
|
| + // If overlap testing is used, this reason will be overridden. If overlap
|
| + // testing is not used, we must assume we overlap if there is anything
|
| + // composited behind us in paint-order.
|
| CompositingReasons overlapCompositingReason =
|
| currentRecursionData.m_subtreeIsCompositing
|
| ? CompositingReasonAssumedOverlap
|
| @@ -289,8 +301,9 @@ void CompositingRequirementsUpdater::updateRecursive(
|
| unclippedDescendantsToRemove.size() - i - 1));
|
|
|
| if (layer->clipParent()) {
|
| - // TODO(schenney): We only need to promote when the clipParent is not a descendant of the ancestor scroller,
|
| - // which we do not check for here. Hence we might be promoting needlessly.
|
| + // TODO(schenney): We only need to promote when the clipParent is not a
|
| + // descendant of the ancestor scroller, which we do not check for here.
|
| + // Hence we might be promoting needlessly.
|
| unclippedDescendants.append(layer);
|
| }
|
| }
|
| @@ -318,12 +331,13 @@ void CompositingRequirementsUpdater::updateRecursive(
|
| // This layer now acts as the ancestor for kids.
|
| childRecursionData.m_compositingAncestor = layer;
|
|
|
| - // 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
|
| - // for overlap with anything behind this layer.
|
| + // 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 for overlap with anything behind this layer.
|
| overlapMap.beginNewOverlapTestingContext();
|
| - // 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.
|
| + // 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.
|
| childRecursionData.m_testingOverlap = true;
|
| }
|
|
|
| @@ -344,8 +358,9 @@ void CompositingRequirementsUpdater::updateRecursive(
|
| absoluteChildDescendantBoundingBox);
|
| absoluteDescendantBoundingBox.unite(absoluteChildDescendantBoundingBox);
|
|
|
| - // If we have to make a layer for this child, make one now so we can have a contents layer
|
| - // (since we need to ensure that the -ve z-order child renders underneath our contents).
|
| + // If we have to make a layer for this child, make one now so we can have
|
| + // a contents layer (since we need to ensure that the -ve z-order child
|
| + // renders underneath our contents).
|
| if (childRecursionData.m_subtreeIsCompositing) {
|
| reasonsToComposite |= CompositingReasonNegativeZIndexChildren;
|
|
|
| @@ -356,9 +371,9 @@ void CompositingRequirementsUpdater::updateRecursive(
|
| willBeCompositedOrSquashed = true;
|
| willHaveForegroundLayer = true;
|
|
|
| - // FIXME: temporary solution for the first negative z-index composited child:
|
| - // re-compute the absBounds for the child so that we can add the
|
| - // negative z-index child's bounds to the new overlap context.
|
| + // FIXME: temporary solution for the first negative z-index composited
|
| + // child: re-compute the absBounds for the child so that we can add
|
| + // the negative z-index child's bounds to the new overlap context.
|
| overlapMap.beginNewOverlapTestingContext();
|
| overlapMap.add(curNode->layer(),
|
| curNode->layer()->clippedAbsoluteBoundingBox());
|
| @@ -370,14 +385,15 @@ void CompositingRequirementsUpdater::updateRecursive(
|
|
|
| if (willHaveForegroundLayer) {
|
| ASSERT(willBeCompositedOrSquashed);
|
| - // 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
|
| - // the previous context that was accumulating rects for the negative z-index
|
| - // children, and start with a fresh new empty context.
|
| + // 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 the previous context that was accumulating rects for
|
| + // the negative z-index children, and start with a fresh new empty context.
|
| overlapMap.finishCurrentOverlapTestingContext();
|
| overlapMap.beginNewOverlapTestingContext();
|
| - // 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
|
| + // 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.
|
| childRecursionData.m_testingOverlap = true;
|
| }
|
|
|
| @@ -391,7 +407,8 @@ void CompositingRequirementsUpdater::updateRecursive(
|
| absoluteDescendantBoundingBox.unite(absoluteChildDescendantBoundingBox);
|
| }
|
|
|
| - // Now that the subtree has been traversed, we can check for compositing reasons that depended on the state of the subtree.
|
| + // Now that the subtree has been traversed, we can check for compositing
|
| + // reasons that depended on the state of the subtree.
|
|
|
| if (layer->stackingNode()->isStackingContext()) {
|
| layer->setShouldIsolateCompositedDescendants(
|
| @@ -402,7 +419,8 @@ void CompositingRequirementsUpdater::updateRecursive(
|
| childRecursionData.m_hasUnisolatedCompositedBlendingDescendant;
|
| }
|
|
|
| - // Subsequent layers in the parent's stacking context may also need to composite.
|
| + // Subsequent layers in the parent's stacking context may also need to
|
| + // composite.
|
| if (childRecursionData.m_subtreeIsCompositing)
|
| currentRecursionData.m_subtreeIsCompositing = true;
|
|
|
| @@ -410,8 +428,8 @@ void CompositingRequirementsUpdater::updateRecursive(
|
| layer->setHasCompositingDescendant(childRecursionData.m_subtreeIsCompositing);
|
|
|
| if (layer->isRootLayer()) {
|
| - // The root layer needs to be composited if anything else in the tree is composited.
|
| - // Otherwise, we can disable compositing entirely.
|
| + // The root layer needs to be composited if anything else in the tree is
|
| + // composited. Otherwise, we can disable compositing entirely.
|
| if (childRecursionData.m_subtreeIsCompositing ||
|
| requiresCompositingOrSquashing(reasonsToComposite) ||
|
| compositor->rootShouldAlwaysComposite()) {
|
| @@ -423,13 +441,15 @@ void CompositingRequirementsUpdater::updateRecursive(
|
| }
|
| } else {
|
| // 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
|
| - // compositing ancestor's backing, and so are still considered for overlap.
|
| + // the overlap map. Layers that are not separately composited will paint
|
| + // into their compositing ancestor's backing, and so are still considered
|
| + // for overlap.
|
| if (childRecursionData.m_compositingAncestor &&
|
| !childRecursionData.m_compositingAncestor->isRootLayer())
|
| overlapMap.add(layer, absBounds);
|
|
|
| - // Now check for reasons to become composited that depend on the state of descendant layers.
|
| + // Now check for reasons to become composited that depend on the state of
|
| + // descendant layers.
|
| CompositingReasons subtreeCompositingReasons = subtreeReasonsForCompositing(
|
| layer, childRecursionData.m_subtreeIsCompositing,
|
| anyDescendantHas3DTransform);
|
| @@ -457,9 +477,11 @@ void CompositingRequirementsUpdater::updateRecursive(
|
| if (willBeCompositedOrSquashed)
|
| currentRecursionData.m_subtreeIsCompositing = true;
|
|
|
| - // Turn overlap testing off for later layers if it's already off, or if we have an animating transform.
|
| - // Note that if the layer clips its descendants, there's no reason to propagate the child animation to the parent layers. That's because
|
| - // we know for sure the animation is contained inside the clipping rectangle, which is already added to the overlap map.
|
| + // Turn overlap testing off for later layers if it's already off, or if we
|
| + // have an animating transform. Note that if the layer clips its
|
| + // descendants, there's no reason to propagate the child animation to the
|
| + // parent layers. That's because we know for sure the animation is contained
|
| + // inside the clipping rectangle, which is already added to the overlap map.
|
| bool isCompositedClippingLayer =
|
| canBeComposited &&
|
| (reasonsToComposite & CompositingReasonClipsCompositingDescendants);
|
| @@ -477,7 +499,8 @@ void CompositingRequirementsUpdater::updateRecursive(
|
| anyDescendantHas3DTransform || layer->has3DTransform();
|
| }
|
|
|
| - // At this point we have finished collecting all reasons to composite this layer.
|
| + // At this point we have finished collecting all reasons to composite this
|
| + // layer.
|
| layer->setCompositingReasons(reasonsToComposite);
|
| }
|
|
|
|
|