Title: [179604] trunk/Source
Revision
179604
Author
simon.fra...@apple.com
Date
2015-02-04 09:13:59 -0800 (Wed, 04 Feb 2015)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (179603 => 179604)


--- trunk/Source/WebCore/ChangeLog	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebCore/ChangeLog	2015-02-04 17:13:59 UTC (rev 179604)
@@ -1,3 +1,64 @@
+2015-02-04  Simon Fraser  <simon.fra...@apple.com>
+
+        [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.
+        
+        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:
+
 2015-02-04  Dean Jackson  <d...@apple.com>
 
         [Media] Fullscreen button should always come last in inline controls (141245)

Modified: trunk/Source/WebCore/WebCore.exp.in (179603 => 179604)


--- trunk/Source/WebCore/WebCore.exp.in	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebCore/WebCore.exp.in	2015-02-04 17:13:59 UTC (rev 179604)
@@ -311,10 +311,9 @@
 __ZN7WebCore13GraphicsLayer18setBackgroundColorERKNS_5ColorE
 __ZN7WebCore13GraphicsLayer20setReplicatedByLayerEPS0_
 __ZN7WebCore13GraphicsLayer54noteDeviceOrPageScaleFactorChangedIncludingDescendantsEv
-__ZN7WebCore13GraphicsLayer6createEPNS_20GraphicsLayerFactoryERNS_19GraphicsLayerClientE
+__ZN7WebCore13GraphicsLayer6createEPNS_20GraphicsLayerFactoryERNS_19GraphicsLayerClientENS0_4TypeE
 __ZN7WebCore13GraphicsLayer7setSizeERKNS_9FloatSizeE
 __ZN7WebCore13GraphicsLayer8addChildEPS0_
-__ZN7WebCore13GraphicsLayerC2ERNS_19GraphicsLayerClientE
 __ZN7WebCore13GraphicsLayerD2Ev
 __ZN7WebCore13HTTPHeaderMap3setERKN3WTF6StringES4_
 __ZN7WebCore13HTTPHeaderMap6removeENS_14HTTPHeaderNameE
@@ -562,7 +561,7 @@
 __ZN7WebCore15GraphicsContext9translateEff
 __ZN7WebCore15GraphicsContextC1EP9CGContext
 __ZN7WebCore15GraphicsContextD1Ev
-__ZN7WebCore15GraphicsLayerCA10initializeEv
+__ZN7WebCore15GraphicsLayerCA10initializeENS_13GraphicsLayer4TypeE
 __ZN7WebCore15GraphicsLayerCA10setFiltersERKNS_16FilterOperationsE
 __ZN7WebCore15GraphicsLayerCA10setOpacityEf
 __ZN7WebCore15GraphicsLayerCA11setChildrenERKN3WTF6VectorIPNS_13GraphicsLayerELm0ENS1_15CrashOnOverflowEEE
@@ -590,7 +589,6 @@
 __ZN7WebCore15GraphicsLayerCA16resumeAnimationsEv
 __ZN7WebCore15GraphicsLayerCA16setMasksToBoundsEb
 __ZN7WebCore15GraphicsLayerCA17setContentsOpaqueEb
-__ZN7WebCore15GraphicsLayerCA17setCustomBehaviorENS_13GraphicsLayer14CustomBehaviorE
 __ZN7WebCore15GraphicsLayerCA17suspendAnimationsEd
 __ZN7WebCore15GraphicsLayerCA18setBackdropFiltersERKNS_16FilterOperationsE
 __ZN7WebCore15GraphicsLayerCA18setBackgroundColorERKNS_5ColorE
@@ -622,7 +620,7 @@
 __ZN7WebCore15GraphicsLayerCA7setNameERKN3WTF6StringE
 __ZN7WebCore15GraphicsLayerCA7setSizeERKNS_9FloatSizeE
 __ZN7WebCore15GraphicsLayerCA8addChildEPNS_13GraphicsLayerE
-__ZN7WebCore15GraphicsLayerCAC2ERNS_19GraphicsLayerClientE
+__ZN7WebCore15GraphicsLayerCAC2ENS_13GraphicsLayer4TypeERNS_19GraphicsLayerClientE
 __ZN7WebCore15GraphicsLayerCAD2Ev
 __ZN7WebCore15HitTestLocation12rectForPointERKNS_11LayoutPointEjjjj
 __ZN7WebCore15HitTestLocationC1ERKNS_10FloatPointE

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (179603 => 179604)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2015-02-04 17:13:59 UTC (rev 179604)
@@ -71,7 +71,7 @@
     m_values.append(WTF::move(value));
 }
 
-GraphicsLayer::GraphicsLayer(GraphicsLayerClient& client)
+GraphicsLayer::GraphicsLayer(Type, GraphicsLayerClient& client)
     : m_client(client)
     , m_anchorPoint(0.5f, 0.5f, 0)
     , m_opacity(1)
@@ -99,7 +99,6 @@
     , m_replicatedLayer(nullptr)
     , m_repaintCount(0)
     , m_customAppearance(NoCustomAppearance)
-    , m_customBehavior(NoCustomBehavior)
 {
 #ifndef NDEBUG
     m_client.verifyNotPainting();

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (179603 => 179604)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2015-02-04 17:13:59 UTC (rev 179604)
@@ -194,11 +194,18 @@
 class GraphicsLayer {
     WTF_MAKE_NONCOPYABLE(GraphicsLayer); WTF_MAKE_FAST_ALLOCATED;
 public:
-    WEBCORE_EXPORT static std::unique_ptr<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayerClient&);
+
+    enum class Type {
+        Normal,
+        PageTiledBacking,
+        Scrolling
+    };
     
+    WEBCORE_EXPORT static std::unique_ptr<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayerClient&, Type = Type::Normal);
+    
     WEBCORE_EXPORT virtual ~GraphicsLayer();
 
-    virtual void initialize() { }
+    virtual void initialize(Type) { }
 
     typedef uint64_t PlatformLayerID;
     virtual PlatformLayerID primaryLayerID() const { return 0; }
@@ -429,10 +436,6 @@
     virtual void setCustomAppearance(CustomAppearance customAppearance) { m_customAppearance = customAppearance; }
     CustomAppearance customAppearance() const { return m_customAppearance; }
 
-    enum CustomBehavior { NoCustomBehavior, CustomScrollingBehavior, CustomScrolledContentsBehavior };
-    virtual void setCustomBehavior(CustomBehavior customBehavior) { m_customBehavior = customBehavior; }
-    CustomBehavior customBehavior() const { return m_customBehavior; }
-
     // z-position is the z-equivalent of position(). It's only used for debugging purposes.
     virtual float zPosition() const { return m_zPosition; }
     WEBCORE_EXPORT virtual void setZPosition(float);
@@ -507,6 +510,8 @@
     virtual bool needsClippingMaskLayer() { return true; };
 
 protected:
+    WEBCORE_EXPORT explicit GraphicsLayer(Type, GraphicsLayerClient&);
+
     // Should be called from derived class destructors. Should call willBeDestroyed() on super.
     WEBCORE_EXPORT virtual void willBeDestroyed();
 
@@ -534,8 +539,6 @@
     GraphicsLayer* replicatedLayer() const { return m_replicatedLayer; }
     virtual void setReplicatedLayer(GraphicsLayer* layer) { m_replicatedLayer = layer; }
 
-    WEBCORE_EXPORT explicit GraphicsLayer(GraphicsLayerClient&);
-
     void dumpProperties(TextStream&, int indent, LayerTreeAsTextBehavior) const;
     virtual void dumpAdditionalProperties(TextStream&, int /*indent*/, LayerTreeAsTextBehavior) const { }
 
@@ -601,7 +604,6 @@
 
     int m_repaintCount;
     CustomAppearance m_customAppearance;
-    CustomBehavior m_customBehavior;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h (179603 => 179604)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h	2015-02-04 17:13:59 UTC (rev 179604)
@@ -73,7 +73,6 @@
 public:
     virtual ~GraphicsLayerClient() {}
 
-    virtual bool shouldUseTiledBacking(const GraphicsLayer*) const { return false; }
     virtual void tiledBackingUsageChanged(const GraphicsLayer*, bool /*usingTiledBacking*/) { }
     
     // Callback for when hardware-accelerated animation started.

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayerFactory.h (179603 => 179604)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayerFactory.h	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayerFactory.h	2015-02-04 17:13:59 UTC (rev 179604)
@@ -26,18 +26,16 @@
 #ifndef GraphicsLayerFactory_h
 #define GraphicsLayerFactory_h
 
+#include "GraphicsLayer.h"
 #include <wtf/Forward.h>
 
 namespace WebCore {
 
-class GraphicsLayer;
-class GraphicsLayerClient;
-
 class GraphicsLayerFactory {
 public:
     virtual ~GraphicsLayerFactory() { }
 
-    virtual std::unique_ptr<GraphicsLayer> createGraphicsLayer(GraphicsLayerClient&) = 0;
+    virtual std::unique_ptr<GraphicsLayer> createGraphicsLayer(GraphicsLayer::Type, GraphicsLayerClient&) = 0;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (179603 => 179604)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2015-02-04 17:13:59 UTC (rev 179604)
@@ -276,15 +276,15 @@
 #endif
 }
 
-std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client)
+std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client, Type layerType)
 {
     std::unique_ptr<GraphicsLayer> graphicsLayer;
     if (!factory)
-        graphicsLayer = std::make_unique<GraphicsLayerCA>(client);
+        graphicsLayer = std::make_unique<GraphicsLayerCA>(layerType, client);
     else
-        graphicsLayer = factory->createGraphicsLayer(client);
+        graphicsLayer = factory->createGraphicsLayer(layerType, client);
 
-    graphicsLayer->initialize();
+    graphicsLayer->initialize(layerType);
 
     return graphicsLayer;
 }
@@ -325,8 +325,8 @@
 #endif
 }
 
-GraphicsLayerCA::GraphicsLayerCA(GraphicsLayerClient& client)
-    : GraphicsLayer(client)
+GraphicsLayerCA::GraphicsLayerCA(Type layerType, GraphicsLayerClient& client)
+    : GraphicsLayer(layerType, client)
     , m_contentsLayerPurpose(NoContentsLayer)
     , m_isPageTiledBackingLayer(false)
     , m_needsFullRepaint(false)
@@ -335,15 +335,24 @@
 {
 }
 
-void GraphicsLayerCA::initialize()
+void GraphicsLayerCA::initialize(Type layerType)
 {
-    PlatformCALayer::LayerType layerType = PlatformCALayer::LayerTypeWebLayer;
-    if (client().shouldUseTiledBacking(this)) {
-        layerType = PlatformCALayer::LayerTypePageTiledBackingLayer;
+    if (layerType == Type::PageTiledBacking)
         m_isPageTiledBackingLayer = true;
-    }
 
-    m_layer = createPlatformCALayer(layerType, this);
+    PlatformCALayer::LayerType platformLayerType;
+    switch (layerType) {
+    case Type::Normal:
+        platformLayerType = PlatformCALayer::LayerType::LayerTypeWebLayer;
+        break;
+    case Type::PageTiledBacking:
+        platformLayerType = PlatformCALayer::LayerType::LayerTypePageTiledBackingLayer;
+        break;
+    case Type::Scrolling:
+        platformLayerType = PlatformCALayer::LayerType::LayerTypeScrollingLayer;
+        break;
+    }
+    m_layer = createPlatformCALayer(platformLayerType, this);
     noteLayerPropertyChanged(ContentsScaleChanged);
 }
 
@@ -1404,9 +1413,6 @@
     if (m_uncommittedChanges & CustomAppearanceChanged)
         updateCustomAppearance();
 
-    if (m_uncommittedChanges & CustomBehaviorChanged)
-        updateCustomBehavior();
-
     if (m_uncommittedChanges & ChildrenChanged) {
         updateSublayerList();
         // Sublayers may set this flag again, so clear it to avoid always updating sublayers in commitLayerChangesAfterSublayers().
@@ -1751,7 +1757,7 @@
             ASSERT(m_structuralLayer->superlayer());
             m_structuralLayer->superlayer()->replaceSublayer(*m_structuralLayer, *m_layer);
 
-            moveOrCopyAnimations(Move, m_structuralLayer.get(), m_layer.get());
+            moveAnimations(m_structuralLayer.get(), m_layer.get());
 
             // Release the structural layer.
             m_structuralLayer = nullptr;
@@ -1808,7 +1814,7 @@
         }
     }
 
-    moveOrCopyAnimations(Move, m_layer.get(), m_structuralLayer.get());
+    moveAnimations(m_layer.get(), m_structuralLayer.get());
 }
 
 GraphicsLayerCA::StructuralLayerPurpose GraphicsLayerCA::structuralLayerPurpose() const
@@ -3001,11 +3007,6 @@
     m_layer->updateCustomAppearance(m_customAppearance);
 }
 
-void GraphicsLayerCA::updateCustomBehavior()
-{
-    m_layer->updateCustomBehavior(m_customBehavior);
-}
-
 void GraphicsLayerCA::setShowDebugBorder(bool showBorder)
 {
     if (showBorder == m_showDebugBorder)
@@ -3110,15 +3111,6 @@
     noteLayerPropertyChanged(CustomAppearanceChanged);
 }
 
-void GraphicsLayerCA::setCustomBehavior(CustomBehavior customBehavior)
-{
-    if (customBehavior == m_customBehavior)
-        return;
-
-    GraphicsLayer::setCustomBehavior(customBehavior);
-    noteLayerPropertyChanged(CustomBehaviorChanged);
-}
-
 bool GraphicsLayerCA::requiresTiledLayer(float pageScaleFactor) const
 {
     if (!m_drawsContent || m_isPageTiledBackingLayer)
@@ -3188,8 +3180,7 @@
     m_layer->setName(name);
 #endif
 
-    // move over animations
-    moveOrCopyAnimations(Move, oldLayer.get(), m_layer.get());
+    moveAnimations(oldLayer.get(), m_layer.get());
     
     // need to tell new layer to draw itself
     setNeedsDisplay();
@@ -3426,7 +3417,7 @@
 
     if (cloneLevel == IntermediateCloneLevel) {
         newLayer->setOpacity(layer->opacity());
-        moveOrCopyAnimations(Copy, layer, newLayer.get());
+        copyAnimations(layer, newLayer.get());
     }
 
     setLayerDebugBorder(*newLayer, cloneLayerDebugBorderColor(isShowingDebugBorder()), cloneLayerBorderWidth);

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (179603 => 179604)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2015-02-04 17:13:59 UTC (rev 179604)
@@ -56,10 +56,10 @@
     // to keep the overall tile cost low.
     static const int kTiledLayerTileSize = 512;
 
-    WEBCORE_EXPORT explicit GraphicsLayerCA(GraphicsLayerClient&);
+    WEBCORE_EXPORT explicit GraphicsLayerCA(Type, GraphicsLayerClient&);
     WEBCORE_EXPORT virtual ~GraphicsLayerCA();
 
-    WEBCORE_EXPORT virtual void initialize() override;
+    WEBCORE_EXPORT virtual void initialize(Type) override;
 
     WEBCORE_EXPORT virtual void setName(const String&) override;
 
@@ -143,7 +143,6 @@
     WEBCORE_EXPORT virtual void setDebugBorder(const Color&, float borderWidth) override;
 
     WEBCORE_EXPORT virtual void setCustomAppearance(CustomAppearance) override;
-    WEBCORE_EXPORT virtual void setCustomBehavior(CustomBehavior) override;
 
     WEBCORE_EXPORT virtual void deviceOrPageScaleFactorChanged() override;
 
@@ -384,7 +383,6 @@
     void updateTiles();
     void updateContentsScale(float pageScaleFactor);
     void updateCustomAppearance();
-    void updateCustomBehavior();
 
     enum StructuralLayerPurpose {
         NoStructuralLayer = 0,
@@ -401,8 +399,17 @@
 
     enum MoveOrCopy { Move, Copy };
     static void moveOrCopyLayerAnimation(MoveOrCopy, const String& animationIdentifier, PlatformCALayer *fromLayer, PlatformCALayer *toLayer);
-    void moveOrCopyAnimations(MoveOrCopy, PlatformCALayer * fromLayer, PlatformCALayer * toLayer);
-    
+    void moveOrCopyAnimations(MoveOrCopy, PlatformCALayer* fromLayer, PlatformCALayer* toLayer);
+
+    void moveAnimations(PlatformCALayer* fromLayer, PlatformCALayer* toLayer)
+    {
+        moveOrCopyAnimations(Move, fromLayer, toLayer);
+    }
+    void copyAnimations(PlatformCALayer* fromLayer, PlatformCALayer* toLayer)
+    {
+        moveOrCopyAnimations(Copy, fromLayer, toLayer);
+    }
+
     bool appendToUncommittedAnimations(const KeyframeValueList&, const TransformOperations*, const Animation*, const String& animationName, const FloatSize& boxSize, int animationIndex, double timeOffset, bool isMatrixAnimation);
     bool appendToUncommittedAnimations(const KeyframeValueList&, const FilterOperation*, const Animation*, const String& animationName, int animationIndex, double timeOffset);
 
@@ -440,8 +447,7 @@
         TilesAdded =                    1LLU << 30,
         DebugIndicatorsChanged =        1LLU << 31,
         CustomAppearanceChanged =       1LLU << 32,
-        CustomBehaviorChanged =         1LLU << 33,
-        BlendModeChanged =              1LLU << 34,
+        BlendModeChanged =              1LLU << 33,
     };
     typedef uint64_t LayerChangeFlags;
     enum ScheduleFlushOrNot { ScheduleFlush, DontScheduleFlush };

Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (179603 => 179604)


--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2015-02-04 17:13:59 UTC (rev 179604)
@@ -80,6 +80,7 @@
         LayerTypeWebGLLayer,
         LayerTypeBackdropLayer,
         LayerTypeShapeLayer,
+        LayerTypeScrollingLayer,
         LayerTypeCustom
     };
     enum FilterType { Linear, Nearest, Trilinear };
@@ -213,9 +214,6 @@
     virtual GraphicsLayer::CustomAppearance customAppearance() const = 0;
     virtual void updateCustomAppearance(GraphicsLayer::CustomAppearance) = 0;
 
-    virtual GraphicsLayer::CustomBehavior customBehavior() const = 0;
-    virtual void updateCustomBehavior(GraphicsLayer::CustomBehavior) = 0;
-
     virtual TiledBacking* tiledBacking() = 0;
 
 #if PLATFORM(WIN)

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h (179603 => 179604)


--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h	2015-02-04 17:13:59 UTC (rev 179604)
@@ -145,9 +145,6 @@
     virtual GraphicsLayer::CustomAppearance customAppearance() const override { return m_customAppearance; }
     virtual void updateCustomAppearance(GraphicsLayer::CustomAppearance) override;
 
-    virtual GraphicsLayer::CustomBehavior customBehavior() const override { return m_customBehavior; }
-    virtual void updateCustomBehavior(GraphicsLayer::CustomBehavior) override;
-
     virtual TiledBacking* tiledBacking() override;
 
     virtual PassRefPtr<PlatformCALayer> clone(PlatformCALayerClient* owner) const override;
@@ -169,7 +166,6 @@
     RetainPtr<NSObject> m_delegate;
     std::unique_ptr<PlatformCALayerList> m_customSublayers;
     GraphicsLayer::CustomAppearance m_customAppearance;
-    GraphicsLayer::CustomBehavior m_customBehavior;
     std::unique_ptr<FloatRoundedRect> m_shapeRoundedRect;
 };
 

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (179603 => 179604)


--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm	2015-02-04 17:13:59 UTC (rev 179604)
@@ -205,7 +205,6 @@
 PlatformCALayerMac::PlatformCALayerMac(LayerType layerType, PlatformCALayerClient* owner)
     : PlatformCALayer(layerType, owner)
     , m_customAppearance(GraphicsLayer::NoCustomAppearance)
-    , m_customBehavior(GraphicsLayer::NoCustomBehavior)
 {
     Class layerClass = Nil;
     switch (layerType) {
@@ -213,6 +212,9 @@
     case LayerTypeRootLayer:
         layerClass = [CALayer class];
         break;
+    case LayerTypeScrollingLayer:
+        // Scrolling layers only have special behavior with PlatformCALayerRemote.
+        // fallthrough
     case LayerTypeWebLayer:
         layerClass = [WebLayer class];
         break;
@@ -262,7 +264,6 @@
 PlatformCALayerMac::PlatformCALayerMac(PlatformLayer* layer, PlatformCALayerClient* owner)
     : PlatformCALayer(layerTypeForPlatformLayer(layer), owner)
     , m_customAppearance(GraphicsLayer::NoCustomAppearance)
-    , m_customBehavior(GraphicsLayer::NoCustomBehavior)
 {
     m_layer = layer;
     commonInit();
@@ -275,7 +276,7 @@
     [m_layer setValue:[NSValue valueWithPointer:this] forKey:platformCALayerPointer];
     
     // Clear all the implicit animations on the CALayer
-    if (m_layerType == LayerTypeAVPlayerLayer || m_layerType == LayerTypeWebGLLayer || m_layerType == LayerTypeCustom)
+    if (m_layerType == LayerTypeAVPlayerLayer || m_layerType == LayerTypeWebGLLayer || m_layerType == LayerTypeScrollingLayer || m_layerType == LayerTypeCustom)
         [m_layer web_disableAllActions];
     else
         [m_layer setDelegate:[WebActionDisablingCALayerDelegate shared]];
@@ -877,19 +878,6 @@
 #endif
 }
 
-void PlatformCALayerMac::updateCustomBehavior(GraphicsLayer::CustomBehavior customBehavior)
-{
-    m_customBehavior = customBehavior;
-
-    // Custom layers can get wrapped in UIViews (which clobbers the layer delegate),
-    // so fall back to the slower way of disabling implicit animations.
-    if (m_customBehavior != GraphicsLayer::NoCustomBehavior) {
-        if ([[m_layer delegate] isKindOfClass:[WebActionDisablingCALayerDelegate class]])
-            [m_layer setDelegate:nil];
-        [m_layer web_disableAllActions];
-    }
-}
-
 TiledBacking* PlatformCALayerMac::tiledBacking()
 {
     if (!usesTiledBackingLayer())

Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp (179603 => 179604)


--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp	2015-02-04 17:13:59 UTC (rev 179604)
@@ -128,7 +128,6 @@
 PlatformCALayerWin::PlatformCALayerWin(LayerType layerType, PlatformLayer* layer, PlatformCALayerClient* owner)
     : PlatformCALayer(layer ? LayerTypeCustom : layerType, owner)
     , m_customAppearance(GraphicsLayer::NoCustomAppearance)
-    , m_customBehavior(GraphicsLayer::NoCustomBehavior)
 {
     if (layer) {
         m_layer = layer;

Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h (179603 => 179604)


--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h	2015-02-04 17:13:59 UTC (rev 179604)
@@ -133,9 +133,6 @@
     virtual GraphicsLayer::CustomAppearance customAppearance() const override { return m_customAppearance; }
     virtual void updateCustomAppearance(GraphicsLayer::CustomAppearance customAppearance) override { m_customAppearance = customAppearance; }
 
-    virtual GraphicsLayer::CustomBehavior customBehavior() const override { return m_customBehavior; }
-    virtual void updateCustomBehavior(GraphicsLayer::CustomBehavior customBehavior) override { m_customBehavior = customBehavior; }
-
     virtual TiledBacking* tiledBacking() override;
     
     virtual PlatformCALayer* rootLayer() const override;
@@ -156,7 +153,6 @@
     HashMap<String, RefPtr<PlatformCAAnimation>> m_animations;
     std::unique_ptr<PlatformCALayerList> m_customSublayers;
     GraphicsLayer::CustomAppearance m_customAppearance;
-    GraphicsLayer::CustomBehavior m_customBehavior;
 };
 
 }

Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp (179603 => 179604)


--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp	2015-02-04 17:13:59 UTC (rev 179604)
@@ -30,16 +30,16 @@
 
 namespace WebCore {
 
-std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client)
+std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient& client, Type layerType)
 {
     if (!factory)
-        return std::make_unique<GraphicsLayerTextureMapper>(client);
+        return std::make_unique<GraphicsLayerTextureMapper>(layerType, client);
 
-    return factory->createGraphicsLayer(client);
+    return factory->createGraphicsLayer(layerType, client);
 }
 
-GraphicsLayerTextureMapper::GraphicsLayerTextureMapper(GraphicsLayerClient& client)
-    : GraphicsLayer(client)
+GraphicsLayerTextureMapper::GraphicsLayerTextureMapper(Type layerType, GraphicsLayerClient& client)
+    : GraphicsLayer(layerType, client)
     , m_compositedNativeImagePtr(0)
     , m_changeMask(NoChanges)
     , m_needsDisplay(false)

Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h (179603 => 179604)


--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h	2015-02-04 17:13:59 UTC (rev 179604)
@@ -34,7 +34,7 @@
 
 class GraphicsLayerTextureMapper final : public GraphicsLayer, TextureMapperPlatformLayer::Client {
 public:
-    explicit GraphicsLayerTextureMapper(GraphicsLayerClient&);
+    explicit GraphicsLayerTextureMapper(Type, GraphicsLayerClient&);
     virtual ~GraphicsLayerTextureMapper();
 
     void setScrollClient(TextureMapperLayer::ScrollingClient* client) { m_layer.setScrollClient(client); }

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CompositingCoordinator.cpp (179603 => 179604)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CompositingCoordinator.cpp	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CompositingCoordinator.cpp	2015-02-04 17:13:59 UTC (rev 179604)
@@ -255,9 +255,9 @@
     m_client->paintLayerContents(graphicsLayer, graphicsContext, enclosingIntRect(clipRect));
 }
 
-std::unique_ptr<GraphicsLayer> CompositingCoordinator::createGraphicsLayer(GraphicsLayerClient& client)
+std::unique_ptr<GraphicsLayer> CompositingCoordinator::createGraphicsLayer(GraphicsLayer::Type layerType, GraphicsLayerClient& client)
 {
-    CoordinatedGraphicsLayer* layer = new CoordinatedGraphicsLayer(client);
+    CoordinatedGraphicsLayer* layer = new CoordinatedGraphicsLayer(layerType, client);
     layer->setCoordinator(this);
     m_registeredLayers.add(layer->id(), layer);
     m_state.layersToCreate.append(layer->id());

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CompositingCoordinator.h (179603 => 179604)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CompositingCoordinator.h	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CompositingCoordinator.h	2015-02-04 17:13:59 UTC (rev 179604)
@@ -114,7 +114,7 @@
     virtual void removeUpdateAtlas(uint32_t atlasID) override;
 
     // GraphicsLayerFactory
-    virtual std::unique_ptr<GraphicsLayer> createGraphicsLayer(GraphicsLayerClient&) override;
+    virtual std::unique_ptr<GraphicsLayer> createGraphicsLayer(GraphicsLayer::Type, GraphicsLayerClient&) override;
 
     void initializeRootCompositingLayerIfNeeded();
     void flushPendingImageBackingChanges();

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp (179603 => 179604)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp	2015-02-04 17:13:59 UTC (rev 179604)
@@ -103,8 +103,8 @@
     setShouldUpdateVisibleRect();
 }
 
-CoordinatedGraphicsLayer::CoordinatedGraphicsLayer(GraphicsLayerClient& client)
-    : GraphicsLayer(client)
+CoordinatedGraphicsLayer::CoordinatedGraphicsLayer(Type layerType, GraphicsLayerClient& client)
+    : GraphicsLayer(layerType, client)
 #ifndef NDEBUG
     , m_isPurging(false)
 #endif

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h (179603 => 179604)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h	2015-02-04 17:13:59 UTC (rev 179604)
@@ -61,7 +61,7 @@
     , public CoordinatedImageBacking::Host
     , public CoordinatedTileClient {
 public:
-    explicit CoordinatedGraphicsLayer(GraphicsLayerClient&);
+    explicit CoordinatedGraphicsLayer(Type, GraphicsLayerClient&);
     virtual ~CoordinatedGraphicsLayer();
 
     // Reimplementations from GraphicsLayer.h.

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (179603 => 179604)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2015-02-04 17:13:59 UTC (rev 179604)
@@ -105,8 +105,6 @@
     return page->scrollingCoordinator();
 }
 
-bool RenderLayerBacking::m_creatingPrimaryGraphicsLayer = false;
-
 RenderLayerBacking::RenderLayerBacking(RenderLayer& layer)
     : m_owningLayer(layer)
     , m_viewportConstrainedNodeID(0)
@@ -163,13 +161,13 @@
         compositor().layerTiledBackingUsageChanged(layer, false);
 }
 
-std::unique_ptr<GraphicsLayer> RenderLayerBacking::createGraphicsLayer(const String& name)
+std::unique_ptr<GraphicsLayer> RenderLayerBacking::createGraphicsLayer(const String& name, GraphicsLayer::Type layerType)
 {
     GraphicsLayerFactory* graphicsLayerFactory = 0;
     if (Page* page = renderer().frame().page())
         graphicsLayerFactory = page->chrome().client().graphicsLayerFactory();
 
-    std::unique_ptr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(graphicsLayerFactory, *this);
+    std::unique_ptr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(graphicsLayerFactory, *this, layerType);
 
 #ifndef NDEBUG
     graphicsLayer->setName(name);
@@ -183,11 +181,6 @@
     return graphicsLayer;
 }
 
-bool RenderLayerBacking::shouldUseTiledBacking(const GraphicsLayer*) const
-{
-    return m_usingTiledCacheLayer && m_creatingPrimaryGraphicsLayer;
-}
-
 void RenderLayerBacking::tiledBackingUsageChanged(const GraphicsLayer* layer, bool usingTiledBacking)
 {
     compositor().layerTiledBackingUsageChanged(layer, usingTiledBacking);
@@ -286,15 +279,8 @@
     layerName = m_owningLayer.name();
 #endif
     
-    // The call to createGraphicsLayer ends calling back into here as
-    // a GraphicsLayerClient to ask if it shouldUseTiledBacking(). We only want
-    // the tile cache on our main layer. This is pretty ugly, but saves us from
-    // exposing the API to all clients.
+    m_graphicsLayer = createGraphicsLayer(layerName, m_usingTiledCacheLayer ? GraphicsLayer::Type::PageTiledBacking : GraphicsLayer::Type::Normal);
 
-    m_creatingPrimaryGraphicsLayer = true;
-    m_graphicsLayer = createGraphicsLayer(layerName);
-    m_creatingPrimaryGraphicsLayer = false;
-
     if (m_usingTiledCacheLayer) {
         m_childContainmentLayer = createGraphicsLayer("TiledBacking Flattening Layer");
         m_graphicsLayer->addChild(m_childContainmentLayer.get());
@@ -1484,18 +1470,14 @@
 
     if (!m_scrollingLayer) {
         // Outer layer which corresponds with the scroll view.
-        m_scrollingLayer = createGraphicsLayer("Scrolling container");
+        m_scrollingLayer = createGraphicsLayer("Scrolling container", GraphicsLayer::Type::Scrolling);
         m_scrollingLayer->setDrawsContent(false);
         m_scrollingLayer->setMasksToBounds(true);
-#if PLATFORM(IOS)
-        m_scrollingLayer->setCustomBehavior(GraphicsLayer::CustomScrollingBehavior);
-#endif
+
         // Inner layer which renders the content that scrolls.
         m_scrollingContentsLayer = createGraphicsLayer("Scrolled Contents");
         m_scrollingContentsLayer->setDrawsContent(true);
-#if PLATFORM(IOS)
-        m_scrollingContentsLayer->setCustomBehavior(GraphicsLayer::CustomScrolledContentsBehavior);
-#endif
+
         GraphicsLayerPaintingPhase paintPhase = GraphicsLayerPaintOverflowContents | GraphicsLayerPaintCompositedScroll;
         if (!m_foregroundLayer)
             paintPhase |= GraphicsLayerPaintForeground;

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (179603 => 179604)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.h	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h	2015-02-04 17:13:59 UTC (rev 179604)
@@ -193,7 +193,6 @@
     void updateDebugIndicators(bool showBorder, bool showRepaintCounter);
 
     // GraphicsLayerClient interface
-    virtual bool shouldUseTiledBacking(const GraphicsLayer*) const override;
     virtual void tiledBackingUsageChanged(const GraphicsLayer*, bool /*usingTiledBacking*/) override;
     virtual void notifyAnimationStarted(const GraphicsLayer*, const String& animationKey, double startTime) override;
     virtual void notifyFlushRequired(const GraphicsLayer*) override;
@@ -256,7 +255,7 @@
 
     LayoutRect compositedBoundsIncludingMargin() const;
     
-    std::unique_ptr<GraphicsLayer> createGraphicsLayer(const String&);
+    std::unique_ptr<GraphicsLayer> createGraphicsLayer(const String&, GraphicsLayer::Type = GraphicsLayer::Type::Normal);
 
     RenderLayerModelObject& renderer() const { return m_owningLayer.renderer(); }
     RenderLayerCompositor& compositor() const { return m_owningLayer.compositor(); }
@@ -365,8 +364,6 @@
     bool m_canCompositeBackdropFilters;
 #endif
     bool m_backgroundLayerPaintsFixedRootBackground;
-
-    static bool m_creatingPrimaryGraphicsLayer;
 };
 
 enum CanvasCompositingStrategy {

Modified: trunk/Source/WebKit2/ChangeLog (179603 => 179604)


--- trunk/Source/WebKit2/ChangeLog	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebKit2/ChangeLog	2015-02-04 17:13:59 UTC (rev 179604)
@@ -1,3 +1,49 @@
+2015-02-04  Simon Fraser  <simon.fra...@apple.com>
+
+        [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.
+
+        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):
+
 2015-02-04  Gyuyoung Kim  <gyuyoung....@samsung.com>
 
         [EFL][WK2] Manage failing API tests

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm (179603 => 179604)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm	2015-02-04 17:13:59 UTC (rev 179604)
@@ -342,6 +342,7 @@
     case PlatformCALayer::LayerTypeWebGLLayer:
     case PlatformCALayer::LayerTypeBackdropLayer:
     case PlatformCALayer::LayerTypeShapeLayer:
+    case PlatformCALayer::LayerTypeScrollingLayer:
     case PlatformCALayer::LayerTypeCustom:
         ASSERT_NOT_REACHED();
         break;

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (179603 => 179604)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h	2015-02-04 17:13:59 UTC (rev 179604)
@@ -82,8 +82,7 @@
         FiltersChanged                  = 1LLU << 29,
         AnimationsChanged               = 1LLU << 30,
         EdgeAntialiasingMaskChanged     = 1LLU << 31,
-        CustomAppearanceChanged         = 1LLU << 32,
-        CustomBehaviorChanged           = 1LLU << 33
+        CustomAppearanceChanged         = 1LLU << 32
     };
     typedef uint64_t LayerChange;
 
@@ -149,7 +148,6 @@
         WebCore::Color borderColor;
         unsigned edgeAntialiasingMask;
         WebCore::GraphicsLayer::CustomAppearance customAppearance;
-        WebCore::GraphicsLayer::CustomBehavior customBehavior;
         WebCore::PlatformCALayer::FilterType minificationFilter;
         WebCore::PlatformCALayer::FilterType magnificationFilter;
         WebCore::BlendMode blendMode;

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (179603 => 179604)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm	2015-02-04 17:13:59 UTC (rev 179604)
@@ -93,7 +93,6 @@
     , borderColor(Color::black)
     , edgeAntialiasingMask(kCALayerLeftEdge | kCALayerRightEdge | kCALayerBottomEdge | kCALayerTopEdge)
     , customAppearance(GraphicsLayer::NoCustomAppearance)
-    , customBehavior(GraphicsLayer::NoCustomBehavior)
     , minificationFilter(PlatformCALayer::FilterType::Linear)
     , magnificationFilter(PlatformCALayer::FilterType::Linear)
     , blendMode(BlendModeNormal)
@@ -128,7 +127,6 @@
     , borderColor(other.borderColor)
     , edgeAntialiasingMask(other.edgeAntialiasingMask)
     , customAppearance(other.customAppearance)
-    , customBehavior(other.customBehavior)
     , minificationFilter(other.minificationFilter)
     , magnificationFilter(other.magnificationFilter)
     , blendMode(other.blendMode)
@@ -256,9 +254,6 @@
 
     if (changedProperties & CustomAppearanceChanged)
         encoder.encodeEnum(customAppearance);
-
-    if (changedProperties & CustomBehaviorChanged)
-        encoder.encodeEnum(customBehavior);
 }
 
 bool RemoteLayerTreeTransaction::LayerProperties::decode(IPC::ArgumentDecoder& decoder, LayerProperties& result)
@@ -454,11 +449,6 @@
             return false;
     }
 
-    if (result.changedProperties & CustomBehaviorChanged) {
-        if (!decoder.decodeEnum(result.customBehavior))
-            return false;
-    }
-
     return true;
 }
 
@@ -1185,9 +1175,6 @@
         if (layerProperties.changedProperties & RemoteLayerTreeTransaction::CustomAppearanceChanged)
             dumpProperty(ts, "customAppearance", layerProperties.customAppearance);
 
-        if (layerProperties.changedProperties & RemoteLayerTreeTransaction::CustomBehaviorChanged)
-            dumpProperty(ts, "customBehavior", layerProperties.customBehavior);
-
         ts << ")";
 
         ts.decreaseIndent();
@@ -1255,6 +1242,9 @@
             case PlatformCALayer::LayerTypeShapeLayer:
                 ts << "shape-layer";
                 break;
+            case PlatformCALayer::LayerTypeScrollingLayer:
+                ts << "scrolling-layer";
+                break;
             case PlatformCALayer::LayerTypeCustom:
                 ts << "custom-layer (context-id " << createdLayer.hostingContextID << ")";
                 break;

Modified: trunk/Source/WebKit2/UIProcess/ios/RemoteLayerTreeHostIOS.mm (179603 => 179604)


--- trunk/Source/WebKit2/UIProcess/ios/RemoteLayerTreeHostIOS.mm	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebKit2/UIProcess/ios/RemoteLayerTreeHostIOS.mm	2015-02-04 17:13:59 UTC (rev 179604)
@@ -173,13 +173,7 @@
     case PlatformCALayer::LayerTypeTiledBackingLayer:
     case PlatformCALayer::LayerTypePageTiledBackingLayer:
     case PlatformCALayer::LayerTypeTiledBackingTileLayer:
-        if (layerProperties && layerProperties->customBehavior == GraphicsLayer::CustomScrollingBehavior) {
-            if (!m_isDebugLayerTreeHost)
-                view = adoptNS([[UIScrollView alloc] init]);
-            else // The debug indicator parents views under layers, which can cause crashes with UIScrollView.
-                view = adoptNS([[UIView alloc] init]);
-        } else
-            view = adoptNS([[WKCompositingView alloc] init]);
+        view = adoptNS([[WKCompositingView alloc] init]);
         break;
     case PlatformCALayer::LayerTypeBackdropLayer:
         view = adoptNS([[WKBackdropView alloc] init]);
@@ -198,6 +192,12 @@
     case PlatformCALayer::LayerTypeShapeLayer:
         view = adoptNS([[WKShapeView alloc] init]);
         break;
+    case PlatformCALayer::LayerTypeScrollingLayer:
+        if (!m_isDebugLayerTreeHost)
+            view = adoptNS([[UIScrollView alloc] init]);
+        else // The debug indicator parents views under layers, which can cause crashes with UIScrollView.
+            view = adoptNS([[UIView alloc] init]);
+        break;
     default:
         ASSERT_NOT_REACHED();
     }

Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm (179603 => 179604)


--- trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm	2015-02-04 17:13:59 UTC (rev 179604)
@@ -222,6 +222,7 @@
     case PlatformCALayer::LayerTypeTiledBackingLayer:
     case PlatformCALayer::LayerTypePageTiledBackingLayer:
     case PlatformCALayer::LayerTypeTiledBackingTileLayer:
+    case PlatformCALayer::LayerTypeScrollingLayer:
         layer = adoptNS([[CALayer alloc] init]);
         break;
     case PlatformCALayer::LayerTypeTransformLayer:

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.h (179603 => 179604)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.h	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.h	2015-02-04 17:13:59 UTC (rev 179604)
@@ -35,8 +35,8 @@
 
 class GraphicsLayerCARemote final : public WebCore::GraphicsLayerCA {
 public:
-    GraphicsLayerCARemote(WebCore::GraphicsLayerClient& client, RemoteLayerTreeContext& context)
-        : GraphicsLayerCA(client)
+    GraphicsLayerCARemote(Type layerType, WebCore::GraphicsLayerClient& client, RemoteLayerTreeContext& context)
+        : GraphicsLayerCA(layerType, client)
         , m_context(context)
     {
     }

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (179603 => 179604)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2015-02-04 17:13:59 UTC (rev 179604)
@@ -724,17 +724,6 @@
     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::CustomAppearanceChanged);
 }
 
-GraphicsLayer::CustomBehavior PlatformCALayerRemote::customBehavior() const
-{
-    return m_properties.customBehavior;
-}
-
-void PlatformCALayerRemote::updateCustomBehavior(GraphicsLayer::CustomBehavior customBehavior)
-{
-    m_properties.customBehavior = customBehavior;
-    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::CustomBehaviorChanged);
-}
-
 PassRefPtr<PlatformCALayer> PlatformCALayerRemote::createCompatibleLayer(PlatformCALayer::LayerType layerType, PlatformCALayerClient* client) const
 {
     return PlatformCALayerRemote::create(layerType, client, *m_context);

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h (179603 => 179604)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h	2015-02-04 17:13:59 UTC (rev 179604)
@@ -150,9 +150,6 @@
     virtual WebCore::GraphicsLayer::CustomAppearance customAppearance() const override;
     virtual void updateCustomAppearance(WebCore::GraphicsLayer::CustomAppearance) override;
 
-    virtual WebCore::GraphicsLayer::CustomBehavior customBehavior() const override;
-    virtual void updateCustomBehavior(WebCore::GraphicsLayer::CustomBehavior) override;
-
     virtual WebCore::TiledBacking* tiledBacking() override { return nullptr; }
 
     virtual PassRefPtr<WebCore::PlatformCALayer> clone(WebCore::PlatformCALayerClient* owner) const override;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h (179603 => 179604)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h	2015-02-04 17:13:59 UTC (rev 179604)
@@ -73,7 +73,7 @@
 
 private:
     // WebCore::GraphicsLayerFactory
-    virtual std::unique_ptr<WebCore::GraphicsLayer> createGraphicsLayer(WebCore::GraphicsLayerClient&) override;
+    virtual std::unique_ptr<WebCore::GraphicsLayer> createGraphicsLayer(WebCore::GraphicsLayer::Type, WebCore::GraphicsLayerClient&) override;
 
     WebPage& m_webPage;
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm (179603 => 179604)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm	2015-02-04 17:03:58 UTC (rev 179603)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm	2015-02-04 17:13:59 UTC (rev 179604)
@@ -98,9 +98,9 @@
     m_backingStoreCollection.backingStoreWillBeDisplayed(backingStore);
 }
 
-std::unique_ptr<GraphicsLayer> RemoteLayerTreeContext::createGraphicsLayer(GraphicsLayerClient& client)
+std::unique_ptr<GraphicsLayer> RemoteLayerTreeContext::createGraphicsLayer(WebCore::GraphicsLayer::Type layerType, GraphicsLayerClient& client)
 {
-    return std::make_unique<GraphicsLayerCARemote>(client, *this);
+    return std::make_unique<GraphicsLayerCARemote>(layerType, client, *this);
 }
 
 void RemoteLayerTreeContext::buildTransaction(RemoteLayerTreeTransaction& transaction, PlatformCALayer& rootLayer)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to