Changeset 123971 in webkit


Ignore:
Timestamp:
Jul 28, 2012 12:44:23 PM (12 years ago)
Author:
Simon Fraser
Message:

Ignore visibility:hidden elements when computing compositing layer bounds
https://bugs.webkit.org/show_bug.cgi?id=92569

Reviewed by Dan Bernstein.

Source/WebCore:

When computing the bounds of compositing layers, we would take into account
layers with no visible content (visibility:hidden, and no non-hidden descendants).
This caused some huge layers in mobile Google maps.

Tests: compositing/geometry/bounds-ignores-hidden-composited-descendant.html

compositing/geometry/bounds-ignores-hidden-dynamic.html
compositing/geometry/bounds-ignores-hidden.html

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::calculateLayerBounds): If the ExcludeHiddenDescendants flag is set, return
the empty rect for layers with no visible content or descendants, as long as the layer is not
the root of the subtree whose bounds are being computed.
calculateLayerBounds() currently (I think incorrectly) passes the default flags to the recursive calls.
It should probably just pass 'flags', but to make this change safe, OR in the ExcludeHiddenDescendants
flag.

  • rendering/RenderLayer.h: Add an ExcludeHiddenDescendants flag to the CalculateLayerBoundsFlags.
  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::calculateCompositedBounds): Pass the ExcludeHiddenDescendants
flag.

LayoutTests:

Tests related to visibility:hidden's affect on composited layer bounds.

  • compositing/geometry/bounds-ignores-hidden-composited-expected.txt: Added.
  • compositing/geometry/bounds-ignores-hidden-composited-descendant.html: Added.

Test with visibility:visible descendants of a visibility:hidden element in a
compositing layer.

  • compositing/geometry/bounds-ignores-hidden-dynamic-expected.txt: Added.
  • compositing/geometry/bounds-ignores-hidden-dynamic.html: Added.

Test that changes visibility on descendants of a compositing layer, to test dynamic changes.

  • compositing/geometry/bounds-ignores-hidden-expected.txt: Added.
  • compositing/geometry/bounds-ignores-hidden.html: Added.

Test with a compositing layer having visibility:hidden descendants, which dumps
layer tree information.

Location:
trunk
Files:
6 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r123970 r123971  
     12012-07-28  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Ignore visibility:hidden elements when computing compositing layer bounds
     4        https://bugs.webkit.org/show_bug.cgi?id=92569
     5
     6        Reviewed by Dan Bernstein.
     7
     8        Tests related to visibility:hidden's affect on composited layer bounds.
     9
     10        * compositing/geometry/bounds-ignores-hidden-composited-expected.txt: Added.
     11        * compositing/geometry/bounds-ignores-hidden-composited-descendant.html: Added.
     12        Test with visibility:visible descendants of a visibility:hidden element in a
     13        compositing layer.
     14
     15        * compositing/geometry/bounds-ignores-hidden-dynamic-expected.txt: Added.
     16        * compositing/geometry/bounds-ignores-hidden-dynamic.html: Added.
     17        Test that changes visibility on descendants of a compositing layer, to test dynamic changes.
     18
     19        * compositing/geometry/bounds-ignores-hidden-expected.txt: Added.
     20        * compositing/geometry/bounds-ignores-hidden.html: Added.
     21        Test with a compositing layer having visibility:hidden descendants, which dumps
     22        layer tree information.
     23
     24
    1252012-07-28  Peter Kasting  <pkasting@google.com>
    226
  • trunk/Source/WebCore/ChangeLog

    r123969 r123971  
     12012-07-28  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Ignore visibility:hidden elements when computing compositing layer bounds
     4        https://bugs.webkit.org/show_bug.cgi?id=92569
     5
     6        Reviewed by Dan Bernstein.
     7
     8        When computing the bounds of compositing layers, we would take into account
     9        layers with no visible content (visibility:hidden, and no non-hidden descendants).
     10        This caused some huge layers in mobile Google maps.
     11
     12        Tests: compositing/geometry/bounds-ignores-hidden-composited-descendant.html
     13               compositing/geometry/bounds-ignores-hidden-dynamic.html
     14               compositing/geometry/bounds-ignores-hidden.html
     15
     16        * rendering/RenderLayer.cpp:
     17        (WebCore::RenderLayer::calculateLayerBounds): If the ExcludeHiddenDescendants flag is set, return
     18        the empty rect for layers with no visible content or descendants, as long as the layer is not
     19        the root of the subtree whose bounds are being computed.
     20        calculateLayerBounds() currently (I think incorrectly) passes the default flags to the recursive calls.
     21        It should probably just pass 'flags', but to make this change safe, OR in the ExcludeHiddenDescendants
     22        flag.
     23        * rendering/RenderLayer.h: Add an ExcludeHiddenDescendants flag to the CalculateLayerBoundsFlags.
     24        * rendering/RenderLayerCompositor.cpp:
     25        (WebCore::RenderLayerCompositor::calculateCompositedBounds): Pass the ExcludeHiddenDescendants
     26        flag.
     27
    1282012-07-28  Min Qin  <qinmin@chromium.org>
    229
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r123811 r123971  
    42274227        return IntRect();
    42284228
     4229    // FIXME: This could be improved to do a check like hasVisibleNonCompositingDescendantLayers() (bug 92580).
     4230    if ((flags & ExcludeHiddenDescendants) && layer != ancestorLayer && !layer->hasVisibleContent() && !layer->hasVisibleDescendant())
     4231        return IntRect();
     4232
    42294233    LayoutRect boundingBoxRect = layer->localBoundingBox();
    42304234    if (layer->renderer()->isBox())
     
    42614265    }
    42624266
     4267    // FIXME: should probably just pass 'flags' down to descendants.
     4268    CalculateLayerBoundsFlags descendantFlags = DefaultCalculateLayerBoundsFlags | (flags & ExcludeHiddenDescendants);
     4269
    42634270    const_cast<RenderLayer*>(layer)->updateLayerListsIfNeeded();
    42644271
    42654272    if (RenderLayer* reflection = layer->reflectionLayer()) {
    42664273        if (!reflection->isComposited()) {
    4267             IntRect childUnionBounds = calculateLayerBounds(reflection, layer);
     4274            IntRect childUnionBounds = calculateLayerBounds(reflection, layer, descendantFlags);
    42684275            unionBounds.unite(childUnionBounds);
    42694276        }
     
    42814288            RenderLayer* curLayer = negZOrderList->at(i);
    42824289            if (!curLayer->isComposited()) {
    4283                 IntRect childUnionBounds = calculateLayerBounds(curLayer, layer);
     4290                IntRect childUnionBounds = calculateLayerBounds(curLayer, layer, descendantFlags);
    42844291                unionBounds.unite(childUnionBounds);
    42854292            }
     
    42924299            RenderLayer* curLayer = posZOrderList->at(i);
    42934300            if (!curLayer->isComposited()) {
    4294                 IntRect childUnionBounds = calculateLayerBounds(curLayer, layer);
     4301                IntRect childUnionBounds = calculateLayerBounds(curLayer, layer, descendantFlags);
    42954302                unionBounds.unite(childUnionBounds);
    42964303            }
     
    43034310            RenderLayer* curLayer = normalFlowList->at(i);
    43044311            if (!curLayer->isComposited()) {
    4305                 IntRect curAbsBounds = calculateLayerBounds(curLayer, layer);
     4312                IntRect curAbsBounds = calculateLayerBounds(curLayer, layer, descendantFlags);
    43064313                unionBounds.unite(curAbsBounds);
    43074314            }
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r123624 r123971  
    548548        UseLocalClipRectIfPossible = 1 << 1,
    549549        IncludeLayerFilterOutsets = 1 << 2,
     550        ExcludeHiddenDescendants = 1 << 3,
    550551        DefaultCalculateLayerBoundsFlags =  IncludeSelfTransform | UseLocalClipRectIfPossible | IncludeLayerFilterOutsets
    551552    };
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r123811 r123971  
    613613    if (!canBeComposited(layer))
    614614        return IntRect();
    615     return RenderLayer::calculateLayerBounds(layer, ancestorLayer);
     615    return RenderLayer::calculateLayerBounds(layer, ancestorLayer, RenderLayer::DefaultCalculateLayerBoundsFlags | RenderLayer::ExcludeHiddenDescendants);
    616616}
    617617
Note: See TracChangeset for help on using the changeset viewer.