Changeset 230950 in webkit


Ignore:
Timestamp:
Apr 24, 2018 1:15:41 AM (6 years ago)
Author:
zandobersek@gmail.com
Message:

[CoordGraphics] Avoid painting backing stores for zero-opacity layers
https://bugs.webkit.org/show_bug.cgi?id=184143

Reviewed by Carlos Garcia Campos.

Source/WebCore:

Skip generating backing stores for layers that have zero opacity and do
not animate the opacity value. In the current CoordinatedGraphics system
this can end up saving loads of memory on Web content that deploys a
large number of such elements.

  • platform/graphics/texmap/TextureMapperLayer.h:
  • platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:

(WebCore::CoordinatedGraphicsLayer::shouldHaveBackingStore const):

Source/WebKit:

  • Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:

(WebKit::layerShouldHaveBackingStore):
Mirror CoordinatedGraphicsLayer's backing store requirements.

Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r230948 r230950  
     12018-04-24  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        [CoordGraphics] Avoid painting backing stores for zero-opacity layers
     4        https://bugs.webkit.org/show_bug.cgi?id=184143
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Skip generating backing stores for layers that have zero opacity and do
     9        not animate the opacity value. In the current CoordinatedGraphics system
     10        this can end up saving loads of memory on Web content that deploys a
     11        large number of such elements.
     12
     13        * platform/graphics/texmap/TextureMapperLayer.h:
     14        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
     15        (WebCore::CoordinatedGraphicsLayer::shouldHaveBackingStore const):
     16
    1172018-04-24  Daniel Bates  <dabates@apple.com>
    218
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h

    r230906 r230950  
    8888    void setContentsLayer(TextureMapperPlatformLayer*);
    8989    void setAnimations(const TextureMapperAnimations&);
     90    const TextureMapperAnimations& animations() const { return m_animations; }
    9091    void setFixedToViewport(bool);
    9192    bool fixedToViewport() const { return m_fixedToViewport; }
  • trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp

    r230913 r230950  
    10991099bool CoordinatedGraphicsLayer::shouldHaveBackingStore() const
    11001100{
    1101     return drawsContent() && contentsAreVisible() && !m_size.isEmpty();
     1101    return drawsContent() && contentsAreVisible() && !m_size.isEmpty()
     1102        && (!!opacity() || m_animations.hasActiveAnimationsOfType(AnimatedPropertyOpacity));
    11021103}
    11031104
  • trunk/Source/WebKit/ChangeLog

    r230945 r230950  
     12018-04-24  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        [CoordGraphics] Avoid painting backing stores for zero-opacity layers
     4        https://bugs.webkit.org/show_bug.cgi?id=184143
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
     9        (WebKit::layerShouldHaveBackingStore):
     10        Mirror CoordinatedGraphicsLayer's backing store requirements.
     11
    1122018-04-23  Daniel Bates  <dabates@apple.com>
    213
  • trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp

    r230906 r230950  
    3838static bool layerShouldHaveBackingStore(TextureMapperLayer* layer)
    3939{
    40     return layer->drawsContent() && layer->contentsAreVisible() && !layer->size().isEmpty();
     40    return layer->drawsContent() && layer->contentsAreVisible() && !layer->size().isEmpty()
     41        && (!!layer->opacity() || layer->animations().hasActiveAnimationsOfType(AnimatedPropertyOpacity));
    4142}
    4243
Note: See TracChangeset for help on using the changeset viewer.