Title: [166308] trunk/Source
Revision
166308
Author
simon.fra...@apple.com
Date
2014-03-26 12:36:49 -0700 (Wed, 26 Mar 2014)

Log Message

Add a custom behavior flag to GraphicsLayer, piped down to PlatformCALayer, for scrolling layers
https://bugs.webkit.org/show_bug.cgi?id=130778

Reviewed by Tim Horton.

Make it possible to put a "custom behavior" flag on a layer so that,
with UI-side compositing, we know to create a specific type of
layer or view for that GraphicsLayer.

Source/WebCore:

* WebCore.exp.in:
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::GraphicsLayer):
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::setCustomBehavior):
(WebCore::GraphicsLayer::customBehavior):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
(WebCore::GraphicsLayerCA::updateCustomBehavior):
(WebCore::GraphicsLayerCA::setCustomBehavior):
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/mac/PlatformCALayerMac.h:
* platform/graphics/ca/mac/PlatformCALayerMac.mm:
(PlatformCALayerMac::PlatformCALayerMac):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateScrollingLayers):

Source/WebKit2:

* Shared/mac/RemoteLayerTreeTransaction.h:
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
(WebKit::dumpChangedLayers):
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(PlatformCALayerRemote::customBehavior):
(PlatformCALayerRemote::updateCustomBehavior):
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (166307 => 166308)


--- trunk/Source/WebCore/ChangeLog	2014-03-26 19:21:49 UTC (rev 166307)
+++ trunk/Source/WebCore/ChangeLog	2014-03-26 19:36:49 UTC (rev 166308)
@@ -1,3 +1,32 @@
+2014-03-26  Simon Fraser  <simon.fra...@apple.com>
+
+        Add a custom behavior flag to GraphicsLayer, piped down to PlatformCALayer, for scrolling layers
+        https://bugs.webkit.org/show_bug.cgi?id=130778
+
+        Reviewed by Tim Horton.
+
+        Make it possible to put a "custom behavior" flag on a layer so that,
+        with UI-side compositing, we know to create a specific type of
+        layer or view for that GraphicsLayer.
+
+        * WebCore.exp.in:
+        * platform/graphics/GraphicsLayer.cpp:
+        (WebCore::GraphicsLayer::GraphicsLayer):
+        * platform/graphics/GraphicsLayer.h:
+        (WebCore::GraphicsLayer::setCustomBehavior):
+        (WebCore::GraphicsLayer::customBehavior):
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
+        (WebCore::GraphicsLayerCA::updateCustomBehavior):
+        (WebCore::GraphicsLayerCA::setCustomBehavior):
+        * platform/graphics/ca/GraphicsLayerCA.h:
+        * platform/graphics/ca/PlatformCALayer.h:
+        * platform/graphics/ca/mac/PlatformCALayerMac.h:
+        * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+        (PlatformCALayerMac::PlatformCALayerMac):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateScrollingLayers):
+
 2014-03-26  Brent Fulgham  <bfulg...@apple.com>
 
         Unreviewed test correction.

Modified: trunk/Source/WebCore/WebCore.exp.in (166307 => 166308)


--- trunk/Source/WebCore/WebCore.exp.in	2014-03-26 19:21:49 UTC (rev 166307)
+++ trunk/Source/WebCore/WebCore.exp.in	2014-03-26 19:36:49 UTC (rev 166308)
@@ -545,6 +545,7 @@
 __ZN7WebCore15GraphicsLayerCA16resumeAnimationsEv
 __ZN7WebCore15GraphicsLayerCA16setMasksToBoundsEb
 __ZN7WebCore15GraphicsLayerCA17setContentsOpaqueEb
+__ZN7WebCore15GraphicsLayerCA17setCustomBehaviorENS_13GraphicsLayer14CustomBehaviorE
 __ZN7WebCore15GraphicsLayerCA17suspendAnimationsEd
 __ZN7WebCore15GraphicsLayerCA18setAllowTiledLayerEb
 __ZN7WebCore15GraphicsLayerCA18setBackgroundColorERKNS_5ColorE

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (166307 => 166308)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2014-03-26 19:21:49 UTC (rev 166307)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2014-03-26 19:36:49 UTC (rev 166308)
@@ -99,6 +99,7 @@
     , m_replicatedLayer(0)
     , m_repaintCount(0)
     , m_customAppearance(NoCustomAppearance)
+    , m_customBehavior(NoCustomBehavior)
 {
 #ifndef NDEBUG
     if (m_client)

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (166307 => 166308)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2014-03-26 19:21:49 UTC (rev 166307)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2014-03-26 19:36:49 UTC (rev 166308)
@@ -443,6 +443,10 @@
     virtual void setCustomAppearance(CustomAppearance customAppearance) { m_customAppearance = customAppearance; }
     CustomAppearance customAppearance() const { return m_customAppearance; }
 
+    enum CustomBehavior { NoCustomBehavior, CustomScrollingBehavior };
+    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; }
     virtual void setZPosition(float);
@@ -611,6 +615,7 @@
 
     int m_repaintCount;
     CustomAppearance m_customAppearance;
+    CustomBehavior m_customBehavior;
 };
 
 #define GRAPHICSLAYER_TYPE_CASTS(ToValueTypeName, predicate) \

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


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2014-03-26 19:21:49 UTC (rev 166307)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2014-03-26 19:36:49 UTC (rev 166308)
@@ -1409,6 +1409,9 @@
     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().
@@ -2952,6 +2955,11 @@
     m_layer->updateCustomAppearance(m_customAppearance);
 }
 
+void GraphicsLayerCA::updateCustomBehavior()
+{
+    m_layer->updateCustomBehavior(m_customBehavior);
+}
+
 void GraphicsLayerCA::setShowDebugBorder(bool showBorder)
 {
     if (showBorder == m_showDebugBorder)
@@ -3053,6 +3061,15 @@
     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_allowTiledLayer || m_isPageTiledBackingLayer)

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


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2014-03-26 19:21:49 UTC (rev 166307)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2014-03-26 19:36:49 UTC (rev 166308)
@@ -138,6 +138,7 @@
     virtual void setDebugBorder(const Color&, float borderWidth);
 
     virtual void setCustomAppearance(CustomAppearance);
+    virtual void setCustomBehavior(CustomBehavior);
 
     virtual void layerDidDisplay(PlatformLayer*);
 
@@ -389,7 +390,8 @@
     void updateTiles();
     void updateContentsScale(float pageScaleFactor);
     void updateCustomAppearance();
-    
+    void updateCustomBehavior();
+
     enum StructuralLayerPurpose {
         NoStructuralLayer = 0,
         StructuralLayerForPreserves3D,
@@ -447,9 +449,10 @@
         TilesAdded = 1 < 29,
         DebugIndicatorsChanged = 1 << 30,
         CustomAppearanceChanged = 1 << 31,
-        BlendModeChanged        = 1 << 32
+        CustomBehaviorChanged = 1 << 32,
+        BlendModeChanged = 1 << 33
     };
-    typedef unsigned LayerChangeFlags;
+    typedef uint64_t LayerChangeFlags;
     enum ScheduleFlushOrNot { ScheduleFlush, DontScheduleFlush };
     void noteLayerPropertyChanged(LayerChangeFlags, ScheduleFlushOrNot = ScheduleFlush);
     void noteSublayersChanged(ScheduleFlushOrNot = ScheduleFlush);

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


--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2014-03-26 19:21:49 UTC (rev 166307)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2014-03-26 19:36:49 UTC (rev 166308)
@@ -197,6 +197,9 @@
     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 (166307 => 166308)


--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h	2014-03-26 19:21:49 UTC (rev 166307)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h	2014-03-26 19:36:49 UTC (rev 166308)
@@ -136,6 +136,9 @@
     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;
@@ -157,6 +160,7 @@
     RetainPtr<NSObject> m_delegate;
     OwnPtr<PlatformCALayerList> m_customSublayers;
     GraphicsLayer::CustomAppearance m_customAppearance;
+    GraphicsLayer::CustomBehavior m_customBehavior;
 };
 
 PLATFORM_CALAYER_TYPE_CASTS(PlatformCALayerMac, isPlatformCALayerMac())

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


--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm	2014-03-26 19:21:49 UTC (rev 166307)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm	2014-03-26 19:36:49 UTC (rev 166308)
@@ -165,6 +165,7 @@
 PlatformCALayerMac::PlatformCALayerMac(LayerType layerType, PlatformCALayerClient* owner)
     : PlatformCALayer(layerType, owner)
     , m_customAppearance(GraphicsLayer::NoCustomAppearance)
+    , m_customBehavior(GraphicsLayer::NoCustomBehavior)
 {
     Class layerClass = Nil;
     switch (layerType) {
@@ -205,6 +206,7 @@
 PlatformCALayerMac::PlatformCALayerMac(PlatformLayer* layer, PlatformCALayerClient* owner)
     : PlatformCALayer([layer isKindOfClass:getAVPlayerLayerClass()] ? LayerTypeAVPlayerLayer : LayerTypeCustom, owner)
     , m_customAppearance(GraphicsLayer::NoCustomAppearance)
+    , m_customBehavior(GraphicsLayer::NoCustomBehavior)
 {
     m_layer = layer;
     commonInit();

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (166307 => 166308)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2014-03-26 19:21:49 UTC (rev 166307)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2014-03-26 19:36:49 UTC (rev 166308)
@@ -1431,7 +1431,9 @@
         m_scrollingLayer = createGraphicsLayer("Scrolling container");
         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);

Modified: trunk/Source/WebKit2/ChangeLog (166307 => 166308)


--- trunk/Source/WebKit2/ChangeLog	2014-03-26 19:21:49 UTC (rev 166307)
+++ trunk/Source/WebKit2/ChangeLog	2014-03-26 19:36:49 UTC (rev 166308)
@@ -1,3 +1,25 @@
+2014-03-26  Simon Fraser  <simon.fra...@apple.com>
+
+        Add a custom behavior flag to GraphicsLayer, piped down to PlatformCALayer, for scrolling layers
+        https://bugs.webkit.org/show_bug.cgi?id=130778
+
+        Reviewed by Tim Horton.
+
+        Make it possible to put a "custom behavior" flag on a layer so that,
+        with UI-side compositing, we know to create a specific type of
+        layer or view for that GraphicsLayer.
+
+        * Shared/mac/RemoteLayerTreeTransaction.h:
+        * Shared/mac/RemoteLayerTreeTransaction.mm:
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
+        (WebKit::dumpChangedLayers):
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+        (PlatformCALayerRemote::customBehavior):
+        (PlatformCALayerRemote::updateCustomBehavior):
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+
 2014-03-26  Zoltan Horvath  <zol...@webkit.org>
 
         [CSS Shapes] Remove shape-inside support

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (166307 => 166308)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h	2014-03-26 19:21:49 UTC (rev 166307)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h	2014-03-26 19:36:49 UTC (rev 166308)
@@ -75,7 +75,8 @@
         BackingStoreChanged = 1 << 24,
         FiltersChanged = 1 << 25,
         EdgeAntialiasingMaskChanged = 1 << 26,
-        CustomAppearanceChanged = 1 << 27
+        CustomAppearanceChanged = 1 << 27,
+        CustomBehaviorChanged = 1 << 28
     };
     typedef unsigned LayerChange;
 
@@ -127,6 +128,7 @@
         WebCore::Color borderColor;
         unsigned edgeAntialiasingMask;
         WebCore::GraphicsLayer::CustomAppearance customAppearance;
+        WebCore::GraphicsLayer::CustomBehavior customBehavior;
         WebCore::PlatformCALayer::FilterType minificationFilter;
         WebCore::PlatformCALayer::FilterType magnificationFilter;
         bool hidden;

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (166307 => 166308)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm	2014-03-26 19:21:49 UTC (rev 166307)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm	2014-03-26 19:36:49 UTC (rev 166308)
@@ -87,6 +87,7 @@
     , borderColor(Color::black)
     , edgeAntialiasingMask(kCALayerLeftEdge | kCALayerRightEdge | kCALayerBottomEdge | kCALayerTopEdge)
     , customAppearance(GraphicsLayer::NoCustomAppearance)
+    , customBehavior(GraphicsLayer::NoCustomBehavior)
     , minificationFilter(PlatformCALayer::FilterType::Linear)
     , magnificationFilter(PlatformCALayer::FilterType::Linear)
     , hidden(false)
@@ -116,6 +117,7 @@
     , borderColor(other.borderColor)
     , edgeAntialiasingMask(other.edgeAntialiasingMask)
     , customAppearance(other.customAppearance)
+    , customBehavior(other.customBehavior)
     , minificationFilter(other.minificationFilter)
     , magnificationFilter(other.magnificationFilter)
     , hidden(other.hidden)
@@ -224,6 +226,9 @@
 
     if (changedProperties & CustomAppearanceChanged)
         encoder.encodeEnum(customAppearance);
+
+    if (changedProperties & CustomBehaviorChanged)
+        encoder.encodeEnum(customBehavior);
 }
 
 bool RemoteLayerTreeTransaction::LayerProperties::decode(IPC::ArgumentDecoder& decoder, LayerProperties& result)
@@ -387,6 +392,11 @@
             return false;
     }
 
+    if (result.changedProperties & CustomBehaviorChanged) {
+        if (!decoder.decodeEnum(result.customBehavior))
+            return false;
+    }
+
     return true;
 }
 
@@ -805,6 +815,9 @@
         if (layerProperties.changedProperties & RemoteLayerTreeTransaction::CustomAppearanceChanged)
             dumpProperty<GraphicsLayer::CustomAppearance>(ts, "customAppearance", layerProperties.customAppearance);
 
+        if (layerProperties.changedProperties & RemoteLayerTreeTransaction::CustomBehaviorChanged)
+            dumpProperty<GraphicsLayer::CustomBehavior>(ts, "customBehavior", layerProperties.customBehavior);
+
         ts << ")";
 
         ts.decreaseIndent();

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


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2014-03-26 19:21:49 UTC (rev 166307)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2014-03-26 19:36:49 UTC (rev 166308)
@@ -563,6 +563,17 @@
     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 (166307 => 166308)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h	2014-03-26 19:21:49 UTC (rev 166307)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h	2014-03-26 19:36:49 UTC (rev 166308)
@@ -138,6 +138,9 @@
     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;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to