Add a PlatformCALayer subclass that proxies its property changes across the process...
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Oct 2013 00:20:32 +0000 (00:20 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Oct 2013 00:20:32 +0000 (00:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=122773

Reviewed by Anders Carlsson.

PlatformCALayerRemote coordinates with RemoteLayerTreeDrawingArea and friends
to enable cross-process proxying of the hierarchy of compositing layers.

In the Web process, we have GraphicsLayerCARemote, which owns 1+ PlatformCALayerRemote(s).
Unlike PlatformCALayer{Mac, Win}, which own PlatformLayers (CALayer/CACFLayer),
PlatformCALayerRemote stores any changes to its properties in a struct, and keeps track of
which properties have changed since the last commit. Commits are scheduled and performed by
RemoteLayerTreeContext, on RemoteLayerTreeDrawingArea's behalf, and result in
RemoteLayerTreeTransaction encoding said property changes and throwing them across
to the UI process, where RemoteLayerTreeHost applies them to a tree of CALayers kept there.

This code can be enabled by running with the WK_USE_REMOTE_LAYER_TREE_DRAWING_AREA
environment variable set.

No new tests, the new drawing area is not yet testable.

* Shared/WebCoreArgumentCoders.cpp:
(CoreIPC::decode):
(CoreIPC::encode):
* Shared/WebCoreArgumentCoders.h:
Add argument coders for FloatPoint3D.

* Shared/mac/RemoteLayerTreeTransaction.h:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::notePropertiesChanged):
(WebKit::RemoteLayerTreeTransaction::changedLayers):
(WebKit::RemoteLayerTreeTransaction::destroyedLayers):
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
(WebKit::RemoteLayerTreeTransaction::decode):
(WebKit::dumpChangedLayers):
Add support for background color and anchor point in the layer transaction.
Make layer position a 3D point because that's what it really is.

(WebKit::RemoteLayerTreeTransaction::layerPropertiesChanged):
The logic in layerPropertiesChanged is moved into PlatformCALayerRemote.

* UIProcess/WebPageProxy.h:
Include PlatformLayer.h; it seems annoying to successfully forward-declare
PlatformLayer because of the difference in definition between Objective-C and C++.
Drive-by un-indent some namespace contents and use OBJC_CLASS.

* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
(WebKit::RemoteLayerTreeDrawingAreaProxy::sizeDidChange):
(WebKit::RemoteLayerTreeDrawingAreaProxy::didUpdateGeometry):
(WebKit::RemoteLayerTreeDrawingAreaProxy::sendUpdateGeometry):
Send geometry updates to the RemoteLayerTreeDrawingArea.

* UIProcess/mac/RemoteLayerTreeHost.h:
* UIProcess/mac/RemoteLayerTreeHost.mm:
(nullActionsDictionary):
(WebKit::RemoteLayerTreeHost::commit):
Apply layer property changes to the named sublayer.

(WebKit::RemoteLayerTreeHost::getOrCreateLayer):
Create CALayers instead of GraphicsLayers.
Ensure that they won't perform implicit animations.

* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::setAcceleratedCompositingRootLayer):
This should take a PlatformLayer instead of a GraphicsLayer, since we don't have
GraphicsLayers in the UIProcess.

* WebKit2.xcodeproj/project.pbxproj:
Add GraphicsLayerCARemote and PlatformCALayerRemote, remove RemoteGraphicsLayer.

* WebProcess/WebPage/mac/RemoteGraphicsLayer.h: Removed.
* WebProcess/WebPage/mac/RemoteGraphicsLayer.mm: Removed.

* WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
* WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
(WebKit::RemoteLayerTreeContext::RemoteLayerTreeContext):
(WebKit::RemoteLayerTreeContext::setRootLayer):
(WebKit::RemoteLayerTreeContext::layerWillBeDestroyed):
(WebKit::RemoteLayerTreeContext::createGraphicsLayer):
(WebKit::RemoteLayerTreeContext::flushLayers):
Build our transaction while flushing; it has no reason to exist outside of that scope.

* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
(WebKit::RemoteLayerTreeDrawingArea::graphicsLayerFactory):
(WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer):
(WebKit::RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlush):
(WebKit::RemoteLayerTreeDrawingArea::updateGeometry):
Fix a capitalization typo.
Update the WebPage's (and thus WebCore's) size when updateGeometry() is called.

* WebProcess/WebPage/mac/GraphicsLayerCARemote.cpp: Added.
(WebKit::GraphicsLayerCARemote::~GraphicsLayerCARemote):
(WebKit::GraphicsLayerCARemote::filtersCanBeComposited):
(WebKit::GraphicsLayerCARemote::createPlatformCALayer):
Added. Delegate to PlatformCALayerRemote. Don't allow creation of a
GraphicsLayerCARemote given a PlatformLayer, because with UI process compositing,
there should be no PlatformLayer instances in the Web process.

* WebProcess/WebPage/mac/GraphicsLayerCARemote.h: Added.
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp: Added.
(generateLayerID):
Generate a layer ID for identification across processes.

(PlatformCALayerRemote::~PlatformCALayerRemote):
Inform the RemoteLayerTreeContext that we've been destroyed, so it can convey
that information to the UI process and the corresponding CALayer can be destroyed.

(PlatformCALayerRemote::recursiveBuildTransaction):
Recursively accumulate changes in layer state on a RemoteLayerTreeTransaction.

The rest of this file is mostly an empty implementation of PlatformCALayer.
A few properties are implemented so far; see below.

(PlatformCALayerRemote::setSublayers):
(PlatformCALayerRemote::removeAllSublayers):
(PlatformCALayerRemote::appendSublayer):
(PlatformCALayerRemote::insertSublayer):
Update our list of sublayers, and note that our children have changed.
recursiveBuildTransaction() will walk our sublayers and record their IDs in the transaction.

(PlatformCALayerRemote::bounds):
(PlatformCALayerRemote::setBounds):
(PlatformCALayerRemote::position):
(PlatformCALayerRemote::setPosition):
(PlatformCALayerRemote::anchorPoint):
(PlatformCALayerRemote::setAnchorPoint):
(PlatformCALayerRemote::backgroundColor):
(PlatformCALayerRemote::setBackgroundColor):
Trivial implementations of basic layer properties, storing the new state in
our LayerProperties struct and noting that they changed in the current commit.
Properties with getters will return the last value that was set on the LayerProperties,
so we don't clear the whole struct at the end of the transaction, just the mask of changed properties.

* WebProcess/WebPage/mac/PlatformCALayerRemote.h: Added.

* WebCore.exp.in:
Export lots of GraphicsLayerCA stuff so we can inherit from it in WebKit2.

* WebCore.xcodeproj/project.pbxproj:
Make PlatformCAFilters.h a private header.

* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::initialize):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayer::create):
(WebCore::GraphicsLayerCA::GraphicsLayerCA):
(WebCore::GraphicsLayerCA::initialize):
* platform/graphics/ca/GraphicsLayerCA.h:
Defer creation of the main PlatformCALayer until just after the constructor is finished
so that GraphicsLayerCA subclasses can successfully override createPlatformCALayer.

* platform/graphics/ca/PlatformCALayer.h:
(WebCore::PlatformCALayer::platformLayer):
Make platformLayer virtual so that subclasses which don't have PlatformLayers can override.

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

29 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/graphics/GraphicsLayer.h
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
Source/WebCore/platform/graphics/ca/PlatformCALayer.h
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebCoreArgumentCoders.cpp
Source/WebKit2/Shared/WebCoreArgumentCoders.h
Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h
Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h
Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm
Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.h
Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm
Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.h [new file with mode: 0644]
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h [new file with mode: 0644]
Source/WebKit2/WebProcess/WebPage/mac/RemoteGraphicsLayer.h [deleted file]
Source/WebKit2/WebProcess/WebPage/mac/RemoteGraphicsLayer.mm [deleted file]
Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h
Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm
Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h
Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm

index 1bd9279..dbf4e98 100644 (file)
@@ -1,3 +1,32 @@
+2013-10-15  Tim Horton  <timothy_horton@apple.com>
+
+        Add a PlatformCALayer subclass that proxies its property changes across the process boundary
+        https://bugs.webkit.org/show_bug.cgi?id=122773
+
+        Reviewed by Anders Carlsson.
+
+        No new tests, the new drawing area is not yet testable.
+
+        * WebCore.exp.in:
+        Export lots of GraphicsLayerCA stuff so we can inherit from it in WebKit2.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        Make PlatformCAFilters.h a private header.
+
+        * platform/graphics/GraphicsLayer.h:
+        (WebCore::GraphicsLayer::initialize):
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayer::create):
+        (WebCore::GraphicsLayerCA::GraphicsLayerCA):
+        (WebCore::GraphicsLayerCA::initialize):
+        * platform/graphics/ca/GraphicsLayerCA.h:
+        Defer creation of the main PlatformCALayer until just after the constructor is finished
+        so that GraphicsLayerCA subclasses can successfully override createPlatformCALayer.
+
+        * platform/graphics/ca/PlatformCALayer.h:
+        (WebCore::PlatformCALayer::platformLayer):
+        Make platformLayer virtual so that subclasses which don't have PlatformLayers can override.
+
 2013-10-14  Ryosuke Niwa  <rniwa@webkit.org>
 
         REGRESSION: Crash in XMLDocumentParser::startElementNs
index f2abc49..275ffdd 100644 (file)
@@ -482,6 +482,67 @@ __ZN7WebCore15GraphicsContext9drawImageEPNS_5ImageENS_10ColorSpaceERKNS_8IntPoin
 __ZN7WebCore15GraphicsContext9setShadowERKNS_9FloatSizeEfRKNS_5ColorENS_10ColorSpaceE
 __ZN7WebCore15GraphicsContext9translateEff
 __ZN7WebCore15GraphicsContextD1Ev
+__ZN7WebCore15GraphicsLayerCAC2EPNS_19GraphicsLayerClientE
+__ZN7WebCore15GraphicsLayerCAD2Ev
+__ZN7WebCore15GraphicsLayerCA10initializeEv
+__ZN7WebCore15GraphicsLayerCA10setFiltersERKNS_16FilterOperationsE
+__ZN7WebCore15GraphicsLayerCA10setOpacityEf
+__ZN7WebCore15GraphicsLayerCA11setChildrenERKN3WTF6VectorIPNS_13GraphicsLayerELm0ENS1_15CrashOnOverflowEEE
+__ZN7WebCore15GraphicsLayerCA11setPositionERKNS_10FloatPointE
+__ZN7WebCore15GraphicsLayerCA12addAnimationERKNS_17KeyframeValueListERKNS_7IntSizeEPKNS_9AnimationERKN3WTF6StringEd
+__ZN7WebCore15GraphicsLayerCA12replaceChildEPNS_13GraphicsLayerES2_
+__ZN7WebCore15GraphicsLayerCA12setMaskLayerEPNS_13GraphicsLayerE
+__ZN7WebCore15GraphicsLayerCA12setTransformERKNS_20TransformationMatrixE
+__ZN7WebCore15GraphicsLayerCA13addChildAboveEPNS_13GraphicsLayerES2_
+__ZN7WebCore15GraphicsLayerCA13addChildBelowEPNS_13GraphicsLayerES2_
+__ZN7WebCore15GraphicsLayerCA14pauseAnimationERKN3WTF6StringEd
+__ZN7WebCore15GraphicsLayerCA14setAnchorPointERKNS_12FloatPoint3DE
+__ZN7WebCore15GraphicsLayerCA14setDebugBorderERKNS_5ColorEf
+__ZN7WebCore15GraphicsLayerCA14setPreserves3DEb
+__ZN7WebCore15GraphicsLayerCA15addChildAtIndexEPNS_13GraphicsLayerEi
+__ZN7WebCore15GraphicsLayerCA15layerDidDisplayEP7CALayer
+__ZN7WebCore15GraphicsLayerCA15removeAnimationERKN3WTF6StringE
+__ZN7WebCore15GraphicsLayerCA15setBoundsOriginERKNS_10FloatPointE
+__ZN7WebCore15GraphicsLayerCA15setContentsRectERKNS_7IntRectE
+__ZN7WebCore15GraphicsLayerCA15setDrawsContentEb
+__ZN7WebCore15GraphicsLayerCA15setNeedsDisplayEv
+__ZN7WebCore15GraphicsLayerCA15willBeDestroyedEv
+__ZN7WebCore15GraphicsLayerCA16removeFromParentEv
+__ZN7WebCore15GraphicsLayerCA16resumeAnimationsEv
+__ZN7WebCore15GraphicsLayerCA16setMasksToBoundsEb
+__ZN7WebCore15GraphicsLayerCA17setContentsOpaqueEb
+__ZN7WebCore15GraphicsLayerCA17suspendAnimationsEd
+__ZN7WebCore15GraphicsLayerCA18setAllowTiledLayerEb
+__ZN7WebCore15GraphicsLayerCA18setBackgroundColorERKNS_5ColorE
+__ZN7WebCore15GraphicsLayerCA18setContentsToImageEPNS_5ImageE
+__ZN7WebCore15GraphicsLayerCA18setContentsToMediaEP7CALayer
+__ZN7WebCore15GraphicsLayerCA18setContentsVisibleEb
+__ZN7WebCore15GraphicsLayerCA18setOpacityInternalEf
+__ZN7WebCore15GraphicsLayerCA18setReplicatedLayerEPNS_13GraphicsLayerE
+__ZN7WebCore15GraphicsLayerCA18setShowDebugBorderEb
+__ZN7WebCore15GraphicsLayerCA19setContentsToCanvasEP7CALayer
+__ZN7WebCore15GraphicsLayerCA20setChildrenTransformERKNS_20TransformationMatrixE
+__ZN7WebCore15GraphicsLayerCA20setReplicatedByLayerEPNS_13GraphicsLayerE
+__ZN7WebCore15GraphicsLayerCA21flushCompositingStateERKNS_9FloatRectE
+__ZN7WebCore15GraphicsLayerCA21setAcceleratesDrawingEb
+__ZN7WebCore15GraphicsLayerCA21setBackfaceVisibilityEb
+__ZN7WebCore15GraphicsLayerCA21setNeedsDisplayInRectERKNS_9FloatRectE
+__ZN7WebCore15GraphicsLayerCA21setShowRepaintCounterEb
+__ZN7WebCore15GraphicsLayerCA23setContentsClippingRectERKNS_7IntRectE
+__ZN7WebCore15GraphicsLayerCA23setContentsNeedsDisplayEv
+__ZN7WebCore15GraphicsLayerCA23setContentsToSolidColorERKNS_5ColorE
+__ZN7WebCore15GraphicsLayerCA23setDebugBackgroundColorERKNS_5ColorE
+__ZN7WebCore15GraphicsLayerCA26setMaintainsPixelAlignmentEb
+__ZN7WebCore15GraphicsLayerCA28platformCALayerPaintContentsERNS_15GraphicsContextERKNS_7IntRectE
+__ZN7WebCore15GraphicsLayerCA30deviceOrPageScaleFactorChangedEv
+__ZN7WebCore15GraphicsLayerCA31platformCALayerAnimationStartedEd
+__ZN7WebCore15GraphicsLayerCA32platformCALayerDeviceScaleFactorEv
+__ZN7WebCore15GraphicsLayerCA37flushCompositingStateForThisLayerOnlyEv
+__ZN7WebCore15GraphicsLayerCA40platformCALayerSetNeedsToRevalidateTilesEv
+__ZN7WebCore15GraphicsLayerCA7setNameERKN3WTF6StringE
+__ZN7WebCore15GraphicsLayerCA7setSizeERKNS_9FloatSizeE
+__ZN7WebCore15GraphicsLayerCA8addChildEPNS_13GraphicsLayerE
+__ZN7WebCore15PlatformCALayerD2Ev
 __ZN7WebCore15HitTestLocation12rectForPointERKNS_11LayoutPointEjjjj
 __ZN7WebCore15JSDOMWindowBase8commonVMEv
 __ZN7WebCore15PasteboardImageC1Ev
@@ -1466,6 +1527,21 @@ __ZNK7WebCore15FocusController18focusedOrMainFrameEv
 __ZNK7WebCore15GraphicsContext15platformContextEv
 __ZNK7WebCore15GraphicsContext16paintingDisabledEv
 __ZNK7WebCore15GraphicsContext20updatingControlTintsEv
+__ZNK7WebCore15GraphicsLayerCA12tiledBackingEv
+__ZNK7WebCore15GraphicsLayerCA13platformLayerEv
+__ZNK7WebCore15GraphicsLayerCA18getDebugBorderInfoERNS_5ColorERf
+__ZNK7WebCore15GraphicsLayerCA21canThrottleLayerFlushEv
+__ZNK7WebCore15GraphicsLayerCA24dumpAdditionalPropertiesERNS_10TextStreamEij
+__ZNK7WebCore15GraphicsLayerCA25shouldRepaintOnSizeChangeEv
+__ZNK7WebCore15GraphicsLayerCA26backingStoreMemoryEstimateEv
+__ZNK7WebCore15GraphicsLayerCA30visibleRectChangeRequiresFlushERKNS_9FloatRectE
+__ZNK7WebCore15GraphicsLayerCA33platformCALayerShowRepaintCounterEPNS_15PlatformCALayerE
+__ZThn496_N7WebCore15GraphicsLayerCA28platformCALayerPaintContentsERNS_15GraphicsContextERKNS_7IntRectE
+__ZThn496_N7WebCore15GraphicsLayerCA31platformCALayerAnimationStartedEd
+__ZThn496_N7WebCore15GraphicsLayerCA32platformCALayerDeviceScaleFactorEv
+__ZThn496_N7WebCore15GraphicsLayerCA40platformCALayerSetNeedsToRevalidateTilesEv
+__ZThn496_NK7WebCore15GraphicsLayerCA33platformCALayerShowRepaintCounterEPNS_15PlatformCALayerE
+__ZTVN7WebCore15PlatformCALayerE
 __ZNK7WebCore15ProgressTracker17estimatedProgressEv
 __ZNK7WebCore15ProtectionSpace10serverTypeEv
 __ZNK7WebCore15ProtectionSpace26receivesCredentialSecurelyEv
index 34ee18a..06920d9 100644 (file)
                0F099D0817B968A100FF84B9 /* WebCoreTypedArrayController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F099D0617B968A100FF84B9 /* WebCoreTypedArrayController.cpp */; };
                0F099D0917B968A100FF84B9 /* WebCoreTypedArrayController.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F099D0717B968A100FF84B9 /* WebCoreTypedArrayController.h */; settings = {ATTRIBUTES = (Private, ); }; };
                0F11A54F0F39233100C37884 /* RenderSelectionInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F11A54E0F39233100C37884 /* RenderSelectionInfo.h */; };
-               0F13163E16ED0CC80035CC04 /* PlatformCAFilters.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F13163D16ED0CC80035CC04 /* PlatformCAFilters.h */; };
+               0F13163E16ED0CC80035CC04 /* PlatformCAFilters.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F13163D16ED0CC80035CC04 /* PlatformCAFilters.h */; settings = {ATTRIBUTES = (Private, ); }; };
                0F13164016ED0CDE0035CC04 /* PlatformCAFiltersMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0F13163F16ED0CDE0035CC04 /* PlatformCAFiltersMac.mm */; };
                0F15DA8A0F3AAEE70000CE47 /* AnimationControllerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F15DA890F3AAEE70000CE47 /* AnimationControllerPrivate.h */; };
                0F29C16E1300C2E2002D794E /* AccessibilityAllInOne.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F29C16D1300C2E2002D794E /* AccessibilityAllInOne.cpp */; };
index eba43dd..86cbc16 100644 (file)
@@ -228,6 +228,8 @@ public:
     
     virtual ~GraphicsLayer();
 
+    virtual void initialize() { }
+
     GraphicsLayerClient* client() const { return m_client; }
 
     // Layer name. Only used to identify layers in debug output
index 45aea4d..3f6124c 100644 (file)
@@ -280,10 +280,15 @@ static inline bool supportsAcceleratedFilterAnimations()
 
 std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient* client)
 {
+    std::unique_ptr<GraphicsLayer> graphicsLayer;
     if (!factory)
-        return std::make_unique<GraphicsLayerCA>(client);
+        graphicsLayer = std::make_unique<GraphicsLayerCA>(client);
+    else
+        graphicsLayer = factory->createGraphicsLayer(client);
+
+    graphicsLayer->initialize();
 
-    return factory->createGraphicsLayer(client);
+    return std::move(graphicsLayer);
 }
 
 #if ENABLE(CSS_FILTERS)
@@ -324,8 +329,12 @@ GraphicsLayerCA::GraphicsLayerCA(GraphicsLayerClient* client)
     , m_uncommittedChanges(0)
     , m_isCommittingChanges(false)
 {
+}
+
+void GraphicsLayerCA::initialize()
+{
     PlatformCALayer::LayerType layerType = PlatformCALayer::LayerTypeWebLayer;
-    if (client && client->shouldUseTiledBacking(this)) {
+    if (m_client && m_client->shouldUseTiledBacking(this)) {
         layerType = PlatformCALayer::LayerTypePageTiledBackingLayer;
         m_isPageTiledBackingLayer = true;
     }
index 8a123e0..f40b255 100644 (file)
@@ -56,6 +56,8 @@ public:
     GraphicsLayerCA(GraphicsLayerClient*);
     virtual ~GraphicsLayerCA();
 
+    virtual void initialize() OVERRIDE;
+
     virtual void setName(const String&);
 
     virtual PlatformLayer* platformLayer() const;
@@ -187,8 +189,8 @@ private:
     void updateFilters();
 #endif
     
-    PassRefPtr<PlatformCALayer> createPlatformCALayer(PlatformCALayer::LayerType, PlatformCALayerClient* owner);
-    PassRefPtr<PlatformCALayer> createPlatformCALayer(PlatformLayer*, PlatformCALayerClient* owner);
+    virtual PassRefPtr<PlatformCALayer> createPlatformCALayer(PlatformCALayer::LayerType, PlatformCALayerClient* owner);
+    virtual PassRefPtr<PlatformCALayer> createPlatformCALayer(PlatformLayer*, PlatformCALayerClient* owner);
 
     PlatformCALayer* primaryLayer() const { return m_structuralLayer.get() ? m_structuralLayer.get() : m_layer.get(); }
     PlatformCALayer* hostLayerForSublayers() const;
index d820c0b..d28788a 100644 (file)
@@ -82,7 +82,7 @@ public:
     // is defined differently for Obj C and C++. This allows callers from both languages.
     static PlatformCALayer* platformCALayer(void* platformLayer);
 
-    PlatformLayer* platformLayer() const { return m_layer.get(); }
+    virtual PlatformLayer* platformLayer() const { return m_layer.get(); }
 
     virtual bool usesTiledBackingLayer() const = 0;
 
index c26238c..f172c3e 100644 (file)
@@ -1,3 +1,143 @@
+2013-10-15  Tim Horton  <timothy_horton@apple.com>
+
+        Add a PlatformCALayer subclass that proxies its property changes across the process boundary
+        https://bugs.webkit.org/show_bug.cgi?id=122773
+
+        Reviewed by Anders Carlsson.
+
+        PlatformCALayerRemote coordinates with RemoteLayerTreeDrawingArea and friends
+        to enable cross-process proxying of the hierarchy of compositing layers.
+
+        In the Web process, we have GraphicsLayerCARemote, which owns 1+ PlatformCALayerRemote(s).
+        Unlike PlatformCALayer{Mac, Win}, which own PlatformLayers (CALayer/CACFLayer),
+        PlatformCALayerRemote stores any changes to its properties in a struct, and keeps track of
+        which properties have changed since the last commit. Commits are scheduled and performed by
+        RemoteLayerTreeContext, on RemoteLayerTreeDrawingArea's behalf, and result in
+        RemoteLayerTreeTransaction encoding said property changes and throwing them across
+        to the UI process, where RemoteLayerTreeHost applies them to a tree of CALayers kept there.
+
+        This code can be enabled by running with the WK_USE_REMOTE_LAYER_TREE_DRAWING_AREA
+        environment variable set.
+
+        * Shared/WebCoreArgumentCoders.cpp:
+        (CoreIPC::decode):
+        (CoreIPC::encode):
+        * Shared/WebCoreArgumentCoders.h:
+        Add argument coders for FloatPoint3D.
+
+        * Shared/mac/RemoteLayerTreeTransaction.h:
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::notePropertiesChanged):
+        (WebKit::RemoteLayerTreeTransaction::changedLayers):
+        (WebKit::RemoteLayerTreeTransaction::destroyedLayers):
+        * Shared/mac/RemoteLayerTreeTransaction.mm:
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
+        (WebKit::RemoteLayerTreeTransaction::decode):
+        (WebKit::dumpChangedLayers):
+        Add support for background color and anchor point in the layer transaction.
+        Make layer position a 3D point because that's what it really is.
+
+        (WebKit::RemoteLayerTreeTransaction::layerPropertiesChanged):
+        The logic in layerPropertiesChanged is moved into PlatformCALayerRemote.
+
+        * UIProcess/WebPageProxy.h:
+        Include PlatformLayer.h; it seems annoying to successfully forward-declare
+        PlatformLayer because of the difference in definition between Objective-C and C++.
+        Drive-by un-indent some namespace contents and use OBJC_CLASS.
+
+        * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.h:
+        * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::sizeDidChange):
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::didUpdateGeometry):
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::sendUpdateGeometry):
+        Send geometry updates to the RemoteLayerTreeDrawingArea.
+
+        * UIProcess/mac/RemoteLayerTreeHost.h:
+        * UIProcess/mac/RemoteLayerTreeHost.mm:
+        (nullActionsDictionary):
+        (WebKit::RemoteLayerTreeHost::commit):
+        Apply layer property changes to the named sublayer.
+
+        (WebKit::RemoteLayerTreeHost::getOrCreateLayer):
+        Create CALayers instead of GraphicsLayers.
+        Ensure that they won't perform implicit animations.
+
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::WebPageProxy::setAcceleratedCompositingRootLayer):
+        This should take a PlatformLayer instead of a GraphicsLayer, since we don't have
+        GraphicsLayers in the UIProcess.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        Add GraphicsLayerCARemote and PlatformCALayerRemote, remove RemoteGraphicsLayer.
+
+        * WebProcess/WebPage/mac/RemoteGraphicsLayer.h: Removed.
+        * WebProcess/WebPage/mac/RemoteGraphicsLayer.mm: Removed.
+
+        * WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
+        * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
+        (WebKit::RemoteLayerTreeContext::RemoteLayerTreeContext):
+        (WebKit::RemoteLayerTreeContext::setRootLayer):
+        (WebKit::RemoteLayerTreeContext::layerWillBeDestroyed):
+        (WebKit::RemoteLayerTreeContext::createGraphicsLayer):
+        (WebKit::RemoteLayerTreeContext::flushLayers):
+        Build our transaction while flushing; it has no reason to exist outside of that scope.
+
+        * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
+        * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
+        (WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
+        (WebKit::RemoteLayerTreeDrawingArea::graphicsLayerFactory):
+        (WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer):
+        (WebKit::RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlush):
+        (WebKit::RemoteLayerTreeDrawingArea::updateGeometry):
+        Fix a capitalization typo.
+        Update the WebPage's (and thus WebCore's) size when updateGeometry() is called.
+
+        * WebProcess/WebPage/mac/GraphicsLayerCARemote.cpp: Added.
+        (WebKit::GraphicsLayerCARemote::~GraphicsLayerCARemote):
+        (WebKit::GraphicsLayerCARemote::filtersCanBeComposited):
+        (WebKit::GraphicsLayerCARemote::createPlatformCALayer):
+        Added. Delegate to PlatformCALayerRemote. Don't allow creation of a
+        GraphicsLayerCARemote given a PlatformLayer, because with UI process compositing,
+        there should be no PlatformLayer instances in the Web process.
+
+        * WebProcess/WebPage/mac/GraphicsLayerCARemote.h: Added.
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp: Added.
+        (generateLayerID):
+        Generate a layer ID for identification across processes.
+
+        (PlatformCALayerRemote::~PlatformCALayerRemote):
+        Inform the RemoteLayerTreeContext that we've been destroyed, so it can convey
+        that information to the UI process and the corresponding CALayer can be destroyed.
+
+        (PlatformCALayerRemote::recursiveBuildTransaction):
+        Recursively accumulate changes in layer state on a RemoteLayerTreeTransaction.
+
+        The rest of this file is mostly an empty implementation of PlatformCALayer.
+        A few properties are implemented so far; see below.
+
+        (PlatformCALayerRemote::setSublayers):
+        (PlatformCALayerRemote::removeAllSublayers):
+        (PlatformCALayerRemote::appendSublayer):
+        (PlatformCALayerRemote::insertSublayer):
+        Update our list of sublayers, and note that our children have changed.
+        recursiveBuildTransaction() will walk our sublayers and record their IDs in the transaction.
+
+        (PlatformCALayerRemote::bounds):
+        (PlatformCALayerRemote::setBounds):
+        (PlatformCALayerRemote::position):
+        (PlatformCALayerRemote::setPosition):
+        (PlatformCALayerRemote::anchorPoint):
+        (PlatformCALayerRemote::setAnchorPoint):
+        (PlatformCALayerRemote::backgroundColor):
+        (PlatformCALayerRemote::setBackgroundColor):
+        Trivial implementations of basic layer properties, storing the new state in
+        our LayerProperties struct and noting that they changed in the current commit.
+        Properties with getters will return the last value that was set on the LayerProperties,
+        so we don't clear the whole struct at the end of the transaction, just the mask of changed properties.
+
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.h: Added.
+
 2013-10-15  Brady Eidson  <beidson@apple.com>
 
         Move WebProcess/IndexedDB to WebProcess/Databases/IndexedDB
index f79472b..b721411 100644 (file)
@@ -81,6 +81,17 @@ bool ArgumentCoder<FloatPoint>::decode(ArgumentDecoder& decoder, FloatPoint& flo
 }
 
 
+void ArgumentCoder<FloatPoint3D>::encode(ArgumentEncoder& encoder, const FloatPoint3D& floatPoint)
+{
+    SimpleArgumentCoder<FloatPoint3D>::encode(encoder, floatPoint);
+}
+
+bool ArgumentCoder<FloatPoint3D>::decode(ArgumentDecoder& decoder, FloatPoint3D& floatPoint)
+{
+    return SimpleArgumentCoder<FloatPoint3D>::decode(decoder, floatPoint);
+}
+
+
 void ArgumentCoder<FloatRect>::encode(ArgumentEncoder& encoder, const FloatRect& floatRect)
 {
     SimpleArgumentCoder<FloatRect>::encode(encoder, floatRect);
index 7733616..e72d1bd 100644 (file)
@@ -36,6 +36,7 @@ namespace WebCore {
     class Cursor;
     class DatabaseDetails;
     class FloatPoint;
+    class FloatPoint3D;
     class FloatRect;
     class FloatSize;
     class HTTPHeaderMap;
@@ -86,6 +87,11 @@ template<> struct ArgumentCoder<WebCore::FloatPoint> {
     static bool decode(ArgumentDecoder&, WebCore::FloatPoint&);
 };
 
+template<> struct ArgumentCoder<WebCore::FloatPoint3D> {
+    static void encode(ArgumentEncoder&, const WebCore::FloatPoint3D&);
+    static bool decode(ArgumentDecoder&, WebCore::FloatPoint3D&);
+};
+
 template<> struct ArgumentCoder<WebCore::FloatRect> {
     static void encode(ArgumentEncoder&, const WebCore::FloatRect&);
     static bool decode(ArgumentDecoder&, WebCore::FloatRect&);
index ea50034..d851a96 100644 (file)
@@ -26,7 +26,8 @@
 #ifndef RemoteLayerTreeTransaction_h
 #define RemoteLayerTreeTransaction_h
 
-#include <WebCore/FloatPoint.h>
+#include <WebCore/Color.h>
+#include <WebCore/FloatPoint3D.h>
 #include <WebCore/FloatSize.h>
 #include <wtf/HashMap.h>
 #include <wtf/text/WTFString.h>
@@ -38,16 +39,20 @@ class ArgumentEncoder;
 
 namespace WebKit {
 
-class RemoteGraphicsLayer;
+class PlatformCALayerRemote;
 
 class RemoteLayerTreeTransaction {
 public:
+    typedef uint64_t LayerID;
+
     enum LayerChange {
         NoChange = 0,
         NameChanged = 1 << 1,
         ChildrenChanged = 1 << 2,
         PositionChanged = 1 << 3,
         SizeChanged = 1 << 4,
+        BackgroundColorChanged = 1 << 5,
+        AnchorPointChanged = 1 << 6,
     };
 
     struct LayerProperties {
@@ -56,12 +61,16 @@ public:
         void encode(CoreIPC::ArgumentEncoder&) const;
         static bool decode(CoreIPC::ArgumentDecoder&, LayerProperties&);
 
+        void notePropertiesChanged(LayerChange layerChanges) { changedProperties |= layerChanges; }
+
         unsigned changedProperties;
 
         String name;
-        Vector<uint64_t> children;
-        WebCore::FloatPoint position;
+        Vector<LayerID> children;
+        WebCore::FloatPoint3D position;
         WebCore::FloatSize size;
+        WebCore::Color backgroundColor;
+        WebCore::FloatPoint3D anchorPoint;
     };
 
     explicit RemoteLayerTreeTransaction();
@@ -70,19 +79,22 @@ public:
     void encode(CoreIPC::ArgumentEncoder&) const;
     static bool decode(CoreIPC::ArgumentDecoder&, RemoteLayerTreeTransaction&);
 
-    uint64_t rootLayerID() const { return m_rootLayerID; }
-    void setRootLayerID(uint64_t rootLayerID);
-    void layerPropertiesChanged(const RemoteGraphicsLayer*, unsigned changedProperties);
-    void setDestroyedLayerIDs(Vector<uint64_t>);
+    LayerID rootLayerID() const { return m_rootLayerID; }
+    void setRootLayerID(LayerID rootLayerID);
+    void layerPropertiesChanged(PlatformCALayerRemote*, LayerProperties&);
+    void setDestroyedLayerIDs(Vector<LayerID>);
 
 #ifndef NDEBUG
     void dump() const;
 #endif
 
+    HashMap<LayerID, LayerProperties> changedLayers() const { return m_changedLayerProperties; }
+    Vector<LayerID> destroyedLayers() const { return m_destroyedLayerIDs; }
+
 private:
-    uint64_t m_rootLayerID;
-    HashMap<uint64_t, LayerProperties> m_changedLayerProperties;
-    Vector<uint64_t> m_destroyedLayerIDs;
+    LayerID m_rootLayerID;
+    HashMap<LayerID, LayerProperties> m_changedLayerProperties;
+    Vector<LayerID> m_destroyedLayerIDs;
 };
 
 } // namespace WebKit
index 9df6c2d..0846121 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "config.h"
-#include "RemoteLayerTreeTransaction.h"
+#import "config.h"
+#import "RemoteLayerTreeTransaction.h"
 
-#include "ArgumentCoders.h"
-#include "MessageDecoder.h"
-#include "MessageEncoder.h"
-#include "RemoteGraphicsLayer.h"
-#include "WebCoreArgumentCoders.h"
-#include <wtf/text/CString.h>
-#include <wtf/text/StringBuilder.h>
+#import "ArgumentCoders.h"
+#import "MessageDecoder.h"
+#import "MessageEncoder.h"
+#import "PlatformCALayerRemote.h"
+#import "WebCoreArgumentCoders.h"
+#import <wtf/text/CString.h>
+#import <wtf/text/StringBuilder.h>
 
 using namespace WebCore;
 
@@ -58,6 +58,12 @@ void RemoteLayerTreeTransaction::LayerProperties::encode(CoreIPC::ArgumentEncode
 
     if (changedProperties & SizeChanged)
         encoder << size;
+
+    if (changedProperties & BackgroundColorChanged)
+        encoder << backgroundColor;
+
+    if (changedProperties & AnchorPointChanged)
+        encoder << anchorPoint;
 }
 
 bool RemoteLayerTreeTransaction::LayerProperties::decode(CoreIPC::ArgumentDecoder& decoder, LayerProperties& result)
@@ -89,6 +95,17 @@ bool RemoteLayerTreeTransaction::LayerProperties::decode(CoreIPC::ArgumentDecode
         if (!decoder.decode(result.size))
             return false;
     }
+
+    if (result.changedProperties & BackgroundColorChanged) {
+        if (!decoder.decode(result.backgroundColor))
+            return false;
+    }
+
+    if (result.changedProperties & AnchorPointChanged) {
+        if (!decoder.decode(result.anchorPoint))
+            return false;
+    }
+
     return true;
 }
 
@@ -119,7 +136,7 @@ bool RemoteLayerTreeTransaction::decode(CoreIPC::ArgumentDecoder& decoder, Remot
 
     if (!decoder.decode(result.m_destroyedLayerIDs))
         return false;
-    for (uint64_t layerID: result.m_destroyedLayerIDs) {
+    for (LayerID layerID : result.m_destroyedLayerIDs) {
         if (!layerID)
             return false;
     }
@@ -127,41 +144,19 @@ bool RemoteLayerTreeTransaction::decode(CoreIPC::ArgumentDecoder& decoder, Remot
     return true;
 }
 
-void RemoteLayerTreeTransaction::setRootLayerID(uint64_t rootLayerID)
+void RemoteLayerTreeTransaction::setRootLayerID(LayerID rootLayerID)
 {
     ASSERT_ARG(rootLayerID, rootLayerID);
 
     m_rootLayerID = rootLayerID;
 }
 
-void RemoteLayerTreeTransaction::layerPropertiesChanged(const RemoteGraphicsLayer* graphicsLayer, unsigned changedProperties)
+void RemoteLayerTreeTransaction::layerPropertiesChanged(PlatformCALayerRemote* remoteLayer, RemoteLayerTreeTransaction::LayerProperties& properties)
 {
-    LayerProperties& layerProperties = m_changedLayerProperties.add(graphicsLayer->layerID(), LayerProperties()).iterator->value;
-
-    layerProperties.changedProperties |= changedProperties;
-
-    if (changedProperties & NameChanged)
-        layerProperties.name = graphicsLayer->name();
-
-    if (changedProperties & ChildrenChanged) {
-        const Vector<GraphicsLayer*>& children = graphicsLayer->children();
-
-        ASSERT(layerProperties.children.isEmpty());
-        layerProperties.children.reserveCapacity(children.size());
-        for (size_t i = 0; i < children.size(); ++i) {
-            RemoteGraphicsLayer* childLayer = static_cast<RemoteGraphicsLayer*>(children[i]);
-            layerProperties.children.uncheckedAppend(childLayer->layerID());
-        }
-    }
-
-    if (changedProperties & PositionChanged)
-        layerProperties.position = graphicsLayer->position();
-
-    if (changedProperties & SizeChanged)
-        layerProperties.size = graphicsLayer->size();
+    m_changedLayerProperties.set(remoteLayer->layerID(), properties);
 }
 
-void RemoteLayerTreeTransaction::setDestroyedLayerIDs(Vector<uint64_t> destroyedLayerIDs)
+void RemoteLayerTreeTransaction::setDestroyedLayerIDs(Vector<LayerID> destroyedLayerIDs)
 {
     m_destroyedLayerIDs = std::move(destroyedLayerIDs);
 }
@@ -174,7 +169,7 @@ static void writeIndent(StringBuilder& builder, int indent)
         builder.append(' ');
 }
 
-static void dumpChangedLayers(StringBuilder& builder, const HashMap<uint64_t, RemoteLayerTreeTransaction::LayerProperties>& changedLayerProperties)
+static void dumpChangedLayers(StringBuilder& builder, const HashMap<RemoteLayerTreeTransaction::LayerID, RemoteLayerTreeTransaction::LayerProperties>& changedLayerProperties)
 {
     if (changedLayerProperties.isEmpty())
         return;
@@ -183,11 +178,11 @@ static void dumpChangedLayers(StringBuilder& builder, const HashMap<uint64_t, Re
     builder.append("(changed-layers\n");
 
     // Dump the layer properties sorted by layer ID.
-    Vector<uint64_t> layerIDs;
+    Vector<RemoteLayerTreeTransaction::LayerID> layerIDs;
     copyKeysToVector(changedLayerProperties, layerIDs);
     std::sort(layerIDs.begin(), layerIDs.end());
 
-    for (uint64_t layerID: layerIDs) {
+    for (auto layerID: layerIDs) {
         const RemoteLayerTreeTransaction::LayerProperties& layerProperties = changedLayerProperties.get(layerID);
 
         writeIndent(builder, 2);
@@ -222,6 +217,8 @@ static void dumpChangedLayers(StringBuilder& builder, const HashMap<uint64_t, Re
             builder.appendNumber(layerProperties.position.x());
             builder.append(' ');
             builder.appendNumber(layerProperties.position.y());
+            builder.append(' ');
+            builder.appendNumber(layerProperties.position.z());
             builder.append(')');
         }
 
@@ -235,6 +232,26 @@ static void dumpChangedLayers(StringBuilder& builder, const HashMap<uint64_t, Re
             builder.append(')');
         }
 
+        if (layerProperties.changedProperties & RemoteLayerTreeTransaction::AnchorPointChanged) {
+            builder.append('\n');
+            writeIndent(builder, 3);
+            builder.append("(anchorPoint ");
+            builder.appendNumber(layerProperties.anchorPoint.x());
+            builder.append(' ');
+            builder.appendNumber(layerProperties.anchorPoint.y());
+            builder.append(' ');
+            builder.appendNumber(layerProperties.anchorPoint.z());
+            builder.append(')');
+        }
+
+        if (layerProperties.changedProperties & RemoteLayerTreeTransaction::BackgroundColorChanged) {
+            builder.append('\n');
+            writeIndent(builder, 3);
+            builder.append("(backgroundColor ");
+            builder.append(layerProperties.backgroundColor.serialized());
+            builder.append(')');
+        }
+
         builder.append(")\n");
     }
 }
index e82aa16..9180a1b 100644 (file)
 #include <Evas.h>
 #endif
 
+#if PLATFORM(MAC)
+#include <WebCore/PlatformLayer.h>
+#endif
+
 namespace CoreIPC {
-    class ArgumentDecoder;
-    class Connection;
+class ArgumentDecoder;
+class Connection;
 }
 
 namespace WebCore {
-    class AuthenticationChallenge;
-    class Cursor;
-    class DragData;
-    class FloatRect;
-    class GraphicsLayer;
-    class IntSize;
-    class CertificateInfo;
-    class ProtectionSpace;
-    class SharedBuffer;
-    struct FileChooserSettings;
-    struct TextAlternativeWithRange;
-    struct TextCheckingResult;
-    struct ViewportAttributes;
-    struct WindowFeatures;
+class AuthenticationChallenge;
+class Cursor;
+class DragData;
+class FloatRect;
+class GraphicsLayer;
+class IntSize;
+class CertificateInfo;
+class ProtectionSpace;
+class SharedBuffer;
+struct FileChooserSettings;
+struct TextAlternativeWithRange;
+struct TextCheckingResult;
+struct ViewportAttributes;
+struct WindowFeatures;
 }
 
 #if USE(APPKIT)
-#ifdef __OBJC__
-@class WKView;
-#else
-class WKView;
-#endif
+OBJC_CLASS WKView;
 #endif
 
 #if PLATFORM(GTK)
@@ -391,13 +391,13 @@ public:
     bool shouldDelayWindowOrderingForEvent(const WebMouseEvent&);
     bool acceptsFirstMouse(int eventNumber, const WebMouseEvent&);
 
-    void setAcceleratedCompositingRootLayer(const WebCore::GraphicsLayer*);
+    void setAcceleratedCompositingRootLayer(PlatformLayer* rootLayer);
 
 #if USE(APPKIT)
     WKView* wkView() const;
     void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize);
 #endif
-#endif
+#endif // PLATFORM(MAC)
 #if PLATFORM(EFL)
     void handleInputMethodKeydown(bool& handled);
     void confirmComposition(const String&);
index 30ab229..012263e 100644 (file)
@@ -28,6 +28,8 @@
 
 #include "DrawingAreaProxy.h"
 #include "RemoteLayerTreeHost.h"
+#include <WebCore/IntPoint.h>
+#include <WebCore/IntSize.h>
 
 namespace WebKit {
 
@@ -39,8 +41,15 @@ public:
 private:
     virtual void sizeDidChange() OVERRIDE;
     virtual void deviceScaleFactorDidChange() OVERRIDE;
+    virtual void didUpdateGeometry() OVERRIDE;
+
+    void sendUpdateGeometry();
 
     RemoteLayerTreeHost m_remoteLayerTreeHost;
+    bool m_isWaitingForDidUpdateGeometry;
+
+    WebCore::IntSize m_lastSentSize;
+    WebCore::IntSize m_lastSentLayerPosition;
 };
 
 } // namespace WebKit
index b69eaaa..3d84b3b 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "config.h"
-#include "RemoteLayerTreeDrawingAreaProxy.h"
+#import "config.h"
+#import "RemoteLayerTreeDrawingAreaProxy.h"
+
+#import "DrawingAreaMessages.h"
+#import "WebPageProxy.h"
+#import "WebProcessProxy.h"
 
 namespace WebKit {
 
 RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy(WebPageProxy* webPageProxy)
     : DrawingAreaProxy(DrawingAreaTypeRemoteLayerTree, webPageProxy)
     , m_remoteLayerTreeHost(webPageProxy)
+    , m_isWaitingForDidUpdateGeometry(false)
 {
 }
 
@@ -40,10 +45,37 @@ RemoteLayerTreeDrawingAreaProxy::~RemoteLayerTreeDrawingAreaProxy()
 
 void RemoteLayerTreeDrawingAreaProxy::sizeDidChange()
 {
+    if (!m_webPageProxy->isValid())
+        return;
+
+    if (m_isWaitingForDidUpdateGeometry)
+        return;
+
+    sendUpdateGeometry();
 }
 
 void RemoteLayerTreeDrawingAreaProxy::deviceScaleFactorDidChange()
 {
 }
 
+void RemoteLayerTreeDrawingAreaProxy::didUpdateGeometry()
+{
+    ASSERT(m_isWaitingForDidUpdateGeometry);
+
+    m_isWaitingForDidUpdateGeometry = false;
+
+    // If the WKView was resized while we were waiting for a DidUpdateGeometry reply from the web process,
+    // we need to resend the new size here.
+    if (m_lastSentSize != m_size || m_lastSentLayerPosition != m_layerPosition)
+        sendUpdateGeometry();
+}
+
+void RemoteLayerTreeDrawingAreaProxy::sendUpdateGeometry()
+{
+    m_lastSentSize = m_size;
+    m_lastSentLayerPosition = m_layerPosition;
+    m_webPageProxy->process()->send(Messages::DrawingArea::UpdateGeometry(m_size, m_layerPosition), m_webPageProxy->pageID());
+    m_isWaitingForDidUpdateGeometry = true;
+}
+
 } // namespace WebKit
index bfbfc1f..e0f0504 100644 (file)
 #define RemoteLayerTreeHost_h
 
 #include "MessageReceiver.h"
-#include <WebCore/GraphicsLayerClient.h>
+#include "RemoteLayerTreeTransaction.h"
 #include <wtf/HashMap.h>
+#include <wtf/RetainPtr.h>
+
+OBJC_CLASS CALayer;
 
 namespace WebKit {
 
-class RemoteLayerTreeTransaction;
 class WebPageProxy;
 
-class RemoteLayerTreeHost : private CoreIPC::MessageReceiver, WebCore::GraphicsLayerClient {
+class RemoteLayerTreeHost : private CoreIPC::MessageReceiver {
 public:
     explicit RemoteLayerTreeHost(WebPageProxy*);
     ~RemoteLayerTreeHost();
@@ -44,20 +46,15 @@ private:
     // CoreIPC::MessageReceiver.
     virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&) OVERRIDE;
 
-    // WebCore::GraphicsLayerClient.
-    virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) OVERRIDE;
-    virtual void notifyFlushRequired(const WebCore::GraphicsLayer*) OVERRIDE;
-    virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect) OVERRIDE;
-
     // Message handlers.
     void commit(const RemoteLayerTreeTransaction&);
 
-    WebCore::GraphicsLayer* getOrCreateLayer(uint64_t layerID);
+    CALayer *getOrCreateLayer(RemoteLayerTreeTransaction::LayerID layerID);
 
     WebPageProxy* m_webPageProxy;
 
-    WebCore::GraphicsLayer* m_rootLayer;
-    HashMap<uint64_t, std::unique_ptr<WebCore::GraphicsLayer>> m_layers;
+    CALayer *m_rootLayer;
+    HashMap<RemoteLayerTreeTransaction::LayerID, RetainPtr<CALayer>> m_layers;
 };
 
 } // namespace WebKit
index 323ab8e..7289924 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include "config.h"
-#include "RemoteLayerTreeHost.h"
+#import "config.h"
+#import "RemoteLayerTreeHost.h"
 
-#include "RemoteLayerTreeHostMessages.h"
-#include "RemoteLayerTreeTransaction.h"
-#include "WebPageProxy.h"
-#include "WebProcessProxy.h"
-#include <WebCore/GraphicsLayer.h>
+#import "RemoteLayerTreeHostMessages.h"
+#import "RemoteLayerTreeTransaction.h"
+#import "WebPageProxy.h"
+#import "WebProcessProxy.h"
+#import <WebCore/PlatformLayer.h>
+
+#import <QuartzCore/QuartzCore.h>
 
 using namespace WebCore;
 
+static NSDictionary *nullActionsDictionary()
+{
+    NSNull* nullValue = [NSNull null];
+    return @{
+        @"anchorPoint" : nullValue,
+        @"anchorPointZ" : nullValue,
+        @"bounds" : nullValue,
+        @"contents" : nullValue,
+        @"contentsRect" : nullValue,
+        @"opacity" : nullValue,
+        @"position" : nullValue,
+        @"shadowColor" : nullValue,
+        @"sublayerTransform" : nullValue,
+        @"sublayers" : nullValue,
+        @"transform" : nullValue,
+        @"zPosition" : nullValue };
+}
+
 namespace WebKit {
 
 RemoteLayerTreeHost::RemoteLayerTreeHost(WebPageProxy* webPageProxy)
@@ -48,37 +68,69 @@ RemoteLayerTreeHost::~RemoteLayerTreeHost()
     m_webPageProxy->process()->removeMessageReceiver(Messages::RemoteLayerTreeHost::messageReceiverName(), m_webPageProxy->pageID());
 }
 
-void RemoteLayerTreeHost::notifyAnimationStarted(const GraphicsLayer*, double time)
-{
-}
-
-void RemoteLayerTreeHost::notifyFlushRequired(const GraphicsLayer*)
-{
-}
-
-void RemoteLayerTreeHost::paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect&)
-{
-}
-
 void RemoteLayerTreeHost::commit(const RemoteLayerTreeTransaction& transaction)
 {
-    GraphicsLayer* rootLayer = getOrCreateLayer(transaction.rootLayerID());
+    CALayer *rootLayer = getOrCreateLayer(transaction.rootLayerID());
     if (m_rootLayer != rootLayer) {
         m_rootLayer = rootLayer;
         m_webPageProxy->setAcceleratedCompositingRootLayer(m_rootLayer);
     }
 
 #ifndef NDEBUG
-    // FIXME: Apply the transaction instead of dumping it to stderr.
     transaction.dump();
 #endif
+
+    for (auto changedLayer : transaction.changedLayers()) {
+        RemoteLayerTreeTransaction::LayerID layerID = changedLayer.key;
+        const auto& properties = changedLayer.value;
+
+        CALayer *sublayer = getOrCreateLayer(layerID);
+
+        if (properties.changedProperties & RemoteLayerTreeTransaction::NameChanged)
+            [sublayer setName:properties.name];
+
+        if (properties.changedProperties & RemoteLayerTreeTransaction::PositionChanged) {
+            [sublayer setPosition:CGPointMake(properties.position.x(), properties.position.y())];
+            [sublayer setZPosition:properties.position.z()];
+        }
+
+        if (properties.changedProperties & RemoteLayerTreeTransaction::AnchorPointChanged) {
+            [sublayer setAnchorPoint:CGPointMake(properties.anchorPoint.x(), properties.anchorPoint.y())];
+            [sublayer setAnchorPointZ:properties.anchorPoint.z()];
+        }
+
+        if (properties.changedProperties & RemoteLayerTreeTransaction::SizeChanged)
+            [sublayer setBounds:FloatRect(FloatPoint(), properties.size)];
+
+        if (properties.changedProperties & RemoteLayerTreeTransaction::BackgroundColorChanged) {
+            CGFloat components[4];
+            properties.backgroundColor.getRGBA(components[0], components[1], components[2], components[3]);
+
+            RetainPtr<CGColorSpaceRef> colorSpace = adoptCF(CGColorSpaceCreateDeviceRGB());
+            RetainPtr<CGColorRef> color = adoptCF(CGColorCreate(colorSpace.get(), components));
+
+            [sublayer setBackgroundColor:color.get()];
+        }
+
+        if (properties.changedProperties & RemoteLayerTreeTransaction::ChildrenChanged) {
+            RetainPtr<NSMutableArray> children = adoptNS([[NSMutableArray alloc] initWithCapacity:properties.children.size()]);
+            for (auto child : properties.children)
+                [children addObject:getOrCreateLayer(child)];
+            [sublayer setSublayers:children.get()];
+        }
+    }
+
+    for (auto destroyedLayer : transaction.destroyedLayers())
+        m_layers.remove(destroyedLayer);
 }
 
-GraphicsLayer* RemoteLayerTreeHost::getOrCreateLayer(uint64_t layerID)
+CALayer *RemoteLayerTreeHost::getOrCreateLayer(RemoteLayerTreeTransaction::LayerID layerID)
 {
-    std::unique_ptr<GraphicsLayer>& layer = m_layers.add(layerID, nullptr).iterator->value;
-    if (!layer)
-        layer = GraphicsLayer::create(0, this);
+    RetainPtr<CALayer>& layer = m_layers.add(layerID, nullptr).iterator->value;
+    if (!layer) {
+        layer = adoptNS([[CALayer alloc] init]);
+        [layer setStyle:@{ @"actions" : nullActionsDictionary() }];
+    }
 
     return layer.get();
 }
index ee9a078..b5de22a 100644 (file)
@@ -511,9 +511,9 @@ void WebPageProxy::intrinsicContentSizeDidChange(const IntSize& intrinsicContent
     m_pageClient->intrinsicContentSizeDidChange(intrinsicContentSize);
 }
 
-void WebPageProxy::setAcceleratedCompositingRootLayer(const GraphicsLayer* rootLayer)
+void WebPageProxy::setAcceleratedCompositingRootLayer(PlatformLayer* rootLayer)
 {
-    m_pageClient->setAcceleratedCompositingRootLayer(rootLayer->platformLayer());
+    m_pageClient->setAcceleratedCompositingRootLayer(rootLayer);
 }
 
 static NSString *temporaryPDFDirectoryPath()
index 0fe6281..91f664c 100644 (file)
                1AB16AE21648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB16AE01648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.h */; };
                1AB16AE9164B3A8800290D62 /* RemoteLayerTreeContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AB16AE7164B3A8800290D62 /* RemoteLayerTreeContext.mm */; };
                1AB16AEA164B3A8800290D62 /* RemoteLayerTreeContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB16AE8164B3A8800290D62 /* RemoteLayerTreeContext.h */; };
-               1AB16AED164B41E400290D62 /* RemoteGraphicsLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AB16AEB164B41E400290D62 /* RemoteGraphicsLayer.mm */; };
-               1AB16AEE164B41E400290D62 /* RemoteGraphicsLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB16AEC164B41E400290D62 /* RemoteGraphicsLayer.h */; };
                1AB31A9616BC688100F6DBC9 /* StorageManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AB31A9416BC688100F6DBC9 /* StorageManagerMessageReceiver.cpp */; };
                1AB31A9716BC688100F6DBC9 /* StorageManagerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB31A9516BC688100F6DBC9 /* StorageManagerMessages.h */; };
                1AB7D4CA1288AAA700CFD08C /* DownloadProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AB7D4C81288AAA700CFD08C /* DownloadProxy.h */; };
                2D2ADF1016364D8200197E47 /* PDFPluginChoiceAnnotation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D2ADF0E16364D8200197E47 /* PDFPluginChoiceAnnotation.mm */; };
                2D429BFD1721E2C700EC681F /* PDFPluginPasswordField.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D429BFB1721E2BA00EC681F /* PDFPluginPasswordField.mm */; };
                2D870D1016234FFE000A3F20 /* PDFPlugin.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D870D0E1622B7F9000A3F20 /* PDFPlugin.mm */; };
+               2DA049B3180CCCD300AAFA9E /* PlatformCALayerRemote.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2DA049B1180CCCD300AAFA9E /* PlatformCALayerRemote.cpp */; };
+               2DA049B4180CCCD300AAFA9E /* PlatformCALayerRemote.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DA049B2180CCCD300AAFA9E /* PlatformCALayerRemote.h */; };
+               2DA049B7180CCD0A00AAFA9E /* GraphicsLayerCARemote.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2DA049B5180CCD0A00AAFA9E /* GraphicsLayerCARemote.cpp */; };
+               2DA049B8180CCD0A00AAFA9E /* GraphicsLayerCARemote.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DA049B6180CCD0A00AAFA9E /* GraphicsLayerCARemote.h */; };
                31099973146C75A20029DEB9 /* WebNotificationClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31099971146C759B0029DEB9 /* WebNotificationClient.cpp */; };
                310999C7146C9E3D0029DEB9 /* WebNotificationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 31099968146C71F50029DEB9 /* WebNotificationClient.h */; };
                312C0C4A146DDC8A0016C911 /* WKNotificationProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 312C0C49146DDC8A0016C911 /* WKNotificationProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
                1AB16AE01648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteLayerTreeDrawingAreaProxy.h; sourceTree = "<group>"; };
                1AB16AE7164B3A8800290D62 /* RemoteLayerTreeContext.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteLayerTreeContext.mm; sourceTree = "<group>"; };
                1AB16AE8164B3A8800290D62 /* RemoteLayerTreeContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteLayerTreeContext.h; sourceTree = "<group>"; };
-               1AB16AEB164B41E400290D62 /* RemoteGraphicsLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteGraphicsLayer.mm; sourceTree = "<group>"; };
-               1AB16AEC164B41E400290D62 /* RemoteGraphicsLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteGraphicsLayer.h; sourceTree = "<group>"; };
                1AB31A9316BC65AB00F6DBC9 /* StorageManager.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = StorageManager.messages.in; sourceTree = "<group>"; };
                1AB31A9416BC688100F6DBC9 /* StorageManagerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageManagerMessageReceiver.cpp; sourceTree = "<group>"; };
                1AB31A9516BC688100F6DBC9 /* StorageManagerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageManagerMessages.h; sourceTree = "<group>"; };
                2D429BFB1721E2BA00EC681F /* PDFPluginPasswordField.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PDFPluginPasswordField.mm; path = PDF/PDFPluginPasswordField.mm; sourceTree = "<group>"; };
                2D870D0D1622B7F9000A3F20 /* PDFPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PDFPlugin.h; path = PDF/PDFPlugin.h; sourceTree = "<group>"; };
                2D870D0E1622B7F9000A3F20 /* PDFPlugin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PDFPlugin.mm; path = PDF/PDFPlugin.mm; sourceTree = "<group>"; };
+               2DA049B1180CCCD300AAFA9E /* PlatformCALayerRemote.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformCALayerRemote.cpp; sourceTree = "<group>"; };
+               2DA049B2180CCCD300AAFA9E /* PlatformCALayerRemote.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformCALayerRemote.h; sourceTree = "<group>"; };
+               2DA049B5180CCD0A00AAFA9E /* GraphicsLayerCARemote.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsLayerCARemote.cpp; sourceTree = "<group>"; };
+               2DA049B6180CCD0A00AAFA9E /* GraphicsLayerCARemote.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsLayerCARemote.h; sourceTree = "<group>"; };
                31099968146C71F50029DEB9 /* WebNotificationClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebNotificationClient.h; sourceTree = "<group>"; };
                31099971146C759B0029DEB9 /* WebNotificationClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebNotificationClient.cpp; sourceTree = "<group>"; };
                312C0C49146DDC8A0016C911 /* WKNotificationProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNotificationProvider.h; sourceTree = "<group>"; };
                        isa = PBXGroup;
                        children = (
                                7C6D37FA172F555F009D2847 /* PageBannerMac.mm */,
-                               1AB16AEC164B41E400290D62 /* RemoteGraphicsLayer.h */,
-                               1AB16AEB164B41E400290D62 /* RemoteGraphicsLayer.mm */,
+                               2DA049B5180CCD0A00AAFA9E /* GraphicsLayerCARemote.cpp */,
+                               2DA049B6180CCD0A00AAFA9E /* GraphicsLayerCARemote.h */,
+                               2DA049B1180CCCD300AAFA9E /* PlatformCALayerRemote.cpp */,
+                               2DA049B2180CCCD300AAFA9E /* PlatformCALayerRemote.h */,
                                1AB16AE8164B3A8800290D62 /* RemoteLayerTreeContext.h */,
                                1AB16AE7164B3A8800290D62 /* RemoteLayerTreeContext.mm */,
                                1AB16ADC1648598400290D62 /* RemoteLayerTreeDrawingArea.h */,
                                1A2D82A7127F4EAB001EB962 /* NPObjectProxy.h in Headers */,
                                1A2D82A9127F4EAB001EB962 /* NPRemoteObjectMap.h in Headers */,
                                1A2161B011F37664008AD0F5 /* NPRuntimeObjectMap.h in Headers */,
+                               2DA049B8180CCD0A00AAFA9E /* GraphicsLayerCARemote.h in Headers */,
+                               2DA049B4180CCCD300AAFA9E /* PlatformCALayerRemote.h in Headers */,
                                1A2162B111F38971008AD0F5 /* NPRuntimeUtilities.h in Headers */,
                                1A2D84A3127F6AD1001EB962 /* NPVariantData.h in Headers */,
                                BC8ACA1316670D89004C1941 /* ObjCObjectGraph.h in Headers */,
                                E1CC1B9012D7EADF00625838 /* PrintInfo.h in Headers */,
                                BC1A7C581136E19C00FB7167 /* ProcessLauncher.h in Headers */,
                                BC597075116591D000551FCA /* ProcessModel.h in Headers */,
-                               1AB16AEE164B41E400290D62 /* RemoteGraphicsLayer.h in Headers */,
                                1AB16AEA164B3A8800290D62 /* RemoteLayerTreeContext.h in Headers */,
                                1AB16ADE1648598400290D62 /* RemoteLayerTreeDrawingArea.h in Headers */,
                                1AB16AE21648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.h in Headers */,
                                BC032DAA10F437D10058C15A /* Connection.cpp in Sources */,
                                1A30EAC6115D7DA30053E937 /* ConnectionMac.cpp in Sources */,
                                5136183D163126DA00A99DDE /* ConnectionStack.cpp in Sources */,
+                               2DA049B7180CCD0A00AAFA9E /* GraphicsLayerCARemote.cpp in Sources */,
+                               2DA049B3180CCCD300AAFA9E /* PlatformCALayerRemote.cpp in Sources */,
                                CDC3831017212440008A2FC3 /* CookieStorageShim.cpp in Sources */,
                                B878B616133428DC006888E9 /* CorrectionPanel.mm in Sources */,
                                2989A411167D1834004F96D2 /* CustomProtocolManagerMac.mm in Sources */,
                                E1CC1B9112D7EADF00625838 /* PrintInfoMac.mm in Sources */,
                                1AE117F611DBB30900981615 /* ProcessLauncher.cpp in Sources */,
                                BC111B1D112F5FE600337BAB /* ProcessLauncherMac.mm in Sources */,
-                               1AB16AED164B41E400290D62 /* RemoteGraphicsLayer.mm in Sources */,
                                1AB16AE9164B3A8800290D62 /* RemoteLayerTreeContext.mm in Sources */,
                                1AB16ADD1648598400290D62 /* RemoteLayerTreeDrawingArea.mm in Sources */,
                                1AB16AE11648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.mm in Sources */,
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.cpp b/Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.cpp
new file mode 100644 (file)
index 0000000..a2c98dd
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "GraphicsLayerCARemote.h"
+#include "PlatformCALayerRemote.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+GraphicsLayerCARemote::~GraphicsLayerCARemote()
+{
+}
+
+#if ENABLE(CSS_FILTERS)
+bool GraphicsLayerCARemote::filtersCanBeComposited(const FilterOperations& filters)
+{
+    return PlatformCALayerRemote::filtersCanBeComposited(filters);
+}
+#endif
+
+PassRefPtr<PlatformCALayer> GraphicsLayerCARemote::createPlatformCALayer(PlatformCALayer::LayerType layerType, PlatformCALayerClient* owner)
+{
+    return PlatformCALayerRemote::create(layerType, owner, m_context);
+}
+
+PassRefPtr<PlatformCALayer> GraphicsLayerCARemote::createPlatformCALayer(PlatformLayer*, PlatformCALayerClient*)
+{
+    ASSERT_NOT_REACHED();
+
+    return nullptr;
+}
+
+}
+
+#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.h b/Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.h
new file mode 100644 (file)
index 0000000..d79c8f6
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GraphicsLayerCARemote_h
+#define GraphicsLayerCARemote_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include <WebCore/GraphicsLayerCA.h>
+#include <WebCore/PlatformLayer.h>
+
+namespace WebKit {
+
+class RemoteLayerTreeContext;
+
+class GraphicsLayerCARemote FINAL : public WebCore::GraphicsLayerCA {
+public:
+    GraphicsLayerCARemote(WebCore::GraphicsLayerClient* client, RemoteLayerTreeContext* context)
+        : GraphicsLayerCA(client)
+        , m_context(context)
+    {
+    }
+
+    virtual ~GraphicsLayerCARemote();
+
+#if ENABLE(CSS_FILTERS)
+    virtual bool filtersCanBeComposited(const WebCore::FilterOperations& filters) OVERRIDE;
+#endif
+
+private:
+    virtual PassRefPtr<WebCore::PlatformCALayer> createPlatformCALayer(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient* owner) OVERRIDE;
+    virtual PassRefPtr<WebCore::PlatformCALayer> createPlatformCALayer(PlatformLayer*, WebCore::PlatformCALayerClient* owner) OVERRIDE;
+
+    RemoteLayerTreeContext* m_context;
+};
+
+} // namespace WebKit
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif // GraphicsLayerCARemote_h
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp b/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp
new file mode 100644 (file)
index 0000000..8147695
--- /dev/null
@@ -0,0 +1,361 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#import "PlatformCALayerRemote.h"
+
+#import "RemoteLayerTreeContext.h"
+#import <WebCore/AnimationUtilities.h>
+#import <WebCore/GraphicsContext.h>
+#import <WebCore/GraphicsLayerCA.h>
+#import <WebCore/LengthFunctions.h>
+#import <WebCore/PlatformCAFilters.h>
+#import <WebCore/TiledBacking.h>
+#import <wtf/CurrentTime.h>
+#import <wtf/RetainPtr.h>
+
+using namespace WebCore;
+using namespace WebKit;
+
+static RemoteLayerTreeTransaction::LayerID generateLayerID()
+{
+    static RemoteLayerTreeTransaction::LayerID layerID;
+    return ++layerID;
+}
+
+PassRefPtr<PlatformCALayer> PlatformCALayerRemote::create(LayerType layerType, PlatformCALayerClient* owner, RemoteLayerTreeContext* context)
+{
+    return adoptRef(new PlatformCALayerRemote(layerType, owner, context));
+}
+
+PlatformCALayerRemote::PlatformCALayerRemote(LayerType layerType, PlatformCALayerClient* owner, RemoteLayerTreeContext* context)
+    : PlatformCALayer(owner)
+    , m_layerID(generateLayerID())
+    , m_context(context)
+{
+    m_layerType = layerType;
+}
+
+PassRefPtr<PlatformCALayer> PlatformCALayerRemote::clone(PlatformCALayerClient* owner) const
+{
+    return nullptr;
+}
+
+PlatformCALayerRemote::~PlatformCALayerRemote()
+{
+    m_context->layerWillBeDestroyed(this);
+}
+
+void PlatformCALayerRemote::recursiveBuildTransaction(RemoteLayerTreeTransaction& transaction)
+{
+    if (m_properties.changedProperties != RemoteLayerTreeTransaction::NoChange) {
+        if (m_properties.changedProperties & RemoteLayerTreeTransaction::ChildrenChanged) {
+            m_properties.children.clear();
+            for (auto layer : m_children)
+                m_properties.children.append(static_cast<PlatformCALayerRemote*>(layer.get())->layerID());
+        }
+
+        transaction.layerPropertiesChanged(this, m_properties);
+        m_properties.changedProperties = RemoteLayerTreeTransaction::NoChange;
+    }
+
+    for (size_t i = 0; i < m_children.size(); ++i) {
+        PlatformCALayerRemote* child = static_cast<PlatformCALayerRemote*>(m_children[i].get());
+        child->recursiveBuildTransaction(transaction);
+    }
+}
+
+void PlatformCALayerRemote::animationStarted(CFTimeInterval beginTime)
+{
+}
+
+void PlatformCALayerRemote::setNeedsDisplay(const FloatRect* dirtyRect)
+{
+}
+
+void PlatformCALayerRemote::setContentsChanged()
+{
+}
+
+PlatformCALayer* PlatformCALayerRemote::superlayer() const
+{
+    return nullptr;
+}
+
+void PlatformCALayerRemote::removeFromSuperlayer()
+{
+}
+
+void PlatformCALayerRemote::setSublayers(const PlatformCALayerList& list)
+{
+    m_children = list;
+    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
+}
+
+void PlatformCALayerRemote::removeAllSublayers()
+{
+    m_children.clear();
+    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
+}
+
+void PlatformCALayerRemote::appendSublayer(PlatformCALayer* layer)
+{
+    m_children.append(layer);
+    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
+}
+
+void PlatformCALayerRemote::insertSublayer(PlatformCALayer* layer, size_t index)
+{
+    m_children.insert(index, layer);
+    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
+}
+
+void PlatformCALayerRemote::replaceSublayer(PlatformCALayer* reference, PlatformCALayer* layer)
+{
+}
+
+void PlatformCALayerRemote::adoptSublayers(PlatformCALayer* source)
+{
+}
+
+void PlatformCALayerRemote::addAnimationForKey(const String& key, PlatformCAAnimation* animation)
+{
+}
+
+void PlatformCALayerRemote::removeAnimationForKey(const String& key)
+{
+}
+
+PassRefPtr<PlatformCAAnimation> PlatformCALayerRemote::animationForKey(const String& key)
+{
+    return nullptr;
+}
+
+void PlatformCALayerRemote::setMask(PlatformCALayer* layer)
+{
+}
+
+bool PlatformCALayerRemote::isOpaque() const
+{
+    return false;
+}
+
+void PlatformCALayerRemote::setOpaque(bool value)
+{
+}
+
+FloatRect PlatformCALayerRemote::bounds() const
+{
+    return FloatRect(FloatPoint(), m_properties.size);
+}
+
+void PlatformCALayerRemote::setBounds(const FloatRect& value)
+{
+    m_properties.size = value.size();
+    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::SizeChanged);
+}
+
+FloatPoint3D PlatformCALayerRemote::position() const
+{
+    return m_properties.position;
+}
+
+void PlatformCALayerRemote::setPosition(const FloatPoint3D& value)
+{
+    m_properties.position = value;
+    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::PositionChanged);
+}
+
+FloatPoint3D PlatformCALayerRemote::anchorPoint() const
+{
+    return m_properties.anchorPoint;
+}
+
+void PlatformCALayerRemote::setAnchorPoint(const FloatPoint3D& value)
+{
+    m_properties.anchorPoint = value;
+    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::AnchorPointChanged);
+}
+
+TransformationMatrix PlatformCALayerRemote::transform() const
+{
+    return TransformationMatrix();
+}
+
+void PlatformCALayerRemote::setTransform(const TransformationMatrix& value)
+{
+}
+
+TransformationMatrix PlatformCALayerRemote::sublayerTransform() const
+{
+    return TransformationMatrix();
+}
+
+void PlatformCALayerRemote::setSublayerTransform(const TransformationMatrix& value)
+{
+}
+
+void PlatformCALayerRemote::setHidden(bool value)
+{
+}
+
+void PlatformCALayerRemote::setGeometryFlipped(bool value)
+{
+}
+
+bool PlatformCALayerRemote::isDoubleSided() const
+{
+    return false;
+}
+
+void PlatformCALayerRemote::setDoubleSided(bool value)
+{
+}
+
+bool PlatformCALayerRemote::masksToBounds() const
+{
+    return false;
+}
+
+void PlatformCALayerRemote::setMasksToBounds(bool value)
+{
+}
+
+bool PlatformCALayerRemote::acceleratesDrawing() const
+{
+    return false;
+}
+
+void PlatformCALayerRemote::setAcceleratesDrawing(bool acceleratesDrawing)
+{
+}
+
+CFTypeRef PlatformCALayerRemote::contents() const
+{
+    return nullptr;
+}
+
+void PlatformCALayerRemote::setContents(CFTypeRef value)
+{
+}
+
+void PlatformCALayerRemote::setContentsRect(const FloatRect& value)
+{
+}
+
+void PlatformCALayerRemote::setMinificationFilter(FilterType value)
+{
+}
+
+void PlatformCALayerRemote::setMagnificationFilter(FilterType value)
+{
+}
+
+Color PlatformCALayerRemote::backgroundColor() const
+{
+    return m_properties.backgroundColor;
+}
+
+void PlatformCALayerRemote::setBackgroundColor(const Color& value)
+{
+    m_properties.backgroundColor = value;
+    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BackgroundColorChanged);
+}
+
+void PlatformCALayerRemote::setBorderWidth(float value)
+{
+}
+
+void PlatformCALayerRemote::setBorderColor(const Color& value)
+{
+}
+
+float PlatformCALayerRemote::opacity() const
+{
+    return 0;
+}
+
+void PlatformCALayerRemote::setOpacity(float value)
+{
+}
+
+#if ENABLE(CSS_FILTERS)
+void PlatformCALayerRemote::setFilters(const FilterOperations& filters)
+{
+}
+
+void PlatformCALayerRemote::copyFiltersFrom(const PlatformCALayer* sourceLayer)
+{
+}
+
+bool PlatformCALayerRemote::filtersCanBeComposited(const FilterOperations& filters)
+{
+    return false; // This will probably work the same as Mac eventually?
+}
+#endif
+
+void PlatformCALayerRemote::setName(const String& value)
+{
+}
+
+void PlatformCALayerRemote::setFrame(const FloatRect& value)
+{
+}
+
+void PlatformCALayerRemote::setSpeed(float value)
+{
+}
+
+void PlatformCALayerRemote::setTimeOffset(CFTimeInterval value)
+{
+}
+
+float PlatformCALayerRemote::contentsScale() const
+{
+    return 0;
+}
+
+void PlatformCALayerRemote::setContentsScale(float value)
+{
+}
+
+TiledBacking* PlatformCALayerRemote::tiledBacking()
+{
+    return nullptr;
+}
+
+void PlatformCALayerRemote::synchronouslyDisplayTilesInRect(const FloatRect& rect)
+{
+}
+
+AVPlayerLayer* PlatformCALayerRemote::playerLayer() const
+{
+    return nullptr;
+}
+
+#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h b/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h
new file mode 100644 (file)
index 0000000..0ca7919
--- /dev/null
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PlatformCALayerRemote_h
+#define PlatformCALayerRemote_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include "RemoteLayerTreeTransaction.h"
+
+#include <WebCore/PlatformCALayer.h>
+#include <WebCore/PlatformLayer.h>
+
+namespace WebKit {
+
+class RemoteLayerTreeContext;
+
+class PlatformCALayerRemote FINAL : public WebCore::PlatformCALayer {
+public:
+    static PassRefPtr<PlatformCALayer> create(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext*);
+
+    ~PlatformCALayerRemote();
+
+    RemoteLayerTreeTransaction::LayerID layerID() { return m_layerID; }
+
+    virtual bool usesTiledBackingLayer() const OVERRIDE { return false; }
+
+    virtual PlatformLayer* platformLayer() const OVERRIDE { return nullptr; }
+
+    void recursiveBuildTransaction(RemoteLayerTreeTransaction&);
+
+    virtual void setNeedsDisplay(const WebCore::FloatRect* dirtyRect = 0) OVERRIDE;
+
+    virtual void setContentsChanged() OVERRIDE;
+
+    virtual WebCore::PlatformCALayer* superlayer() const OVERRIDE;
+    virtual void removeFromSuperlayer() OVERRIDE;
+    virtual void setSublayers(const WebCore::PlatformCALayerList&) OVERRIDE;
+    virtual void removeAllSublayers() OVERRIDE;
+    virtual void appendSublayer(WebCore::PlatformCALayer*) OVERRIDE;
+    virtual void insertSublayer(WebCore::PlatformCALayer*, size_t index) OVERRIDE;
+    virtual void replaceSublayer(WebCore::PlatformCALayer* reference, WebCore::PlatformCALayer*) OVERRIDE;
+    virtual const WebCore::PlatformCALayerList* customSublayers() const OVERRIDE { return nullptr; }
+    virtual void adoptSublayers(WebCore::PlatformCALayer* source) OVERRIDE;
+
+    virtual void addAnimationForKey(const String& key, WebCore::PlatformCAAnimation*) OVERRIDE;
+    virtual void removeAnimationForKey(const String& key) OVERRIDE;
+    virtual PassRefPtr<WebCore::PlatformCAAnimation> animationForKey(const String& key) OVERRIDE;
+    virtual void animationStarted(CFTimeInterval beginTime) OVERRIDE;
+
+    virtual void setMask(WebCore::PlatformCALayer*) OVERRIDE;
+
+    virtual bool isOpaque() const OVERRIDE;
+    virtual void setOpaque(bool) OVERRIDE;
+
+    virtual WebCore::FloatRect bounds() const OVERRIDE;
+    virtual void setBounds(const WebCore::FloatRect&) OVERRIDE;
+
+    virtual WebCore::FloatPoint3D position() const OVERRIDE;
+    virtual void setPosition(const WebCore::FloatPoint3D&) OVERRIDE;
+
+    virtual WebCore::FloatPoint3D anchorPoint() const OVERRIDE;
+    virtual void setAnchorPoint(const WebCore::FloatPoint3D&) OVERRIDE;
+
+    virtual WebCore::TransformationMatrix transform() const OVERRIDE;
+    virtual void setTransform(const WebCore::TransformationMatrix&) OVERRIDE;
+
+    virtual WebCore::TransformationMatrix sublayerTransform() const OVERRIDE;
+    virtual void setSublayerTransform(const WebCore::TransformationMatrix&) OVERRIDE;
+
+    virtual void setHidden(bool) OVERRIDE;
+
+    virtual void setGeometryFlipped(bool) OVERRIDE;
+
+    virtual bool isDoubleSided() const OVERRIDE;
+    virtual void setDoubleSided(bool) OVERRIDE;
+
+    virtual bool masksToBounds() const OVERRIDE;
+    virtual void setMasksToBounds(bool) OVERRIDE;
+
+    virtual bool acceleratesDrawing() const OVERRIDE;
+    virtual void setAcceleratesDrawing(bool) OVERRIDE;
+
+    virtual CFTypeRef contents() const OVERRIDE;
+    virtual void setContents(CFTypeRef) OVERRIDE;
+
+    virtual void setContentsRect(const WebCore::FloatRect&) OVERRIDE;
+
+    virtual void setMinificationFilter(WebCore::PlatformCALayer::FilterType) OVERRIDE;
+    virtual void setMagnificationFilter(WebCore::PlatformCALayer::FilterType) OVERRIDE;
+
+    virtual WebCore::Color backgroundColor() const OVERRIDE;
+    virtual void setBackgroundColor(const WebCore::Color&) OVERRIDE;
+
+    virtual void setBorderWidth(float) OVERRIDE;
+
+    virtual void setBorderColor(const WebCore::Color&) OVERRIDE;
+
+    virtual float opacity() const OVERRIDE;
+    virtual void setOpacity(float) OVERRIDE;
+
+#if ENABLE(CSS_FILTERS)
+    virtual void setFilters(const WebCore::FilterOperations&) OVERRIDE;
+    static bool filtersCanBeComposited(const WebCore::FilterOperations&);
+    virtual void copyFiltersFrom(const WebCore::PlatformCALayer*) OVERRIDE;
+#endif
+
+    virtual void setName(const String&) OVERRIDE;
+
+    virtual void setFrame(const WebCore::FloatRect&) OVERRIDE;
+
+    virtual void setSpeed(float) OVERRIDE;
+
+    virtual void setTimeOffset(CFTimeInterval) OVERRIDE;
+
+    virtual float contentsScale() const OVERRIDE;
+    virtual void setContentsScale(float) OVERRIDE;
+
+    virtual WebCore::TiledBacking* tiledBacking() OVERRIDE;
+
+    virtual void synchronouslyDisplayTilesInRect(const WebCore::FloatRect&) OVERRIDE;
+
+    virtual PassRefPtr<WebCore::PlatformCALayer> clone(WebCore::PlatformCALayerClient* owner) const OVERRIDE;
+
+private:
+    PlatformCALayerRemote(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext* context);
+
+    virtual AVPlayerLayer* playerLayer() const OVERRIDE;
+
+    RemoteLayerTreeTransaction::LayerID m_layerID;
+    RemoteLayerTreeTransaction::LayerProperties m_properties;
+    WebCore::PlatformCALayerList m_children;
+
+    RemoteLayerTreeContext* m_context;
+};
+
+} // namespace WebKit
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif // PlatformCALayerRemote_h
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/RemoteGraphicsLayer.h b/Source/WebKit2/WebProcess/WebPage/mac/RemoteGraphicsLayer.h
deleted file mode 100644 (file)
index 1bc3926..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef RemoteGraphicsLayer_h
-#define RemoteGraphicsLayer_h
-
-#include <WebCore/GraphicsLayer.h>
-
-namespace WebKit {
-
-class RemoteLayerTreeContext;
-
-class RemoteGraphicsLayer : public WebCore::GraphicsLayer {
-public:
-    RemoteGraphicsLayer(WebCore::GraphicsLayerClient*, RemoteLayerTreeContext*);
-    virtual ~RemoteGraphicsLayer();
-
-    uint64_t layerID() const { return m_layerID; }
-
-private:
-    // WebCore::GraphicsLayer
-    virtual void setName(const String&) OVERRIDE;
-
-    virtual bool setChildren(const Vector<WebCore::GraphicsLayer*>&);
-    virtual void addChild(WebCore::GraphicsLayer*);
-    virtual void addChildAtIndex(WebCore::GraphicsLayer*, int index);
-    virtual void addChildAbove(WebCore::GraphicsLayer* childLayer, WebCore::GraphicsLayer* sibling);
-    virtual void addChildBelow(WebCore::GraphicsLayer* childLayer, WebCore::GraphicsLayer* sibling);
-    virtual bool replaceChild(WebCore::GraphicsLayer* oldChild, WebCore::GraphicsLayer* newChild);
-
-    virtual void removeFromParent() OVERRIDE;
-
-    virtual void setPosition(const WebCore::FloatPoint&) OVERRIDE;
-    virtual void setSize(const WebCore::FloatSize&) OVERRIDE;
-
-    virtual void setNeedsDisplay() OVERRIDE;
-    virtual void setNeedsDisplayInRect(const WebCore::FloatRect&) OVERRIDE;
-    virtual void flushCompositingState(const WebCore::FloatRect&) OVERRIDE;
-    virtual void flushCompositingStateForThisLayerOnly() OVERRIDE;
-
-    virtual void willBeDestroyed() OVERRIDE;
-
-    void noteLayerPropertiesChanged(unsigned layerChanges);
-    void noteSublayersChanged();
-
-    void recursiveCommitChanges();
-
-    uint64_t m_layerID;
-    RemoteLayerTreeContext* m_context;
-    unsigned m_uncommittedLayerChanges;
-};
-
-} // namespace WebKit
-
-#endif // RemoteGraphicsLayer_h
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/RemoteGraphicsLayer.mm b/Source/WebKit2/WebProcess/WebPage/mac/RemoteGraphicsLayer.mm
deleted file mode 100644 (file)
index 043675d..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "RemoteGraphicsLayer.h"
-
-#include "RemoteLayerTreeContext.h"
-#include "RemoteLayerTreeTransaction.h"
-
-#include <WebCore/FloatRect.h>
-#include <wtf/text/CString.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-static uint64_t generateLayerID()
-{
-    static uint64_t layerID;
-    return ++layerID;
-}
-
-RemoteGraphicsLayer::RemoteGraphicsLayer(GraphicsLayerClient* client, RemoteLayerTreeContext* context)
-    : GraphicsLayer(client)
-    , m_layerID(generateLayerID())
-    , m_context(context)
-    , m_uncommittedLayerChanges(RemoteLayerTreeTransaction::NoChange)
-{
-}
-
-RemoteGraphicsLayer::~RemoteGraphicsLayer()
-{
-    willBeDestroyed();
-}
-
-void RemoteGraphicsLayer::setName(const String& name)
-{
-    String longName = String::format("RemoteGraphicsLayer(%p) ", this) + name;
-    GraphicsLayer::setName(longName);
-
-    noteLayerPropertiesChanged(RemoteLayerTreeTransaction::NameChanged);
-}
-
-bool RemoteGraphicsLayer::setChildren(const Vector<GraphicsLayer*>& children)
-{
-    if (GraphicsLayer::setChildren(children)) {
-        noteSublayersChanged();
-        return true;
-    }
-
-    return false;
-}
-
-void RemoteGraphicsLayer::addChild(GraphicsLayer* childLayer)
-{
-    GraphicsLayer::addChild(childLayer);
-    noteSublayersChanged();
-}
-
-void RemoteGraphicsLayer::addChildAtIndex(GraphicsLayer* childLayer, int index)
-{
-    GraphicsLayer::addChildAtIndex(childLayer, index);
-    noteSublayersChanged();
-}
-
-void RemoteGraphicsLayer::addChildAbove(GraphicsLayer* childLayer, GraphicsLayer* sibling)
-{
-    GraphicsLayer::addChildAbove(childLayer, sibling);
-    noteSublayersChanged();
-}
-
-void RemoteGraphicsLayer::addChildBelow(GraphicsLayer* childLayer, GraphicsLayer* sibling)
-{
-    GraphicsLayer::addChildBelow(childLayer, sibling);
-    noteSublayersChanged();
-}
-
-bool RemoteGraphicsLayer::replaceChild(GraphicsLayer* oldChild, GraphicsLayer* newChild)
-{
-    if (GraphicsLayer::replaceChild(oldChild, newChild)) {
-        noteSublayersChanged();
-        return true;
-    }
-
-    return false;
-}
-
-void RemoteGraphicsLayer::removeFromParent()
-{
-    if (m_parent)
-        static_cast<RemoteGraphicsLayer*>(m_parent)->noteSublayersChanged();
-    GraphicsLayer::removeFromParent();
-}
-
-void RemoteGraphicsLayer::setPosition(const FloatPoint& position)
-{
-    if (position == m_position)
-        return;
-
-    GraphicsLayer::setPosition(position);
-    noteLayerPropertiesChanged(RemoteLayerTreeTransaction::PositionChanged);
-}
-
-void RemoteGraphicsLayer::setSize(const FloatSize& size)
-{
-    if (size == m_size)
-        return;
-
-    GraphicsLayer::setSize(size);
-    noteLayerPropertiesChanged(RemoteLayerTreeTransaction::SizeChanged);
-}
-
-void RemoteGraphicsLayer::setNeedsDisplay()
-{
-    FloatRect hugeRect(-std::numeric_limits<float>::max() / 2, -std::numeric_limits<float>::max() / 2,
-                       std::numeric_limits<float>::max(), std::numeric_limits<float>::max());
-    setNeedsDisplayInRect(hugeRect);
-}
-
-void RemoteGraphicsLayer::setNeedsDisplayInRect(const FloatRect&)
-{
-    // FIXME: Implement this.
-}
-
-void RemoteGraphicsLayer::flushCompositingState(const FloatRect&)
-{
-    recursiveCommitChanges();
-}
-
-void RemoteGraphicsLayer::flushCompositingStateForThisLayerOnly()
-{
-    if (!m_uncommittedLayerChanges)
-        return;
-
-    m_context->currentTransaction().layerPropertiesChanged(this, m_uncommittedLayerChanges);
-
-    m_uncommittedLayerChanges = RemoteLayerTreeTransaction::NoChange;
-}
-
-void RemoteGraphicsLayer::willBeDestroyed()
-{
-    m_context->layerWillBeDestroyed(this);
-    GraphicsLayer::willBeDestroyed();
-}
-
-void RemoteGraphicsLayer::noteLayerPropertiesChanged(unsigned layerChanges)
-{
-    if (!m_uncommittedLayerChanges && m_client)
-        m_client->notifyFlushRequired(this);
-    m_uncommittedLayerChanges |= layerChanges;
-}
-
-void RemoteGraphicsLayer::noteSublayersChanged()
-{
-    noteLayerPropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
-
-    // FIXME: Handle replica layers.
-}
-
-void RemoteGraphicsLayer::recursiveCommitChanges()
-{
-    flushCompositingStateForThisLayerOnly();
-
-    for (size_t i = 0; i < children().size(); ++i) {
-        RemoteGraphicsLayer* graphicsLayer = static_cast<RemoteGraphicsLayer*>(children()[i]);
-        graphicsLayer->recursiveCommitChanges();
-    }
-}
-
-} // namespace WebKit
index 4dd95b3..f24ac44 100644 (file)
@@ -32,8 +32,7 @@
 
 namespace WebKit {
 
-class RemoteGraphicsLayer;
-class RemoteLayerTreeTransaction;
+class PlatformCALayerRemote;
 class WebPage;
 
 class RemoteLayerTreeContext : public WebCore::GraphicsLayerFactory {
@@ -42,11 +41,10 @@ public:
     ~RemoteLayerTreeContext();
 
     void setRootLayer(WebCore::GraphicsLayer*);
-    void layerWillBeDestroyed(RemoteGraphicsLayer*);
 
     void scheduleLayerFlush();
 
-    RemoteLayerTreeTransaction& currentTransaction();
+    void layerWillBeDestroyed(PlatformCALayerRemote*);
 
 private:
     // WebCore::GraphicsLayerFactory
@@ -58,9 +56,9 @@ private:
     WebPage* m_webPage;
     WebCore::Timer<RemoteLayerTreeContext> m_layerFlushTimer;
 
-    uint64_t m_rootLayerID;
+    RefPtr<PlatformCALayerRemote> m_rootLayer;
+
     Vector<uint64_t> m_destroyedLayers;
-    RemoteLayerTreeTransaction* m_currentTransaction;
 };
 
 } // namespace WebKit
index abf1a66..2b40f3b 100644 (file)
@@ -26,7 +26,8 @@
 #import "config.h"
 #import "RemoteLayerTreeContext.h"
 
-#import "RemoteGraphicsLayer.h"
+#import "GraphicsLayerCARemote.h"
+#import "PlatformCALayerRemote.h"
 #import "RemoteLayerTreeTransaction.h"
 #import "RemoteLayerTreeHostMessages.h"
 #import "WebPage.h"
@@ -42,8 +43,6 @@ namespace WebKit {
 RemoteLayerTreeContext::RemoteLayerTreeContext(WebPage* webPage)
     : m_webPage(webPage)
     , m_layerFlushTimer(this, &RemoteLayerTreeContext::layerFlushTimerFired)
-    , m_rootLayerID(0)
-    , m_currentTransaction(nullptr)
 {
 }
 
@@ -53,16 +52,18 @@ RemoteLayerTreeContext::~RemoteLayerTreeContext()
 
 void RemoteLayerTreeContext::setRootLayer(GraphicsLayer* rootLayer)
 {
-    ASSERT(rootLayer);
+    if (!rootLayer) {
+        m_rootLayer = nullptr;
+        return;
+    }
 
-    m_rootLayerID = static_cast<RemoteGraphicsLayer*>(rootLayer)->layerID();
+    m_rootLayer = static_cast<PlatformCALayerRemote*>(static_cast<GraphicsLayerCARemote*>(rootLayer)->platformCALayer());
 }
 
-void RemoteLayerTreeContext::layerWillBeDestroyed(RemoteGraphicsLayer* graphicsLayer)
+void RemoteLayerTreeContext::layerWillBeDestroyed(PlatformCALayerRemote* layer)
 {
-    ASSERT(!m_destroyedLayers.contains(graphicsLayer->layerID()));
-
-    m_destroyedLayers.append(graphicsLayer->layerID());
+    ASSERT(!m_destroyedLayers.contains(layer->layerID()));
+    m_destroyedLayers.append(layer->layerID());
 }
 
 void RemoteLayerTreeContext::scheduleLayerFlush()
@@ -73,16 +74,9 @@ void RemoteLayerTreeContext::scheduleLayerFlush()
     m_layerFlushTimer.startOneShot(0);
 }
 
-RemoteLayerTreeTransaction& RemoteLayerTreeContext::currentTransaction()
-{
-    ASSERT(m_currentTransaction);
-
-    return *m_currentTransaction;
-}
-
 std::unique_ptr<GraphicsLayer> RemoteLayerTreeContext::createGraphicsLayer(GraphicsLayerClient* client)
 {
-    return std::make_unique<RemoteGraphicsLayer>(client, this);
+    return std::make_unique<GraphicsLayerCARemote>(client, this);
 }
 
 void RemoteLayerTreeContext::layerFlushTimerFired(WebCore::Timer<RemoteLayerTreeContext>*)
@@ -92,17 +86,19 @@ void RemoteLayerTreeContext::layerFlushTimerFired(WebCore::Timer<RemoteLayerTree
 
 void RemoteLayerTreeContext::flushLayers()
 {
-    ASSERT(!m_currentTransaction);
+    if (!m_rootLayer)
+        return;
 
     RemoteLayerTreeTransaction transaction;
-    transaction.setRootLayerID(m_rootLayerID);
-    transaction.setDestroyedLayerIDs(std::move(m_destroyedLayers));
 
-    TemporaryChange<RemoteLayerTreeTransaction*> transactionChange(m_currentTransaction, &transaction);
+    transaction.setRootLayerID(m_rootLayer->layerID());
+    transaction.setDestroyedLayerIDs(std::move(m_destroyedLayers));
 
     m_webPage->layoutIfNeeded();
     m_webPage->corePage()->mainFrame().view()->flushCompositingStateIncludingSubframes();
 
+    m_rootLayer->recursiveBuildTransaction(transaction);
+
     m_webPage->send(Messages::RemoteLayerTreeHost::Commit(transaction));
 }
 
index c6863ce..f220c15 100644 (file)
@@ -42,12 +42,13 @@ private:
     virtual void setNeedsDisplay() OVERRIDE;
     virtual void setNeedsDisplayInRect(const WebCore::IntRect&) OVERRIDE;
     virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollDelta) OVERRIDE;
+    virtual void updateGeometry(const WebCore::IntSize& viewSize, const WebCore::IntSize& layerPosition) OVERRIDE;
 
     virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() OVERRIDE;
     virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) OVERRIDE;
     virtual void scheduleCompositingLayerFlush() OVERRIDE;
 
-    std::unique_ptr<RemoteLayerTreeContext> m_RemoteLayerTreeContext;
+    std::unique_ptr<RemoteLayerTreeContext> m_remoteLayerTreeContext;
 };
 
 } // namespace WebKit
index 0ca0997..ce4f37c 100644 (file)
@@ -26,7 +26,9 @@
 #import "config.h"
 #import "RemoteLayerTreeDrawingArea.h"
 
+#import "DrawingAreaProxyMessages.h"
 #import "RemoteLayerTreeContext.h"
+#import "WebPage.h"
 
 using namespace WebCore;
 
@@ -34,7 +36,7 @@ namespace WebKit {
 
 RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea(WebPage* webPage, const WebPageCreationParameters&)
     : DrawingArea(DrawingAreaTypeRemoteLayerTree, webPage)
-    , m_RemoteLayerTreeContext(std::make_unique<RemoteLayerTreeContext>(webPage))
+    , m_remoteLayerTreeContext(std::make_unique<RemoteLayerTreeContext>(webPage))
 {
 }
 
@@ -56,17 +58,25 @@ void RemoteLayerTreeDrawingArea::scroll(const IntRect& scrollRect, const IntSize
 
 GraphicsLayerFactory* RemoteLayerTreeDrawingArea::graphicsLayerFactory()
 {
-    return m_RemoteLayerTreeContext.get();
+    return m_remoteLayerTreeContext.get();
 }
 
 void RemoteLayerTreeDrawingArea::setRootCompositingLayer(GraphicsLayer* rootLayer)
 {
-    m_RemoteLayerTreeContext->setRootLayer(rootLayer);
+    m_remoteLayerTreeContext->setRootLayer(rootLayer);
 }
 
 void RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlush()
 {
-    m_RemoteLayerTreeContext->scheduleLayerFlush();
+    m_remoteLayerTreeContext->scheduleLayerFlush();
+}
+
+void RemoteLayerTreeDrawingArea::updateGeometry(const IntSize& viewSize, const IntSize& layerPosition)
+{
+    m_webPage->setSize(viewSize);
+    scheduleCompositingLayerFlush();
+
+    m_webPage->send(Messages::DrawingAreaProxy::DidUpdateGeometry());
 }
 
 } // namespace WebKit