Changeset 175656 in webkit


Ignore:
Timestamp:
Nov 5, 2014, 6:21:51 PM (11 years ago)
Author:
Simon Fraser
Message:

Avoid backing store for opacity:0 descendant layers
https://bugs.webkit.org/show_bug.cgi?id=138448

Reviewed by Dean Jackson.

Source/WebCore:

If a composited layer has no rendered content but a painting zero-opacity descendant
layer, than we can avoid making backing store.

When the opacity on such a child changes, we need to trigger a tree rebuild
to force the backing store to come back (this could be optimized later).

Tests: compositing/backing/no-backing-for-opacity-0-child.html

compositing/backing/toggle-opacity-0-child.html

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::calculateClipRects):

  • rendering/RenderLayerCompositor.cpp:

(WebCore::styleChangeRequiresLayerRebuild):

  • rendering/RenderObject.cpp:

(WebCore::RenderObject::containerForRepaint):

LayoutTests:

Test for no backing store with opacity:0 child, and that we get backing
store when dynamically changing the opacity to non-0.

  • compositing/backing/no-backing-for-opacity-0-child-expected.txt: Added.
  • compositing/backing/no-backing-for-opacity-0-child.html: Added.
  • compositing/backing/toggle-opacity-0-child-expected.txt: Added.
  • compositing/backing/toggle-opacity-0-child.html: Added.
Location:
trunk
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r175654 r175656  
     12014-11-05  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Avoid backing store for opacity:0 descendant layers
     4        https://bugs.webkit.org/show_bug.cgi?id=138448
     5
     6        Reviewed by Dean Jackson.
     7       
     8        Test for no backing store with opacity:0 child, and that we get backing
     9        store when dynamically changing the opacity to non-0.
     10
     11        * compositing/backing/no-backing-for-opacity-0-child-expected.txt: Added.
     12        * compositing/backing/no-backing-for-opacity-0-child.html: Added.
     13        * compositing/backing/toggle-opacity-0-child-expected.txt: Added.
     14        * compositing/backing/toggle-opacity-0-child.html: Added.
     15
    1162014-11-05  Chris Fleizach  <cfleizach@apple.com>
    217
  • trunk/Source/WebCore/ChangeLog

    r175655 r175656  
     12014-11-05  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Avoid backing store for opacity:0 descendant layers
     4        https://bugs.webkit.org/show_bug.cgi?id=138448
     5
     6        Reviewed by Dean Jackson.
     7       
     8        If a composited layer has no rendered content but a painting zero-opacity descendant
     9        layer, than we can avoid making backing store.
     10       
     11        When the opacity on such a child changes, we need to trigger a tree rebuild
     12        to force the backing store to come back (this could be optimized later).
     13
     14        Tests: compositing/backing/no-backing-for-opacity-0-child.html
     15               compositing/backing/toggle-opacity-0-child.html
     16
     17        * rendering/RenderLayer.cpp:
     18        (WebCore::RenderLayer::calculateClipRects):
     19        * rendering/RenderLayerCompositor.cpp:
     20        (WebCore::styleChangeRequiresLayerRebuild):
     21        * rendering/RenderObject.cpp:
     22        (WebCore::RenderObject::containerForRepaint):
     23
    1242014-11-05  Chris Dumez  <cdumez@apple.com>
    225
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r174986 r175656  
    63296329    ASSERT(!m_visibleDescendantStatusDirty);
    63306330
    6331     if (!hasVisibleContent())
     6331    if (!hasVisibleContent() || !renderer().style().opacity())
    63326332        return false;
    63336333
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r175150 r175656  
    882882        return true;
    883883
     884    // FIXME: need to check everything that we consult to avoid backing store here: webkit.org/b/138383
     885    if (!oldStyle.opacity() != !newStyle.opacity()) {
     886        RenderLayerModelObject* repaintContainer = layer.renderer().containerForRepaint();
     887        if (RenderLayerBacking* ancestorBacking = repaintContainer->layer()->backing()) {
     888            if (newStyle.opacity() != ancestorBacking->graphicsLayer()->drawsContent())
     889                return true;
     890        }
     891    }
     892
    884893    // When overflow changes, composited layers may need to update their ancestorClipping layers.
    885894    if (!layer.isComposited() && (oldStyle.overflowX() != newStyle.overflowX() || oldStyle.overflowY() != newStyle.overflowY()) && layer.stackingContainer()->hasCompositingDescendant())
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r175395 r175656  
    11961196RenderLayerModelObject* RenderObject::containerForRepaint() const
    11971197{
    1198     RenderLayerModelObject* repaintContainer = 0;
     1198    RenderLayerModelObject* repaintContainer = nullptr;
    11991199
    12001200    if (view().usesCompositing()) {
Note: See TracChangeset for help on using the changeset viewer.