Changeset 157528 in webkit


Ignore:
Timestamp:
Oct 16, 2013, 2:20:14 PM (12 years ago)
Author:
timothy_horton@apple.com
Message:

PlatformCALayer constructor should take layer type as an argument
https://bugs.webkit.org/show_bug.cgi?id=122915

Reviewed by Simon Fraser.

No new tests, just a minor refactoring.

  • platform/graphics/ca/PlatformCALayer.h:

(WebCore::PlatformCALayer::PlatformCALayer):
Add a LayerType argument.

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

(PlatformCALayerMac::PlatformCALayerMac):

  • platform/graphics/ca/win/PlatformCALayerWin.cpp:

(PlatformCALayerWin::PlatformCALayerWin):
Use the new LayerType argument, and early-return in the case where we
are wrapping a custom PlatformLayer.
Drive-by un-indent the switch in the Mac version.

  • WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:

(PlatformCALayerRemote::PlatformCALayerRemote):
Use the new LayerType argument.

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r157524 r157528  
     12013-10-16  Tim Horton  <timothy_horton@apple.com>
     2
     3        PlatformCALayer constructor should take layer type as an argument
     4        https://bugs.webkit.org/show_bug.cgi?id=122915
     5
     6        Reviewed by Simon Fraser.
     7
     8        No new tests, just a minor refactoring.
     9
     10        * platform/graphics/ca/PlatformCALayer.h:
     11        (WebCore::PlatformCALayer::PlatformCALayer):
     12        Add a LayerType argument.
     13
     14        * platform/graphics/ca/mac/PlatformCALayerMac.mm:
     15        (PlatformCALayerMac::PlatformCALayerMac):
     16        * platform/graphics/ca/win/PlatformCALayerWin.cpp:
     17        (PlatformCALayerWin::PlatformCALayerWin):
     18        Use the new LayerType argument, and early-return in the case where we
     19        are wrapping a custom PlatformLayer.
     20        Drive-by un-indent the switch in the Mac version.
     21
    1222013-10-15  Brady Eidson  <beidson@apple.com>
    223
  • trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h

    r157478 r157528  
    201201
    202202protected:
    203     PlatformCALayer(PlatformCALayerClient* owner)
    204         : m_owner(owner)
     203    PlatformCALayer(LayerType layerType, PlatformCALayerClient* owner)
     204        : m_layerType(layerType)
     205        , m_owner(owner)
    205206    {
    206207
  • trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm

    r157419 r157528  
    173173
    174174PlatformCALayerMac::PlatformCALayerMac(LayerType layerType, PlatformLayer* layer, PlatformCALayerClient* owner)
    175     : PlatformCALayer(owner)
     175    : PlatformCALayer(layer ? LayerTypeCustom : layerType, owner)
    176176{
    177177    BEGIN_BLOCK_OBJC_EXCEPTIONS
     
    179179        if ([layer isKindOfClass:getAVPlayerLayerClass()])
    180180            m_layerType = LayerTypeAVPlayerLayer;
    181         else
    182             m_layerType = LayerTypeCustom;
    183181        m_layer = layer;
    184     } else {
    185         m_layerType = layerType;
    186    
    187         Class layerClass = Nil;
    188         switch (layerType) {
    189             case LayerTypeLayer:
    190             case LayerTypeRootLayer:
    191                 layerClass = [CALayer class];
    192                 break;
    193             case LayerTypeWebLayer:
    194                 layerClass = [WebLayer class];
    195                 break;
    196             case LayerTypeTransformLayer:
    197                 layerClass = [CATransformLayer class];
    198                 break;
    199             case LayerTypeWebTiledLayer:
    200                 layerClass = [WebTiledLayer class];
    201                 break;
    202             case LayerTypeTiledBackingLayer:
    203             case LayerTypePageTiledBackingLayer:
    204                 layerClass = [WebTiledBackingLayer class];
    205                 break;
    206             case LayerTypeAVPlayerLayer:
    207                 layerClass = getAVPlayerLayerClass();
    208                 break;
    209             case LayerTypeCustom:
    210                 break;
    211         }
    212 
    213         if (layerClass)
    214             m_layer = adoptNS([[layerClass alloc] init]);
    215     }
     182        return;
     183    }
     184
     185    Class layerClass = Nil;
     186    switch (layerType) {
     187    case LayerTypeLayer:
     188    case LayerTypeRootLayer:
     189        layerClass = [CALayer class];
     190        break;
     191    case LayerTypeWebLayer:
     192        layerClass = [WebLayer class];
     193        break;
     194    case LayerTypeTransformLayer:
     195        layerClass = [CATransformLayer class];
     196        break;
     197    case LayerTypeWebTiledLayer:
     198        layerClass = [WebTiledLayer class];
     199        break;
     200    case LayerTypeTiledBackingLayer:
     201    case LayerTypePageTiledBackingLayer:
     202        layerClass = [WebTiledBackingLayer class];
     203        break;
     204    case LayerTypeAVPlayerLayer:
     205        layerClass = getAVPlayerLayerClass();
     206        break;
     207    case LayerTypeCustom:
     208        break;
     209    }
     210
     211    if (layerClass)
     212        m_layer = adoptNS([[layerClass alloc] init]);
    216213   
    217214    // Save a pointer to 'this' in the CALayer
  • trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp

    r157419 r157528  
    109109
    110110PlatformCALayerWin::PlatformCALayerWin(LayerType layerType, PlatformLayer* layer, PlatformCALayerClient* owner)
    111     : PlatformCALayer(owner)
     111    : PlatformCALayer(layer ? LayerTypeCustom : layerType, owner)
    112112{
    113113    if (layer) {
    114         m_layerType = LayerTypeCustom;
    115114        m_layer = layer;
    116     } else {
    117         m_layerType = layerType;
    118         ASSERT((layerType != LayerTypeTiledBackingLayer) && (layerType != LayerTypePageTiledBackingLayer));
    119         m_layer = adoptCF(CACFLayerCreate(toCACFLayerType(layerType)));
    120 
    121         // Create the PlatformCALayerWinInternal object and point to it in the userdata.
    122         PlatformCALayerWinInternal* intern = new PlatformCALayerWinInternal(this);
    123         CACFLayerSetUserData(m_layer.get(), intern);
    124 
    125         // Set the display callback
    126         CACFLayerSetDisplayCallback(m_layer.get(), displayCallback);
    127         CACFLayerSetLayoutCallback(m_layer.get(), layoutSublayersProc);   
    128     }
     115        return;
     116    }
     117
     118    ASSERT((layerType != LayerTypeTiledBackingLayer) && (layerType != LayerTypePageTiledBackingLayer));
     119    m_layer = adoptCF(CACFLayerCreate(toCACFLayerType(layerType)));
     120
     121    // Create the PlatformCALayerWinInternal object and point to it in the userdata.
     122    PlatformCALayerWinInternal* intern = new PlatformCALayerWinInternal(this);
     123    CACFLayerSetUserData(m_layer.get(), intern);
     124
     125    // Set the display callback
     126    CACFLayerSetDisplayCallback(m_layer.get(), displayCallback);
     127    CACFLayerSetLayoutCallback(m_layer.get(), layoutSublayersProc);
    129128}
    130129
  • trunk/Source/WebKit2/ChangeLog

    r157527 r157528  
     12013-10-16  Tim Horton  <timothy_horton@apple.com>
     2
     3        PlatformCALayer constructor should take layer type as an argument
     4        https://bugs.webkit.org/show_bug.cgi?id=122915
     5
     6        Reviewed by Simon Fraser.
     7
     8        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
     9        (PlatformCALayerRemote::PlatformCALayerRemote):
     10        Use the new LayerType argument.
     11
    1122013-10-16  Tim Horton  <timothy_horton@apple.com>
    213
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp

    r157523 r157528  
    5555
    5656PlatformCALayerRemote::PlatformCALayerRemote(LayerType layerType, PlatformCALayerClient* owner, RemoteLayerTreeContext* context)
    57     : PlatformCALayer(owner)
     57    : PlatformCALayer(layerType, owner)
    5858    , m_layerID(generateLayerID())
    5959    , m_context(context)
    6060{
    61     m_layerType = layerType;
    62 
    6361    m_context->layerWasCreated(this, layerType);
    6462}
Note: See TracChangeset for help on using the changeset viewer.