Changeset 179604 in webkit


Ignore:
Timestamp:
Feb 4, 2015 9:13:59 AM (9 years ago)
Author:
Simon Fraser
Message:

[iOS WK2] Assert in ScrollingTreeOverflowScrollingNodeIOS::updateAfterChildren() on tab switching
https://bugs.webkit.org/show_bug.cgi?id=141223
rdar://problem/18458993

Reviewed by Tim Horton.
Source/WebCore:

It's possible to submit a RemoteLayerTree transaction that contains data
about a created layer, but doesn't have any properties for that layer. This
happens when the newly created layer isn't reached during the traversal that
gathers layer properties (i.e. it's not rooted). However, whether we create
a scrolling layer or not requires having properties; they are missing, so we
create a normal layer, but then the scrolling tree commit asserts that we
should have a scrolling layer.

Fix by making scrolling layers have a corresponding layer type, which is
stored in layer creation properties. This required exposing layer types
up through GraphicsLayer, but that allows for some nice cleanup:

  1. No need to have the hokey shouldUseTiledBacking() GraphicsLayerClient hack for creating the page tiled layer.
  2. The notion of "custom behaviors" can be removed from GraphicsLayer entirely.

Not testable because it requires tab switching.

  • WebCore.exp.in:
  • platform/graphics/GraphicsLayer.cpp:

(WebCore::GraphicsLayer::GraphicsLayer):

  • platform/graphics/GraphicsLayer.h:

(WebCore::GraphicsLayer::initialize):
(WebCore::GraphicsLayer::setCustomBehavior): Deleted.
(WebCore::GraphicsLayer::customBehavior): Deleted.

  • platform/graphics/GraphicsLayerClient.h:

(WebCore::GraphicsLayerClient::shouldUseTiledBacking): Deleted.

  • platform/graphics/GraphicsLayerFactory.h:
  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayer::create):
(WebCore::GraphicsLayerCA::GraphicsLayerCA):
(WebCore::GraphicsLayerCA::initialize):
(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
(WebCore::GraphicsLayerCA::ensureStructuralLayer):
(WebCore::GraphicsLayerCA::swapFromOrToTiledLayer):
(WebCore::GraphicsLayerCA::updateCustomBehavior): Deleted.
(WebCore::GraphicsLayerCA::setCustomBehavior): Deleted.

  • platform/graphics/ca/GraphicsLayerCA.h:

(WebCore::GraphicsLayerCA::moveAnimations):
(WebCore::GraphicsLayerCA::copyAnimations):

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

(PlatformCALayerMac::PlatformCALayerMac):
(PlatformCALayerMac::commonInit):
(PlatformCALayerMac::updateCustomBehavior): Deleted.

  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::createGraphicsLayer):
(WebCore::RenderLayerBacking::createPrimaryGraphicsLayer):
(WebCore::RenderLayerBacking::updateScrollingLayers):
(WebCore::RenderLayerBacking::shouldUseTiledBacking): Deleted.

  • rendering/RenderLayerBacking.h:

Source/WebKit2:

It's possible to submit a RemoteLayerTree transaction that contains data
about a created layer, but doesn't have any properties for that layer. This
happens when the newly created layer isn't reached during the traversal that
gathers layer properties (i.e. it's not rooted). However, whether we create
a scrolling layer or not requires having properties; they are missing, so we
create a normal layer, but then the scrolling tree commit asserts that we
should have a scrolling layer.

Fix by making scrolling layers have a corresponding layer type, which is
stored in layer creation properties. This required exposing layer types
up through GraphicsLayer, but that allows for some nice cleanup:

  1. No need to have the hokey shouldUseTiledBacking() GraphicsLayerClient hack for creating the page tiled layer.
  2. The notion of "custom behaviors" can be removed from GraphicsLayer entirely.
  • Shared/mac/RemoteLayerBackingStore.mm:

(WebKit::RemoteLayerBackingStore::drawInContext):

  • Shared/mac/RemoteLayerTreeTransaction.h:
  • Shared/mac/RemoteLayerTreeTransaction.mm:

(WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
(WebKit::dumpChangedLayers):
(WebKit::RemoteLayerTreeTransaction::description):

  • UIProcess/ios/RemoteLayerTreeHostIOS.mm:

(WebKit::RemoteLayerTreeHost::createLayer):

  • UIProcess/mac/RemoteLayerTreeHost.mm:

(WebKit::RemoteLayerTreeHost::createLayer):

  • WebProcess/WebPage/mac/GraphicsLayerCARemote.h:
  • WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:

(WebKit::PlatformCALayerRemote::customBehavior): Deleted.
(WebKit::PlatformCALayerRemote::updateCustomBehavior): Deleted.

  • WebProcess/WebPage/mac/PlatformCALayerRemote.h:
  • WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
  • WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:

(WebKit::RemoteLayerTreeContext::createGraphicsLayer):

Location:
trunk/Source
Files:
32 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r179602 r179604  
     12015-02-04  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS WK2] Assert in ScrollingTreeOverflowScrollingNodeIOS::updateAfterChildren() on tab switching
     4        https://bugs.webkit.org/show_bug.cgi?id=141223
     5        rdar://problem/18458993
     6
     7        Reviewed by Tim Horton.
     8       
     9        It's possible to submit a RemoteLayerTree transaction that contains data
     10        about a created layer, but doesn't have any properties for that layer. This
     11        happens when the newly created layer isn't reached during the traversal that
     12        gathers layer properties (i.e. it's not rooted). However, whether we create
     13        a scrolling layer or not requires having properties; they are missing, so we
     14        create a normal layer, but then the scrolling tree commit asserts that we
     15        should have a scrolling layer.
     16       
     17        Fix by making scrolling layers have a corresponding layer type, which is
     18        stored in layer creation properties. This required exposing layer types
     19        up through GraphicsLayer, but that allows for some nice cleanup:
     20       
     21        1. No need to have the hokey shouldUseTiledBacking() GraphicsLayerClient hack
     22           for creating the page tiled layer.
     23        2. The notion of "custom behaviors" can be removed from GraphicsLayer entirely.
     24
     25        Not testable because it requires tab switching.
     26
     27        * WebCore.exp.in:
     28        * platform/graphics/GraphicsLayer.cpp:
     29        (WebCore::GraphicsLayer::GraphicsLayer):
     30        * platform/graphics/GraphicsLayer.h:
     31        (WebCore::GraphicsLayer::initialize):
     32        (WebCore::GraphicsLayer::setCustomBehavior): Deleted.
     33        (WebCore::GraphicsLayer::customBehavior): Deleted.
     34        * platform/graphics/GraphicsLayerClient.h:
     35        (WebCore::GraphicsLayerClient::shouldUseTiledBacking): Deleted.
     36        * platform/graphics/GraphicsLayerFactory.h:
     37        * platform/graphics/ca/GraphicsLayerCA.cpp:
     38        (WebCore::GraphicsLayer::create):
     39        (WebCore::GraphicsLayerCA::GraphicsLayerCA):
     40        (WebCore::GraphicsLayerCA::initialize):
     41        (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
     42        (WebCore::GraphicsLayerCA::ensureStructuralLayer):
     43        (WebCore::GraphicsLayerCA::swapFromOrToTiledLayer):
     44        (WebCore::GraphicsLayerCA::updateCustomBehavior): Deleted.
     45        (WebCore::GraphicsLayerCA::setCustomBehavior): Deleted.
     46        * platform/graphics/ca/GraphicsLayerCA.h:
     47        (WebCore::GraphicsLayerCA::moveAnimations):
     48        (WebCore::GraphicsLayerCA::copyAnimations):
     49        * platform/graphics/ca/PlatformCALayer.h:
     50        * platform/graphics/ca/mac/PlatformCALayerMac.h:
     51        * platform/graphics/ca/mac/PlatformCALayerMac.mm:
     52        (PlatformCALayerMac::PlatformCALayerMac):
     53        (PlatformCALayerMac::commonInit):
     54        (PlatformCALayerMac::updateCustomBehavior): Deleted.
     55        * rendering/RenderLayerBacking.cpp:
     56        (WebCore::RenderLayerBacking::createGraphicsLayer):
     57        (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer):
     58        (WebCore::RenderLayerBacking::updateScrollingLayers):
     59        (WebCore::RenderLayerBacking::shouldUseTiledBacking): Deleted.
     60        * rendering/RenderLayerBacking.h:
     61
    1622015-02-04  Dean Jackson  <dino@apple.com>
    263
  • trunk/Source/WebCore/WebCore.exp.in

    r179489 r179604  
    312312__ZN7WebCore13GraphicsLayer20setReplicatedByLayerEPS0_
    313313__ZN7WebCore13GraphicsLayer54noteDeviceOrPageScaleFactorChangedIncludingDescendantsEv
    314 __ZN7WebCore13GraphicsLayer6createEPNS_20GraphicsLayerFactoryERNS_19GraphicsLayerClientE
     314__ZN7WebCore13GraphicsLayer6createEPNS_20GraphicsLayerFactoryERNS_19GraphicsLayerClientENS0_4TypeE
    315315__ZN7WebCore13GraphicsLayer7setSizeERKNS_9FloatSizeE
    316316__ZN7WebCore13GraphicsLayer8addChildEPS0_
    317 __ZN7WebCore13GraphicsLayerC2ERNS_19GraphicsLayerClientE
    318317__ZN7WebCore13GraphicsLayerD2Ev
    319318__ZN7WebCore13HTTPHeaderMap3setERKN3WTF6StringES4_
     
    563562__ZN7WebCore15GraphicsContextC1EP9CGContext
    564563__ZN7WebCore15GraphicsContextD1Ev
    565 __ZN7WebCore15GraphicsLayerCA10initializeEv
     564__ZN7WebCore15GraphicsLayerCA10initializeENS_13GraphicsLayer4TypeE
    566565__ZN7WebCore15GraphicsLayerCA10setFiltersERKNS_16FilterOperationsE
    567566__ZN7WebCore15GraphicsLayerCA10setOpacityEf
     
    591590__ZN7WebCore15GraphicsLayerCA16setMasksToBoundsEb
    592591__ZN7WebCore15GraphicsLayerCA17setContentsOpaqueEb
    593 __ZN7WebCore15GraphicsLayerCA17setCustomBehaviorENS_13GraphicsLayer14CustomBehaviorE
    594592__ZN7WebCore15GraphicsLayerCA17suspendAnimationsEd
    595593__ZN7WebCore15GraphicsLayerCA18setBackdropFiltersERKNS_16FilterOperationsE
     
    623621__ZN7WebCore15GraphicsLayerCA7setSizeERKNS_9FloatSizeE
    624622__ZN7WebCore15GraphicsLayerCA8addChildEPNS_13GraphicsLayerE
    625 __ZN7WebCore15GraphicsLayerCAC2ERNS_19GraphicsLayerClientE
     623__ZN7WebCore15GraphicsLayerCAC2ENS_13GraphicsLayer4TypeERNS_19GraphicsLayerClientE
    626624__ZN7WebCore15GraphicsLayerCAD2Ev
    627625__ZN7WebCore15HitTestLocation12rectForPointERKNS_11LayoutPointEjjjj
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp

    r179599 r179604  
    7272}
    7373
    74 GraphicsLayer::GraphicsLayer(GraphicsLayerClient& client)
     74GraphicsLayer::GraphicsLayer(Type, GraphicsLayerClient& client)
    7575    : m_client(client)
    7676    , m_anchorPoint(0.5f, 0.5f, 0)
     
    100100    , m_repaintCount(0)
    101101    , m_customAppearance(NoCustomAppearance)
    102     , m_customBehavior(NoCustomBehavior)
    103102{
    104103#ifndef NDEBUG
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.h

    r179369 r179604  
    195195    WTF_MAKE_NONCOPYABLE(GraphicsLayer); WTF_MAKE_FAST_ALLOCATED;
    196196public:
    197     WEBCORE_EXPORT static std::unique_ptr<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayerClient&);
     197
     198    enum class Type {
     199        Normal,
     200        PageTiledBacking,
     201        Scrolling
     202    };
     203   
     204    WEBCORE_EXPORT static std::unique_ptr<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayerClient&, Type = Type::Normal);
    198205   
    199206    WEBCORE_EXPORT virtual ~GraphicsLayer();
    200207
    201     virtual void initialize() { }
     208    virtual void initialize(Type) { }
    202209
    203210    typedef uint64_t PlatformLayerID;
     
    430437    CustomAppearance customAppearance() const { return m_customAppearance; }
    431438
    432     enum CustomBehavior { NoCustomBehavior, CustomScrollingBehavior, CustomScrolledContentsBehavior };
    433     virtual void setCustomBehavior(CustomBehavior customBehavior) { m_customBehavior = customBehavior; }
    434     CustomBehavior customBehavior() const { return m_customBehavior; }
    435 
    436439    // z-position is the z-equivalent of position(). It's only used for debugging purposes.
    437440    virtual float zPosition() const { return m_zPosition; }
     
    508511
    509512protected:
     513    WEBCORE_EXPORT explicit GraphicsLayer(Type, GraphicsLayerClient&);
     514
    510515    // Should be called from derived class destructors. Should call willBeDestroyed() on super.
    511516    WEBCORE_EXPORT virtual void willBeDestroyed();
     
    534539    GraphicsLayer* replicatedLayer() const { return m_replicatedLayer; }
    535540    virtual void setReplicatedLayer(GraphicsLayer* layer) { m_replicatedLayer = layer; }
    536 
    537     WEBCORE_EXPORT explicit GraphicsLayer(GraphicsLayerClient&);
    538541
    539542    void dumpProperties(TextStream&, int indent, LayerTreeAsTextBehavior) const;
     
    602605    int m_repaintCount;
    603606    CustomAppearance m_customAppearance;
    604     CustomBehavior m_customBehavior;
    605607};
    606608
  • trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h

    r178868 r179604  
    7474    virtual ~GraphicsLayerClient() {}
    7575
    76     virtual bool shouldUseTiledBacking(const GraphicsLayer*) const { return false; }
    7776    virtual void tiledBackingUsageChanged(const GraphicsLayer*, bool /*usingTiledBacking*/) { }
    7877   
  • trunk/Source/WebCore/platform/graphics/GraphicsLayerFactory.h

    r168423 r179604  
    2727#define GraphicsLayerFactory_h
    2828
     29#include "GraphicsLayer.h"
    2930#include <wtf/Forward.h>
    3031
    3132namespace WebCore {
    32 
    33 class GraphicsLayer;
    34 class GraphicsLayerClient;
    3533
    3634class GraphicsLayerFactory {
     
    3836    virtual ~GraphicsLayerFactory() { }
    3937
    40     virtual std::unique_ptr<GraphicsLayer> createGraphicsLayer(GraphicsLayerClient&) = 0;
     38    virtual std::unique_ptr<GraphicsLayer> createGraphicsLayer(GraphicsLayer::Type, GraphicsLayerClient&) = 0;
    4139};
    4240
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r179369 r179604  
    277277}
    278278
    279 std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client)
     279std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client, Type layerType)
    280280{
    281281    std::unique_ptr<GraphicsLayer> graphicsLayer;
    282282    if (!factory)
    283         graphicsLayer = std::make_unique<GraphicsLayerCA>(client);
     283        graphicsLayer = std::make_unique<GraphicsLayerCA>(layerType, client);
    284284    else
    285         graphicsLayer = factory->createGraphicsLayer(client);
    286 
    287     graphicsLayer->initialize();
     285        graphicsLayer = factory->createGraphicsLayer(layerType, client);
     286
     287    graphicsLayer->initialize(layerType);
    288288
    289289    return graphicsLayer;
     
    326326}
    327327
    328 GraphicsLayerCA::GraphicsLayerCA(GraphicsLayerClient& client)
    329     : GraphicsLayer(client)
     328GraphicsLayerCA::GraphicsLayerCA(Type layerType, GraphicsLayerClient& client)
     329    : GraphicsLayer(layerType, client)
    330330    , m_contentsLayerPurpose(NoContentsLayer)
    331331    , m_isPageTiledBackingLayer(false)
     
    336336}
    337337
    338 void GraphicsLayerCA::initialize()
    339 {
    340     PlatformCALayer::LayerType layerType = PlatformCALayer::LayerTypeWebLayer;
    341     if (client().shouldUseTiledBacking(this)) {
    342         layerType = PlatformCALayer::LayerTypePageTiledBackingLayer;
     338void GraphicsLayerCA::initialize(Type layerType)
     339{
     340    if (layerType == Type::PageTiledBacking)
    343341        m_isPageTiledBackingLayer = true;
    344     }
    345 
    346     m_layer = createPlatformCALayer(layerType, this);
     342
     343    PlatformCALayer::LayerType platformLayerType;
     344    switch (layerType) {
     345    case Type::Normal:
     346        platformLayerType = PlatformCALayer::LayerType::LayerTypeWebLayer;
     347        break;
     348    case Type::PageTiledBacking:
     349        platformLayerType = PlatformCALayer::LayerType::LayerTypePageTiledBackingLayer;
     350        break;
     351    case Type::Scrolling:
     352        platformLayerType = PlatformCALayer::LayerType::LayerTypeScrollingLayer;
     353        break;
     354    }
     355    m_layer = createPlatformCALayer(platformLayerType, this);
    347356    noteLayerPropertyChanged(ContentsScaleChanged);
    348357}
     
    14051414        updateCustomAppearance();
    14061415
    1407     if (m_uncommittedChanges & CustomBehaviorChanged)
    1408         updateCustomBehavior();
    1409 
    14101416    if (m_uncommittedChanges & ChildrenChanged) {
    14111417        updateSublayerList();
     
    17521758            m_structuralLayer->superlayer()->replaceSublayer(*m_structuralLayer, *m_layer);
    17531759
    1754             moveOrCopyAnimations(Move, m_structuralLayer.get(), m_layer.get());
     1760            moveAnimations(m_structuralLayer.get(), m_layer.get());
    17551761
    17561762            // Release the structural layer.
     
    18091815    }
    18101816
    1811     moveOrCopyAnimations(Move, m_layer.get(), m_structuralLayer.get());
     1817    moveAnimations(m_layer.get(), m_structuralLayer.get());
    18121818}
    18131819
     
    30023008}
    30033009
    3004 void GraphicsLayerCA::updateCustomBehavior()
    3005 {
    3006     m_layer->updateCustomBehavior(m_customBehavior);
    3007 }
    3008 
    30093010void GraphicsLayerCA::setShowDebugBorder(bool showBorder)
    30103011{
     
    31093110    GraphicsLayer::setCustomAppearance(customAppearance);
    31103111    noteLayerPropertyChanged(CustomAppearanceChanged);
    3111 }
    3112 
    3113 void GraphicsLayerCA::setCustomBehavior(CustomBehavior customBehavior)
    3114 {
    3115     if (customBehavior == m_customBehavior)
    3116         return;
    3117 
    3118     GraphicsLayer::setCustomBehavior(customBehavior);
    3119     noteLayerPropertyChanged(CustomBehaviorChanged);
    31203112}
    31213113
     
    31893181#endif
    31903182
    3191     // move over animations
    3192     moveOrCopyAnimations(Move, oldLayer.get(), m_layer.get());
     3183    moveAnimations(oldLayer.get(), m_layer.get());
    31933184   
    31943185    // need to tell new layer to draw itself
     
    34273418    if (cloneLevel == IntermediateCloneLevel) {
    34283419        newLayer->setOpacity(layer->opacity());
    3429         moveOrCopyAnimations(Copy, layer, newLayer.get());
     3420        copyAnimations(layer, newLayer.get());
    34303421    }
    34313422
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h

    r179389 r179604  
    5757    static const int kTiledLayerTileSize = 512;
    5858
    59     WEBCORE_EXPORT explicit GraphicsLayerCA(GraphicsLayerClient&);
     59    WEBCORE_EXPORT explicit GraphicsLayerCA(Type, GraphicsLayerClient&);
    6060    WEBCORE_EXPORT virtual ~GraphicsLayerCA();
    6161
    62     WEBCORE_EXPORT virtual void initialize() override;
     62    WEBCORE_EXPORT virtual void initialize(Type) override;
    6363
    6464    WEBCORE_EXPORT virtual void setName(const String&) override;
     
    144144
    145145    WEBCORE_EXPORT virtual void setCustomAppearance(CustomAppearance) override;
    146     WEBCORE_EXPORT virtual void setCustomBehavior(CustomBehavior) override;
    147146
    148147    WEBCORE_EXPORT virtual void deviceOrPageScaleFactorChanged() override;
     
    385384    void updateContentsScale(float pageScaleFactor);
    386385    void updateCustomAppearance();
    387     void updateCustomBehavior();
    388386
    389387    enum StructuralLayerPurpose {
     
    402400    enum MoveOrCopy { Move, Copy };
    403401    static void moveOrCopyLayerAnimation(MoveOrCopy, const String& animationIdentifier, PlatformCALayer *fromLayer, PlatformCALayer *toLayer);
    404     void moveOrCopyAnimations(MoveOrCopy, PlatformCALayer * fromLayer, PlatformCALayer * toLayer);
    405    
     402    void moveOrCopyAnimations(MoveOrCopy, PlatformCALayer* fromLayer, PlatformCALayer* toLayer);
     403
     404    void moveAnimations(PlatformCALayer* fromLayer, PlatformCALayer* toLayer)
     405    {
     406        moveOrCopyAnimations(Move, fromLayer, toLayer);
     407    }
     408    void copyAnimations(PlatformCALayer* fromLayer, PlatformCALayer* toLayer)
     409    {
     410        moveOrCopyAnimations(Copy, fromLayer, toLayer);
     411    }
     412
    406413    bool appendToUncommittedAnimations(const KeyframeValueList&, const TransformOperations*, const Animation*, const String& animationName, const FloatSize& boxSize, int animationIndex, double timeOffset, bool isMatrixAnimation);
    407414    bool appendToUncommittedAnimations(const KeyframeValueList&, const FilterOperation*, const Animation*, const String& animationName, int animationIndex, double timeOffset);
     
    441448        DebugIndicatorsChanged =        1LLU << 31,
    442449        CustomAppearanceChanged =       1LLU << 32,
    443         CustomBehaviorChanged =         1LLU << 33,
    444         BlendModeChanged =              1LLU << 34,
     450        BlendModeChanged =              1LLU << 33,
    445451    };
    446452    typedef uint64_t LayerChangeFlags;
  • trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h

    r175794 r179604  
    8181        LayerTypeBackdropLayer,
    8282        LayerTypeShapeLayer,
     83        LayerTypeScrollingLayer,
    8384        LayerTypeCustom
    8485    };
     
    214215    virtual void updateCustomAppearance(GraphicsLayer::CustomAppearance) = 0;
    215216
    216     virtual GraphicsLayer::CustomBehavior customBehavior() const = 0;
    217     virtual void updateCustomBehavior(GraphicsLayer::CustomBehavior) = 0;
    218 
    219217    virtual TiledBacking* tiledBacking() = 0;
    220218
  • trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h

    r175794 r179604  
    146146    virtual void updateCustomAppearance(GraphicsLayer::CustomAppearance) override;
    147147
    148     virtual GraphicsLayer::CustomBehavior customBehavior() const override { return m_customBehavior; }
    149     virtual void updateCustomBehavior(GraphicsLayer::CustomBehavior) override;
    150 
    151148    virtual TiledBacking* tiledBacking() override;
    152149
     
    170167    std::unique_ptr<PlatformCALayerList> m_customSublayers;
    171168    GraphicsLayer::CustomAppearance m_customAppearance;
    172     GraphicsLayer::CustomBehavior m_customBehavior;
    173169    std::unique_ptr<FloatRoundedRect> m_shapeRoundedRect;
    174170};
  • trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm

    r179450 r179604  
    206206    : PlatformCALayer(layerType, owner)
    207207    , m_customAppearance(GraphicsLayer::NoCustomAppearance)
    208     , m_customBehavior(GraphicsLayer::NoCustomBehavior)
    209208{
    210209    Class layerClass = Nil;
     
    214213        layerClass = [CALayer class];
    215214        break;
     215    case LayerTypeScrollingLayer:
     216        // Scrolling layers only have special behavior with PlatformCALayerRemote.
     217        // fallthrough
    216218    case LayerTypeWebLayer:
    217219        layerClass = [WebLayer class];
     
    263265    : PlatformCALayer(layerTypeForPlatformLayer(layer), owner)
    264266    , m_customAppearance(GraphicsLayer::NoCustomAppearance)
    265     , m_customBehavior(GraphicsLayer::NoCustomBehavior)
    266267{
    267268    m_layer = layer;
     
    276277   
    277278    // Clear all the implicit animations on the CALayer
    278     if (m_layerType == LayerTypeAVPlayerLayer || m_layerType == LayerTypeWebGLLayer || m_layerType == LayerTypeCustom)
     279    if (m_layerType == LayerTypeAVPlayerLayer || m_layerType == LayerTypeWebGLLayer || m_layerType == LayerTypeScrollingLayer || m_layerType == LayerTypeCustom)
    279280        [m_layer web_disableAllActions];
    280281    else
     
    878879}
    879880
    880 void PlatformCALayerMac::updateCustomBehavior(GraphicsLayer::CustomBehavior customBehavior)
    881 {
    882     m_customBehavior = customBehavior;
    883 
    884     // Custom layers can get wrapped in UIViews (which clobbers the layer delegate),
    885     // so fall back to the slower way of disabling implicit animations.
    886     if (m_customBehavior != GraphicsLayer::NoCustomBehavior) {
    887         if ([[m_layer delegate] isKindOfClass:[WebActionDisablingCALayerDelegate class]])
    888             [m_layer setDelegate:nil];
    889         [m_layer web_disableAllActions];
    890     }
    891 }
    892 
    893881TiledBacking* PlatformCALayerMac::tiledBacking()
    894882{
  • trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp

    r178520 r179604  
    129129    : PlatformCALayer(layer ? LayerTypeCustom : layerType, owner)
    130130    , m_customAppearance(GraphicsLayer::NoCustomAppearance)
    131     , m_customBehavior(GraphicsLayer::NoCustomBehavior)
    132131{
    133132    if (layer) {
  • trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h

    r175794 r179604  
    134134    virtual void updateCustomAppearance(GraphicsLayer::CustomAppearance customAppearance) override { m_customAppearance = customAppearance; }
    135135
    136     virtual GraphicsLayer::CustomBehavior customBehavior() const override { return m_customBehavior; }
    137     virtual void updateCustomBehavior(GraphicsLayer::CustomBehavior customBehavior) override { m_customBehavior = customBehavior; }
    138 
    139136    virtual TiledBacking* tiledBacking() override;
    140137   
     
    157154    std::unique_ptr<PlatformCALayerList> m_customSublayers;
    158155    GraphicsLayer::CustomAppearance m_customAppearance;
    159     GraphicsLayer::CustomBehavior m_customBehavior;
    160156};
    161157
  • trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp

    r178182 r179604  
    3131namespace WebCore {
    3232
    33 std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client)
     33std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client, Type layerType)
    3434{
    3535    if (!factory)
    36         return std::make_unique<GraphicsLayerTextureMapper>(client);
    37 
    38     return factory->createGraphicsLayer(client);
    39 }
    40 
    41 GraphicsLayerTextureMapper::GraphicsLayerTextureMapper(GraphicsLayerClient& client)
    42     : GraphicsLayer(client)
     36        return std::make_unique<GraphicsLayerTextureMapper>(layerType, client);
     37
     38    return factory->createGraphicsLayer(layerType, client);
     39}
     40
     41GraphicsLayerTextureMapper::GraphicsLayerTextureMapper(Type layerType, GraphicsLayerClient& client)
     42    : GraphicsLayer(layerType, client)
    4343    , m_compositedNativeImagePtr(0)
    4444    , m_changeMask(NoChanges)
  • trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h

    r178182 r179604  
    3535class GraphicsLayerTextureMapper final : public GraphicsLayer, TextureMapperPlatformLayer::Client {
    3636public:
    37     explicit GraphicsLayerTextureMapper(GraphicsLayerClient&);
     37    explicit GraphicsLayerTextureMapper(Type, GraphicsLayerClient&);
    3838    virtual ~GraphicsLayerTextureMapper();
    3939
  • trunk/Source/WebCore/platform/graphics/texmap/coordinated/CompositingCoordinator.cpp

    r178119 r179604  
    256256}
    257257
    258 std::unique_ptr<GraphicsLayer> CompositingCoordinator::createGraphicsLayer(GraphicsLayerClient& client)
    259 {
    260     CoordinatedGraphicsLayer* layer = new CoordinatedGraphicsLayer(client);
     258std::unique_ptr<GraphicsLayer> CompositingCoordinator::createGraphicsLayer(GraphicsLayer::Type layerType, GraphicsLayerClient& client)
     259{
     260    CoordinatedGraphicsLayer* layer = new CoordinatedGraphicsLayer(layerType, client);
    261261    layer->setCoordinator(this);
    262262    m_registeredLayers.add(layer->id(), layer);
  • trunk/Source/WebCore/platform/graphics/texmap/coordinated/CompositingCoordinator.h

    r176495 r179604  
    115115
    116116    // GraphicsLayerFactory
    117     virtual std::unique_ptr<GraphicsLayer> createGraphicsLayer(GraphicsLayerClient&) override;
     117    virtual std::unique_ptr<GraphicsLayer> createGraphicsLayer(GraphicsLayer::Type, GraphicsLayerClient&) override;
    118118
    119119    void initializeRootCompositingLayerIfNeeded();
  • trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp

    r178182 r179604  
    104104}
    105105
    106 CoordinatedGraphicsLayer::CoordinatedGraphicsLayer(GraphicsLayerClient& client)
    107     : GraphicsLayer(client)
     106CoordinatedGraphicsLayer::CoordinatedGraphicsLayer(Type layerType, GraphicsLayerClient& client)
     107    : GraphicsLayer(layerType, client)
    108108#ifndef NDEBUG
    109109    , m_isPurging(false)
  • trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h

    r178182 r179604  
    6262    , public CoordinatedTileClient {
    6363public:
    64     explicit CoordinatedGraphicsLayer(GraphicsLayerClient&);
     64    explicit CoordinatedGraphicsLayer(Type, GraphicsLayerClient&);
    6565    virtual ~CoordinatedGraphicsLayer();
    6666
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r179495 r179604  
    106106}
    107107
    108 bool RenderLayerBacking::m_creatingPrimaryGraphicsLayer = false;
    109 
    110108RenderLayerBacking::RenderLayerBacking(RenderLayer& layer)
    111109    : m_owningLayer(layer)
     
    164162}
    165163
    166 std::unique_ptr<GraphicsLayer> RenderLayerBacking::createGraphicsLayer(const String& name)
     164std::unique_ptr<GraphicsLayer> RenderLayerBacking::createGraphicsLayer(const String& name, GraphicsLayer::Type layerType)
    167165{
    168166    GraphicsLayerFactory* graphicsLayerFactory = 0;
     
    170168        graphicsLayerFactory = page->chrome().client().graphicsLayerFactory();
    171169
    172     std::unique_ptr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(graphicsLayerFactory, *this);
     170    std::unique_ptr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(graphicsLayerFactory, *this, layerType);
    173171
    174172#ifndef NDEBUG
     
    182180   
    183181    return graphicsLayer;
    184 }
    185 
    186 bool RenderLayerBacking::shouldUseTiledBacking(const GraphicsLayer*) const
    187 {
    188     return m_usingTiledCacheLayer && m_creatingPrimaryGraphicsLayer;
    189182}
    190183
     
    287280#endif
    288281   
    289     // The call to createGraphicsLayer ends calling back into here as
    290     // a GraphicsLayerClient to ask if it shouldUseTiledBacking(). We only want
    291     // the tile cache on our main layer. This is pretty ugly, but saves us from
    292     // exposing the API to all clients.
    293 
    294     m_creatingPrimaryGraphicsLayer = true;
    295     m_graphicsLayer = createGraphicsLayer(layerName);
    296     m_creatingPrimaryGraphicsLayer = false;
     282    m_graphicsLayer = createGraphicsLayer(layerName, m_usingTiledCacheLayer ? GraphicsLayer::Type::PageTiledBacking : GraphicsLayer::Type::Normal);
    297283
    298284    if (m_usingTiledCacheLayer) {
     
    14851471    if (!m_scrollingLayer) {
    14861472        // Outer layer which corresponds with the scroll view.
    1487         m_scrollingLayer = createGraphicsLayer("Scrolling container");
     1473        m_scrollingLayer = createGraphicsLayer("Scrolling container", GraphicsLayer::Type::Scrolling);
    14881474        m_scrollingLayer->setDrawsContent(false);
    14891475        m_scrollingLayer->setMasksToBounds(true);
    1490 #if PLATFORM(IOS)
    1491         m_scrollingLayer->setCustomBehavior(GraphicsLayer::CustomScrollingBehavior);
    1492 #endif
     1476
    14931477        // Inner layer which renders the content that scrolls.
    14941478        m_scrollingContentsLayer = createGraphicsLayer("Scrolled Contents");
    14951479        m_scrollingContentsLayer->setDrawsContent(true);
    1496 #if PLATFORM(IOS)
    1497         m_scrollingContentsLayer->setCustomBehavior(GraphicsLayer::CustomScrolledContentsBehavior);
    1498 #endif
     1480
    14991481        GraphicsLayerPaintingPhase paintPhase = GraphicsLayerPaintOverflowContents | GraphicsLayerPaintCompositedScroll;
    15001482        if (!m_foregroundLayer)
  • trunk/Source/WebCore/rendering/RenderLayerBacking.h

    r179244 r179604  
    194194
    195195    // GraphicsLayerClient interface
    196     virtual bool shouldUseTiledBacking(const GraphicsLayer*) const override;
    197196    virtual void tiledBackingUsageChanged(const GraphicsLayer*, bool /*usingTiledBacking*/) override;
    198197    virtual void notifyAnimationStarted(const GraphicsLayer*, const String& animationKey, double startTime) override;
     
    257256    LayoutRect compositedBoundsIncludingMargin() const;
    258257   
    259     std::unique_ptr<GraphicsLayer> createGraphicsLayer(const String&);
     258    std::unique_ptr<GraphicsLayer> createGraphicsLayer(const String&, GraphicsLayer::Type = GraphicsLayer::Type::Normal);
    260259
    261260    RenderLayerModelObject& renderer() const { return m_owningLayer.renderer(); }
     
    366365#endif
    367366    bool m_backgroundLayerPaintsFixedRootBackground;
    368 
    369     static bool m_creatingPrimaryGraphicsLayer;
    370367};
    371368
  • trunk/Source/WebKit2/ChangeLog

    r179603 r179604  
     12015-02-04  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS WK2] Assert in ScrollingTreeOverflowScrollingNodeIOS::updateAfterChildren() on tab switching
     4        https://bugs.webkit.org/show_bug.cgi?id=141223
     5        rdar://problem/18458993
     6
     7        Reviewed by Tim Horton.
     8
     9        It's possible to submit a RemoteLayerTree transaction that contains data
     10        about a created layer, but doesn't have any properties for that layer. This
     11        happens when the newly created layer isn't reached during the traversal that
     12        gathers layer properties (i.e. it's not rooted). However, whether we create
     13        a scrolling layer or not requires having properties; they are missing, so we
     14        create a normal layer, but then the scrolling tree commit asserts that we
     15        should have a scrolling layer.
     16       
     17        Fix by making scrolling layers have a corresponding layer type, which is
     18        stored in layer creation properties. This required exposing layer types
     19        up through GraphicsLayer, but that allows for some nice cleanup:
     20       
     21        1. No need to have the hokey shouldUseTiledBacking() GraphicsLayerClient hack
     22           for creating the page tiled layer.
     23        2. The notion of "custom behaviors" can be removed from GraphicsLayer entirely.
     24
     25        * Shared/mac/RemoteLayerBackingStore.mm:
     26        (WebKit::RemoteLayerBackingStore::drawInContext):
     27        * Shared/mac/RemoteLayerTreeTransaction.h:
     28        * Shared/mac/RemoteLayerTreeTransaction.mm:
     29        (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
     30        (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
     31        (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
     32        (WebKit::dumpChangedLayers):
     33        (WebKit::RemoteLayerTreeTransaction::description):
     34        * UIProcess/ios/RemoteLayerTreeHostIOS.mm:
     35        (WebKit::RemoteLayerTreeHost::createLayer):
     36        * UIProcess/mac/RemoteLayerTreeHost.mm:
     37        (WebKit::RemoteLayerTreeHost::createLayer):
     38        * WebProcess/WebPage/mac/GraphicsLayerCARemote.h:
     39        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
     40        (WebKit::PlatformCALayerRemote::customBehavior): Deleted.
     41        (WebKit::PlatformCALayerRemote::updateCustomBehavior): Deleted.
     42        * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
     43        * WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
     44        * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
     45        (WebKit::RemoteLayerTreeContext::createGraphicsLayer):
     46
    1472015-02-04  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
    248
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm

    r177543 r179604  
    343343    case PlatformCALayer::LayerTypeBackdropLayer:
    344344    case PlatformCALayer::LayerTypeShapeLayer:
     345    case PlatformCALayer::LayerTypeScrollingLayer:
    345346    case PlatformCALayer::LayerTypeCustom:
    346347        ASSERT_NOT_REACHED();
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h

    r176334 r179604  
    8383        AnimationsChanged               = 1LLU << 30,
    8484        EdgeAntialiasingMaskChanged     = 1LLU << 31,
    85         CustomAppearanceChanged         = 1LLU << 32,
    86         CustomBehaviorChanged           = 1LLU << 33
     85        CustomAppearanceChanged         = 1LLU << 32
    8786    };
    8887    typedef uint64_t LayerChange;
     
    150149        unsigned edgeAntialiasingMask;
    151150        WebCore::GraphicsLayer::CustomAppearance customAppearance;
    152         WebCore::GraphicsLayer::CustomBehavior customBehavior;
    153151        WebCore::PlatformCALayer::FilterType minificationFilter;
    154152        WebCore::PlatformCALayer::FilterType magnificationFilter;
  • trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm

    r178710 r179604  
    9494    , edgeAntialiasingMask(kCALayerLeftEdge | kCALayerRightEdge | kCALayerBottomEdge | kCALayerTopEdge)
    9595    , customAppearance(GraphicsLayer::NoCustomAppearance)
    96     , customBehavior(GraphicsLayer::NoCustomBehavior)
    9796    , minificationFilter(PlatformCALayer::FilterType::Linear)
    9897    , magnificationFilter(PlatformCALayer::FilterType::Linear)
     
    129128    , edgeAntialiasingMask(other.edgeAntialiasingMask)
    130129    , customAppearance(other.customAppearance)
    131     , customBehavior(other.customBehavior)
    132130    , minificationFilter(other.minificationFilter)
    133131    , magnificationFilter(other.magnificationFilter)
     
    257255    if (changedProperties & CustomAppearanceChanged)
    258256        encoder.encodeEnum(customAppearance);
    259 
    260     if (changedProperties & CustomBehaviorChanged)
    261         encoder.encodeEnum(customBehavior);
    262257}
    263258
     
    452447    if (result.changedProperties & CustomAppearanceChanged) {
    453448        if (!decoder.decodeEnum(result.customAppearance))
    454             return false;
    455     }
    456 
    457     if (result.changedProperties & CustomBehaviorChanged) {
    458         if (!decoder.decodeEnum(result.customBehavior))
    459449            return false;
    460450    }
     
    11851175        if (layerProperties.changedProperties & RemoteLayerTreeTransaction::CustomAppearanceChanged)
    11861176            dumpProperty(ts, "customAppearance", layerProperties.customAppearance);
    1187 
    1188         if (layerProperties.changedProperties & RemoteLayerTreeTransaction::CustomBehaviorChanged)
    1189             dumpProperty(ts, "customBehavior", layerProperties.customBehavior);
    11901177
    11911178        ts << ")";
     
    12561243                ts << "shape-layer";
    12571244                break;
     1245            case PlatformCALayer::LayerTypeScrollingLayer:
     1246                ts << "scrolling-layer";
     1247                break;
    12581248            case PlatformCALayer::LayerTypeCustom:
    12591249                ts << "custom-layer (context-id " << createdLayer.hostingContextID << ")";
  • trunk/Source/WebKit2/UIProcess/ios/RemoteLayerTreeHostIOS.mm

    r175811 r179604  
    174174    case PlatformCALayer::LayerTypePageTiledBackingLayer:
    175175    case PlatformCALayer::LayerTypeTiledBackingTileLayer:
    176         if (layerProperties && layerProperties->customBehavior == GraphicsLayer::CustomScrollingBehavior) {
    177             if (!m_isDebugLayerTreeHost)
    178                 view = adoptNS([[UIScrollView alloc] init]);
    179             else // The debug indicator parents views under layers, which can cause crashes with UIScrollView.
    180                 view = adoptNS([[UIView alloc] init]);
    181         } else
    182             view = adoptNS([[WKCompositingView alloc] init]);
     176        view = adoptNS([[WKCompositingView alloc] init]);
    183177        break;
    184178    case PlatformCALayer::LayerTypeBackdropLayer:
     
    199193        view = adoptNS([[WKShapeView alloc] init]);
    200194        break;
     195    case PlatformCALayer::LayerTypeScrollingLayer:
     196        if (!m_isDebugLayerTreeHost)
     197            view = adoptNS([[UIScrollView alloc] init]);
     198        else // The debug indicator parents views under layers, which can cause crashes with UIScrollView.
     199            view = adoptNS([[UIView alloc] init]);
     200        break;
    201201    default:
    202202        ASSERT_NOT_REACHED();
  • trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm

    r175794 r179604  
    223223    case PlatformCALayer::LayerTypePageTiledBackingLayer:
    224224    case PlatformCALayer::LayerTypeTiledBackingTileLayer:
     225    case PlatformCALayer::LayerTypeScrollingLayer:
    225226        layer = adoptNS([[CALayer alloc] init]);
    226227        break;
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.h

    r174602 r179604  
    3636class GraphicsLayerCARemote final : public WebCore::GraphicsLayerCA {
    3737public:
    38     GraphicsLayerCARemote(WebCore::GraphicsLayerClient& client, RemoteLayerTreeContext& context)
    39         : GraphicsLayerCA(client)
     38    GraphicsLayerCARemote(Type layerType, WebCore::GraphicsLayerClient& client, RemoteLayerTreeContext& context)
     39        : GraphicsLayerCA(layerType, client)
    4040        , m_context(context)
    4141    {
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp

    r175794 r179604  
    725725}
    726726
    727 GraphicsLayer::CustomBehavior PlatformCALayerRemote::customBehavior() const
    728 {
    729     return m_properties.customBehavior;
    730 }
    731 
    732 void PlatformCALayerRemote::updateCustomBehavior(GraphicsLayer::CustomBehavior customBehavior)
    733 {
    734     m_properties.customBehavior = customBehavior;
    735     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::CustomBehaviorChanged);
    736 }
    737 
    738727PassRefPtr<PlatformCALayer> PlatformCALayerRemote::createCompatibleLayer(PlatformCALayer::LayerType layerType, PlatformCALayerClient* client) const
    739728{
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h

    r175794 r179604  
    151151    virtual void updateCustomAppearance(WebCore::GraphicsLayer::CustomAppearance) override;
    152152
    153     virtual WebCore::GraphicsLayer::CustomBehavior customBehavior() const override;
    154     virtual void updateCustomBehavior(WebCore::GraphicsLayer::CustomBehavior) override;
    155 
    156153    virtual WebCore::TiledBacking* tiledBacking() override { return nullptr; }
    157154
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h

    r173702 r179604  
    7474private:
    7575    // WebCore::GraphicsLayerFactory
    76     virtual std::unique_ptr<WebCore::GraphicsLayer> createGraphicsLayer(WebCore::GraphicsLayerClient&) override;
     76    virtual std::unique_ptr<WebCore::GraphicsLayer> createGraphicsLayer(WebCore::GraphicsLayer::Type, WebCore::GraphicsLayerClient&) override;
    7777
    7878    WebPage& m_webPage;
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm

    r174657 r179604  
    9999}
    100100
    101 std::unique_ptr<GraphicsLayer> RemoteLayerTreeContext::createGraphicsLayer(GraphicsLayerClient& client)
     101std::unique_ptr<GraphicsLayer> RemoteLayerTreeContext::createGraphicsLayer(WebCore::GraphicsLayer::Type layerType, GraphicsLayerClient& client)
    102102{
    103     return std::make_unique<GraphicsLayerCARemote>(client, *this);
     103    return std::make_unique<GraphicsLayerCARemote>(layerType, client, *this);
    104104}
    105105
Note: See TracChangeset for help on using the changeset viewer.