[CoordGraphics] Implement sync methods for position, bounds origin
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Oct 2019 15:16:27 +0000 (15:16 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Oct 2019 15:16:27 +0000 (15:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=202398

Reviewed by Carlos Garcia Campos.

Add the CoordinatedGraphicsLayer::syncPosition() and
CoordinatedGraphicsLayer::syncBoundsOrigin() method overrides, both
performing a synchronization of the given GraphicsLayer attribute.

These methods are used by the scrolling code to reflect changes in these
attributes without causing a layer flush (which is not necessary since
the changes have already been applied in an equivalent way).

* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::didChangeGeometry):
(WebCore::CoordinatedGraphicsLayer::syncPosition):
(WebCore::CoordinatedGraphicsLayer::syncBoundsOrigin):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h

index 0a75e43..351b49f 100644 (file)
@@ -1,3 +1,24 @@
+2019-10-01  Zan Dobersek  <zdobersek@igalia.com>
+
+        [CoordGraphics] Implement sync methods for position, bounds origin
+        https://bugs.webkit.org/show_bug.cgi?id=202398
+
+        Reviewed by Carlos Garcia Campos.
+
+        Add the CoordinatedGraphicsLayer::syncPosition() and
+        CoordinatedGraphicsLayer::syncBoundsOrigin() method overrides, both
+        performing a synchronization of the given GraphicsLayer attribute.
+
+        These methods are used by the scrolling code to reflect changes in these
+        attributes without causing a layer flush (which is not necessary since
+        the changes have already been applied in an equivalent way).
+
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
+        (WebCore::CoordinatedGraphicsLayer::didChangeGeometry):
+        (WebCore::CoordinatedGraphicsLayer::syncPosition):
+        (WebCore::CoordinatedGraphicsLayer::syncBoundsOrigin):
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
+
 2019-10-01  Joonghun Park  <jh718.park@samsung.com>
 
         Make table's clientWidth/Height include its border sizes.
index 1b7da85..f067e64 100644 (file)
@@ -106,9 +106,10 @@ void CoordinatedGraphicsLayer::setShouldUpdateVisibleRect()
         downcast<CoordinatedGraphicsLayer>(*replicaLayer()).setShouldUpdateVisibleRect();
 }
 
-void CoordinatedGraphicsLayer::didChangeGeometry()
+void CoordinatedGraphicsLayer::didChangeGeometry(FlushNotification flushNotification)
 {
-    notifyFlushRequired();
+    if (flushNotification == FlushNotification::Required)
+        notifyFlushRequired();
     setShouldUpdateVisibleRect();
 }
 
@@ -238,6 +239,16 @@ void CoordinatedGraphicsLayer::setPosition(const FloatPoint& p)
     didChangeGeometry();
 }
 
+void CoordinatedGraphicsLayer::syncPosition(const FloatPoint& p)
+{
+    if (position() == p)
+        return;
+
+    GraphicsLayer::syncPosition(p);
+    m_nicosia.delta.positionChanged = true;
+    didChangeGeometry(FlushNotification::NotRequired);
+}
+
 void CoordinatedGraphicsLayer::setAnchorPoint(const FloatPoint3D& p)
 {
     if (anchorPoint() == p)
@@ -271,6 +282,16 @@ void CoordinatedGraphicsLayer::setBoundsOrigin(const FloatPoint& boundsOrigin)
     didChangeGeometry();
 }
 
+void CoordinatedGraphicsLayer::syncBoundsOrigin(const FloatPoint& boundsOrigin)
+{
+    if (this->boundsOrigin() == boundsOrigin)
+        return;
+
+    GraphicsLayer::syncBoundsOrigin(boundsOrigin);
+    m_nicosia.delta.boundsOriginChanged = true;
+    didChangeGeometry(FlushNotification::NotRequired);
+}
+
 void CoordinatedGraphicsLayer::setTransform(const TransformationMatrix& t)
 {
     if (transform() == t)
index da8e766..4936d4d 100644 (file)
@@ -73,9 +73,11 @@ public:
     bool replaceChild(GraphicsLayer*, Ref<GraphicsLayer>&&) override;
     void removeFromParent() override;
     void setPosition(const FloatPoint&) override;
+    void syncPosition(const FloatPoint&) override;
     void setAnchorPoint(const FloatPoint3D&) override;
     void setSize(const FloatSize&) override;
     void setBoundsOrigin(const FloatPoint&) override;
+    void syncBoundsOrigin(const FloatPoint&) override;
     void setTransform(const TransformationMatrix&) override;
     void setChildrenTransform(const TransformationMatrix&) override;
     void setPreserves3D(bool) override;
@@ -155,6 +157,11 @@ public:
     void requestBackingStoreUpdate();
 
 private:
+    enum class FlushNotification {
+        Required,
+        NotRequired,
+    };
+
     bool isCoordinatedGraphicsLayer() const override;
 
     void updatePlatformLayer();
@@ -162,7 +169,7 @@ private:
     void setDebugBorder(const Color&, float width) override;
 
     void didChangeAnimations();
-    void didChangeGeometry();
+    void didChangeGeometry(FlushNotification = FlushNotification::Required);
     void didChangeChildren();
     void didChangeFilters();
     void didUpdateTileBuffers();