Title: [134462] trunk/Source/WebKit2
Revision
134462
Author
[email protected]
Date
2012-11-13 12:11:32 -0800 (Tue, 13 Nov 2012)

Log Message

Store layer positions and sizes in the transaction
https://bugs.webkit.org/show_bug.cgi?id=102115

Reviewed by Andreas Kling.

* Shared/mac/RemoteLayerTreeTransaction.h:
(LayerProperties):
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
(WebKit::RemoteLayerTreeTransaction::layerPropertiesChanged):
(WebKit::dumpChangedLayers):
* WebProcess/WebPage/mac/RemoteGraphicsLayer.h:
(RemoteGraphicsLayer):
* WebProcess/WebPage/mac/RemoteGraphicsLayer.mm:
(WebKit::RemoteGraphicsLayer::setPosition):
(WebKit::RemoteGraphicsLayer::setSize):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (134461 => 134462)


--- trunk/Source/WebKit2/ChangeLog	2012-11-13 20:08:04 UTC (rev 134461)
+++ trunk/Source/WebKit2/ChangeLog	2012-11-13 20:11:32 UTC (rev 134462)
@@ -1,5 +1,25 @@
 2012-11-13  Anders Carlsson  <[email protected]>
 
+        Store layer positions and sizes in the transaction
+        https://bugs.webkit.org/show_bug.cgi?id=102115
+
+        Reviewed by Andreas Kling.
+
+        * Shared/mac/RemoteLayerTreeTransaction.h:
+        (LayerProperties):
+        * Shared/mac/RemoteLayerTreeTransaction.mm:
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
+        (WebKit::RemoteLayerTreeTransaction::layerPropertiesChanged):
+        (WebKit::dumpChangedLayers):
+        * WebProcess/WebPage/mac/RemoteGraphicsLayer.h:
+        (RemoteGraphicsLayer):
+        * WebProcess/WebPage/mac/RemoteGraphicsLayer.mm:
+        (WebKit::RemoteGraphicsLayer::setPosition):
+        (WebKit::RemoteGraphicsLayer::setSize):
+
+2012-11-13  Anders Carlsson  <[email protected]>
+
         The layer tree transaction should include the root layer
         https://bugs.webkit.org/show_bug.cgi?id=102109
 

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (134461 => 134462)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h	2012-11-13 20:08:04 UTC (rev 134461)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h	2012-11-13 20:11:32 UTC (rev 134462)
@@ -26,6 +26,8 @@
 #ifndef RemoteLayerTreeTransaction_h
 #define RemoteLayerTreeTransaction_h
 
+#include <WebCore/FloatPoint.h>
+#include <WebCore/FloatSize.h>
 #include <wtf/HashMap.h>
 #include <wtf/text/WTFString.h>
 
@@ -44,6 +46,8 @@
         NoChange = 0,
         NameChanged = 1 << 1,
         ChildrenChanged = 1 << 2,
+        PositionChanged = 1 << 3,
+        SizeChanged = 1 << 4,
     };
 
     struct LayerProperties {
@@ -56,6 +60,8 @@
 
         String name;
         Vector<uint64_t> children;
+        WebCore::FloatPoint position;
+        WebCore::FloatSize size;
     };
 
     explicit RemoteLayerTreeTransaction();

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (134461 => 134462)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm	2012-11-13 20:08:04 UTC (rev 134461)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm	2012-11-13 20:11:32 UTC (rev 134462)
@@ -30,6 +30,7 @@
 #include "MessageDecoder.h"
 #include "MessageEncoder.h"
 #include "RemoteGraphicsLayer.h"
+#include "WebCoreArgumentCoders.h"
 #include <wtf/text/CString.h>
 #include <wtf/text/StringBuilder.h>
 
@@ -51,6 +52,12 @@
 
     if (changedProperties & ChildrenChanged)
         encoder << children;
+
+    if (changedProperties & PositionChanged)
+        encoder << position;
+
+    if (changedProperties & SizeChanged)
+        encoder << size;
 }
 
 bool RemoteLayerTreeTransaction::LayerProperties::decode(CoreIPC::ArgumentDecoder* decoder, LayerProperties& result)
@@ -73,6 +80,15 @@
         }
     }
 
+    if (result.changedProperties & PositionChanged) {
+        if (!decoder->decode(result.position))
+            return false;
+    }
+
+    if (result.changedProperties & SizeChanged) {
+        if (!decoder->decode(result.size))
+            return false;
+    }
     return true;
 }
 
@@ -129,6 +145,12 @@
             layerProperties.children.uncheckedAppend(childLayer->layerID());
         }
     }
+
+    if (changedProperties & PositionChanged)
+        layerProperties.position = graphicsLayer->position();
+
+    if (changedProperties & SizeChanged)
+        layerProperties.size = graphicsLayer->size();
 }
 
 #ifndef NDEBUG
@@ -180,6 +202,26 @@
             builder.append(")");
         }
 
+        if (layerProperties.changedProperties & RemoteLayerTreeTransaction::PositionChanged) {
+            builder.append('\n');
+            writeIndent(builder, 3);
+            builder.append("(position ");
+            builder.append(String::number(layerProperties.position.x()));
+            builder.append(" ");
+            builder.append(String::number(layerProperties.position.y()));
+            builder.append(')');
+        }
+
+        if (layerProperties.changedProperties & RemoteLayerTreeTransaction::SizeChanged) {
+            builder.append('\n');
+            writeIndent(builder, 3);
+            builder.append("(size ");
+            builder.append(String::number(layerProperties.size.width()));
+            builder.append(" ");
+            builder.append(String::number(layerProperties.size.height()));
+            builder.append(')');
+        }
+
         builder.append(")\n");
     }
 }

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


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteGraphicsLayer.h	2012-11-13 20:08:04 UTC (rev 134461)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteGraphicsLayer.h	2012-11-13 20:11:32 UTC (rev 134462)
@@ -52,6 +52,9 @@
     virtual void addChildBelow(WebCore::GraphicsLayer* childLayer, WebCore::GraphicsLayer* sibling);
     virtual bool replaceChild(WebCore::GraphicsLayer* oldChild, WebCore::GraphicsLayer* newChild);
 
+    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;

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


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteGraphicsLayer.mm	2012-11-13 20:08:04 UTC (rev 134461)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteGraphicsLayer.mm	2012-11-13 20:11:32 UTC (rev 134462)
@@ -110,6 +110,24 @@
     return false;
 }
 
+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,
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to