Title: [160388] trunk/Source/WebKit2
Revision
160388
Author
ander...@apple.com
Date
2013-12-10 14:11:28 -0800 (Tue, 10 Dec 2013)

Log Message

UserData should handle geometry types
https://bugs.webkit.org/show_bug.cgi?id=125542

Reviewed by Andreas Kling.

Rename WebGeometry.h to APIGeometry.h in preparation for moving the classes into the API namespace.
Add encode/decode functions to geometry classes. Use them in UserData::encode and UserData::decode.

* Shared/API/c/WKGeometry.cpp:
* Shared/APIGeometry.cpp: Added.
* Shared/APIGeometry.h: Renamed from Source/WebKit2/Shared/WebGeometry.h.
(WebKit::UserData::encode):
(WebKit::UserData::decode):
* Shared/UserMessageCoders.h:
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebPage/WebPage.cpp:

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (160387 => 160388)


--- trunk/Source/WebKit2/ChangeLog	2013-12-10 21:51:36 UTC (rev 160387)
+++ trunk/Source/WebKit2/ChangeLog	2013-12-10 22:11:28 UTC (rev 160388)
@@ -1,3 +1,22 @@
+2013-12-10  Anders Carlsson  <ander...@apple.com>
+
+        UserData should handle geometry types
+        https://bugs.webkit.org/show_bug.cgi?id=125542
+
+        Reviewed by Andreas Kling.
+
+        Rename WebGeometry.h to APIGeometry.h in preparation for moving the classes into the API namespace.
+        Add encode/decode functions to geometry classes. Use them in UserData::encode and UserData::decode.
+
+        * Shared/API/c/WKGeometry.cpp:
+        * Shared/APIGeometry.cpp: Added.
+        * Shared/APIGeometry.h: Renamed from Source/WebKit2/Shared/WebGeometry.h.
+        (WebKit::UserData::encode):
+        (WebKit::UserData::decode):
+        * Shared/UserMessageCoders.h:
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/WebPage/WebPage.cpp:
+
 2013-12-10  Beth Dakin  <bda...@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=125533

Modified: trunk/Source/WebKit2/Shared/API/c/WKGeometry.cpp (160387 => 160388)


--- trunk/Source/WebKit2/Shared/API/c/WKGeometry.cpp	2013-12-10 21:51:36 UTC (rev 160387)
+++ trunk/Source/WebKit2/Shared/API/c/WKGeometry.cpp	2013-12-10 22:11:28 UTC (rev 160388)
@@ -26,8 +26,8 @@
 #include "config.h"
 #include "WKGeometry.h"
 
+#include "APIGeometry.h"
 #include "WKAPICast.h"
-#include "WebGeometry.h"
 
 using namespace WebKit;
 

Modified: trunk/Source/WebKit2/Shared/UserData.cpp (160387 => 160388)


--- trunk/Source/WebKit2/Shared/UserData.cpp	2013-12-10 21:51:36 UTC (rev 160387)
+++ trunk/Source/WebKit2/Shared/UserData.cpp	2013-12-10 22:11:28 UTC (rev 160388)
@@ -28,6 +28,7 @@
 
 #include "APIArray.h"
 #include "APIFrameHandle.h"
+#include "APIGeometry.h"
 #include "ArgumentCoders.h"
 #include "ArgumentEncoder.h"
 #include "MutableDictionary.h"
@@ -137,12 +138,30 @@
         break;
     }
 
+    case API::Object::Type::Point: {
+        auto& point = static_cast<const WebPoint&>(object);
+        point.encode(encoder);
+        break;
+    }
+
+    case API::Object::Type::Rect: {
+        auto& rect = static_cast<const WebRect&>(object);
+        rect.encode(encoder);
+        break;
+    }
+
     case API::Object::Type::SerializedScriptValue: {
         auto& serializedScriptValue = static_cast<const WebSerializedScriptValue&>(object);
         encoder << serializedScriptValue.dataReference();
         break;
     }
 
+    case API::Object::Type::Size: {
+        auto& size = static_cast<const WebSize&>(object);
+        size.encode(encoder);
+        break;
+    }
+
     case API::Object::Type::String: {
         auto& string = static_cast<const WebString&>(object);
         encoder << string.string();
@@ -235,7 +254,17 @@
     case API::Object::Type::Null:
         result = nullptr;
         break;
+        
+    case API::Object::Type::Point:
+        if (!WebPoint::decode(decoder, result))
+            return false;
+        break;
 
+    case API::Object::Type::Rect:
+        if (!WebRect::decode(decoder, result))
+            return false;
+        break;
+
     case API::Object::Type::SerializedScriptValue: {
         CoreIPC::DataReference dataReference;
         if (!decoder.decode(dataReference))
@@ -246,6 +275,11 @@
         break;
     }
 
+    case API::Object::Type::Size:
+        if (!WebSize::decode(decoder, result))
+            return false;
+        break;
+
     case API::Object::Type::String: {
         String string;
         if (!decoder.decode(string))

Modified: trunk/Source/WebKit2/Shared/UserMessageCoders.h (160387 => 160388)


--- trunk/Source/WebKit2/Shared/UserMessageCoders.h	2013-12-10 21:51:36 UTC (rev 160387)
+++ trunk/Source/WebKit2/Shared/UserMessageCoders.h	2013-12-10 22:11:28 UTC (rev 160388)
@@ -27,6 +27,7 @@
 #define UserMessageCoders_h
 
 #include "APIArray.h"
+#include "APIGeometry.h"
 #include "ArgumentDecoder.h"
 #include "ArgumentEncoder.h"
 #include "DataReference.h"
@@ -36,7 +37,6 @@
 #include "WebCoreArgumentCoders.h"
 #include "WebData.h"
 #include "WebError.h"
-#include "WebGeometry.h"
 #include "WebImage.h"
 #include "WebNumber.h"
 #include "WebRenderLayer.h"

Deleted: trunk/Source/WebKit2/Shared/WebGeometry.h (160387 => 160388)


--- trunk/Source/WebKit2/Shared/WebGeometry.h	2013-12-10 21:51:36 UTC (rev 160387)
+++ trunk/Source/WebKit2/Shared/WebGeometry.h	2013-12-10 22:11:28 UTC (rev 160388)
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WebGeometry_h
-#define WebGeometry_h
-
-#include "APIObject.h"
-#include "WKGeometry.h"
-#include <WebCore/FloatRect.h>
-#include <wtf/PassRefPtr.h>
-
-namespace CoreIPC {
-    class ArgumentDecoder;
-    class ArgumentEncoder;
-}
-
-namespace WebKit {
-
-class WebSize : public API::ObjectImpl<API::Object::Type::Size> {
-public:
-    static PassRefPtr<WebSize> create(const WKSize& size)
-    {
-        return adoptRef(new WebSize(size));
-    }
-
-    const WKSize& size() const { return m_size; }
-
-private:
-    explicit WebSize(const WKSize& size)
-        : m_size(size)
-    { }
-
-    WKSize m_size;
-};
-
-class WebPoint : public API::ObjectImpl<API::Object::Type::Point> {
-public:
-    static PassRefPtr<WebPoint> create(const WKPoint& point)
-    {
-        return adoptRef(new WebPoint(point));
-    }
-
-    const WKPoint& point() const { return m_point; }
-
-private:
-    explicit WebPoint(const WKPoint& point)
-        : m_point(point)
-    { }
-
-    WKPoint m_point;
-};
-
-class WebRect : public API::ObjectImpl<API::Object::Type::Rect> {
-public:
-    static PassRefPtr<WebRect> create(const WKRect& rect)
-    {
-        return adoptRef(new WebRect(rect));
-    }
-
-    const WKRect& rect() const { return m_rect; }
-
-private:
-    explicit WebRect(const WKRect& rect)
-        : m_rect(rect)
-    { }
-
-    WKRect m_rect;
-};
-
-} // namespace WebKit
-
-#endif // WebGeometry_h

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (160387 => 160388)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2013-12-10 21:51:36 UTC (rev 160387)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2013-12-10 22:11:28 UTC (rev 160388)
@@ -47,7 +47,7 @@
 /* End PBXAggregateTarget section */
 
 /* Begin PBXBuildFile section */
-		0F174AA3142A4CB70039250F /* WebGeometry.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F174AA2142A4CB60039250F /* WebGeometry.h */; };
+		0F174AA3142A4CB70039250F /* APIGeometry.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F174AA2142A4CB60039250F /* APIGeometry.h */; };
 		0F174AA7142AAC610039250F /* WKGeometry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F174AA6142AAC610039250F /* WKGeometry.cpp */; };
 		0FB659231208B4DB0044816C /* DrawingAreaInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FB659221208B4DB0044816C /* DrawingAreaInfo.h */; };
 		1A043976124D034800FFBFB5 /* PluginProcess.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A043974124D034800FFBFB5 /* PluginProcess.h */; };
@@ -269,6 +269,7 @@
 		1AC1336E18565D2B00F3EC05 /* APIPageHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC1336D18565D2B00F3EC05 /* APIPageHandle.cpp */; };
 		1AC1337118566C7C00F3EC05 /* APIFrameHandle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC1336F18566C7C00F3EC05 /* APIFrameHandle.cpp */; };
 		1AC1337218566C7C00F3EC05 /* APIFrameHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC1337018566C7C00F3EC05 /* APIFrameHandle.h */; };
+		1AC133741857C21E00F3EC05 /* APIGeometry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC133731857C21E00F3EC05 /* APIGeometry.cpp */; };
 		1AC25FC212A48F6000BD2671 /* PluginProcessShim.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AC25F8A12A48E0300BD2671 /* PluginProcessShim.mm */; };
 		1AC4C82916B876A90069DCCD /* MessageFlags.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC4C82816B876A90069DCCD /* MessageFlags.h */; };
 		1AC5FFC2174BFD1B0001483D /* PluginProcessAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC5FFC1174BFD1B0001483D /* PluginProcessAttributes.h */; };
@@ -1550,7 +1551,7 @@
 /* Begin PBXFileReference section */
 		0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
 		089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
-		0F174AA2142A4CB60039250F /* WebGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGeometry.h; sourceTree = "<group>"; };
+		0F174AA2142A4CB60039250F /* APIGeometry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIGeometry.h; sourceTree = "<group>"; };
 		0F174AA6142AAC610039250F /* WKGeometry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKGeometry.cpp; sourceTree = "<group>"; };
 		0FB659221208B4DB0044816C /* DrawingAreaInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawingAreaInfo.h; sourceTree = "<group>"; };
 		1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
@@ -1800,6 +1801,7 @@
 		1AC1336D18565D2B00F3EC05 /* APIPageHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIPageHandle.cpp; sourceTree = "<group>"; };
 		1AC1336F18566C7C00F3EC05 /* APIFrameHandle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIFrameHandle.cpp; sourceTree = "<group>"; };
 		1AC1337018566C7C00F3EC05 /* APIFrameHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIFrameHandle.h; sourceTree = "<group>"; };
+		1AC133731857C21E00F3EC05 /* APIGeometry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIGeometry.cpp; sourceTree = "<group>"; };
 		1AC25F8912A48E0300BD2671 /* PluginProcessShim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginProcessShim.h; sourceTree = "<group>"; };
 		1AC25F8A12A48E0300BD2671 /* PluginProcessShim.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginProcessShim.mm; sourceTree = "<group>"; };
 		1AC25FB012A48EA700BD2671 /* PluginProcessShim.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = PluginProcessShim.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -3427,6 +3429,8 @@
 				1A3DD205125E5A2F004515E6 /* APIClient.h */,
 				1AC1336F18566C7C00F3EC05 /* APIFrameHandle.cpp */,
 				1AC1337018566C7C00F3EC05 /* APIFrameHandle.h */,
+				1AC133731857C21E00F3EC05 /* APIGeometry.cpp */,
+				0F174AA2142A4CB60039250F /* APIGeometry.h */,
 				B63403F814910D57001070B5 /* APIObject.cpp */,
 				BCF04C8C11FF9B7D00F86A58 /* APIObject.h */,
 				1AC1336D18565D2B00F3EC05 /* APIPageHandle.cpp */,
@@ -3524,7 +3528,6 @@
 				1A90C1ED1264FD50003E44D4 /* WebFindOptions.h */,
 				BC0E607212D6BC200012A72A /* WebGeolocationPosition.cpp */,
 				BC0E607112D6BC200012A72A /* WebGeolocationPosition.h */,
-				0F174AA2142A4CB60039250F /* WebGeometry.h */,
 				7801C095142290C400FAF9AF /* WebHitTestResult.cpp */,
 				7801C096142290C400FAF9AF /* WebHitTestResult.h */,
 				BCCF6ABA12C91EF9008F9C35 /* WebImage.cpp */,
@@ -5945,7 +5948,7 @@
 				BC0E618312D6CB1D0012A72A /* WebGeolocationManagerProxyMessages.h in Headers */,
 				BC0E607312D6BC200012A72A /* WebGeolocationPosition.h in Headers */,
 				BC1BE1F212D54DBD0004A228 /* WebGeolocationProvider.h in Headers */,
-				0F174AA3142A4CB70039250F /* WebGeometry.h in Headers */,
+				0F174AA3142A4CB70039250F /* APIGeometry.h in Headers */,
 				BCF69F871176CD6F00471A52 /* WebHistoryClient.h in Headers */,
 				7801C09A142290C400FAF9AF /* WebHitTestResult.h in Headers */,
 				511B24AB132E097200065A0C /* WebIconDatabase.h in Headers */,
@@ -7218,6 +7221,7 @@
 				C5E1AFEE16B21025006CC1F2 /* WebArchiveResource.cpp in Sources */,
 				BC72BA1D11E64907001EB4EA /* WebBackForwardList.cpp in Sources */,
 				51B3005012529D0E000B5CA0 /* WebBackForwardListCF.cpp in Sources */,
+				1AC133741857C21E00F3EC05 /* APIGeometry.cpp in Sources */,
 				518D2CAD12D5153B003BB93B /* WebBackForwardListItem.cpp in Sources */,
 				BC72B9FA11E6476B001EB4EA /* WebBackForwardListProxy.cpp in Sources */,
 				BC111A5A112F4FBB00337BAB /* WebChromeClient.cpp in Sources */,

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (160387 => 160388)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-12-10 21:51:36 UTC (rev 160387)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-12-10 22:11:28 UTC (rev 160388)
@@ -70,7 +70,6 @@
 #include "WebFullScreenManager.h"
 #include "WebFullScreenManagerMessages.h"
 #include "WebGeolocationClient.h"
-#include "WebGeometry.h"
 #include "WebImage.h"
 #include "WebInspector.h"
 #include "WebInspectorClient.h"
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to