Title: [133198] trunk/Source/Platform
Revision
133198
Author
dan...@chromium.org
Date
2012-11-01 11:36:32 -0700 (Thu, 01 Nov 2012)

Log Message

[chromium] Allow implicit conversion between gfx::Vector2d and WebSize
https://bugs.webkit.org/show_bug.cgi?id=100553

Reviewed by James Robinson.

The gfx::Vector2d class is used in chromium for defining distances. The
IntSize class is used equivalently inside WebCore. This lets us convert
between vectors and sizes along the API boundary.

* chromium/public/WebSize.h:
(WebKit::WebSize::WebSize):
(WebSize):
(WebKit::WebSize::operator=):
(WebKit::WebSize::operator gfx::Vector2d):

Modified Paths

Diff

Modified: trunk/Source/Platform/ChangeLog (133197 => 133198)


--- trunk/Source/Platform/ChangeLog	2012-11-01 18:28:56 UTC (rev 133197)
+++ trunk/Source/Platform/ChangeLog	2012-11-01 18:36:32 UTC (rev 133198)
@@ -1,3 +1,20 @@
+2012-11-01  Dana Jansens  <dan...@chromium.org>
+
+        [chromium] Allow implicit conversion between gfx::Vector2d and WebSize
+        https://bugs.webkit.org/show_bug.cgi?id=100553
+
+        Reviewed by James Robinson.
+
+        The gfx::Vector2d class is used in chromium for defining distances. The
+        IntSize class is used equivalently inside WebCore. This lets us convert
+        between vectors and sizes along the API boundary.
+
+        * chromium/public/WebSize.h:
+        (WebKit::WebSize::WebSize):
+        (WebSize):
+        (WebKit::WebSize::operator=):
+        (WebKit::WebSize::operator gfx::Vector2d):
+
 2012-11-01  W. James MacLean  <wjmacl...@chromium.org>
 
         [chromium] Make WebLayerTreeView::adjustEventPointForPinchZoom pure virtual.

Modified: trunk/Source/Platform/chromium/public/WebSize.h (133197 => 133198)


--- trunk/Source/Platform/chromium/public/WebSize.h	2012-11-01 18:28:56 UTC (rev 133197)
+++ trunk/Source/Platform/chromium/public/WebSize.h	2012-11-01 18:36:32 UTC (rev 133198)
@@ -37,6 +37,7 @@
 #include "IntSize.h"
 #else
 #include <ui/gfx/size.h>
+#include <ui/gfx/vector2d.h>
 #endif
 
 namespace WebKit {
@@ -84,6 +85,12 @@
     {
     }
 
+    WebSize(const gfx::Vector2d& v)
+        : width(v.x())
+        , height(v.y())
+    {
+    }
+
     WebSize& operator=(const gfx::Size& s)
     {
         width = s.width();
@@ -91,10 +98,22 @@
         return *this;
     }
 
+    WebSize& operator=(const gfx::Vector2d& v)
+    {
+        width = v.x();
+        height = v.y();
+        return *this;
+    }
+
     operator gfx::Size() const
     {
         return gfx::Size(width, height);
     }
+
+    operator gfx::Vector2d() const
+    {
+        return gfx::Vector2d(width, height);
+    }
 #endif
 };
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to