Changeset 158889 in webkit


Ignore:
Timestamp:
Nov 7, 2013 5:42:59 PM (10 years ago)
Author:
Simon Fraser
Message:

Lots of layers get solid color but transparent contents layers now
https://bugs.webkit.org/show_bug.cgi?id=123537

Source/WebCore:

Reviewed by Tim Horton.

We call rendererBackgroundColor() to determine the layer's background color,
but on most elements this returns the transparent color (a valid color).
This caused us to allocate a contentsLayer, and use the transparent color as its
backgroundColor, which was wasteful.

Fix by only making a background-color layer if the color is not transparent (zero alpha).

Also avoid making a new contents layer on every color change, and make sure that
we don't do implicit animations for backgroundColor, and some other properties
that were omitted by mistake.

Layer tree dumps don't dump content layers, so no way to test easily.

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::setContentsToSolidColor):

  • platform/graphics/ca/mac/PlatformCALayerMac.mm:

(nullActionsDictionary):

Source/WebKit2:

Reviewed by Tim Horton.

Add some properties to the list of things not to implicitly animate.

  • Shared/mac/RemoteLayerTreePropertyApplier.mm:

(WebKit::RemoteLayerTreePropertyApplier::disableActionsForLayer):

Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r158877 r158889  
     12013-11-07  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Lots of layers get solid color but transparent contents layers now
     4        https://bugs.webkit.org/show_bug.cgi?id=123537
     5
     6        Reviewed by Tim Horton.
     7       
     8        We call rendererBackgroundColor() to determine the layer's background color,
     9        but on most elements this returns the transparent color (a valid color).
     10        This caused us to allocate a contentsLayer, and use the transparent color as its
     11        backgroundColor, which was wasteful.
     12       
     13        Fix by only making a background-color layer if the color is not transparent (zero alpha).
     14       
     15        Also avoid making a new contents layer on every color change, and make sure that
     16        we don't do implicit animations for backgroundColor, and some other properties
     17        that were omitted by mistake.
     18
     19        Layer tree dumps don't dump content layers, so no way to test easily.
     20
     21        * platform/graphics/ca/GraphicsLayerCA.cpp:
     22        (WebCore::GraphicsLayerCA::setContentsToSolidColor):
     23        * platform/graphics/ca/mac/PlatformCALayerMac.mm:
     24        (nullActionsDictionary):
     25
    1262013-11-07  Ryosuke Niwa  <rniwa@webkit.org>
    227
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r158859 r158889  
    819819
    820820    m_contentsSolidColor = color;
    821 
    822     if (m_contentsSolidColor.isValid()) {
    823         m_contentsLayerPurpose = ContentsLayerForBackgroundColor;
    824         m_contentsLayer = createPlatformCALayer(PlatformCALayer::LayerTypeLayer, this);
     821   
     822    bool contentsLayerChanged = false;
     823
     824    if (m_contentsSolidColor.isValid() && m_contentsSolidColor.alpha()) {
     825        if (!m_contentsLayer || m_contentsLayerPurpose != ContentsLayerForBackgroundColor) {
     826            m_contentsLayerPurpose = ContentsLayerForBackgroundColor;
     827            m_contentsLayer = createPlatformCALayer(PlatformCALayer::LayerTypeLayer, this);
    825828#ifndef NDEBUG
    826         m_contentsLayer->setName("Background Color Layer");
     829            m_contentsLayer->setName("Background Color Layer");
    827830#endif
     831            contentsLayerChanged = true;
     832        }
    828833    } else {
     834        contentsLayerChanged = m_contentsLayer;
    829835        m_contentsLayerPurpose = NoContentsLayer;
    830836        m_contentsLayer = 0;
    831837    }
    832838
    833     noteSublayersChanged();
     839    if (contentsLayerChanged)
     840        noteSublayersChanged();
     841
    834842    noteLayerPropertyChanged(ContentsColorLayerChanged);
    835843}
  • trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm

    r158619 r158889  
    148148                             nullValue, @"anchorPoint",
    149149                             nullValue, @"anchorPointZ",
     150                             nullValue, @"backgroundColor",
     151                             nullValue, @"borderColor",
     152                             nullValue, @"borderWidth",
    150153                             nullValue, @"bounds",
    151154                             nullValue, @"contents",
    152155                             nullValue, @"contentsRect",
     156                             nullValue, @"contentsScale",
     157                             nullValue, @"cornerRadius",
    153158                             nullValue, @"opacity",
    154159                             nullValue, @"position",
  • trunk/Source/WebKit2/ChangeLog

    r158880 r158889  
     12013-11-07  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Lots of layers get solid color but transparent contents layers now
     4        https://bugs.webkit.org/show_bug.cgi?id=123537
     5
     6        Reviewed by Tim Horton.
     7       
     8        Add some properties to the list of things not to implicitly animate.
     9
     10        * Shared/mac/RemoteLayerTreePropertyApplier.mm:
     11        (WebKit::RemoteLayerTreePropertyApplier::disableActionsForLayer):
     12
    1132013-11-07  Anders Carlsson  <andersca@apple.com>
    214
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm

    r158691 r158889  
    162162            @"anchorPoint" : nullValue,
    163163            @"anchorPointZ" : nullValue,
     164            @"backgroundColor" : nullValue,
     165            @"borderColor" : nullValue,
     166            @"borderWidth" : nullValue,
    164167            @"bounds" : nullValue,
    165168            @"contents" : nullValue,
    166169            @"contentsRect" : nullValue,
     170            @"contentsScale" : nullValue,
     171            @"cornerRadius" : nullValue,
    167172            @"opacity" : nullValue,
    168173            @"position" : nullValue,
Note: See TracChangeset for help on using the changeset viewer.