Modified: trunk/Source/WebKit2/ChangeLog (131741 => 131742)
--- trunk/Source/WebKit2/ChangeLog 2012-10-18 13:38:19 UTC (rev 131741)
+++ trunk/Source/WebKit2/ChangeLog 2012-10-18 13:39:51 UTC (rev 131742)
@@ -1,3 +1,20 @@
+2012-10-18 Carlos Garcia Campos <[email protected]>
+
+ [GTK] Don't use the C API internally in WebKitWindowProperties
+ https://bugs.webkit.org/show_bug.cgi?id=96785
+
+ Reviewed by Gustavo Noronha Silva.
+
+ Using the C++ classes directly instead of the C API wrappers we
+ avoid a lot of toImpl/toAPI casts, string conversions and
+ allocations. The code is also a lot simpler and easier to read.
+
+ * UIProcess/API/gtk/WebKitWebView.cpp:
+ (webkitWebViewCreateNewPage):
+ * UIProcess/API/gtk/WebKitWindowProperties.cpp:
+ (webkitWindowPropertiesUpdateFromWebWindowFeatures):
+ * UIProcess/API/gtk/WebKitWindowPropertiesPrivate.h:
+
2012-10-18 Huang Dongsung <[email protected]>
[WK2] Add CustomFilterOperation serialization in ArgumentCoder.
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp (131741 => 131742)
--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp 2012-10-18 13:38:19 UTC (rev 131741)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebView.cpp 2012-10-18 13:39:51 UTC (rev 131742)
@@ -1355,7 +1355,7 @@
if (!newWebView)
return 0;
- webkitWindowPropertiesUpdateFromWKWindowFeatures(newWebView->priv->windowProperties.get(), toAPI(windowFeatures));
+ webkitWindowPropertiesUpdateFromWebWindowFeatures(newWebView->priv->windowProperties.get(), windowFeatures);
RefPtr<WebPageProxy> newPage = getPage(newWebView);
return newPage.release().leakRef();
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp (131741 => 131742)
--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp 2012-10-18 13:38:19 UTC (rev 131741)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWindowProperties.cpp 2012-10-18 13:39:51 UTC (rev 131742)
@@ -20,8 +20,10 @@
#include "config.h"
#include "WebKitWindowProperties.h"
+#include "ImmutableDictionary.h"
#include "WebKitPrivate.h"
#include "WebKitWindowPropertiesPrivate.h"
+#include "WebNumber.h"
#include "WebURLRequest.h"
#include <WebCore/IntRect.h>
#include <glib/gi18n-lib.h>
@@ -388,56 +390,54 @@
g_object_notify(G_OBJECT(windowProperties), "fullscreen");
}
-void webkitWindowPropertiesUpdateFromWKWindowFeatures(WebKitWindowProperties* windowProperties, WKDictionaryRef wkFeatures)
+void webkitWindowPropertiesUpdateFromWebWindowFeatures(WebKitWindowProperties* windowProperties, ImmutableDictionary* features)
{
GdkRectangle geometry = windowProperties->priv->geometry;
- WKDoubleRef doubleValue;
- WKRetainPtr<WKStringRef> xKey(AdoptWK, WKStringCreateWithUTF8CString("x"));
- if (doubleValue = static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(wkFeatures, xKey.get())))
- geometry.x = WKDoubleGetValue(doubleValue);
+ WebDouble* doubleValue = static_cast<WebDouble*>(features->get("x"));
+ if (doubleValue)
+ geometry.x = doubleValue->value();
- WKRetainPtr<WKStringRef> yKey(AdoptWK, WKStringCreateWithUTF8CString("y"));
- if (doubleValue = static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(wkFeatures, yKey.get())))
- geometry.y = WKDoubleGetValue(doubleValue);
+ doubleValue = static_cast<WebDouble*>(features->get("y"));
+ if (doubleValue)
+ geometry.y = doubleValue->value();
- WKRetainPtr<WKStringRef> widthKey(AdoptWK, WKStringCreateWithUTF8CString("width"));
- if (doubleValue = static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(wkFeatures, widthKey.get())))
- geometry.width = WKDoubleGetValue(doubleValue);
+ doubleValue = static_cast<WebDouble*>(features->get("width"));
+ if (doubleValue)
+ geometry.width = doubleValue->value();
- WKRetainPtr<WKStringRef> heightKey(AdoptWK, WKStringCreateWithUTF8CString("height"));
- if (doubleValue = static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(wkFeatures, heightKey.get())))
- geometry.height = WKDoubleGetValue(doubleValue);
+ doubleValue = static_cast<WebDouble*>(features->get("height"));
+ if (doubleValue)
+ geometry.height = doubleValue->value();
webkitWindowPropertiesSetGeometry(windowProperties, &geometry);
- WKBooleanRef booleanValue;
- WKRetainPtr<WKStringRef> menuBarVisibleKey(AdoptWK, WKStringCreateWithUTF8CString("menuBarVisible"));
- if (booleanValue = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(wkFeatures, menuBarVisibleKey.get())))
- webkitWindowPropertiesSetMenubarVisible(windowProperties, WKBooleanGetValue(booleanValue));
+ WebBoolean* booleanValue = static_cast<WebBoolean*>(features->get("menuBarVisible"));
+ if (booleanValue)
+ webkitWindowPropertiesSetMenubarVisible(windowProperties, booleanValue->value());
- WKRetainPtr<WKStringRef> statusBarVisibleKey(AdoptWK, WKStringCreateWithUTF8CString("statusBarVisible"));
- if (booleanValue = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(wkFeatures, statusBarVisibleKey.get())))
- webkitWindowPropertiesSetStatusbarVisible(windowProperties, WKBooleanGetValue(booleanValue));
+ booleanValue = static_cast<WebBoolean*>(features->get("statusBarVisible"));
+ if (booleanValue)
+ webkitWindowPropertiesSetStatusbarVisible(windowProperties, booleanValue->value());
- WKRetainPtr<WKStringRef> toolBarVisibleKey(AdoptWK, WKStringCreateWithUTF8CString("toolBarVisible"));
- if (booleanValue = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(wkFeatures, toolBarVisibleKey.get())))
- webkitWindowPropertiesSetToolbarVisible(windowProperties, WKBooleanGetValue(booleanValue));
+ booleanValue = static_cast<WebBoolean*>(features->get("toolBarVisible"));
+ if (booleanValue)
+ webkitWindowPropertiesSetToolbarVisible(windowProperties, booleanValue->value());
- WKRetainPtr<WKStringRef> locationBarVisibleKey(AdoptWK, WKStringCreateWithUTF8CString("locationBarVisible"));
- if (booleanValue = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(wkFeatures, locationBarVisibleKey.get())))
- webkitWindowPropertiesSetLocationbarVisible(windowProperties, WKBooleanGetValue(booleanValue));
+ booleanValue = static_cast<WebBoolean*>(features->get("locationBarVisible"));
+ if (booleanValue)
+ webkitWindowPropertiesSetLocationbarVisible(windowProperties, booleanValue->value());
- WKRetainPtr<WKStringRef> scrollbarsVisibleKey(AdoptWK, WKStringCreateWithUTF8CString("scrollbarsVisible"));
- if (booleanValue = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(wkFeatures, scrollbarsVisibleKey.get())))
- webkitWindowPropertiesSetScrollbarsVisible(windowProperties, WKBooleanGetValue(booleanValue));
+ booleanValue = static_cast<WebBoolean*>(features->get("scrollbarsVisible"));
+ if (booleanValue)
+ webkitWindowPropertiesSetScrollbarsVisible(windowProperties, booleanValue->value());
- WKRetainPtr<WKStringRef> resizableKey(AdoptWK, WKStringCreateWithUTF8CString("resizable"));
- if (booleanValue = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(wkFeatures, resizableKey.get())))
- webkitWindowPropertiesSetResizable(windowProperties, WKBooleanGetValue(booleanValue));
+ booleanValue = static_cast<WebBoolean*>(features->get("resizable"));
+ if (booleanValue)
+ webkitWindowPropertiesSetResizable(windowProperties, booleanValue->value());
- WKRetainPtr<WKStringRef> fullscreenKey(AdoptWK, WKStringCreateWithUTF8CString("fullscreen"));
- if (booleanValue = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(wkFeatures, fullscreenKey.get())))
- webkitWindowPropertiesSetFullscreen(windowProperties, WKBooleanGetValue(booleanValue));
+ booleanValue = static_cast<WebBoolean*>(features->get("fullscreen"));
+ if (booleanValue)
+ webkitWindowPropertiesSetFullscreen(windowProperties, booleanValue->value());
}
/**
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWindowPropertiesPrivate.h (131741 => 131742)
--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWindowPropertiesPrivate.h 2012-10-18 13:38:19 UTC (rev 131741)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWindowPropertiesPrivate.h 2012-10-18 13:39:51 UTC (rev 131742)
@@ -27,11 +27,13 @@
#ifndef WebKitWindowPropertiesPrivate_h
#define WebKitWindowPropertiesPrivate_h
+#include "WebKitPrivate.h"
#include "WebKitWindowProperties.h"
-#include <WebKit2/WKBase.h>
+using namespace WebKit;
+
WebKitWindowProperties* webkitWindowPropertiesCreate();
-void webkitWindowPropertiesUpdateFromWKWindowFeatures(WebKitWindowProperties*, WKDictionaryRef wkFeatures);
+void webkitWindowPropertiesUpdateFromWebWindowFeatures(WebKitWindowProperties*, ImmutableDictionary* features);
void webkitWindowPropertiesSetGeometry(WebKitWindowProperties*, GdkRectangle*);
void webkitWindowPropertiesSetToolbarVisible(WebKitWindowProperties*, bool toolbarsVisible);
void webkitWindowPropertiesSetMenubarVisible(WebKitWindowProperties*, bool menuBarVisible);