- Revision
- 159967
- Author
- [email protected]
- Date
- 2013-12-02 14:42:34 -0800 (Mon, 02 Dec 2013)
Log Message
Remote Layer Tree: Support cloning layers
https://bugs.webkit.org/show_bug.cgi?id=124874
<rdar://problem/15349468>
Reviewed by Simon Fraser.
We use PlatformCALayer::clone for CSS reflections, so implement it.
Also, since many reflections testcases also use masks,
working on this revealed that masks weren't working, because
we weren't flushing mask layers.
* Shared/mac/RemoteLayerTreePropertyApplier.mm:
(WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToLayer):
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
Rename maskLayer->maskLayerID since it's a LayerID.
* UIProcess/mac/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::commit):
Don't try to look up the layer if it's null.
* Shared/mac/RemoteLayerTreeTransaction.h:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::notePropertiesChanged):
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
Keep track of all properties that have ever been changed on a layer.
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(PlatformCALayerRemote::create):
(PlatformCALayerRemote::PlatformCALayerRemote):
(PlatformCALayerRemote::clone):
Copy all of the layer properties from the original to the clone,
and mark all properties that have ever been modified as
needing to be flushed to the UI process.
(PlatformCALayerRemote::recursiveBuildTransaction):
Flush our mask layer, if we have one.
(PlatformCALayerRemote::setMask):
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:
Store the mask layer we're given. Our owning GraphicsLayer will
hold on to it for us.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (159966 => 159967)
--- trunk/Source/WebKit2/ChangeLog 2013-12-02 22:36:07 UTC (rev 159966)
+++ trunk/Source/WebKit2/ChangeLog 2013-12-02 22:42:34 UTC (rev 159967)
@@ -1,3 +1,51 @@
+2013-12-02 Tim Horton <[email protected]>
+
+ Remote Layer Tree: Support cloning layers
+ https://bugs.webkit.org/show_bug.cgi?id=124874
+ <rdar://problem/15349468>
+
+ Reviewed by Simon Fraser.
+
+ We use PlatformCALayer::clone for CSS reflections, so implement it.
+
+ Also, since many reflections testcases also use masks,
+ working on this revealed that masks weren't working, because
+ we weren't flushing mask layers.
+
+ * Shared/mac/RemoteLayerTreePropertyApplier.mm:
+ (WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToLayer):
+ * Shared/mac/RemoteLayerTreeTransaction.mm:
+ (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
+ (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
+ (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
+ Rename maskLayer->maskLayerID since it's a LayerID.
+
+ * UIProcess/mac/RemoteLayerTreeHost.mm:
+ (WebKit::RemoteLayerTreeHost::commit):
+ Don't try to look up the layer if it's null.
+
+ * Shared/mac/RemoteLayerTreeTransaction.h:
+ (WebKit::RemoteLayerTreeTransaction::LayerProperties::notePropertiesChanged):
+ * Shared/mac/RemoteLayerTreeTransaction.mm:
+ (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
+ Keep track of all properties that have ever been changed on a layer.
+
+ * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+ (PlatformCALayerRemote::create):
+ (PlatformCALayerRemote::PlatformCALayerRemote):
+ (PlatformCALayerRemote::clone):
+ Copy all of the layer properties from the original to the clone,
+ and mark all properties that have ever been modified as
+ needing to be flushed to the UI process.
+
+ (PlatformCALayerRemote::recursiveBuildTransaction):
+ Flush our mask layer, if we have one.
+
+ (PlatformCALayerRemote::setMask):
+ * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+ Store the mask layer we're given. Our owning GraphicsLayer will
+ hold on to it for us.
+
2013-12-02 Anders Carlsson <[email protected]>
WKPageLoaderClient should be versioned
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm (159966 => 159967)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm 2013-12-02 22:36:07 UTC (rev 159966)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm 2013-12-02 22:42:34 UTC (rev 159967)
@@ -116,10 +116,14 @@
layer.opaque = properties.opaque;
if (properties.changedProperties & RemoteLayerTreeTransaction::MaskLayerChanged) {
- CALayer *maskLayer = relatedLayers.get(properties.maskLayer);
- ASSERT(!maskLayer.superlayer);
- if (!maskLayer.superlayer)
- layer.mask = maskLayer;
+ if (!properties.maskLayerID)
+ layer.mask = nullptr;
+ else {
+ CALayer *maskLayer = relatedLayers.get(properties.maskLayerID);
+ ASSERT(!maskLayer.superlayer);
+ if (!maskLayer.superlayer)
+ layer.mask = maskLayer;
+ }
}
if (properties.changedProperties & RemoteLayerTreeTransaction::ContentsRectChanged)
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (159966 => 159967)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h 2013-12-02 22:36:07 UTC (rev 159966)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h 2013-12-02 22:42:34 UTC (rev 159967)
@@ -97,9 +97,14 @@
void encode(CoreIPC::ArgumentEncoder&) const;
static bool decode(CoreIPC::ArgumentDecoder&, LayerProperties&);
- void notePropertiesChanged(LayerChange layerChanges) { changedProperties = static_cast<LayerChange>(changedProperties | layerChanges); }
+ void notePropertiesChanged(LayerChange layerChanges)
+ {
+ changedProperties = static_cast<LayerChange>(changedProperties | layerChanges);
+ everChangedProperties = static_cast<LayerChange>(everChangedProperties | layerChanges);
+ }
LayerChange changedProperties;
+ LayerChange everChangedProperties;
String name;
Vector<LayerID> children;
@@ -117,7 +122,7 @@
bool doubleSided;
bool masksToBounds;
bool opaque;
- LayerID maskLayer;
+ LayerID maskLayerID;
WebCore::FloatRect contentsRect;
float contentsScale;
WebCore::PlatformCALayer::FilterType minificationFilter;
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (159966 => 159967)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm 2013-12-02 22:36:07 UTC (rev 159966)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm 2013-12-02 22:42:34 UTC (rev 159967)
@@ -70,6 +70,7 @@
RemoteLayerTreeTransaction::LayerProperties::LayerProperties()
: changedProperties(NoChange)
+ , everChangedProperties(NoChange)
{
}
@@ -126,7 +127,7 @@
encoder << opaque;
if (changedProperties & MaskLayerChanged)
- encoder << maskLayer;
+ encoder << maskLayerID;
if (changedProperties & ContentsRectChanged)
encoder << contentsRect;
@@ -247,7 +248,7 @@
}
if (result.changedProperties & MaskLayerChanged) {
- if (!decoder.decode(result.maskLayer))
+ if (!decoder.decode(result.maskLayerID))
return false;
}
@@ -609,7 +610,7 @@
dumpProperty<bool>(ts, "opaque", layerProperties.opaque);
if (layerProperties.changedProperties & RemoteLayerTreeTransaction::MaskLayerChanged)
- dumpProperty<RemoteLayerTreeTransaction::LayerID>(ts, "maskLayer", layerProperties.maskLayer);
+ dumpProperty<RemoteLayerTreeTransaction::LayerID>(ts, "maskLayer", layerProperties.maskLayerID);
if (layerProperties.changedProperties & RemoteLayerTreeTransaction::ContentsRectChanged)
dumpProperty<FloatRect>(ts, "contentsRect", layerProperties.contentsRect);
Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm (159966 => 159967)
--- trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm 2013-12-02 22:36:07 UTC (rev 159966)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm 2013-12-02 22:42:34 UTC (rev 159967)
@@ -80,8 +80,8 @@
relatedLayers.set(child, getLayer(child));
}
- if (properties.changedProperties & RemoteLayerTreeTransaction::MaskLayerChanged)
- relatedLayers.set(properties.maskLayer, getLayer(properties.maskLayer));
+ if (properties.changedProperties & RemoteLayerTreeTransaction::MaskLayerChanged && properties.maskLayerID)
+ relatedLayers.set(properties.maskLayerID, getLayer(properties.maskLayerID));
RemoteLayerTreePropertyApplier::applyPropertiesToLayer(layer, properties, relatedLayers);
}
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (159966 => 159967)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp 2013-12-02 22:36:07 UTC (rev 159966)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp 2013-12-02 22:42:34 UTC (rev 159967)
@@ -59,7 +59,7 @@
return static_cast<PlatformCALayerRemote*>(layer);
}
-PassRefPtr<PlatformCALayer> PlatformCALayerRemote::create(LayerType layerType, PlatformCALayerClient* owner, RemoteLayerTreeContext* context)
+PassRefPtr<PlatformCALayerRemote> PlatformCALayerRemote::create(LayerType layerType, PlatformCALayerClient* owner, RemoteLayerTreeContext* context)
{
RefPtr<PlatformCALayerRemote> layer;
@@ -73,7 +73,7 @@
return layer.release();
}
-PassRefPtr<PlatformCALayer> PlatformCALayerRemote::create(PlatformLayer *platformLayer, PlatformCALayerClient* owner, RemoteLayerTreeContext* context)
+PassRefPtr<PlatformCALayerRemote> PlatformCALayerRemote::create(PlatformLayer *platformLayer, PlatformCALayerClient* owner, RemoteLayerTreeContext* context)
{
RefPtr<PlatformCALayerRemote> layer = adoptRef(new PlatformCALayerRemoteCustom(static_cast<PlatformLayer*>(platformLayer), owner, context));
@@ -86,6 +86,7 @@
: PlatformCALayer(layerType, owner)
, m_layerID(generateLayerID())
, m_superlayer(nullptr)
+ , m_maskLayer(nullptr)
, m_acceleratesDrawing(false)
, m_context(context)
{
@@ -93,9 +94,14 @@
setContentsScale(1);
}
-PassRefPtr<PlatformCALayer> PlatformCALayerRemote::clone(PlatformCALayerClient* owner) const
+PassRefPtr<PlatformCALayer> PlatformCALayerRemote::clone(PlatformCALayerClient* client) const
{
- return nullptr;
+ RefPtr<PlatformCALayerRemote> clone = PlatformCALayerRemote::create(layerType(), client, m_context);
+
+ clone->m_properties = m_properties;
+ clone->m_properties.notePropertiesChanged(static_cast<RemoteLayerTreeTransaction::LayerChange>(m_properties.everChangedProperties & ~RemoteLayerTreeTransaction::BackingStoreChanged));
+
+ return clone.release();
}
PlatformCALayerRemote::~PlatformCALayerRemote()
@@ -132,6 +138,9 @@
ASSERT(child->superlayer() == this);
child->recursiveBuildTransaction(transaction);
}
+
+ if (m_maskLayer)
+ m_maskLayer->recursiveBuildTransaction(transaction);
}
void PlatformCALayerRemote::animationStarted(CFTimeInterval beginTime)
@@ -264,7 +273,14 @@
void PlatformCALayerRemote::setMask(PlatformCALayer* layer)
{
- m_properties.maskLayer = toPlatformCALayerRemote(layer)->layerID();
+ if (layer) {
+ m_maskLayer = toPlatformCALayerRemote(layer);
+ m_properties.maskLayerID = m_maskLayer->layerID();
+ } else {
+ m_maskLayer = nullptr;
+ m_properties.maskLayerID = 0;
+ }
+
m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::MaskLayerChanged);
}
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h (159966 => 159967)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h 2013-12-02 22:36:07 UTC (rev 159966)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h 2013-12-02 22:42:34 UTC (rev 159967)
@@ -39,8 +39,8 @@
class PlatformCALayerRemote : public WebCore::PlatformCALayer {
public:
- static PassRefPtr<PlatformCALayer> create(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext*);
- static PassRefPtr<PlatformCALayer> create(PlatformLayer *, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext*);
+ static PassRefPtr<PlatformCALayerRemote> create(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext*);
+ static PassRefPtr<PlatformCALayerRemote> create(PlatformLayer *, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext*);
virtual ~PlatformCALayerRemote();
@@ -161,6 +161,7 @@
RemoteLayerTreeTransaction::LayerProperties m_properties;
WebCore::PlatformCALayerList m_children;
PlatformCALayerRemote* m_superlayer;
+ PlatformCALayerRemote* m_maskLayer;
bool m_acceleratesDrawing;
RemoteLayerTreeContext* m_context;