[iOS] Acclerated overflow-scrolling broken in WK1
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 May 2014 21:49:10 +0000 (21:49 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 May 2014 21:49:10 +0000 (21:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=132665
<rdar://problem/16842909>

Reviewed by Tim Horton.

r168301 added a CALayer delegate to disable implicit animations,
but for some layers we wrap them in UIViews (which are themselves
layer delegates), so bad things happened.

Fix by falling back to setting the null actions dictionary for
layers with custom scrolling behavior.

* platform/graphics/GraphicsLayer.h:
* platform/graphics/ca/mac/PlatformCALayerMac.h:
* platform/graphics/ca/mac/PlatformCALayerMac.mm:
(PlatformCALayerMac::updateCustomBehavior):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateScrollingLayers):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@168440 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/GraphicsLayer.h
Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h
Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm
Source/WebCore/rendering/RenderLayerBacking.cpp

index 4d09be7..ab3458a 100644 (file)
@@ -1,3 +1,25 @@
+2014-05-07  Simon Fraser  <simon.fraser@apple.com>
+
+        [iOS] Acclerated overflow-scrolling broken in WK1
+        https://bugs.webkit.org/show_bug.cgi?id=132665
+        <rdar://problem/16842909>
+
+        Reviewed by Tim Horton.
+
+        r168301 added a CALayer delegate to disable implicit animations,
+        but for some layers we wrap them in UIViews (which are themselves
+        layer delegates), so bad things happened.
+        
+        Fix by falling back to setting the null actions dictionary for
+        layers with custom scrolling behavior.
+
+        * platform/graphics/GraphicsLayer.h:
+        * platform/graphics/ca/mac/PlatformCALayerMac.h:
+        * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+        (PlatformCALayerMac::updateCustomBehavior):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateScrollingLayers):
+
 2014-05-07  Jeremy Jones  <jeremyj@apple.com>
 
         HTMLMediaElement should exitFullscreen when view is removed from the window.
index 2c0f01f..3075cd1 100644 (file)
@@ -446,7 +446,7 @@ public:
     virtual void setCustomAppearance(CustomAppearance customAppearance) { m_customAppearance = customAppearance; }
     CustomAppearance customAppearance() const { return m_customAppearance; }
 
-    enum CustomBehavior { NoCustomBehavior, CustomScrollingBehavior };
+    enum CustomBehavior { NoCustomBehavior, CustomScrollingBehavior, CustomScrolledContentsBehavior };
     virtual void setCustomBehavior(CustomBehavior customBehavior) { m_customBehavior = customBehavior; }
     CustomBehavior customBehavior() const { return m_customBehavior; }
 
index dfb0f4b..ba7f3f7 100644 (file)
@@ -141,7 +141,7 @@ public:
     virtual void updateCustomAppearance(GraphicsLayer::CustomAppearance) override;
 
     virtual GraphicsLayer::CustomBehavior customBehavior() const override { return m_customBehavior; }
-    virtual void updateCustomBehavior(GraphicsLayer::CustomBehavior customBehavior) override { m_customBehavior = customBehavior; }
+    virtual void updateCustomBehavior(GraphicsLayer::CustomBehavior) override;
 
     virtual TiledBacking* tiledBacking() override;
 
index bf0eae1..40580d9 100644 (file)
@@ -764,6 +764,19 @@ void PlatformCALayerMac::updateCustomAppearance(GraphicsLayer::CustomAppearance
 #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())
index b3b04cb..acc1016 100644 (file)
@@ -1427,6 +1427,9 @@ bool RenderLayerBacking::updateScrollingLayers(bool needsScrollingLayers)
         // 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;