Title: [134336] trunk/Source/WebKit2
Revision
134336
Author
[email protected]
Date
2012-11-12 18:10:09 -0800 (Mon, 12 Nov 2012)

Log Message

Include child layers in the remote layer tree transaction
https://bugs.webkit.org/show_bug.cgi?id=102026

Reviewed by Andreas Kling.

* Shared/mac/RemoteLayerTreeTransaction.h:
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
Encode and decode child layer IDs.

(WebKit::RemoteLayerTreeTransaction::layerPropertiesChanged):
Grab all child layer IDs and stick them in a vector.

(WebKit::dumpChangedLayers):
Dump child layer IDs as well.

* WebProcess/WebPage/mac/RemoteGraphicsLayer.h:
* WebProcess/WebPage/mac/RemoteGraphicsLayer.mm:
(WebKit::RemoteGraphicsLayer::setChildren):
(WebKit::RemoteGraphicsLayer::addChild):
(WebKit::RemoteGraphicsLayer::addChildAtIndex):
(WebKit::RemoteGraphicsLayer::addChildAbove):
(WebKit::RemoteGraphicsLayer::addChildBelow):
(WebKit::RemoteGraphicsLayer::replaceChild):
Call noteSublayersChanged.

(WebKit::RemoteGraphicsLayer::noteSublayersChanged):
Note that the Children property changed.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (134335 => 134336)


--- trunk/Source/WebKit2/ChangeLog	2012-11-13 02:09:45 UTC (rev 134335)
+++ trunk/Source/WebKit2/ChangeLog	2012-11-13 02:10:09 UTC (rev 134336)
@@ -1,5 +1,37 @@
 2012-11-12  Anders Carlsson  <[email protected]>
 
+        Include child layers in the remote layer tree transaction
+        https://bugs.webkit.org/show_bug.cgi?id=102026
+
+        Reviewed by Andreas Kling.
+
+        * Shared/mac/RemoteLayerTreeTransaction.h:
+        * Shared/mac/RemoteLayerTreeTransaction.mm:
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
+        Encode and decode child layer IDs.
+
+        (WebKit::RemoteLayerTreeTransaction::layerPropertiesChanged):
+        Grab all child layer IDs and stick them in a vector.
+
+        (WebKit::dumpChangedLayers):
+        Dump child layer IDs as well.
+
+        * WebProcess/WebPage/mac/RemoteGraphicsLayer.h:
+        * WebProcess/WebPage/mac/RemoteGraphicsLayer.mm:
+        (WebKit::RemoteGraphicsLayer::setChildren):
+        (WebKit::RemoteGraphicsLayer::addChild):
+        (WebKit::RemoteGraphicsLayer::addChildAtIndex):
+        (WebKit::RemoteGraphicsLayer::addChildAbove):
+        (WebKit::RemoteGraphicsLayer::addChildBelow):
+        (WebKit::RemoteGraphicsLayer::replaceChild):
+        Call noteSublayersChanged.
+
+        (WebKit::RemoteGraphicsLayer::noteSublayersChanged):
+        Note that the Children property changed.
+
+2012-11-12  Anders Carlsson  <[email protected]>
+
         Send along the current remote layer tree transaction with the commit message
         https://bugs.webkit.org/show_bug.cgi?id=102014
 

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (134335 => 134336)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h	2012-11-13 02:09:45 UTC (rev 134335)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h	2012-11-13 02:10:09 UTC (rev 134336)
@@ -43,6 +43,7 @@
     enum LayerChange {
         NoChange = 0,
         NameChanged = 1 << 1,
+        ChildrenChanged = 1 << 2,
     };
 
     struct LayerProperties {
@@ -54,6 +55,7 @@
         unsigned changedProperties;
 
         String name;
+        Vector<uint64_t> children;
     };
 
     RemoteLayerTreeTransaction();

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (134335 => 134336)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm	2012-11-13 02:09:45 UTC (rev 134335)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm	2012-11-13 02:10:09 UTC (rev 134336)
@@ -33,6 +33,8 @@
 #include <wtf/text/CString.h>
 #include <wtf/text/StringBuilder.h>
 
+using namespace WebCore;
+
 namespace WebKit {
 
 RemoteLayerTreeTransaction::LayerProperties::LayerProperties()
@@ -46,6 +48,9 @@
 
     if (changedProperties & NameChanged)
         encoder << name;
+
+    if (changedProperties & ChildrenChanged)
+        encoder << children;
 }
 
 bool RemoteLayerTreeTransaction::LayerProperties::decode(CoreIPC::ArgumentDecoder* decoder, LayerProperties& result)
@@ -58,6 +63,16 @@
             return false;
     }
 
+    if (result.changedProperties & ChildrenChanged) {
+        if (!decoder->decode(result.children))
+            return false;
+
+        for (auto layerID: result.children) {
+            if (!layerID)
+                return false;
+        }
+    }
+
     return true;
 }
 
@@ -90,6 +105,17 @@
 
     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());
+        }
+    }
 }
 
 #ifndef NDEBUG
@@ -128,6 +154,19 @@
             builder.append("\")");
         }
 
+        if (layerProperties.changedProperties & RemoteLayerTreeTransaction::ChildrenChanged) {
+            builder.append('\n');
+            writeIndent(builder, 3);
+            builder.append("(children (");
+            for (size_t i = 0; i < layerProperties.children.size(); ++i) {
+                if (i != 0)
+                    builder.append(' ');
+                builder.appendNumber(layerProperties.children[i]);
+            }
+
+            builder.append(")");
+        }
+
         builder.append(")\n");
     }
 }

Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm (134335 => 134336)


--- trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm	2012-11-13 02:09:45 UTC (rev 134335)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm	2012-11-13 02:10:09 UTC (rev 134336)
@@ -51,8 +51,10 @@
 
 void RemoteLayerTreeHost::commit(const RemoteLayerTreeTransaction& transaction)
 {
+#ifndef NDEBUG
     // FIXME: Apply the transaction instead of dumping it to stderr.
     transaction.dump();
+#endif
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteGraphicsLayer.h (134335 => 134336)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteGraphicsLayer.h	2012-11-13 02:09:45 UTC (rev 134335)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteGraphicsLayer.h	2012-11-13 02:10:09 UTC (rev 134336)
@@ -44,12 +44,22 @@
 
     // 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 setNeedsDisplay() OVERRIDE;
     virtual void setNeedsDisplayInRect(const WebCore::FloatRect&) OVERRIDE;
     virtual void flushCompositingState(const WebCore::FloatRect&) OVERRIDE;
     virtual void flushCompositingStateForThisLayerOnly() OVERRIDE;
 
     void noteLayerPropertiesChanged(unsigned layerChanges);
+    void noteSublayersChanged();
+
     void recursiveCommitChanges();
 
     uint64_t m_layerID;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteGraphicsLayer.mm (134335 => 134336)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteGraphicsLayer.mm	2012-11-13 02:09:45 UTC (rev 134335)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteGraphicsLayer.mm	2012-11-13 02:10:09 UTC (rev 134336)
@@ -66,6 +66,50 @@
     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::setNeedsDisplay()
 {
     FloatRect hugeRect(-std::numeric_limits<float>::max() / 2, -std::numeric_limits<float>::max() / 2,
@@ -100,6 +144,13 @@
     m_uncommittedLayerChanges |= layerChanges;
 }
 
+void RemoteGraphicsLayer::noteSublayersChanged()
+{
+    noteLayerPropertiesChanged(RemoteLayerTreeTransaction::ChildrenChanged);
+
+    // FIXME: Handle replica layers.
+}
+
 void RemoteGraphicsLayer::recursiveCommitChanges()
 {
     flushCompositingStateForThisLayerOnly();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to