summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/API
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/UIProcess/API')
-rw-r--r--Source/WebKit2/UIProcess/API/C/WKAPICast.h1
-rw-r--r--Source/WebKit2/UIProcess/API/C/efl/WKView.cpp7
-rw-r--r--Source/WebKit2/UIProcess/API/C/efl/WKView.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/EWebKit2.h3
-rw-r--r--Source/WebKit2/UIProcess/API/efl/EwkViewCallbacks.h30
-rw-r--r--Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp179
-rw-r--r--Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h50
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_auth_request.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_auth_request_private.h3
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp22
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item_private.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_private.h8
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_color_picker.cpp6
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_color_picker.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_color_picker_private.h8
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_context.cpp6
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_context.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_context_menu.cpp149
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_context_menu.h111
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item.cpp222
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item.h270
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item_private.h82
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_context_menu_private.h79
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_context_private.h6
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.cpp22
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager_private.h8
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_database_manager.cpp7
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_database_manager.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_database_manager_private.h8
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_defines.h48
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_download_job.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_download_job_private.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_error.cpp12
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_error.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_error_private.h8
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.cpp18
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_favicon_database_private.h10
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_file_chooser_request.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_file_chooser_request_private.h3
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request_private.h3
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_intent.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_intent_private.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_intent_service.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_intent_service_private.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_navigation_data.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_navigation_data_private.h3
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision_private.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_object.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_object_private.h12
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_popup_menu.cpp12
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_popup_menu.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_item.cpp20
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_item.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_item_private.h8
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_private.h10
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_resource.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_resource_private.h3
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_security_origin.cpp9
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_security_origin.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_security_origin_private.h9
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp36
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_settings.h48
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_settings_private.h8
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_storage_manager.cpp7
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_storage_manager.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_storage_manager_private.h8
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_text_checker.cpp5
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_text_checker_private.h1
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_url_request.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_url_request_private.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_url_response.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_url_response_private.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request_private.h2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_view.cpp29
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_view.h48
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_view_private.h3
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_window_features.cpp161
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_window_features.h129
-rw-r--r--Source/WebKit2/UIProcess/API/efl/ewk_window_features_private.h88
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp14
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h9
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h1
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestMain.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_auth_request.cpp3
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp3
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_color_picker.cpp3
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp10
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context_history_callbacks.cpp4
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context_menu.cpp109
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp4
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_database_manager.cpp2
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_download_job.cpp4
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_eina_shared_string.cpp4
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_favicon_database.cpp3
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_file_chooser_request.cpp3
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp3
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_object.cpp15
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_popup_menu.cpp3
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_refptr_evas_object.cpp5
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp31
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_storage_manager.cpp3
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_text_checker.cpp4
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp26
-rw-r--r--Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_window_features.cpp110
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp43
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h38
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp9
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am14
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/InspectorTestServer.cpp58
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestInspectorServer.cpp264
-rw-r--r--Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp20
-rw-r--r--Source/WebKit2/UIProcess/API/mac/PageClientImpl.h1
-rw-r--r--Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm19
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.h3
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm21
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h1
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKView.mm73
-rw-r--r--Source/WebKit2/UIProcess/API/mac/WKViewInternal.h4
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h1
-rw-r--r--Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp1
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_doubleTapToZoom.qml137
129 files changed, 2810 insertions, 389 deletions
diff --git a/Source/WebKit2/UIProcess/API/C/WKAPICast.h b/Source/WebKit2/UIProcess/API/C/WKAPICast.h
index 713b4f896..3c0584c06 100644
--- a/Source/WebKit2/UIProcess/API/C/WKAPICast.h
+++ b/Source/WebKit2/UIProcess/API/C/WKAPICast.h
@@ -42,7 +42,6 @@
#include "WKProtectionSpaceTypes.h"
#include "WKResourceCacheManager.h"
#include "WKSharedAPICast.h"
-#include <WebCore/CookieJar.h>
#include <WebCore/Credential.h>
#include <WebCore/FrameLoaderTypes.h>
#include <WebCore/ProtectionSpace.h>
diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp b/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp
index a03d189df..80a1ac381 100644
--- a/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp
+++ b/Source/WebKit2/UIProcess/API/C/efl/WKView.cpp
@@ -28,7 +28,12 @@ using namespace WebKit;
WKViewRef WKViewCreate(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
{
- return toAPI(ewk_view_base_add(canvas, contextRef, pageGroupRef));
+ return toAPI(ewk_view_base_add(canvas, contextRef, pageGroupRef, EwkViewImpl::LegacyBehavior));
+}
+
+WKViewRef WKViewCreateWithFixedLayout(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
+{
+ return toAPI(ewk_view_base_add(canvas, contextRef, pageGroupRef, EwkViewImpl::DefaultBehavior));
}
WKPageRef WKViewGetPage(WKViewRef viewRef)
diff --git a/Source/WebKit2/UIProcess/API/C/efl/WKView.h b/Source/WebKit2/UIProcess/API/C/efl/WKView.h
index 1a7961daa..db0da2c27 100644
--- a/Source/WebKit2/UIProcess/API/C/efl/WKView.h
+++ b/Source/WebKit2/UIProcess/API/C/efl/WKView.h
@@ -30,6 +30,8 @@ extern "C" {
WK_EXPORT WKViewRef WKViewCreate(Evas* canvas, WKContextRef context, WKPageGroupRef pageGroup);
+WK_EXPORT WKViewRef WKViewCreateWithFixedLayout(Evas* canvas, WKContextRef context, WKPageGroupRef pageGroup);
+
WK_EXPORT WKPageRef WKViewGetPage(WKViewRef view);
#ifdef __cplusplus
diff --git a/Source/WebKit2/UIProcess/API/efl/EWebKit2.h b/Source/WebKit2/UIProcess/API/efl/EWebKit2.h
index 07ca12935..b12211084 100644
--- a/Source/WebKit2/UIProcess/API/efl/EWebKit2.h
+++ b/Source/WebKit2/UIProcess/API/efl/EWebKit2.h
@@ -33,6 +33,8 @@
#include "ewk_back_forward_list_item.h"
#include "ewk_color_picker.h"
#include "ewk_context.h"
+#include "ewk_context_menu.h"
+#include "ewk_context_menu_item.h"
#include "ewk_cookie_manager.h"
#include "ewk_database_manager.h"
#include "ewk_download_job.h"
@@ -58,5 +60,6 @@
#include "ewk_url_response.h"
#include "ewk_url_scheme_request.h"
#include "ewk_view.h"
+#include "ewk_window_features.h"
#endif // EWebKit2_h
diff --git a/Source/WebKit2/UIProcess/API/efl/EwkViewCallbacks.h b/Source/WebKit2/UIProcess/API/efl/EwkViewCallbacks.h
index 9852599a2..4140c742b 100644
--- a/Source/WebKit2/UIProcess/API/efl/EwkViewCallbacks.h
+++ b/Source/WebKit2/UIProcess/API/efl/EwkViewCallbacks.h
@@ -32,21 +32,21 @@
#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
-typedef struct Ewk_Object Ewk_Auth_Request;
-typedef struct Ewk_Object Ewk_Download_Job;
-typedef struct Ewk_Object Ewk_File_Chooser_Request;
-typedef struct Ewk_Object Ewk_Form_Submission_Request;
-typedef struct Ewk_Object Ewk_Navigation_Policy_Decision;
-typedef struct Ewk_Object Ewk_Resource;
+typedef struct EwkObject Ewk_Auth_Request;
+typedef struct EwkObject Ewk_Download_Job;
+typedef struct EwkObject Ewk_File_Chooser_Request;
+typedef struct EwkObject Ewk_Form_Submission_Request;
+typedef struct EwkObject Ewk_Navigation_Policy_Decision;
+typedef struct EwkObject Ewk_Resource;
#if ENABLE(WEB_INTENTS)
-typedef struct Ewk_Object Ewk_Intent;
+typedef struct EwkObject Ewk_Intent;
#endif
#if ENABLE(WEB_INTENTS_TAG)
-typedef struct Ewk_Object Ewk_Intent_Service;
+typedef struct EwkObject Ewk_Intent_Service;
#endif
+typedef struct EwkError Ewk_Error;
struct Ewk_Download_Job_Error;
-struct Ewk_Error;
struct Ewk_Resource_Request;
struct Ewk_Resource_Load_Response;
struct Ewk_Resource_Load_Error;
@@ -57,8 +57,6 @@ enum CallbackType {
AuthenticationRequest,
BackForwardListChange,
CancelVibration,
- CloseWindow,
- CreateWindow,
DownloadJobCancelled,
DownloadJobFailed,
DownloadJobFinished,
@@ -69,6 +67,7 @@ enum CallbackType {
LoadError,
LoadFinished,
LoadProgress,
+ MenuBarVisible,
ProvisionalLoadFailed,
ProvisionalLoadRedirect,
ProvisionalLoadStarted,
@@ -77,15 +76,18 @@ enum CallbackType {
ResourceLoadFailed,
ResourceLoadFinished,
ResourceRequestSent,
+ StatusBarVisible,
NavigationPolicyDecision,
NewWindowPolicyDecision,
TextFound,
TitleChange,
+ ToolbarVisible,
TooltipTextUnset,
TooltipTextSet,
URLChanged,
Vibrate,
WebProcessCrashed,
+ WindowResizable,
#if ENABLE(WEB_INTENTS)
IntentRequest,
#endif
@@ -164,8 +166,6 @@ struct CallBackInfo<callbackType> { \
DECLARE_EWK_VIEW_CALLBACK(AuthenticationRequest, "authentication,request", Ewk_Auth_Request);
DECLARE_EWK_VIEW_CALLBACK(BackForwardListChange, "back,forward,list,changed", void);
DECLARE_EWK_VIEW_CALLBACK(CancelVibration, "cancel,vibration", void);
-DECLARE_EWK_VIEW_CALLBACK(CloseWindow, "close,window", void);
-DECLARE_EWK_VIEW_CALLBACK(CreateWindow, "create,window", Evas_Object*);
DECLARE_EWK_VIEW_CALLBACK(DownloadJobCancelled, "download,cancelled", Ewk_Download_Job);
DECLARE_EWK_VIEW_CALLBACK(DownloadJobFailed, "download,failed", Ewk_Download_Job_Error);
DECLARE_EWK_VIEW_CALLBACK(DownloadJobFinished, "download,finished", Ewk_Download_Job);
@@ -179,6 +179,7 @@ DECLARE_EWK_VIEW_CALLBACK(LoadProgress, "load,progress", double);
DECLARE_EWK_VIEW_CALLBACK(ProvisionalLoadFailed, "load,provisional,failed", Ewk_Error);
DECLARE_EWK_VIEW_CALLBACK(ProvisionalLoadRedirect, "load,provisional,redirect", void);
DECLARE_EWK_VIEW_CALLBACK(ProvisionalLoadStarted, "load,provisional,started", void);
+DECLARE_EWK_VIEW_CALLBACK(MenuBarVisible, "menubar,visible", bool);
DECLARE_EWK_VIEW_CALLBACK(NavigationPolicyDecision, "policy,decision,navigation", Ewk_Navigation_Policy_Decision);
DECLARE_EWK_VIEW_CALLBACK(NewWindowPolicyDecision, "policy,decision,new,window", Ewk_Navigation_Policy_Decision);
DECLARE_EWK_VIEW_CALLBACK(ResourceLoadStarted, "resource,request,new", Ewk_Resource_Request);
@@ -186,13 +187,16 @@ DECLARE_EWK_VIEW_CALLBACK(ResourceLoadResponse, "resource,request,response", Ewk
DECLARE_EWK_VIEW_CALLBACK(ResourceLoadFailed, "resource,request,failed", Ewk_Resource_Load_Error);
DECLARE_EWK_VIEW_CALLBACK(ResourceLoadFinished, "resource,request,finished", Ewk_Resource);
DECLARE_EWK_VIEW_CALLBACK(ResourceRequestSent, "resource,request,sent", Ewk_Resource_Request);
+DECLARE_EWK_VIEW_CALLBACK(StatusBarVisible, "statusbar,visible", bool);
DECLARE_EWK_VIEW_CALLBACK(TextFound, "text,found", unsigned);
DECLARE_EWK_VIEW_CALLBACK(TitleChange, "title,changed", char);
+DECLARE_EWK_VIEW_CALLBACK(ToolbarVisible, "toolbar,visible", bool);
DECLARE_EWK_VIEW_CALLBACK(TooltipTextUnset, "tooltip,text,unset", void);
DECLARE_EWK_VIEW_CALLBACK(TooltipTextSet, "tooltip,text,set", char);
DECLARE_EWK_VIEW_CALLBACK(URLChanged, "url,changed", char);
DECLARE_EWK_VIEW_CALLBACK(Vibrate, "vibrate", uint64_t);
DECLARE_EWK_VIEW_CALLBACK(WebProcessCrashed, "webprocess,crashed", bool);
+DECLARE_EWK_VIEW_CALLBACK(WindowResizable, "window,resizable", bool);
#if ENABLE(WEB_INTENTS)
DECLARE_EWK_VIEW_CALLBACK(IntentRequest, "intent,request,new", Ewk_Intent);
#endif
diff --git a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp
index 13812a649..2e4462734 100644
--- a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp
@@ -21,6 +21,7 @@
#include "config.h"
#include "EwkViewImpl.h"
+#include "ContextMenuClientEfl.h"
#include "EflScreenUtilities.h"
#include "FindClientEfl.h"
#include "FormClientEfl.h"
@@ -34,6 +35,9 @@
#include "PagePolicyClientEfl.h"
#include "PageUIClientEfl.h"
#include "ResourceLoadClientEfl.h"
+#include "WKDictionary.h"
+#include "WKGeometry.h"
+#include "WKNumber.h"
#include "WKString.h"
#include "WebContext.h"
#include "WebPageGroup.h"
@@ -42,17 +46,21 @@
#include "WebPreferences.h"
#include "ewk_back_forward_list_private.h"
#include "ewk_color_picker_private.h"
+#include "ewk_context_menu_private.h"
#include "ewk_context_private.h"
#include "ewk_favicon_database_private.h"
#include "ewk_popup_menu_item_private.h"
#include "ewk_popup_menu_private.h"
#include "ewk_private.h"
+#include "ewk_security_origin_private.h"
#include "ewk_settings_private.h"
#include "ewk_view.h"
#include "ewk_view_private.h"
+#include "ewk_window_features_private.h"
#include <Ecore_Evas.h>
#include <Ecore_X.h>
#include <Edje.h>
+#include <WebCore/CairoUtilitiesEfl.h>
#include <WebCore/Cursor.h>
#if ENABLE(VIBRATION)
@@ -109,6 +117,7 @@ EwkViewImpl::EwkViewImpl(Evas_Object* view, PassRefPtr<EwkContext> context, Pass
, m_pagePolicyClient(PagePolicyClientEfl::create(this))
, m_pageUIClient(PageUIClientEfl::create(this))
, m_resourceLoadClient(ResourceLoadClientEfl::create(this))
+ , m_contextMenuClient(ContextMenuClientEfl::create(this))
, m_findClient(FindClientEfl::create(this))
, m_formClient(FormClientEfl::create(this))
#if ENABLE(VIBRATION)
@@ -119,13 +128,15 @@ EwkViewImpl::EwkViewImpl(Evas_Object* view, PassRefPtr<EwkContext> context, Pass
, m_scaleFactor(1)
#endif
, m_settings(Ewk_Settings::create(this))
- , m_cursorGroup(0)
+ , m_cursorIdentifier(0)
, m_mouseEventsEnabled(false)
#if ENABLE(TOUCH_EVENTS)
, m_touchEventsEnabled(false)
#endif
, m_displayTimer(this, &EwkViewImpl::displayTimerFired)
, m_inputMethodContext(InputMethodContextEfl::create(this, smartData()->base.evas))
+ , m_isHardwareAccelerated(true)
+ , m_setDrawsBackground(false)
{
ASSERT(m_view);
ASSERT(m_context);
@@ -148,6 +159,8 @@ EwkViewImpl::EwkViewImpl(Evas_Object* view, PassRefPtr<EwkContext> context, Pass
m_pageProxy->pageGroup()->preferences()->setFullScreenEnabled(true);
#endif
+ m_pageProxy->pageGroup()->preferences()->setOfflineWebApplicationCacheEnabled(true);
+
// Enable mouse events by default
setMouseEventsEnabled(true);
@@ -198,11 +211,38 @@ WKPageRef EwkViewImpl::wkPage()
void EwkViewImpl::setCursor(const Cursor& cursor)
{
+ if (cursor.image()) {
+ // Custom cursor.
+ if (cursor.image() == m_cursorIdentifier)
+ return;
+
+ m_cursorIdentifier = cursor.image();
+
+ Ewk_View_Smart_Data* sd = smartData();
+ RefPtr<Evas_Object> cursorObject = adoptRef(cursor.image()->getEvasObject(sd->base.evas));
+ if (!cursorObject)
+ return;
+
+ // Resize cursor.
+ evas_object_resize(cursorObject.get(), cursor.image()->size().width(), cursor.image()->size().height());
+
+ // Get cursor hot spot.
+ IntPoint hotSpot;
+ cursor.image()->getHotSpot(hotSpot);
+
+ Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(sd->base.evas);
+ // ecore_evas takes care of freeing the cursor object.
+ ecore_evas_object_cursor_set(ecoreEvas, cursorObject.release().leakRef(), EVAS_LAYER_MAX, hotSpot.x(), hotSpot.y());
+
+ return;
+ }
+
+ // Standard cursor.
const char* group = cursor.platformCursor();
- if (!group || group == m_cursorGroup)
+ if (!group || group == m_cursorIdentifier)
return;
- m_cursorGroup = group;
+ m_cursorIdentifier = group;
Ewk_View_Smart_Data* sd = smartData();
RefPtr<Evas_Object> cursorObject = adoptRef(edje_object_add(sd->base.evas));
@@ -291,6 +331,21 @@ AffineTransform EwkViewImpl::transformToScreen() const
return transform;
}
+#if USE(COORDINATED_GRAPHICS)
+LayerTreeRenderer* EwkViewImpl::layerTreeRenderer()
+{
+ DrawingAreaProxy* drawingArea = page()->drawingArea();
+ if (!drawingArea)
+ return 0;
+
+ WebKit::LayerTreeCoordinatorProxy* layerTreeCoordinatorProxy = drawingArea->layerTreeCoordinatorProxy();
+ if (!layerTreeCoordinatorProxy)
+ return 0;
+
+ return layerTreeCoordinatorProxy->layerTreeRenderer();
+}
+#endif
+
void EwkViewImpl::displayTimerFired(Timer<EwkViewImpl>*)
{
#if USE(COORDINATED_GRAPHICS)
@@ -301,26 +356,46 @@ void EwkViewImpl::displayTimerFired(Timer<EwkViewImpl>*)
// We are supposed to clip to the actual viewport, nothing less.
IntRect viewport(sd->view.x, sd->view.y, sd->view.w, sd->view.h);
- LayerTreeRenderer* renderer = page()->drawingArea()->layerTreeCoordinatorProxy()->layerTreeRenderer();
- renderer->setActive(true);
- renderer->syncRemoteContent();
-
- renderer->paintToCurrentGLContext(transformToScene().toTransformationMatrix(), /* opacity */ 1, viewport);
+ LayerTreeRenderer* renderer = layerTreeRenderer();
+ if (!renderer)
+ return;
- evas_object_image_data_update_add(sd->image, viewport.x(), viewport.y(), viewport.width(), viewport.height());
+ renderer->setActive(true);
+ renderer->setDrawsBackground(m_setDrawsBackground);
+ if (m_isHardwareAccelerated) {
+ renderer->paintToCurrentGLContext(transformToScene().toTransformationMatrix(), /* opacity */ 1, viewport);
+ // sd->image is tied to a native surface. The native surface is in the parent's coordinates,
+ // so we need to account for the viewport position when calling evas_object_image_data_update_add.
+ evas_object_image_data_update_add(sd->image, viewport.x(), viewport.y(), viewport.width(), viewport.height());
+ } else {
+ RefPtr<cairo_surface_t> surface = createSurfaceForImage(sd->image);
+ if (!surface)
+ return;
+
+ RefPtr<cairo_t> graphicsContext = adoptRef(cairo_create(surface.get()));
+ cairo_scale(graphicsContext.get(), m_scaleFactor, m_scaleFactor);
+ cairo_translate(graphicsContext.get(), -m_scrollPosition.x(), -m_scrollPosition.y());
+ renderer->paintToGraphicsContext(graphicsContext.get());
+ evas_object_image_data_update_add(sd->image, 0, 0, viewport.width(), viewport.height());
+ }
#endif
}
void EwkViewImpl::update(const IntRect& rect)
{
+ Ewk_View_Smart_Data* sd = smartData();
#if USE(COORDINATED_GRAPHICS)
// Coordinated graphices needs to schedule an full update, not
// repainting of a region. Update in the event loop.
UNUSED_PARAM(rect);
+
+ // Guard for zero sized viewport.
+ if (!(sd->view.w && sd->view.h))
+ return;
+
if (!m_displayTimer.isActive())
m_displayTimer.startOneShot(0);
#else
- Ewk_View_Smart_Data* sd = smartData();
if (!sd->image)
return;
@@ -337,7 +412,9 @@ void EwkViewImpl::enterFullScreen()
{
Ewk_View_Smart_Data* sd = smartData();
- if (!sd->api->fullscreen_enter || !sd->api->fullscreen_enter(sd)) {
+ RefPtr<EwkSecurityOrigin> origin = EwkSecurityOrigin::create(KURL(ParsedURLString, String::fromUTF8(m_url)));
+
+ if (!sd->api->fullscreen_enter || !sd->api->fullscreen_enter(sd, origin.get())) {
Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(sd->base.evas);
ecore_evas_fullscreen_set(ecoreEvas, true);
}
@@ -531,11 +608,21 @@ void EwkViewImpl::informIconChange()
#if USE(ACCELERATED_COMPOSITING)
bool EwkViewImpl::createGLSurface(const IntSize& viewSize)
{
+ if (!m_isHardwareAccelerated)
+ return true;
+
if (!m_evasGL) {
Evas* evas = evas_object_evas_get(m_view);
m_evasGL = adoptPtr(evas_gl_new(evas));
- if (!m_evasGL)
+ if (!m_evasGL) {
+ WARN("Failed to create Evas_GL, falling back to software mode.");
+ m_isHardwareAccelerated = false;
+ layerTreeRenderer()->setAccelerationMode(TextureMapper::SoftwareMode);
+#if ENABLE(WEBGL)
+ m_pageProxy->pageGroup()->preferences()->setWebGLEnabled(false);
+#endif
return false;
+ }
}
if (!m_evasGLContext) {
@@ -575,6 +662,11 @@ bool EwkViewImpl::createGLSurface(const IntSize& viewSize)
bool EwkViewImpl::enterAcceleratedCompositingMode()
{
+ layerTreeRenderer()->setActive(true);
+
+ if (!m_isHardwareAccelerated)
+ return true;
+
if (!m_evasGLSurface) {
if (!createGLSurface(size())) {
WARN("Failed to create GLSurface.");
@@ -582,7 +674,6 @@ bool EwkViewImpl::enterAcceleratedCompositingMode()
}
}
- page()->drawingArea()->layerTreeCoordinatorProxy()->layerTreeRenderer()->setActive(true);
return true;
}
@@ -644,6 +735,38 @@ void EwkViewImpl::informContentsSizeChange(const IntSize& size)
COMPILE_ASSERT_MATCHING_ENUM(EWK_TEXT_DIRECTION_RIGHT_TO_LEFT, RTL);
COMPILE_ASSERT_MATCHING_ENUM(EWK_TEXT_DIRECTION_LEFT_TO_RIGHT, LTR);
+void EwkViewImpl::showContextMenu(WebContextMenuProxyEfl* contextMenuProxy, const WebCore::IntPoint& position, const Vector<WebContextMenuItemData>& items)
+{
+ Ewk_View_Smart_Data* sd = smartData();
+ ASSERT(sd->api);
+
+ ASSERT(contextMenuProxy);
+
+ if (!sd->api->context_menu_show)
+ return;
+
+ if (m_contextMenu)
+ hideContextMenu();
+
+ m_contextMenu = Ewk_Context_Menu::create(this, contextMenuProxy, items);
+
+ sd->api->context_menu_show(sd, position.x(), position.y(), m_contextMenu.get());
+}
+
+void EwkViewImpl::hideContextMenu()
+{
+ if (!m_contextMenu)
+ return;
+
+ Ewk_View_Smart_Data* sd = smartData();
+ ASSERT(sd->api);
+
+ if (sd->api->context_menu_hide)
+ sd->api->context_menu_hide(sd);
+
+ m_contextMenu.clear();
+}
+
void EwkViewImpl::requestPopupMenu(WebPopupMenuProxyEfl* popupMenuProxy, const IntRect& rect, TextDirection textDirection, double pageScaleFactor, const Vector<WebPopupItem>& items, int32_t selectedIndex)
{
Ewk_View_Smart_Data* sd = smartData();
@@ -762,23 +885,45 @@ void EwkViewImpl::informURLChange()
informIconChange();
}
-WKPageRef EwkViewImpl::createNewPage()
+EwkWindowFeatures* EwkViewImpl::windowFeatures()
{
- Evas_Object* newEwkView = 0;
- smartCallback<CreateWindow>().call(&newEwkView);
+ if (!m_windowFeatures)
+ m_windowFeatures = EwkWindowFeatures::create(0, this);
+
+ return m_windowFeatures.get();
+}
+
+WKPageRef EwkViewImpl::createNewPage(ImmutableDictionary* windowFeatures)
+{
+ Ewk_View_Smart_Data* sd = smartData();
+ ASSERT(sd->api);
+ if (!sd->api->window_create)
+ return 0;
+
+ RefPtr<EwkWindowFeatures> ewkWindowFeatures = EwkWindowFeatures::create(windowFeatures, this);
+
+ Evas_Object* newEwkView = sd->api->window_create(sd, ewkWindowFeatures.get());
if (!newEwkView)
return 0;
EwkViewImpl* newViewImpl = EwkViewImpl::fromEvasObject(newEwkView);
ASSERT(newViewImpl);
+ newViewImpl->m_windowFeatures = ewkWindowFeatures;
+
return static_cast<WKPageRef>(WKRetain(newViewImpl->page()));
}
void EwkViewImpl::closePage()
{
- smartCallback<CloseWindow>().call();
+ Ewk_View_Smart_Data* sd = smartData();
+ ASSERT(sd->api);
+
+ if (!sd->api->window_close)
+ return;
+
+ sd->api->window_close(sd);
}
void EwkViewImpl::onMouseDown(void* data, Evas*, Evas_Object*, void* eventInfo)
diff --git a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h
index 2c061c4e6..545c5ab68 100644
--- a/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h
+++ b/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.h
@@ -22,6 +22,7 @@
#define EwkViewImpl_h
#include "EwkViewCallbacks.h"
+#include "ImmutableDictionary.h"
#include "RefPtrEfl.h"
#include "WKEinaSharedString.h"
#include "WKGeometry.h"
@@ -46,6 +47,7 @@
#endif
namespace WebKit {
+class ContextMenuClientEfl;
class FindClientEfl;
class FormClientEfl;
class InputMethodContextEfl;
@@ -54,6 +56,8 @@ class PageLoadClientEfl;
class PagePolicyClientEfl;
class PageUIClientEfl;
class ResourceLoadClientEfl;
+class WebContextMenuItemData;
+class WebContextMenuProxyEfl;
class WebPageGroup;
class WebPageProxy;
class WebPopupItem;
@@ -62,6 +66,10 @@ class WebPopupMenuProxyEfl;
#if ENABLE(VIBRATION)
class VibrationClientEfl;
#endif
+
+#if USE(COORDINATED_GRAPHICS)
+class LayerTreeRenderer;
+#endif
}
namespace WebCore {
@@ -72,10 +80,12 @@ class IntSize;
}
class EwkContext;
-class Ewk_Back_Forward_List;
-class Ewk_Color_Picker;
-class Ewk_Popup_Menu;
-class Ewk_Settings;
+class EwkBackForwardList;
+class EwkColorPicker;
+class EwkContextMenu;
+class EwkPopupMenu;
+class EwkSettings;
+class EwkWindowFeatures;
#if USE(ACCELERATED_COMPOSITING)
typedef struct _Evas_GL_Context Evas_GL_Context;
@@ -100,8 +110,9 @@ public:
WKPageRef wkPage();
WebKit::WebPageProxy* page() { return m_pageProxy.get(); }
EwkContext* ewkContext() { return m_context.get(); }
- Ewk_Settings* settings() { return m_settings.get(); }
- Ewk_Back_Forward_List* backForwardList() { return m_backForwardList.get(); }
+ EwkSettings* settings() { return m_settings.get(); }
+ EwkBackForwardList* backForwardList() { return m_backForwardList.get(); }
+ EwkWindowFeatures* windowFeatures();
WebCore::IntSize size() const;
bool isFocused() const;
@@ -156,11 +167,14 @@ public:
void dismissColorPicker();
#endif
- WKPageRef createNewPage();
+ WKPageRef createNewPage(WebKit::ImmutableDictionary* windowFeatures);
void closePage();
void requestPopupMenu(WebKit::WebPopupMenuProxyEfl*, const WebCore::IntRect&, WebCore::TextDirection, double pageScaleFactor, const Vector<WebKit::WebPopupItem>& items, int32_t selectedIndex);
void closePopupMenu();
+
+ void showContextMenu(WebKit::WebContextMenuProxyEfl*, const WebCore::IntPoint& position, const Vector<WebKit::WebContextMenuItemData>& items);
+ void hideContextMenu();
void updateTextInputState();
@@ -199,10 +213,17 @@ public:
// FIXME: needs refactoring (split callback invoke)
void informURLChange();
+ bool isHardwareAccelerated() const { return m_isHardwareAccelerated; }
+ void setDrawsBackground(bool enable) { m_setDrawsBackground = enable; }
+
private:
inline Ewk_View_Smart_Data* smartData() const;
void displayTimerFired(WebCore::Timer<EwkViewImpl>*);
+#if USE(COORDINATED_GRAPHICS)
+ WebKit::LayerTreeRenderer* layerTreeRenderer();
+#endif
+
void informIconChange();
static void onMouseDown(void* data, Evas*, Evas_Object*, void* eventInfo);
@@ -230,18 +251,20 @@ private:
OwnPtr<WebKit::PagePolicyClientEfl> m_pagePolicyClient;
OwnPtr<WebKit::PageUIClientEfl> m_pageUIClient;
OwnPtr<WebKit::ResourceLoadClientEfl> m_resourceLoadClient;
+ OwnPtr<WebKit::ContextMenuClientEfl> m_contextMenuClient;
OwnPtr<WebKit::FindClientEfl> m_findClient;
OwnPtr<WebKit::FormClientEfl> m_formClient;
#if ENABLE(VIBRATION)
OwnPtr<WebKit::VibrationClientEfl> m_vibrationClient;
#endif
- OwnPtr<Ewk_Back_Forward_List> m_backForwardList;
+ OwnPtr<EwkBackForwardList> m_backForwardList;
#if USE(TILED_BACKING_STORE)
float m_scaleFactor;
WebCore::IntPoint m_scrollPosition;
#endif
- OwnPtr<Ewk_Settings> m_settings;
- const char* m_cursorGroup; // This is an address, do not free it or use WKEinaSharedString.
+ OwnPtr<EwkSettings> m_settings;
+ RefPtr<EwkWindowFeatures> m_windowFeatures;
+ const void* m_cursorIdentifier; // This is an address, do not free it.
WKEinaSharedString m_faviconURL;
WKEinaSharedString m_url;
mutable WKEinaSharedString m_title;
@@ -252,9 +275,12 @@ private:
bool m_touchEventsEnabled;
#endif
WebCore::Timer<EwkViewImpl> m_displayTimer;
- OwnPtr<Ewk_Popup_Menu> m_popupMenu;
+ OwnPtr<EwkContextMenu> m_contextMenu;
+ OwnPtr<EwkPopupMenu> m_popupMenu;
OwnPtr<WebKit::InputMethodContextEfl> m_inputMethodContext;
- OwnPtr<Ewk_Color_Picker> m_colorPicker;
+ OwnPtr<EwkColorPicker> m_colorPicker;
+ bool m_isHardwareAccelerated;
+ bool m_setDrawsBackground;
};
#endif // EwkViewImpl_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_auth_request.h b/Source/WebKit2/UIProcess/API/efl/ewk_auth_request.h
index 78abb2b38..010d44c08 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_auth_request.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_auth_request.h
@@ -42,7 +42,7 @@ extern "C" {
*
* @see Ewk_Object
*/
-typedef struct Ewk_Object Ewk_Auth_Request;
+typedef struct EwkObject Ewk_Auth_Request;
/**
* Queries the suggested username to be used for authenticating.
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_auth_request_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_auth_request_private.h
index ad1277cd0..9dbbd62e0 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_auth_request_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_auth_request_private.h
@@ -29,14 +29,13 @@
#include "WKEinaSharedString.h"
#include "ewk_object_private.h"
#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
#include <wtf/text/WTFString.h>
namespace WebKit {
class AuthenticationChallengeProxy;
}
-class EwkAuthRequest : public Ewk_Object {
+class EwkAuthRequest : public EwkObject {
public:
EWK_OBJECT_DECLARE(EwkAuthRequest)
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp
index dd3ae623b..fb9d9b408 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.cpp
@@ -35,38 +35,38 @@
using namespace WebKit;
-Ewk_Back_Forward_List::Ewk_Back_Forward_List(WKBackForwardListRef listRef)
+EwkBackForwardList::EwkBackForwardList(WKBackForwardListRef listRef)
: m_wkList(listRef)
{ }
-Ewk_Back_Forward_List_Item* Ewk_Back_Forward_List::nextItem() const
+Ewk_Back_Forward_List_Item* EwkBackForwardList::nextItem() const
{
return getFromCacheOrCreate(WKBackForwardListGetForwardItem(m_wkList.get()));
}
-Ewk_Back_Forward_List_Item* Ewk_Back_Forward_List::previousItem() const
+Ewk_Back_Forward_List_Item* EwkBackForwardList::previousItem() const
{
return getFromCacheOrCreate(WKBackForwardListGetBackItem(m_wkList.get()));
}
-Ewk_Back_Forward_List_Item* Ewk_Back_Forward_List::currentItem() const
+Ewk_Back_Forward_List_Item* EwkBackForwardList::currentItem() const
{
return getFromCacheOrCreate(WKBackForwardListGetCurrentItem(m_wkList.get()));
}
-Ewk_Back_Forward_List_Item* Ewk_Back_Forward_List::itemAt(int index) const
+Ewk_Back_Forward_List_Item* EwkBackForwardList::itemAt(int index) const
{
return getFromCacheOrCreate(WKBackForwardListGetItemAtIndex(m_wkList.get(), index));
}
-unsigned Ewk_Back_Forward_List::size() const
+unsigned EwkBackForwardList::size() const
{
const unsigned currentItem = WKBackForwardListGetCurrentItem(m_wkList.get()) ? 1 : 0;
return WKBackForwardListGetBackListCount(m_wkList.get()) + WKBackForwardListGetForwardListCount(m_wkList.get()) + currentItem;
}
-WKRetainPtr<WKArrayRef> Ewk_Back_Forward_List::backList(int limit) const
+WKRetainPtr<WKArrayRef> EwkBackForwardList::backList(int limit) const
{
if (limit == -1)
limit = WKBackForwardListGetBackListCount(m_wkList.get());
@@ -75,7 +75,7 @@ WKRetainPtr<WKArrayRef> Ewk_Back_Forward_List::backList(int limit) const
return adoptWK(WKBackForwardListCopyBackListWithLimit(m_wkList.get(), limit));
}
-WKRetainPtr<WKArrayRef> Ewk_Back_Forward_List::forwardList(int limit) const
+WKRetainPtr<WKArrayRef> EwkBackForwardList::forwardList(int limit) const
{
if (limit == -1)
limit = WKBackForwardListGetForwardListCount(m_wkList.get());
@@ -84,7 +84,7 @@ WKRetainPtr<WKArrayRef> Ewk_Back_Forward_List::forwardList(int limit) const
return adoptWK(WKBackForwardListCopyForwardListWithLimit(m_wkList.get(), limit));
}
-Ewk_Back_Forward_List_Item* Ewk_Back_Forward_List::getFromCacheOrCreate(WKBackForwardListItemRef wkItem) const
+Ewk_Back_Forward_List_Item* EwkBackForwardList::getFromCacheOrCreate(WKBackForwardListItemRef wkItem) const
{
if (!wkItem)
return 0;
@@ -98,7 +98,7 @@ Ewk_Back_Forward_List_Item* Ewk_Back_Forward_List::getFromCacheOrCreate(WKBackFo
return item.get();
}
-Eina_List* Ewk_Back_Forward_List::createEinaList(WKArrayRef wkList) const
+Eina_List* EwkBackForwardList::createEinaList(WKArrayRef wkList) const
{
if (!wkList)
return 0;
@@ -119,7 +119,7 @@ Eina_List* Ewk_Back_Forward_List::createEinaList(WKArrayRef wkList) const
* @internal
* Updates items cache.
*/
-void Ewk_Back_Forward_List::update(WKBackForwardListItemRef wkAddedItem, WKArrayRef wkRemovedItems)
+void EwkBackForwardList::update(WKBackForwardListItemRef wkAddedItem, WKArrayRef wkRemovedItems)
{
if (wkAddedItem) // Checking also here to avoid EINA_SAFETY_ON_NULL_RETURN_VAL warnings.
getFromCacheOrCreate(wkAddedItem); // Puts new item to the cache.
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.h b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.h
index 9a791ba2d..93d727698 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list.h
@@ -38,7 +38,7 @@ extern "C" {
#endif
/** Creates a type name for Ewk_Back_Forward_List */
-typedef struct Ewk_Back_Forward_List Ewk_Back_Forward_List;
+typedef struct EwkBackForwardList Ewk_Back_Forward_List;
/**
* Returns the current item in the @a list.
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.h b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.h
index 18bc61146..46c75e340 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item.h
@@ -42,7 +42,7 @@ extern "C" {
*
* @see Ewk_Object
*/
-typedef struct Ewk_Object Ewk_Back_Forward_List_Item;
+typedef struct EwkObject Ewk_Back_Forward_List_Item;
/**
* Returns URL of the item.
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item_private.h
index 87525169b..8225532c7 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_item_private.h
@@ -35,7 +35,7 @@
* \struct Ewk_Back_Forward_List
* @brief Contains the Back Forward List data.
*/
-class EwkBackForwardListItem : public Ewk_Object {
+class EwkBackForwardListItem : public EwkObject {
public:
EWK_OBJECT_DECLARE(EwkBackForwardListItem)
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_private.h
index fd0db1247..e676ccca6 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_back_forward_list_private.h
@@ -35,11 +35,11 @@
typedef HashMap<WKBackForwardListItemRef, RefPtr<Ewk_Back_Forward_List_Item> > ItemsMap;
-class Ewk_Back_Forward_List {
+class EwkBackForwardList {
public:
- static PassOwnPtr<Ewk_Back_Forward_List> create(WKBackForwardListRef listRef)
+ static PassOwnPtr<EwkBackForwardList> create(WKBackForwardListRef listRef)
{
- return adoptPtr(new Ewk_Back_Forward_List(listRef));
+ return adoptPtr(new EwkBackForwardList(listRef));
}
Ewk_Back_Forward_List_Item* previousItem() const;
@@ -55,7 +55,7 @@ public:
Eina_List* createEinaList(WKArrayRef wkList) const;
private:
- explicit Ewk_Back_Forward_List(WKBackForwardListRef listRef);
+ explicit EwkBackForwardList(WKBackForwardListRef listRef);
Ewk_Back_Forward_List_Item* getFromCacheOrCreate(WKBackForwardListItemRef wkItem) const;
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_color_picker.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_color_picker.cpp
index 24bd0ed60..4e6bde62c 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_color_picker.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_color_picker.cpp
@@ -31,19 +31,19 @@
using namespace WebCore;
#if ENABLE(INPUT_TYPE_COLOR)
-Ewk_Color_Picker::Ewk_Color_Picker(WKColorPickerResultListenerRef colorPickerListener, const Color& initialColor)
+EwkColorPicker::EwkColorPicker(WKColorPickerResultListenerRef colorPickerListener, const Color& initialColor)
: m_colorPickerListener(colorPickerListener)
, m_color(initialColor)
{
}
-void Ewk_Color_Picker::setColor(const Color& color)
+void EwkColorPicker::setColor(const Color& color)
{
WKRetainPtr<WKStringRef> colorString(AdoptWK, WKStringCreateWithUTF8CString(color.serialized().utf8().data()));
WKColorPickerResultListenerSetColor(m_colorPickerListener.get(), colorString.get());
}
-const Color& Ewk_Color_Picker::color() const
+const Color& EwkColorPicker::color() const
{
return m_color;
}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_color_picker.h b/Source/WebKit2/UIProcess/API/efl/ewk_color_picker.h
index e13c37e3e..56fb4d08d 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_color_picker.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_color_picker.h
@@ -28,7 +28,7 @@ extern "C" {
#endif
/** Creates a type name for @a Ewk_Color_Picker. */
-typedef struct Ewk_Color_Picker Ewk_Color_Picker;
+typedef struct EwkColorPicker Ewk_Color_Picker;
/**
* Sets the selected color.
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_color_picker_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_color_picker_private.h
index 273140bd4..29d036079 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_color_picker_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_color_picker_private.h
@@ -27,18 +27,18 @@
#include <WebCore/Color.h>
#include <wtf/PassOwnPtr.h>
-class Ewk_Color_Picker {
+class EwkColorPicker {
public:
- static PassOwnPtr<Ewk_Color_Picker> create(WKColorPickerResultListenerRef colorPickerListener, const WebCore::Color& initialColor)
+ static PassOwnPtr<EwkColorPicker> create(WKColorPickerResultListenerRef colorPickerListener, const WebCore::Color& initialColor)
{
- return adoptPtr(new Ewk_Color_Picker(colorPickerListener, initialColor));
+ return adoptPtr(new EwkColorPicker(colorPickerListener, initialColor));
}
const WebCore::Color& color() const;
void setColor(const WebCore::Color&);
private:
- Ewk_Color_Picker(WKColorPickerResultListenerRef colorPickerListener, const WebCore::Color& initialColor);
+ EwkColorPicker(WKColorPickerResultListenerRef colorPickerListener, const WebCore::Color& initialColor);
WKRetainPtr<WKColorPickerResultListenerRef> m_colorPickerListener;
WebCore::Color m_color;
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp
index c68e48c43..13534988a 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_context.cpp
@@ -66,14 +66,14 @@ EwkContext::EwkContext(PassRefPtr<WebContext> context)
, m_databaseManager(Ewk_Database_Manager::create(m_context))
, m_storageManager(Ewk_Storage_Manager::create(m_context))
#if ENABLE(BATTERY_STATUS)
- , m_batteryProvider(BatteryProvider::create(toAPI(m_context.get()))) // FIXME: All below should be initialized consistently.
+ , m_batteryProvider(BatteryProvider::create(m_context))
#endif
#if ENABLE(NETWORK_INFO)
- , m_networkInfoProvider(NetworkInfoProvider::create(toAPI(m_context.get())))
+ , m_networkInfoProvider(NetworkInfoProvider::create(m_context))
#endif
, m_downloadManager(DownloadManagerEfl::create(this))
, m_requestManagerClient(RequestManagerClientEfl::create(this))
- , m_historyClient(ContextHistoryClientEfl::create(toAPI(m_context.get())))
+ , m_historyClient(ContextHistoryClientEfl::create(m_context))
{
ContextMap::AddResult result = contextMap().add(m_context.get(), this);
ASSERT_UNUSED(result, result.isNewEntry);
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context.h b/Source/WebKit2/UIProcess/API/efl/ewk_context.h
index 078803842..bfb7fd263 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_context.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_context.h
@@ -54,7 +54,7 @@ extern "C" {
*
* @see Ewk_Object
*/
-typedef struct Ewk_Object Ewk_Context;
+typedef struct EwkObject Ewk_Context;
/**
* \enum Ewk_Cache_Model
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_menu.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context_menu.cpp
new file mode 100644
index 000000000..0a4e54718
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_context_menu.cpp
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR
+ * 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.
+ */
+
+#include "config.h"
+#include "ewk_context_menu.h"
+
+#include "APIObject.h"
+#include "EwkViewImpl.h"
+#include "WebContextMenuItemData.h"
+#include "WebContextMenuProxyEfl.h"
+#include "ewk_context_menu_item.h"
+#include "ewk_context_menu_item_private.h"
+#include "ewk_context_menu_private.h"
+
+using namespace WebKit;
+
+EwkContextMenu::EwkContextMenu(EwkViewImpl* viewImpl, WebContextMenuProxyEfl* contextMenuProxy, const Vector<WebKit::WebContextMenuItemData>& items)
+ : m_viewImpl(viewImpl)
+ , m_contextMenuProxy(contextMenuProxy)
+ , m_contextMenuItems(0)
+{
+ const size_t size = items.size();
+ for (size_t i = 0; i < size; ++i)
+ m_contextMenuItems = eina_list_append(m_contextMenuItems, Ewk_Context_Menu_Item::create(items[i]).leakPtr());
+}
+
+EwkContextMenu::EwkContextMenu()
+ : m_viewImpl(0)
+ , m_contextMenuProxy(0)
+ , m_contextMenuItems(0)
+{
+}
+
+EwkContextMenu::EwkContextMenu(Eina_List* items)
+ : m_viewImpl(0)
+ , m_contextMenuProxy(0)
+ , m_contextMenuItems(0)
+{
+ Eina_List* l;
+ void* data;
+ EINA_LIST_FOREACH(items, l, data)
+ m_contextMenuItems = eina_list_append(m_contextMenuItems, static_cast<EwkContextMenuItem*>(data));
+}
+
+EwkContextMenu::~EwkContextMenu()
+{
+ void* data;
+ EINA_LIST_FREE(m_contextMenuItems, data)
+ delete static_cast<Ewk_Context_Menu_Item*>(data);
+}
+
+void EwkContextMenu::hide()
+{
+ m_viewImpl->hideContextMenu();
+}
+
+void Ewk_Context_Menu::appendItem(EwkContextMenuItem* item)
+{
+ m_contextMenuItems = eina_list_append(m_contextMenuItems, item);
+}
+
+void Ewk_Context_Menu::removeItem(EwkContextMenuItem* item)
+{
+ m_contextMenuItems = eina_list_remove(m_contextMenuItems, item);
+}
+
+void EwkContextMenu::contextMenuItemSelected(const WebKit::WebContextMenuItemData& item)
+{
+ m_contextMenuProxy->contextMenuItemSelected(item);
+}
+
+Ewk_Context_Menu* ewk_context_menu_new()
+{
+ return EwkContextMenu::create().leakPtr();
+}
+
+Ewk_Context_Menu* ewk_context_menu_new_with_items(Eina_List* items)
+{
+ return EwkContextMenu::create(items).leakPtr();
+}
+
+Eina_Bool ewk_context_menu_item_append(Ewk_Context_Menu* menu, Ewk_Context_Menu_Item* item)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(menu, false);
+
+ menu->appendItem(item);
+
+ return true;
+}
+
+Eina_Bool ewk_context_menu_item_remove(Ewk_Context_Menu* menu, Ewk_Context_Menu_Item* item)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(menu, false);
+
+ menu->removeItem(item);
+
+ return true;
+}
+
+Eina_Bool ewk_context_menu_hide(Ewk_Context_Menu* menu)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(menu, false);
+
+ menu->hide();
+
+ return true;
+}
+
+const Eina_List* ewk_context_menu_items_get(const Ewk_Context_Menu* menu)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(menu, 0);
+
+ return menu->items();
+}
+
+Eina_Bool ewk_context_menu_item_select(Ewk_Context_Menu* menu, Ewk_Context_Menu_Item* item)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(menu, false);
+ EINA_SAFETY_ON_NULL_RETURN_VAL(item, false);
+
+ WebCore::ContextMenuItemType type = static_cast<WebCore::ContextMenuItemType>(item->type());
+ WebCore::ContextMenuAction action = static_cast<WebCore::ContextMenuAction>(item->action());
+
+ menu->contextMenuItemSelected(WebContextMenuItemData(type, action, item->title(), item->enabled(), item->checked()));
+
+ return true;
+}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_menu.h b/Source/WebKit2/UIProcess/API/efl/ewk_context_menu.h
new file mode 100644
index 000000000..ad3561939
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_context_menu.h
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR
+ * 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.
+ */
+
+/**
+ * @file ewk_context_menu.h
+ * @brief Describes the Ewk Context Menu API.
+ */
+
+#ifndef ewk_context_menu_h
+#define ewk_context_menu_h
+
+#include "ewk_defines.h"
+#include <Eina.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Creates a new Ewk_Context_Menu to be used as a submenu of an existing
+ * Ewk_Context_Menu. The context menu is created by the ewk_view and
+ * passed as an argument of ewk_view smart callback.
+ *
+ * @return the pointer to the new context menu
+ *
+ * @see ewk_context_menu_new_with_items
+ */
+EAPI Ewk_Context_Menu *ewk_context_menu_new(void);
+
+/**
+ * Creates a new Ewk_Context_Menu to be used as a submenu of an existing
+ * Ewk_Context_Menu with the given initial items. The context menu is
+ * created by the ewk_view and passed as an argument of ewk_view smart callback.
+ *
+ * @param items the list of initial items
+ * @return the pointer to the new context menu
+ *
+ * @see ewk_context_menu_new
+ */
+EAPI Ewk_Context_Menu *ewk_context_menu_new_with_items(Eina_List *items);
+
+/**
+ * Appends the item of the context menu.
+ *
+ * @param menu the context menu
+ * @param item the item to append
+ * @return @c EINA_TRUE on success, @c EINA_FALSE on failure
+ */
+EAPI Eina_Bool ewk_context_menu_item_append(Ewk_Context_Menu *menu, Ewk_Context_Menu_Item *item);
+
+/**
+ * Removes the item of the context menu.
+ *
+ * @param menu the context menu
+ * @param item the item to remove
+ * @return @c EINA_TRUE on success, @c EINA_FALSE on failure
+ */
+EAPI Eina_Bool ewk_context_menu_item_remove(Ewk_Context_Menu *menu, Ewk_Context_Menu_Item *item);
+
+/**
+ * Hides the context menu.
+ *
+ * @param menu the context menu to hide
+ * @return @c EINA_TRUE on success, @c EINA_FALSE on failure
+ */
+EAPI Eina_Bool ewk_context_menu_hide(Ewk_Context_Menu *menu);
+
+/**
+ * Gets the list of items.
+ *
+ * @param o the context menu to get list of the items
+ * @return the list of the items on success or @c NULL on failure
+ */
+EAPI const Eina_List *ewk_context_menu_items_get(const Ewk_Context_Menu *o);
+
+/**
+ * Selects the item from the context menu.
+ *
+ * @param menu the context menu
+ * @param item the item is selected
+ * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
+ */
+EAPI Eina_Bool ewk_context_menu_item_select(Ewk_Context_Menu *menu, Ewk_Context_Menu_Item *item);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ewk_context_menu_h */
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item.cpp
new file mode 100644
index 000000000..d57dbf62a
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item.cpp
@@ -0,0 +1,222 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR
+ * 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.
+ */
+
+#include "config.h"
+#include "ewk_context_menu_item.h"
+
+#include "ewk_context_menu_item_private.h"
+#include "ewk_private.h"
+#include <wtf/text/CString.h>
+
+using namespace WebCore;
+using namespace WebKit;
+
+EwkContextMenuItem::EwkContextMenuItem(const WebContextMenuItemData& item)
+ : m_type(static_cast<Ewk_Context_Menu_Item_Type>(item.type()))
+ , m_action(static_cast<Ewk_Context_Menu_Item_Action>(item.action()))
+ , m_title(item.title().utf8().data())
+ , m_isChecked(item.checked())
+ , m_isEnabled(item.enabled())
+ , m_parentMenu(0)
+ , m_subMenu(0)
+{
+}
+
+EwkContextMenuItem::EwkContextMenuItem(Ewk_Context_Menu_Item_Type type, Ewk_Context_Menu_Item_Action action, const char* title, Eina_Bool checked, Eina_Bool enabled, Ewk_Context_Menu* subMenu)
+ : m_type(type)
+ , m_action(action)
+ , m_title(title)
+ , m_isChecked(checked)
+ , m_isEnabled(enabled)
+ , m_parentMenu(0)
+ , m_subMenu(subMenu)
+{
+}
+
+Ewk_Context_Menu_Item* ewk_context_menu_item_new(Ewk_Context_Menu_Item_Type type, Ewk_Context_Menu_Item_Action action, const char* title, Eina_Bool checked, Eina_Bool enabled)
+{
+ return Ewk_Context_Menu_Item::create(type, action, title, checked, enabled, 0).leakPtr();
+}
+
+Ewk_Context_Menu_Item* ewk_context_menu_item_new_with_submenu(Ewk_Context_Menu_Item_Type type, Ewk_Context_Menu_Item_Action action, const char* title, Eina_Bool checked, Eina_Bool enabled, Ewk_Context_Menu* subMenu)
+{
+ return Ewk_Context_Menu_Item::create(type, action, title, checked, enabled, subMenu).leakPtr();
+}
+
+Ewk_Context_Menu_Item_Type ewk_context_menu_item_type_get(const Ewk_Context_Menu_Item* item)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(item, EWK_ACTION_TYPE);
+
+ return item->type();
+}
+
+Eina_Bool ewk_context_menu_item_type_set(Ewk_Context_Menu_Item* item, Ewk_Context_Menu_Item_Type type)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(item, false);
+
+ item->setType(type);
+
+ return true;
+}
+
+Ewk_Context_Menu_Item_Action ewk_context_menu_item_action_get(const Ewk_Context_Menu_Item* item)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(item, EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION);
+
+ return item->action();
+}
+
+Eina_Bool ewk_context_menu_item_action_set(Ewk_Context_Menu_Item* item, Ewk_Context_Menu_Item_Action action)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(item, false);
+
+ item->setAction(action);
+
+ return true;
+}
+
+const char* ewk_context_menu_item_title_get(const Ewk_Context_Menu_Item* item)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(item, 0);
+
+ return item->title();
+}
+
+Eina_Bool ewk_context_menu_item_title_set(Ewk_Context_Menu_Item* item, const char* title)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(item, false);
+
+ item->setTitle(title);
+
+ return true;
+}
+
+Eina_Bool ewk_context_menu_item_checked_get(const Ewk_Context_Menu_Item* item)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(item, false);
+
+ return item->checked();
+}
+
+Eina_Bool ewk_context_menu_item_checked_set(Ewk_Context_Menu_Item* item, Eina_Bool checked)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(item, false);
+
+ item->setChecked(checked);
+
+ return true;
+}
+
+Eina_Bool ewk_context_menu_item_enabled_get(const Ewk_Context_Menu_Item* item)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(item, false);
+
+ return item->enabled();
+}
+
+Eina_Bool ewk_context_menu_item_enabled_set(Ewk_Context_Menu_Item* item, Eina_Bool enabled)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(item, false);
+
+ item->setEnabled(enabled);
+
+ return true;
+}
+
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION, WebCore::ContextMenuItemTagNoAction);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK_IN_NEW_WINDOW, WebCore::ContextMenuItemTagOpenLinkInNewWindow);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_LINK_TO_DISK, WebCore::ContextMenuItemTagDownloadLinkToDisk);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_COPY_LINK_TO_CLIPBOARD, WebCore::ContextMenuItemTagCopyLinkToClipboard);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_OPEN_IMAGE_IN_NEW_WINDOW, WebCore::ContextMenuItemTagOpenImageInNewWindow);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_IMAGE_TO_DISK, WebCore::ContextMenuItemTagDownloadImageToDisk);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_TO_CLIPBOARD, WebCore::ContextMenuItemTagCopyImageToClipboard);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_URL_TO_CLIPBOARD, WebCore::ContextMenuItemTagCopyImageUrlToClipboard);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_OPEN_FRAME_IN_NEW_WINDOW, WebCore::ContextMenuItemTagOpenFrameInNewWindow);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_COPY, WebCore::ContextMenuItemTagCopy);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_GO_BACK, WebCore::ContextMenuItemTagGoBack);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_GO_FORWARD, WebCore::ContextMenuItemTagGoForward);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_STOP, WebCore::ContextMenuItemTagStop);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_RELOAD, WebCore::ContextMenuItemTagReload);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_CUT, WebCore::ContextMenuItemTagCut);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_PASTE, WebCore::ContextMenuItemTagPaste);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SELECT_ALL, WebCore::ContextMenuItemTagSelectAll);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_GUESS, WebCore::ContextMenuItemTagSpellingGuess);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_NO_GUESSES_FOUND, WebCore::ContextMenuItemTagNoGuessesFound);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_SPELLING, WebCore::ContextMenuItemTagIgnoreSpelling);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_LEARN_SPELLING, WebCore::ContextMenuItemTagLearnSpelling);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_OTHER, WebCore::ContextMenuItemTagOther);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_IN_SPOTLIGHT, WebCore::ContextMenuItemTagSearchInSpotlight);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_WEB, WebCore::ContextMenuItemTagSearchWeb);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_LOOK_UP_IN_DICTIONARY, WebCore::ContextMenuItemTagLookUpInDictionary);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_OPEN_WITH_DEFAULT_APPLICATION, WebCore::ContextMenuItemTagOpenWithDefaultApplication);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFACTUAL_SIZE, WebCore::ContextMenuItemPDFActualSize);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFZOOM_IN, WebCore::ContextMenuItemPDFZoomIn);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFZOOM_OUT, WebCore::ContextMenuItemPDFZoomOut);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFAUTO_SIZE, WebCore::ContextMenuItemPDFAutoSize);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFSINGLE_PAGE, WebCore::ContextMenuItemPDFSinglePage);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFFACING_PAGES, WebCore::ContextMenuItemPDFFacingPages);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFCONTINUOUS, WebCore::ContextMenuItemPDFContinuous);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFNEXT_PAGE, WebCore::ContextMenuItemPDFNextPage);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_PDFPREVIOUS_PAGE, WebCore::ContextMenuItemPDFPreviousPage);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK, WebCore::ContextMenuItemTagOpenLink);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_GRAMMAR, WebCore::ContextMenuItemTagIgnoreGrammar);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_MENU, WebCore::ContextMenuItemTagSpellingMenu);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SHOW_SPELLING_PANEL, WebCore::ContextMenuItemTagShowSpellingPanel);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING, WebCore::ContextMenuItemTagCheckSpelling);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING_WHILE_TYPING, WebCore::ContextMenuItemTagCheckSpellingWhileTyping);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_CHECK_GRAMMAR_WITH_SPELLING, WebCore::ContextMenuItemTagCheckGrammarWithSpelling);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_FONT_MENU, WebCore::ContextMenuItemTagFontMenu);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SHOW_FONTS, WebCore::ContextMenuItemTagShowFonts);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_BOLD, WebCore::ContextMenuItemTagBold);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_ITALIC, WebCore::ContextMenuItemTagItalic);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_UNDERLINE, WebCore::ContextMenuItemTagUnderline);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_OUTLINE, WebCore::ContextMenuItemTagOutline);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_STYLES, WebCore::ContextMenuItemTagStyles);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SHOW_COLORS, WebCore::ContextMenuItemTagShowColors);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_SPEECH_MENU, WebCore::ContextMenuItemTagSpeechMenu);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_START_SPEAKING, WebCore::ContextMenuItemTagStartSpeaking);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_STOP_SPEAKING, WebCore::ContextMenuItemTagStopSpeaking);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_WRITING_DIRECTION_MENU, WebCore::ContextMenuItemTagWritingDirectionMenu);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_DEFAULT_DIRECTION, WebCore::ContextMenuItemTagDefaultDirection);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_LEFT_TO_RIGHT, WebCore::ContextMenuItemTagLeftToRight);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_RIGHT_TO_LEFT, WebCore::ContextMenuItemTagRightToLeft);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_PDFSINGLE_PAGE_SCROLLING, WebCore::ContextMenuItemTagPDFSinglePageScrolling);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_PDFFACING_PAGES_SCROLLING, WebCore::ContextMenuItemTagPDFFacingPagesScrolling);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_INSPECT_ELEMENT, WebCore::ContextMenuItemTagInspectElement);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_MENU, WebCore::ContextMenuItemTagTextDirectionMenu);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_DEFAULT, WebCore::ContextMenuItemTagTextDirectionDefault);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_LEFT_TO_RIGHT, WebCore::ContextMenuItemTagTextDirectionLeftToRight);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_RIGHT_TO_LEFT, WebCore::ContextMenuItemTagTextDirectionRightToLeft);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_OPEN_MEDIA_IN_NEW_WINDOW, WebCore::ContextMenuItemTagOpenMediaInNewWindow);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_COPY_MEDIA_LINK_TO_CLIPBOARD, WebCore::ContextMenuItemTagCopyMediaLinkToClipboard);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_CONTROLS, WebCore::ContextMenuItemTagToggleMediaControls);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_LOOP, WebCore::ContextMenuItemTagToggleMediaLoop);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_ENTER_VIDEO_FULLSCREEN, WebCore::ContextMenuItemTagEnterVideoFullscreen);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_PLAY_PAUSE, WebCore::ContextMenuItemTagMediaPlayPause);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_MUTE, WebCore::ContextMenuItemTagMediaMute);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_BASE_CUSTOM_TAG, WebCore::ContextMenuItemBaseCustomTag);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_CUSTOM_TAG_NO_ACTION, WebCore::ContextMenuItemCustomTagNoAction);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_LAST_CUSTOM_TAG, WebCore::ContextMenuItemLastCustomTag);
+COMPILE_ASSERT_MATCHING_ENUM(EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG, WebCore::ContextMenuItemBaseApplicationTag);
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item.h b/Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item.h
new file mode 100644
index 000000000..9612a21f5
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item.h
@@ -0,0 +1,270 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR
+ * 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.
+ */
+
+/**
+ * @file ewk_context_menu_item.h
+ * @brief Describes the Ewk Context Menu Item API.
+ */
+
+#ifndef ewk_context_menu_item_h
+#define ewk_context_menu_item_h
+
+#include "ewk_defines.h"
+#include <Eina.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \enum Ewk_Context_Menu_Item_Type
+ * @brief Defines the types of the items for the context menu.
+ * @info Keep this in sync with ContextMenuItem.h
+ */
+typedef enum {
+ EWK_ACTION_TYPE,
+ EWK_CHECKABLE_ACTION_TYPE,
+ EWK_SEPARATOR_TYPE,
+ EWK_SUBMENU_TYPE
+} Ewk_Context_Menu_Item_Type;
+
+/**
+ * \enum Ewk_Context_Menu_Action
+ * @brief Provides the actions of items for the context menu.
+ * @info Keep this in sync with ContextMenuItem.h
+ */
+typedef enum {
+ EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION,
+ EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK_IN_NEW_WINDOW,
+ EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_LINK_TO_DISK,
+ EWK_CONTEXT_MENU_ITEM_TAG_COPY_LINK_TO_CLIPBOARD,
+ EWK_CONTEXT_MENU_ITEM_TAG_OPEN_IMAGE_IN_NEW_WINDOW,
+ EWK_CONTEXT_MENU_ITEM_TAG_DOWNLOAD_IMAGE_TO_DISK,
+ EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_TO_CLIPBOARD,
+ EWK_CONTEXT_MENU_ITEM_TAG_COPY_IMAGE_URL_TO_CLIPBOARD,
+ EWK_CONTEXT_MENU_ITEM_TAG_OPEN_FRAME_IN_NEW_WINDOW,
+ EWK_CONTEXT_MENU_ITEM_TAG_COPY,
+ EWK_CONTEXT_MENU_ITEM_TAG_GO_BACK,
+ EWK_CONTEXT_MENU_ITEM_TAG_GO_FORWARD,
+ EWK_CONTEXT_MENU_ITEM_TAG_STOP,
+ EWK_CONTEXT_MENU_ITEM_TAG_RELOAD,
+ EWK_CONTEXT_MENU_ITEM_TAG_CUT,
+ EWK_CONTEXT_MENU_ITEM_TAG_PASTE,
+ EWK_CONTEXT_MENU_ITEM_TAG_SELECT_ALL,
+ EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_GUESS,
+ EWK_CONTEXT_MENU_ITEM_TAG_NO_GUESSES_FOUND,
+ EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_SPELLING,
+ EWK_CONTEXT_MENU_ITEM_TAG_LEARN_SPELLING,
+ EWK_CONTEXT_MENU_ITEM_TAG_OTHER,
+ EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_IN_SPOTLIGHT,
+ EWK_CONTEXT_MENU_ITEM_TAG_SEARCH_WEB,
+ EWK_CONTEXT_MENU_ITEM_TAG_LOOK_UP_IN_DICTIONARY,
+ EWK_CONTEXT_MENU_ITEM_TAG_OPEN_WITH_DEFAULT_APPLICATION,
+ EWK_CONTEXT_MENU_ITEM_PDFACTUAL_SIZE,
+ EWK_CONTEXT_MENU_ITEM_PDFZOOM_IN,
+ EWK_CONTEXT_MENU_ITEM_PDFZOOM_OUT,
+ EWK_CONTEXT_MENU_ITEM_PDFAUTO_SIZE,
+ EWK_CONTEXT_MENU_ITEM_PDFSINGLE_PAGE,
+ EWK_CONTEXT_MENU_ITEM_PDFFACING_PAGES,
+ EWK_CONTEXT_MENU_ITEM_PDFCONTINUOUS,
+ EWK_CONTEXT_MENU_ITEM_PDFNEXT_PAGE,
+ EWK_CONTEXT_MENU_ITEM_PDFPREVIOUS_PAGE,
+ EWK_CONTEXT_MENU_ITEM_TAG_OPEN_LINK = 2000,
+ EWK_CONTEXT_MENU_ITEM_TAG_IGNORE_GRAMMAR,
+ EWK_CONTEXT_MENU_ITEM_TAG_SPELLING_MENU, /**< spelling or spelling/grammar sub-menu */
+ EWK_CONTEXT_MENU_ITEM_TAG_SHOW_SPELLING_PANEL,
+ EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING,
+ EWK_CONTEXT_MENU_ITEM_TAG_CHECK_SPELLING_WHILE_TYPING,
+ EWK_CONTEXT_MENU_ITEM_TAG_CHECK_GRAMMAR_WITH_SPELLING,
+ EWK_CONTEXT_MENU_ITEM_TAG_FONT_MENU, /**< font sub-menu */
+ EWK_CONTEXT_MENU_ITEM_TAG_SHOW_FONTS,
+ EWK_CONTEXT_MENU_ITEM_TAG_BOLD,
+ EWK_CONTEXT_MENU_ITEM_TAG_ITALIC,
+ EWK_CONTEXT_MENU_ITEM_TAG_UNDERLINE,
+ EWK_CONTEXT_MENU_ITEM_TAG_OUTLINE,
+ EWK_CONTEXT_MENU_ITEM_TAG_STYLES,
+ EWK_CONTEXT_MENU_ITEM_TAG_SHOW_COLORS,
+ EWK_CONTEXT_MENU_ITEM_TAG_SPEECH_MENU, /**< speech sub-menu */
+ EWK_CONTEXT_MENU_ITEM_TAG_START_SPEAKING,
+ EWK_CONTEXT_MENU_ITEM_TAG_STOP_SPEAKING,
+ EWK_CONTEXT_MENU_ITEM_TAG_WRITING_DIRECTION_MENU, /**< writing direction sub-menu */
+ EWK_CONTEXT_MENU_ITEM_TAG_DEFAULT_DIRECTION,
+ EWK_CONTEXT_MENU_ITEM_TAG_LEFT_TO_RIGHT,
+ EWK_CONTEXT_MENU_ITEM_TAG_RIGHT_TO_LEFT,
+ EWK_CONTEXT_MENU_ITEM_TAG_PDFSINGLE_PAGE_SCROLLING,
+ EWK_CONTEXT_MENU_ITEM_TAG_PDFFACING_PAGES_SCROLLING,
+ EWK_CONTEXT_MENU_ITEM_TAG_INSPECT_ELEMENT,
+ EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_MENU, /**< text direction sub-menu */
+ EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_DEFAULT,
+ EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_LEFT_TO_RIGHT,
+ EWK_CONTEXT_MENU_ITEM_TAG_TEXT_DIRECTION_RIGHT_TO_LEFT,
+ EWK_CONTEXT_MENU_ITEM_OPEN_MEDIA_IN_NEW_WINDOW,
+ EWK_CONTEXT_MENU_ITEM_TAG_COPY_MEDIA_LINK_TO_CLIPBOARD,
+ EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_CONTROLS,
+ EWK_CONTEXT_MENU_ITEM_TAG_TOGGLE_MEDIA_LOOP,
+ EWK_CONTEXT_MENU_ITEM_TAG_ENTER_VIDEO_FULLSCREEN,
+ EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_PLAY_PAUSE,
+ EWK_CONTEXT_MENU_ITEM_TAG_MEDIA_MUTE,
+ EWK_CONTEXT_MENU_ITEM_BASE_CUSTOM_TAG = 5000,
+ EWK_CONTEXT_MENU_ITEM_CUSTOM_TAG_NO_ACTION = 5998,
+ EWK_CONTEXT_MENU_ITEM_LAST_CUSTOM_TAG = 5999,
+ EWK_CONTEXT_MENU_ITEM_BASE_APPLICATION_TAG = 10000
+} Ewk_Context_Menu_Item_Action;
+
+/**
+ * Creates a new item of the context menu.
+ *
+ * @param type specifies a type of the item
+ * @param action specifies a action of the item
+ * @param title specifies a title of the item
+ * @param checked @c EINA_TRUE if the item should be toggled or @c EINA_FALSE if not
+ * @param enabled @c EINA_TRUE to enable the item or @c EINA_FALSE to disable
+ * @return the pointer to the new item
+ *
+ * @see ewk_context_menu_item_new_with_submenu
+ */
+EAPI Ewk_Context_Menu_Item *ewk_context_menu_item_new(Ewk_Context_Menu_Item_Type type, Ewk_Context_Menu_Item_Action action, const char *title, Eina_Bool checked, Eina_Bool enabled);
+
+/**
+ * Creates a new item of the context menu.
+ *
+ * @param type specifies a type of the item
+ * @param action specifies a action of the item
+ * @param title specifies a title of the item
+ * @param checked @c EINA_TRUE if the item should be toggled or @c EINA_FALSE if not
+ * @param enabled @c EINA_TRUE to enable the item or @c EINA_FALSE to disable
+ * @param submenu specifies a submenu of the item
+ * @return the pointer to the new item
+ *
+ * @see ewk_context_menu_item_new
+ */
+EAPI Ewk_Context_Menu_Item *ewk_context_menu_item_new_with_submenu(Ewk_Context_Menu_Item_Type type, Ewk_Context_Menu_Item_Action action, const char *title, Eina_Bool checked, Eina_Bool enabled, Ewk_Context_Menu *submenu);
+
+/**
+ * Gets type of the item.
+ *
+ * @param o the item to get the type
+ * @return type of the item on success or @c EWK_ACTION_TYPE on failure
+ *
+ * @see ewk_context_menu_item_type_set
+ */
+EAPI Ewk_Context_Menu_Item_Type ewk_context_menu_item_type_get(const Ewk_Context_Menu_Item *o);
+
+/**
+ * Sets the type of item.
+ *
+ * @param o the item to set the type
+ * @param type a new type for the item object
+ * @return @c EINA_TRUE on success, or @c EINA_FALSE on failure
+ *
+ * @see ewk_context_menu_item_type_get
+ */
+EAPI Eina_Bool ewk_context_menu_item_type_set(Ewk_Context_Menu_Item *o, Ewk_Context_Menu_Item_Type type);
+
+/**
+ * Gets an action of the item.
+ *
+ * @param o the item to get the action
+ * @return an action of the item on success or @c EWK_CONTEXT_MENU_ITEM_TAG_NO_ACTION on failure
+ *
+ * @see ewk_context_menu_item_action_set
+ */
+EAPI Ewk_Context_Menu_Item_Action ewk_context_menu_item_action_get(const Ewk_Context_Menu_Item *o);
+
+/**
+ * Sets an action of the item.
+ *
+ * @param o the item to set the action
+ * @param action a new action for the item object
+ * @return @c EINA_TRUE on success, or @c EINA_FALSE on failure
+ *
+ * @see ewk_context_menu_item_action_get
+ */
+EAPI Eina_Bool ewk_context_menu_item_action_set(Ewk_Context_Menu_Item *o, Ewk_Context_Menu_Item_Action action);
+
+/**
+ * Gets a title of the item.
+ *
+ * @param o the item to get the title
+ * @return a title of the item on success, or @c NULL on failure
+ *
+ * @see ewk_context_menu_item_title_set
+ */
+EAPI const char *ewk_context_menu_item_title_get(const Ewk_Context_Menu_Item *o);
+
+/**
+ * Sets a title of the item.
+ *
+ * @param o the item to set the title
+ * @param title a new title for the item object
+ * @return @c EINA_TRUE on success, or @c EINA_FALSE on failure
+ *
+ * @see ewk_context_menu_item_title_get
+ */
+EAPI Eina_Bool ewk_context_menu_item_title_set(Ewk_Context_Menu_Item *o, const char *title);
+
+/**
+ * Queries if the item is toggled.
+ *
+ * @param o the item to query if the item is toggled
+ * @return @c EINA_TRUE if the item is toggled or @c EINA_FALSE if not or on failure
+ */
+EAPI Eina_Bool ewk_context_menu_item_checked_get(const Ewk_Context_Menu_Item *o);
+
+/**
+ * Sets if the item should be toggled.
+ *
+ * @param o the item to be toggled
+ * @param checked @c EINA_TRUE if the item should be toggled or @c EINA_FALSE if not
+ * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
+ */
+EAPI Eina_Bool ewk_context_menu_item_checked_set(Ewk_Context_Menu_Item *o, Eina_Bool checked);
+
+/**
+ * Gets if the item is enabled.
+ *
+ * @param o the item to get enabled state
+ * @return @c EINA_TRUE if it's enabled, @c EINA_FALSE if not or on failure
+ *
+ * @see ewk_context_menu_item_enabled_set
+ */
+EAPI Eina_Bool ewk_context_menu_item_enabled_get(const Ewk_Context_Menu_Item *o);
+
+/**
+ * Enables/disables the item.
+ *
+ * @param o the item to enable/disable
+ * @param enabled @c EINA_TRUE to enable the item or @c EINA_FALSE to disable
+ * @return @c EINA_TRUE on success, or @c EINA_FALSE on failure
+ *
+ * @see ewk_context_menu_item_enabled_get
+ */
+EAPI Eina_Bool ewk_context_menu_item_enabled_set(Ewk_Context_Menu_Item *o, Eina_Bool enabled);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ewk_context_menu_item_h */
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item_private.h
new file mode 100644
index 000000000..62f2790b2
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_context_menu_item_private.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR
+ * 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 ewk_context_menu_item_private_h
+#define ewk_context_menu_item_private_h
+
+#include "WKEinaSharedString.h"
+#include "WebContextMenuItemData.h"
+#include "ewk_context_menu.h"
+#include "ewk_context_menu_item.h"
+#include <wtf/PassOwnPtr.h>
+
+/**
+ * \struct Ewk_Context_Menu_Item
+ * @brief Contains the context menu item data.
+ */
+class EwkContextMenuItem {
+public:
+ static PassOwnPtr<EwkContextMenuItem> create(const WebKit::WebContextMenuItemData& item)
+ {
+ return adoptPtr(new EwkContextMenuItem(item));
+ }
+
+ static PassOwnPtr<EwkContextMenuItem> create(Ewk_Context_Menu_Item_Type type, Ewk_Context_Menu_Item_Action action, const char* title, Eina_Bool checked, Eina_Bool enabled, EwkContextMenu* subMenu)
+ {
+ return adoptPtr(new EwkContextMenuItem(type, action, title, checked, enabled, subMenu));
+ }
+
+ Ewk_Context_Menu_Item_Action action() const { return m_action; }
+ void setAction(Ewk_Context_Menu_Item_Action action) { m_action = action; }
+
+ const char* title() const { return m_title; }
+ void setTitle(const char* title) { m_title = title; }
+
+ Ewk_Context_Menu_Item_Type type() const { return m_type; }
+ void setType(Ewk_Context_Menu_Item_Type type) { m_type = type; }
+
+ bool checked() const { return m_isChecked; }
+ void setChecked(bool checked) { m_isChecked = checked; }
+
+ bool enabled() const { return m_isEnabled; }
+ void setEnabled(bool enabled) { m_isEnabled = enabled; }
+
+private:
+ explicit EwkContextMenuItem(const WebKit::WebContextMenuItemData&);
+ EwkContextMenuItem(Ewk_Context_Menu_Item_Type type, Ewk_Context_Menu_Item_Action action, const char* title, Eina_Bool checked, Eina_Bool enabled, EwkContextMenu* subMenu);
+
+ Ewk_Context_Menu_Item_Type m_type;
+ Ewk_Context_Menu_Item_Action m_action;
+
+ WKEinaSharedString m_title;
+
+ bool m_isChecked;
+ bool m_isEnabled;
+
+ Ewk_Context_Menu* m_parentMenu;
+ Ewk_Context_Menu* m_subMenu;
+};
+
+#endif // ewk_context_menu_item_private_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_menu_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_context_menu_private.h
new file mode 100644
index 000000000..29f5c90ac
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_context_menu_private.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR
+ * 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 ewk_context_menu_private_h
+#define ewk_context_menu_private_h
+
+#include "WebContextMenuItemData.h"
+#include "ewk_context_menu_item.h"
+#include <Eina.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebKit {
+class WebContextMenuItemData;
+class WebContextMenuProxyEfl;
+}
+
+class EwkViewImpl;
+
+class EwkContextMenu {
+public:
+ static PassOwnPtr<EwkContextMenu> create(EwkViewImpl* viewImpl, WebKit::WebContextMenuProxyEfl* contextMenuProxy, const Vector<WebKit::WebContextMenuItemData>& items)
+ {
+ return adoptPtr(new EwkContextMenu(viewImpl, contextMenuProxy, items));
+ }
+
+ static PassOwnPtr<EwkContextMenu> create()
+ {
+ return adoptPtr(new EwkContextMenu());
+ }
+
+ static PassOwnPtr<EwkContextMenu> create(Eina_List* items)
+ {
+ return adoptPtr(new EwkContextMenu(items));
+ }
+
+ ~EwkContextMenu();
+
+ void hide();
+ void appendItem(EwkContextMenuItem*);
+ void removeItem(EwkContextMenuItem*);
+
+ const Eina_List* items() const { return m_contextMenuItems; }
+ void contextMenuItemSelected(const WebKit::WebContextMenuItemData& item);
+
+private:
+ EwkContextMenu();
+ EwkContextMenu(Eina_List* items);
+ EwkContextMenu(EwkViewImpl* viewImpl, WebKit::WebContextMenuProxyEfl*, const Vector<WebKit::WebContextMenuItemData>& items);
+
+ EwkViewImpl* m_viewImpl;
+ WebKit::WebContextMenuProxyEfl* m_contextMenuProxy;
+ Eina_List* m_contextMenuItems;
+};
+
+#endif // ewk_context_menu_private_h
+
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h
index c3b0ba2e0..cb52a92b0 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_context_private.h
@@ -29,8 +29,8 @@
using namespace WebKit;
-class Ewk_Cookie_Manager;
-class Ewk_Favicon_Database;
+class EwkCookieManager;
+class EwkFaviconDatabase;
namespace WebKit {
class ContextHistoryClientEfl;
@@ -43,7 +43,7 @@ class NetworkInfoProvider;
#endif
}
-class EwkContext : public Ewk_Object {
+class EwkContext : public EwkObject {
public:
EWK_OBJECT_DECLARE(EwkContext)
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.cpp
index d37da6f54..831d3bb01 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.cpp
@@ -39,7 +39,7 @@
using namespace WebKit;
-Ewk_Cookie_Manager::Ewk_Cookie_Manager(WKCookieManagerRef cookieManagerRef)
+EwkCookieManager::EwkCookieManager(WKCookieManagerRef cookieManagerRef)
: m_wkCookieManager(cookieManagerRef)
{
WKCookieManagerClient wkCookieManagerClient = {
@@ -50,13 +50,13 @@ Ewk_Cookie_Manager::Ewk_Cookie_Manager(WKCookieManagerRef cookieManagerRef)
WKCookieManagerSetClient(m_wkCookieManager.get(), &wkCookieManagerClient);
}
-Ewk_Cookie_Manager::~Ewk_Cookie_Manager()
+EwkCookieManager::~EwkCookieManager()
{
if (isWatchingForChanges())
WKCookieManagerStopObservingCookieChanges(m_wkCookieManager.get());
}
-void Ewk_Cookie_Manager::setPersistentStorage(const String& filename, SoupCookiePersistentStorageType storage)
+void EwkCookieManager::setPersistentStorage(const String& filename, SoupCookiePersistentStorageType storage)
{
bool isWatchingChanges = isWatchingForChanges();
if (isWatchingChanges)
@@ -68,22 +68,22 @@ void Ewk_Cookie_Manager::setPersistentStorage(const String& filename, SoupCookie
WKCookieManagerStartObservingCookieChanges(m_wkCookieManager.get());
}
-void Ewk_Cookie_Manager::setHTTPAcceptPolicy(WKHTTPCookieAcceptPolicy policy)
+void EwkCookieManager::setHTTPAcceptPolicy(WKHTTPCookieAcceptPolicy policy)
{
WKCookieManagerSetHTTPCookieAcceptPolicy(m_wkCookieManager.get(), policy);
}
-void Ewk_Cookie_Manager::clearHostnameCookies(const String& hostname)
+void EwkCookieManager::clearHostnameCookies(const String& hostname)
{
toImpl(m_wkCookieManager.get())->deleteCookiesForHostname(hostname);
}
-void Ewk_Cookie_Manager::clearAllCookies()
+void EwkCookieManager::clearAllCookies()
{
WKCookieManagerDeleteAllCookies(m_wkCookieManager.get());
}
-void Ewk_Cookie_Manager::watchChanges(const Cookie_Change_Handler& changeHandler)
+void EwkCookieManager::watchChanges(const Cookie_Change_Handler& changeHandler)
{
m_changeHandler = changeHandler;
@@ -93,22 +93,22 @@ void Ewk_Cookie_Manager::watchChanges(const Cookie_Change_Handler& changeHandler
WKCookieManagerStopObservingCookieChanges(m_wkCookieManager.get());
}
-bool Ewk_Cookie_Manager::isWatchingForChanges() const
+bool EwkCookieManager::isWatchingForChanges() const
{
return static_cast<bool>(m_changeHandler.callback);
}
-void Ewk_Cookie_Manager::getHostNamesWithCookies(WKCookieManagerGetCookieHostnamesFunction callback, void* userData) const
+void EwkCookieManager::getHostNamesWithCookies(WKCookieManagerGetCookieHostnamesFunction callback, void* userData) const
{
WKCookieManagerGetHostnamesWithCookies(m_wkCookieManager.get(), userData, callback);
}
-void Ewk_Cookie_Manager::getHTTPAcceptPolicy(WKCookieManagerGetHTTPCookieAcceptPolicyFunction callback, void* userData) const
+void EwkCookieManager::getHTTPAcceptPolicy(WKCookieManagerGetHTTPCookieAcceptPolicyFunction callback, void* userData) const
{
WKCookieManagerGetHTTPCookieAcceptPolicy(m_wkCookieManager.get(), userData, callback);
}
-void Ewk_Cookie_Manager::cookiesDidChange(WKCookieManagerRef, const void* clientInfo)
+void EwkCookieManager::cookiesDidChange(WKCookieManagerRef, const void* clientInfo)
{
Ewk_Cookie_Manager* manager = static_cast<Ewk_Cookie_Manager*>(const_cast<void*>(clientInfo));
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.h b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.h
index 0d2a4c64f..5257b75b7 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager.h
@@ -39,7 +39,7 @@ extern "C" {
#endif
/** Creates a type name for Ewk_Cookie_Manager */
-typedef struct Ewk_Cookie_Manager Ewk_Cookie_Manager;
+typedef struct EwkCookieManager Ewk_Cookie_Manager;
/**
* \enum Ewk_Cookie_Accept_Policy
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager_private.h
index 8c32f891a..5de30606b 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_cookie_manager_private.h
@@ -48,14 +48,14 @@ struct Cookie_Change_Handler {
{ }
};
-class Ewk_Cookie_Manager {
+class EwkCookieManager {
public:
- static PassOwnPtr<Ewk_Cookie_Manager> create(WKCookieManagerRef cookieManagerRef)
+ static PassOwnPtr<EwkCookieManager> create(WKCookieManagerRef cookieManagerRef)
{
return adoptPtr(new Ewk_Cookie_Manager(cookieManagerRef));
}
- ~Ewk_Cookie_Manager();
+ ~EwkCookieManager();
void setPersistentStorage(const String& filename, WebKit::SoupCookiePersistentStorageType storage);
@@ -69,7 +69,7 @@ public:
void watchChanges(const Cookie_Change_Handler& changeHandler);
private:
- explicit Ewk_Cookie_Manager(WKCookieManagerRef cookieManagerRef);
+ explicit EwkCookieManager(WKCookieManagerRef cookieManagerRef);
bool isWatchingForChanges() const;
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_database_manager.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_database_manager.cpp
index 49bbce1ac..85ef90677 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_database_manager.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_database_manager.cpp
@@ -34,20 +34,19 @@
#include "ewk_error_private.h"
#include "ewk_security_origin.h"
#include "ewk_security_origin_private.h"
-#include <wtf/RefCounted.h>
using namespace WebKit;
-Ewk_Database_Manager::Ewk_Database_Manager(WebDatabaseManagerProxy* databaseManager)
+EwkDatabaseManager::EwkDatabaseManager(WebDatabaseManagerProxy* databaseManager)
: m_databaseManager(databaseManager)
{ }
-void Ewk_Database_Manager::getDatabaseOrigins(WKDatabaseManagerGetDatabaseOriginsFunction callback, void* context) const
+void EwkDatabaseManager::getDatabaseOrigins(WKDatabaseManagerGetDatabaseOriginsFunction callback, void* context) const
{
WKDatabaseManagerGetDatabaseOrigins(toAPI(m_databaseManager.get()), context, callback);
}
-Eina_List* Ewk_Database_Manager::createOriginList(WKArrayRef origins) const
+Eina_List* EwkDatabaseManager::createOriginList(WKArrayRef origins) const
{
Eina_List* originList = 0;
const size_t length = WKArrayGetSize(origins);
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_database_manager.h b/Source/WebKit2/UIProcess/API/efl/ewk_database_manager.h
index dc8236c5b..7ce348daa 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_database_manager.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_database_manager.h
@@ -41,7 +41,7 @@ extern "C" {
#endif
/** Creates a type name for Ewk_Database_Manager. */
-typedef struct Ewk_Database_Manager Ewk_Database_Manager;
+typedef struct EwkDatabaseManager Ewk_Database_Manager;
/**
* @typedef Ewk_Database_Origins_Get_Cb Ewk_Database_Origins_Get_Cb
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_database_manager_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_database_manager_private.h
index 3424668c2..eee492412 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_database_manager_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_database_manager_private.h
@@ -35,19 +35,19 @@
using namespace WebKit;
-class Ewk_Database_Manager {
+class EwkDatabaseManager {
public:
- static PassOwnPtr<Ewk_Database_Manager> create(PassRefPtr<WebContext> context)
+ static PassOwnPtr<EwkDatabaseManager> create(PassRefPtr<WebContext> context)
{
ASSERT(context);
- return adoptPtr(new Ewk_Database_Manager(context->databaseManagerProxy()));
+ return adoptPtr(new EwkDatabaseManager(context->databaseManagerProxy()));
}
Eina_List* createOriginList(WKArrayRef wkList) const;
void getDatabaseOrigins(WKDatabaseManagerGetDatabaseOriginsFunction callback, void* context) const;
private:
- explicit Ewk_Database_Manager(WebDatabaseManagerProxy*);
+ explicit EwkDatabaseManager(WebDatabaseManagerProxy*);
RefPtr<WebDatabaseManagerProxy> m_databaseManager;
mutable HashMap<WKSecurityOriginRef, RefPtr<Ewk_Security_Origin> > m_wrapperCache;
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_defines.h b/Source/WebKit2/UIProcess/API/efl/ewk_defines.h
new file mode 100644
index 000000000..97320fb37
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_defines.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT HOLDER OR
+ * 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.
+ */
+
+/**
+ * @file ewk_defines.h
+ * @brief Defines the Ewk Structs
+ */
+
+#ifndef ewk_defines_h
+#define ewk_defines_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Creates a type name for Ewk_Context_Menu */
+typedef struct EwkContextMenu Ewk_Context_Menu;
+
+/** Creates a type name for Ewk_Context_Menu_Item */
+typedef struct EwkContextMenuItem Ewk_Context_Menu_Item;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* ewk_defines_h */
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_download_job.h b/Source/WebKit2/UIProcess/API/efl/ewk_download_job.h
index 4784fc598..6160904aa 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_download_job.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_download_job.h
@@ -48,7 +48,7 @@ extern "C" {
*
* @see Ewk_Object
*/
-typedef struct Ewk_Object Ewk_Download_Job;
+typedef struct EwkObject Ewk_Download_Job;
/// Defines the possible states of a download.
enum Ewk_Download_Job_State {
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_download_job_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_download_job_private.h
index d903874e6..5b6a53f9a 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_download_job_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_download_job_private.h
@@ -40,7 +40,7 @@ class DownloadProxy;
class EwkViewImpl;
-class EwkDownloadJob : public Ewk_Object {
+class EwkDownloadJob : public EwkObject {
public:
EWK_OBJECT_DECLARE(EwkDownloadJob)
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_error.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_error.cpp
index c3b92fd52..cb9d68e1c 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_error.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_error.cpp
@@ -36,34 +36,34 @@
using namespace WebCore;
using namespace WebKit;
-Ewk_Error::Ewk_Error(WKErrorRef errorRef)
+EwkError::EwkError(WKErrorRef errorRef)
: m_wkError(errorRef)
, m_url(AdoptWK, WKErrorCopyFailingURL(errorRef))
, m_description(AdoptWK, WKErrorCopyLocalizedDescription(errorRef))
{ }
-const char* Ewk_Error::url() const
+const char* EwkError::url() const
{
return m_url;
}
-const char* Ewk_Error::description() const
+const char* EwkError::description() const
{
return m_description;
}
-String Ewk_Error::domain() const
+String EwkError::domain() const
{
WKRetainPtr<WKStringRef> wkDomain(AdoptWK, WKErrorCopyDomain(m_wkError.get()));
return toWTFString(wkDomain.get());
}
-int Ewk_Error::errorCode() const
+int EwkError::errorCode() const
{
return WKErrorGetErrorCode(m_wkError.get());
}
-bool Ewk_Error::isCancellation() const
+bool EwkError::isCancellation() const
{
return toImpl(m_wkError.get())->platformError().isCancellation();
}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_error.h b/Source/WebKit2/UIProcess/API/efl/ewk_error.h
index d151543e9..b857a30e2 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_error.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_error.h
@@ -38,7 +38,7 @@ extern "C" {
#endif
/** Creates a type name for @a Ewk_Error. */
-typedef struct Ewk_Error Ewk_Error;
+typedef struct EwkError Ewk_Error;
/// Creates a type name for Ewk_Error_Type.
typedef enum {
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_error_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_error_private.h
index 64fdcf75d..0a3873bb7 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_error_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_error_private.h
@@ -32,14 +32,14 @@
#include <wtf/PassOwnPtr.h>
#include <wtf/text/WTFString.h>
-class Ewk_Error {
+class EwkError {
public:
- static PassOwnPtr<Ewk_Error> create(WKErrorRef errorRef)
+ static PassOwnPtr<EwkError> create(WKErrorRef errorRef)
{
if (!errorRef)
return nullptr;
- return adoptPtr(new Ewk_Error(errorRef));
+ return adoptPtr(new EwkError(errorRef));
}
const char* url() const;
@@ -49,7 +49,7 @@ public:
bool isCancellation() const;
private:
- explicit Ewk_Error(WKErrorRef errorRef);
+ explicit EwkError(WKErrorRef errorRef);
WKRetainPtr<WKErrorRef> m_wkError;
WKEinaSharedString m_url;
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.cpp
index b22afc89d..7df4f3b75 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.cpp
@@ -39,7 +39,7 @@
using namespace WebKit;
-Ewk_Favicon_Database::Ewk_Favicon_Database(WebIconDatabase* iconDatabase)
+EwkFaviconDatabase::EwkFaviconDatabase(WebIconDatabase* iconDatabase)
: m_iconDatabase(iconDatabase)
{
WKIconDatabaseClient iconDatabaseClient;
@@ -51,11 +51,11 @@ Ewk_Favicon_Database::Ewk_Favicon_Database(WebIconDatabase* iconDatabase)
WKIconDatabaseSetIconDatabaseClient(toAPI(m_iconDatabase.get()), &iconDatabaseClient);
}
-Ewk_Favicon_Database::~Ewk_Favicon_Database()
+EwkFaviconDatabase::~EwkFaviconDatabase()
{
}
-String Ewk_Favicon_Database::iconURLForPageURL(const String& pageURL) const
+String EwkFaviconDatabase::iconURLForPageURL(const String& pageURL) const
{
String iconURL;
m_iconDatabase->synchronousIconURLForPageURL(pageURL, iconURL);
@@ -63,7 +63,7 @@ String Ewk_Favicon_Database::iconURLForPageURL(const String& pageURL) const
return iconURL;
}
-void Ewk_Favicon_Database::watchChanges(const IconChangeCallbackData& callbackData)
+void EwkFaviconDatabase::watchChanges(const IconChangeCallbackData& callbackData)
{
ASSERT(callbackData.callback);
if (m_changeListeners.contains(callbackData.callback))
@@ -72,7 +72,7 @@ void Ewk_Favicon_Database::watchChanges(const IconChangeCallbackData& callbackDa
m_changeListeners.add(callbackData.callback, callbackData);
}
-void Ewk_Favicon_Database::unwatchChanges(Ewk_Favicon_Database_Icon_Change_Cb callback)
+void EwkFaviconDatabase::unwatchChanges(Ewk_Favicon_Database_Icon_Change_Cb callback)
{
ASSERT(callback);
m_changeListeners.remove(callback);
@@ -102,7 +102,7 @@ static Eina_Bool respond_icon_request_idle(void* data)
return ECORE_CALLBACK_DONE;
}
-void Ewk_Favicon_Database::iconForPageURL(const String& pageURL, const IconRequestCallbackData& callbackData)
+void EwkFaviconDatabase::iconForPageURL(const String& pageURL, const IconRequestCallbackData& callbackData)
{
// We ask for the icon directly. If we don't get the icon data now,
// we'll be notified later (even if the database is still importing icons).
@@ -125,7 +125,7 @@ void Ewk_Favicon_Database::iconForPageURL(const String& pageURL, const IconReque
ecore_idler_add(respond_icon_request_idle, response);
}
-void Ewk_Favicon_Database::didChangeIconForPageURL(WKIconDatabaseRef, WKURLRef pageURLRef, const void* clientInfo)
+void EwkFaviconDatabase::didChangeIconForPageURL(WKIconDatabaseRef, WKURLRef pageURLRef, const void* clientInfo)
{
const Ewk_Favicon_Database* ewkIconDatabase = static_cast<const Ewk_Favicon_Database*>(clientInfo);
@@ -140,7 +140,7 @@ void Ewk_Favicon_Database::didChangeIconForPageURL(WKIconDatabaseRef, WKURLRef p
it->value.callback(pageURL.data(), it->value.userData);
}
-PassRefPtr<cairo_surface_t> Ewk_Favicon_Database::getIconSurfaceSynchronously(const String& pageURL) const
+PassRefPtr<cairo_surface_t> EwkFaviconDatabase::getIconSurfaceSynchronously(const String& pageURL) const
{
m_iconDatabase->retainIconForPageURL(pageURL);
@@ -155,7 +155,7 @@ PassRefPtr<cairo_surface_t> Ewk_Favicon_Database::getIconSurfaceSynchronously(co
return surface.release();
}
-void Ewk_Favicon_Database::iconDataReadyForPageURL(WKIconDatabaseRef, WKURLRef pageURL, const void* clientInfo)
+void EwkFaviconDatabase::iconDataReadyForPageURL(WKIconDatabaseRef, WKURLRef pageURL, const void* clientInfo)
{
Ewk_Favicon_Database* ewkIconDatabase = const_cast<Ewk_Favicon_Database*>(static_cast<const Ewk_Favicon_Database*>(clientInfo));
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.h b/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.h
index 89cc31f84..b66a67b16 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database.h
@@ -38,7 +38,7 @@ extern "C" {
#endif
/** Creates a type name for @a Ewk_Favicon_Database. */
-typedef struct Ewk_Favicon_Database Ewk_Favicon_Database;
+typedef struct EwkFaviconDatabase Ewk_Favicon_Database;
/**
* @typedef Ewk_Favicon_Database_Icon_Change_Cb Ewk_Favicon_Database_Icon_Change_Cb
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database_private.h
index 34da50375..86a911263 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_favicon_database_private.h
@@ -71,13 +71,13 @@ typedef HashMap<Ewk_Favicon_Database_Icon_Change_Cb, IconChangeCallbackData> Cha
typedef Vector<IconRequestCallbackData> PendingIconRequestVector;
typedef HashMap<String /* pageURL */, PendingIconRequestVector> PendingIconRequestMap;
-class Ewk_Favicon_Database {
+class EwkFaviconDatabase {
public:
- static PassOwnPtr<Ewk_Favicon_Database> create(WebKit::WebIconDatabase* iconDatabase)
+ static PassOwnPtr<EwkFaviconDatabase> create(WebKit::WebIconDatabase* iconDatabase)
{
- return adoptPtr(new Ewk_Favicon_Database(iconDatabase));
+ return adoptPtr(new EwkFaviconDatabase(iconDatabase));
}
- ~Ewk_Favicon_Database();
+ ~EwkFaviconDatabase();
String iconURLForPageURL(const String& pageURL) const;
void iconForPageURL(const String& pageURL, const IconRequestCallbackData& callbackData);
@@ -86,7 +86,7 @@ public:
void unwatchChanges(Ewk_Favicon_Database_Icon_Change_Cb callback);
private:
- explicit Ewk_Favicon_Database(WebKit::WebIconDatabase* iconDatabase);
+ explicit EwkFaviconDatabase(WebKit::WebIconDatabase* iconDatabase);
PassRefPtr<cairo_surface_t> getIconSurfaceSynchronously(const String& pageURL) const;
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_file_chooser_request.h b/Source/WebKit2/UIProcess/API/efl/ewk_file_chooser_request.h
index 3e7507835..d7c2d12b4 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_file_chooser_request.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_file_chooser_request.h
@@ -42,7 +42,7 @@ extern "C" {
*
* @see Ewk_Object
*/
-typedef struct Ewk_Object Ewk_File_Chooser_Request;
+typedef struct EwkObject Ewk_File_Chooser_Request;
/**
* Queries if it is allowed to select multiple files or not.
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_file_chooser_request_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_file_chooser_request_private.h
index 8580a8f4c..61778ff83 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_file_chooser_request_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_file_chooser_request_private.h
@@ -29,7 +29,6 @@
#include "APIObject.h"
#include "ewk_object_private.h"
#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
@@ -39,7 +38,7 @@ class WebOpenPanelParameters;
class WebOpenPanelResultListenerProxy;
}
-class EwkFileChooserRequest : public Ewk_Object {
+class EwkFileChooserRequest : public EwkObject {
public:
EWK_OBJECT_DECLARE(EwkFileChooserRequest)
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.h b/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.h
index 8df76986a..58c001f8e 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request.h
@@ -45,7 +45,7 @@ extern "C" {
*
* @see Ewk_Object
*/
-typedef struct Ewk_Object Ewk_Form_Submission_Request;
+typedef struct EwkObject Ewk_Form_Submission_Request;
/**
* Returns the list of field names contained in the form associated to @a request.
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request_private.h
index a6f7ab7f9..26d324631 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_form_submission_request_private.h
@@ -31,10 +31,9 @@
#include "WKRetainPtr.h"
#include "ewk_object_private.h"
#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
#include <wtf/text/WTFString.h>
-class EwkFormSubmissionRequest : public Ewk_Object {
+class EwkFormSubmissionRequest : public EwkObject {
public:
EWK_OBJECT_DECLARE(EwkFormSubmissionRequest)
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_intent.h b/Source/WebKit2/UIProcess/API/efl/ewk_intent.h
index 4667b6831..75448f212 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_intent.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_intent.h
@@ -42,7 +42,7 @@ extern "C" {
*
* @see Ewk_Object
*/
-typedef struct Ewk_Object Ewk_Intent;
+typedef struct EwkObject Ewk_Intent;
/**
* Query action for this intent.
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_intent_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_intent_private.h
index 3abc4d76a..199ec79c1 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_intent_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_intent_private.h
@@ -44,7 +44,7 @@ class WebIntentData;
* \struct EwkIntent
* @brief Contains the intent data.
*/
-class EwkIntent : public Ewk_Object {
+class EwkIntent : public EwkObject {
public:
EWK_OBJECT_DECLARE(EwkIntent)
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.h b/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.h
index 01476692f..12e580804 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_intent_service.h
@@ -42,7 +42,7 @@ extern "C" {
*
* @see Ewk_Object
*/
-typedef struct Ewk_Object Ewk_Intent_Service;
+typedef struct EwkObject Ewk_Intent_Service;
/**
* Query action for this intent service.
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_intent_service_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_intent_service_private.h
index 022e39762..7a98a645d 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_intent_service_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_intent_service_private.h
@@ -38,7 +38,7 @@
* \struct EwkIntentService
* @brief Contains the intent service data.
*/
-class EwkIntentService : public Ewk_Object {
+class EwkIntentService : public EwkObject {
public:
EWK_OBJECT_DECLARE(EwkIntentService)
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data.h b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data.h
index 16f7bc5b8..7f62641e7 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data.h
@@ -43,7 +43,7 @@ extern "C" {
*
* @see Ewk_Object
*/
-typedef struct Ewk_Object Ewk_Navigation_Data;
+typedef struct EwkObject Ewk_Navigation_Data;
/**
* Returns title for this navigation data.
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data_private.h
index 59e0c6976..5ba5a5cb8 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_data_private.h
@@ -33,13 +33,12 @@
#include "ewk_private.h"
#include "ewk_url_request_private.h"
#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
/**
* \struct EwkNavigationData
* @brief Contains the navigation data details.
*/
-class EwkNavigationData : public Ewk_Object {
+class EwkNavigationData : public EwkObject {
public:
EWK_OBJECT_DECLARE(EwkNavigationData)
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.h b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.h
index 0f341f53b..a9fbbefe5 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision.h
@@ -43,7 +43,7 @@ extern "C" {
*
* @see Ewk_Object
*/
-typedef struct Ewk_Object Ewk_Navigation_Policy_Decision;
+typedef struct EwkObject Ewk_Navigation_Policy_Decision;
/// Enum containing navigation types
typedef enum {
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision_private.h
index fb2773ab8..714dbccbe 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_navigation_policy_decision_private.h
@@ -40,7 +40,7 @@
* \struct EwkNavigationPolicyDecision
* @brief Contains the navigation policy decision data.
*/
-class EwkNavigationPolicyDecision : public Ewk_Object {
+class EwkNavigationPolicyDecision : public EwkObject {
public:
EWK_OBJECT_DECLARE(EwkNavigationPolicyDecision)
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_object.h b/Source/WebKit2/UIProcess/API/efl/ewk_object.h
index 0349493c8..9ad1afe5f 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_object.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_object.h
@@ -38,7 +38,7 @@ extern "C" {
#endif
/** Creates a type name for Ewk_Object */
-typedef struct Ewk_Object Ewk_Object;
+typedef struct EwkObject Ewk_Object;
/**
* Increases the reference count of the given Ewk_Object.
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_object_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_object_private.h
index 4d4ccfabc..b67f33820 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_object_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_object_private.h
@@ -28,20 +28,20 @@
#include <wtf/RefCounted.h>
-class Ewk_Object : public RefCounted<Ewk_Object> {
+class EwkObject : public RefCounted<EwkObject> {
public:
- virtual ~Ewk_Object() { }
+ virtual ~EwkObject() { }
virtual const char* instanceClassName() const = 0;
};
template <class T>
-inline bool ewk_object_is_of_type(const Ewk_Object* object)
+inline bool ewk_object_is_of_type(const EwkObject* object)
{
return (reinterpret_cast<T>(0)->className() == object->instanceClassName());
}
template <class T>
-inline bool ewk_object_cast_check(const Ewk_Object* object)
+inline bool ewk_object_cast_check(const EwkObject* object)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(object, false);
@@ -56,13 +56,13 @@ inline bool ewk_object_cast_check(const Ewk_Object* object)
}
template <class T>
-inline const T ewk_object_cast(const Ewk_Object* object)
+inline const T ewk_object_cast(const EwkObject* object)
{
return ewk_object_cast_check<T>(object) ? static_cast<T>(object) : 0;
}
template <class T>
-inline T ewk_object_cast(Ewk_Object* object)
+inline T ewk_object_cast(EwkObject* object)
{
return ewk_object_cast_check<T>(object) ? static_cast<T>(object) : 0;
}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu.cpp
index 765114e6d..f1dad3ab7 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu.cpp
@@ -34,7 +34,7 @@
using namespace WebKit;
-Ewk_Popup_Menu::Ewk_Popup_Menu(EwkViewImpl* viewImpl, WebPopupMenuProxyEfl* popupMenuProxy, const Vector<WebKit::WebPopupItem>& items, unsigned selectedIndex)
+EwkPopupMenu::EwkPopupMenu(EwkViewImpl* viewImpl, WebPopupMenuProxyEfl* popupMenuProxy, const Vector<WebKit::WebPopupItem>& items, unsigned selectedIndex)
: m_viewImpl(viewImpl)
, m_popupMenuProxy(popupMenuProxy)
, m_popupMenuItems(0)
@@ -45,29 +45,29 @@ Ewk_Popup_Menu::Ewk_Popup_Menu(EwkViewImpl* viewImpl, WebPopupMenuProxyEfl* popu
m_popupMenuItems = eina_list_append(m_popupMenuItems, Ewk_Popup_Menu_Item::create(items[i]).leakPtr());
}
-Ewk_Popup_Menu::~Ewk_Popup_Menu()
+EwkPopupMenu::~EwkPopupMenu()
{
void* item;
EINA_LIST_FREE(m_popupMenuItems, item)
delete static_cast<Ewk_Popup_Menu_Item*>(item);
}
-void Ewk_Popup_Menu::close()
+void EwkPopupMenu::close()
{
m_viewImpl->closePopupMenu();
}
-const Eina_List* Ewk_Popup_Menu::items() const
+const Eina_List* EwkPopupMenu::items() const
{
return m_popupMenuItems;
}
-unsigned Ewk_Popup_Menu::selectedIndex() const
+unsigned EwkPopupMenu::selectedIndex() const
{
return m_selectedIndex;
}
-bool Ewk_Popup_Menu::setSelectedIndex(unsigned selectedIndex)
+bool EwkPopupMenu::setSelectedIndex(unsigned selectedIndex)
{
if (!m_popupMenuProxy)
return false;
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu.h b/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu.h
index 04e17688c..0ad0f5fcc 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu.h
@@ -39,7 +39,7 @@ extern "C" {
#endif
/** Creates a type name for Ewk_Popup_Menu */
-typedef struct Ewk_Popup_Menu Ewk_Popup_Menu;
+typedef struct EwkPopupMenu Ewk_Popup_Menu;
/**
* Selects index of current popup menu.
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_item.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_item.cpp
index 549da1839..0a51d958a 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_item.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_item.cpp
@@ -32,7 +32,7 @@
using namespace WebKit;
-Ewk_Popup_Menu_Item::Ewk_Popup_Menu_Item(const WebKit::WebPopupItem& item)
+EwkPopupMenuItem::EwkPopupMenuItem(const WebKit::WebPopupItem& item)
: m_type(static_cast<Ewk_Popup_Menu_Item_Type>(item.m_type))
, m_textDirection(static_cast<Ewk_Text_Direction>(item.m_textDirection))
, m_hasTextDirectionOverride(item.m_hasTextDirectionOverride)
@@ -44,47 +44,47 @@ Ewk_Popup_Menu_Item::Ewk_Popup_Menu_Item(const WebKit::WebPopupItem& item)
, m_accessibilityText(item.m_accessibilityText.utf8().data())
{ }
-Ewk_Popup_Menu_Item_Type Ewk_Popup_Menu_Item::type() const
+Ewk_Popup_Menu_Item_Type EwkPopupMenuItem::type() const
{
return m_type;
}
-Ewk_Text_Direction Ewk_Popup_Menu_Item::textDirection() const
+Ewk_Text_Direction EwkPopupMenuItem::textDirection() const
{
return m_textDirection;
}
-const char* Ewk_Popup_Menu_Item::text() const
+const char* EwkPopupMenuItem::text() const
{
return m_text;
}
-const char* Ewk_Popup_Menu_Item::tooltipText() const
+const char* EwkPopupMenuItem::tooltipText() const
{
return m_tooltipText;
}
-const char* Ewk_Popup_Menu_Item::accessibilityText() const
+const char* EwkPopupMenuItem::accessibilityText() const
{
return m_accessibilityText;
}
-bool Ewk_Popup_Menu_Item::hasTextDirectionOverride() const
+bool EwkPopupMenuItem::hasTextDirectionOverride() const
{
return m_hasTextDirectionOverride;
}
-bool Ewk_Popup_Menu_Item::isEnabled() const
+bool EwkPopupMenuItem::isEnabled() const
{
return m_isEnabled;
}
-bool Ewk_Popup_Menu_Item::isLabel() const
+bool EwkPopupMenuItem::isLabel() const
{
return m_isLabel;
}
-bool Ewk_Popup_Menu_Item::isSelected() const
+bool EwkPopupMenuItem::isSelected() const
{
return m_isSelected;
}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_item.h b/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_item.h
index 5efe6fe0e..1a2eacd0c 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_item.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_item.h
@@ -46,7 +46,7 @@ typedef enum {
} Ewk_Popup_Menu_Item_Type;
/** Creates a type name for Ewk_Popup_Menu_Item */
-typedef struct Ewk_Popup_Menu_Item Ewk_Popup_Menu_Item;
+typedef struct EwkPopupMenuItem Ewk_Popup_Menu_Item;
/**
* Returns type of the popup menu item.
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_item_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_item_private.h
index 660579670..680a391f1 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_item_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_item_private.h
@@ -35,11 +35,11 @@
* \struct Ewk_Popup_Menu_Item
* @brief Contains the popup menu data.
*/
-class Ewk_Popup_Menu_Item {
+class EwkPopupMenuItem {
public:
- static PassOwnPtr<Ewk_Popup_Menu_Item> create(const WebKit::WebPopupItem& item)
+ static PassOwnPtr<EwkPopupMenuItem> create(const WebKit::WebPopupItem& item)
{
- return adoptPtr(new Ewk_Popup_Menu_Item(item));
+ return adoptPtr(new EwkPopupMenuItem(item));
}
Ewk_Popup_Menu_Item_Type type() const;
@@ -55,7 +55,7 @@ public:
const char* accessibilityText() const;
private:
- explicit Ewk_Popup_Menu_Item(const WebKit::WebPopupItem& item);
+ explicit EwkPopupMenuItem(const WebKit::WebPopupItem& item);
Ewk_Popup_Menu_Item_Type m_type;
Ewk_Text_Direction m_textDirection;
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_private.h
index bdadc5ec3..2b5de0684 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_popup_menu_private.h
@@ -38,13 +38,13 @@ class WebPopupMenuProxyEfl;
class EwkViewImpl;
-class Ewk_Popup_Menu {
+class EwkPopupMenu {
public:
- static PassOwnPtr<Ewk_Popup_Menu> create(EwkViewImpl* viewImpl, WebKit::WebPopupMenuProxyEfl* popupMenuProxy, const Vector<WebKit::WebPopupItem>& items, unsigned selectedIndex)
+ static PassOwnPtr<EwkPopupMenu> create(EwkViewImpl* viewImpl, WebKit::WebPopupMenuProxyEfl* popupMenuProxy, const Vector<WebKit::WebPopupItem>& items, unsigned selectedIndex)
{
- return adoptPtr(new Ewk_Popup_Menu(viewImpl, popupMenuProxy, items, selectedIndex));
+ return adoptPtr(new EwkPopupMenu(viewImpl, popupMenuProxy, items, selectedIndex));
}
- ~Ewk_Popup_Menu();
+ ~EwkPopupMenu();
void close();
@@ -54,7 +54,7 @@ public:
unsigned selectedIndex() const;
private:
- Ewk_Popup_Menu(EwkViewImpl* viewImpl, WebKit::WebPopupMenuProxyEfl*, const Vector<WebKit::WebPopupItem>& items, unsigned selectedIndex);
+ EwkPopupMenu(EwkViewImpl* viewImpl, WebKit::WebPopupMenuProxyEfl*, const Vector<WebKit::WebPopupItem>& items, unsigned selectedIndex);
EwkViewImpl* m_viewImpl;
WebKit::WebPopupMenuProxyEfl* m_popupMenuProxy;
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_resource.h b/Source/WebKit2/UIProcess/API/efl/ewk_resource.h
index 074f828fa..ca36b6c54 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_resource.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_resource.h
@@ -42,7 +42,7 @@ extern "C" {
*
* @see Ewk_Object
*/
-typedef struct Ewk_Object Ewk_Resource;
+typedef struct EwkObject Ewk_Resource;
/**
* Query URL for this resource.
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_resource_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_resource_private.h
index 9c090fd47..df872c60a 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_resource_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_resource_private.h
@@ -30,11 +30,10 @@
#include "WKURL.h"
#include "ewk_object_private.h"
#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
-class EwkResource : public Ewk_Object {
+class EwkResource : public EwkObject {
public:
EWK_OBJECT_DECLARE(EwkResource)
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_security_origin.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_security_origin.cpp
index 35061260c..60d8e39f8 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_security_origin.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_security_origin.cpp
@@ -28,8 +28,11 @@
#include "WKAPICast.h"
#include "WKSecurityOrigin.h"
+#include "WebSecurityOrigin.h"
#include "ewk_security_origin_private.h"
+#include <WebCore/SecurityOrigin.h>
+using namespace WebCore;
using namespace WebKit;
EwkSecurityOrigin::EwkSecurityOrigin(WKSecurityOriginRef originRef)
@@ -38,6 +41,12 @@ EwkSecurityOrigin::EwkSecurityOrigin(WKSecurityOriginRef originRef)
, m_protocol(AdoptWK, WKSecurityOriginCopyProtocol(originRef))
{ }
+EwkSecurityOrigin::EwkSecurityOrigin(const KURL& url)
+ : m_wkOrigin(AdoptWK, toAPI(WebSecurityOrigin::create(SecurityOrigin::create(url)).leakRef()))
+ , m_host(AdoptWK, WKSecurityOriginCopyHost(m_wkOrigin.get()))
+ , m_protocol(AdoptWK, WKSecurityOriginCopyProtocol(m_wkOrigin.get()))
+{ }
+
const char* EwkSecurityOrigin::host() const
{
return m_host;
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_security_origin.h b/Source/WebKit2/UIProcess/API/efl/ewk_security_origin.h
index 2b8175e22..2cfcfe0d1 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_security_origin.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_security_origin.h
@@ -47,7 +47,7 @@ extern "C" {
*
* @see Ewk_Object
*/
-typedef struct Ewk_Object Ewk_Security_Origin;
+typedef struct EwkObject Ewk_Security_Origin;
/**
* Returns the host of the security origin.
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_security_origin_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_security_origin_private.h
index a8a39a499..a2d3b317b 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_security_origin_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_security_origin_private.h
@@ -29,10 +29,11 @@
#include "WKEinaSharedString.h"
#include "WKSecurityOrigin.h"
#include "ewk_object_private.h"
+#include <WebCore/KURL.h>
#include <WebKit2/WKBase.h>
#include <wtf/PassRefPtr.h>
-class EwkSecurityOrigin : public Ewk_Object {
+class EwkSecurityOrigin : public EwkObject {
public:
EWK_OBJECT_DECLARE(EwkSecurityOrigin)
@@ -41,12 +42,18 @@ public:
return adoptRef(new EwkSecurityOrigin(originRef));
}
+ static PassRefPtr<EwkSecurityOrigin> create(const WebCore::KURL& url)
+ {
+ return adoptRef(new EwkSecurityOrigin(url));
+ }
+
const char* host() const;
const char* protocol() const;
uint32_t port() const;
private:
explicit EwkSecurityOrigin(WKSecurityOriginRef originRef);
+ explicit EwkSecurityOrigin(const WebCore::KURL& url);
WKRetainPtr<WKSecurityOriginRef> m_wkOrigin;
WKEinaSharedString m_host;
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp
index 96a321038..c61703078 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp
@@ -43,12 +43,12 @@
using namespace WebKit;
-const WebKit::WebPreferences* Ewk_Settings::preferences() const
+const WebKit::WebPreferences* EwkSettings::preferences() const
{
return m_viewImpl->page()->pageGroup()->preferences();
}
-WebKit::WebPreferences* Ewk_Settings::preferences()
+WebKit::WebPreferences* EwkSettings::preferences()
{
return m_viewImpl->page()->pageGroup()->preferences();
}
@@ -225,7 +225,7 @@ void ewk_settings_continuous_spell_checking_enabled_set(Eina_Bool enable)
WKTextCheckerContinuousSpellCheckingEnabledStateChanged(enable);
// Sets the default language if user didn't specify any.
- if (enable && Ewk_Text_Checker::loadedSpellCheckingLanguages().isEmpty())
+ if (enable && !Ewk_Text_Checker::hasDictionary())
spellCheckingLanguagesSet(Vector<String>());
if (ewkTextCheckerSettings.onContinuousSpellChecking)
@@ -302,3 +302,33 @@ unsigned ewk_settings_preferred_minimum_contents_width_get(const Ewk_Settings *s
return settings->preferences()->layoutFallbackWidth();
}
+
+Eina_Bool ewk_settings_offline_web_application_cache_enabled_set(Ewk_Settings* settings, Eina_Bool enable)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
+ settings->preferences()->setOfflineWebApplicationCacheEnabled(enable);
+
+ return true;
+}
+
+Eina_Bool ewk_settings_offline_web_application_cache_enabled_get(const Ewk_Settings* settings)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
+
+ return settings->preferences()->offlineWebApplicationCacheEnabled();
+}
+
+Eina_Bool ewk_settings_scripts_can_open_windows_set(Ewk_Settings* settings, Eina_Bool enable)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
+ settings->preferences()->setJavaScriptCanOpenWindowsAutomatically(enable);
+
+ return true;
+}
+
+Eina_Bool ewk_settings_scripts_can_open_windows_get(const Ewk_Settings* settings)
+{
+ EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
+
+ return settings->preferences()->javaScriptCanOpenWindowsAutomatically();
+}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_settings.h b/Source/WebKit2/UIProcess/API/efl/ewk_settings.h
index f01c654f6..856daaa00 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_settings.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_settings.h
@@ -41,7 +41,7 @@ extern "C" {
#endif
/** Creates a type name for Ewk_Settings */
-typedef struct Ewk_Settings Ewk_Settings;
+typedef struct EwkSettings Ewk_Settings;
/**
* Creates a type name for the callback function used to notify the client when
@@ -345,6 +345,52 @@ EAPI Eina_Bool ewk_settings_preferred_minimum_contents_width_set(Ewk_Settings *s
*/
EAPI unsigned ewk_settings_preferred_minimum_contents_width_get(const Ewk_Settings *settings);
+/**
+ * Enables/disables the offline application cache.
+ *
+ * By default, the offline application cache is enabled.
+ *
+ * @param settings settings object to set the offline application cache state
+ * @param enable @c EINA_TRUE to enable the offline application cache,
+ * @c EINA_FALSE to disable
+ *
+ * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
+ */
+EAPI Eina_Bool ewk_settings_offline_web_application_cache_enabled_set(Ewk_Settings *settings, Eina_Bool enable);
+
+/**
+ * Returns whether the offline application cache is enabled or not.
+ *
+ * @param settings settings object to query whether offline application cache is enabled
+ *
+ * @return @c EINA_TRUE if the offline application cache is enabled
+ * @c EINA_FALSE if disabled or on failure
+ */
+EAPI Eina_Bool ewk_settings_offline_web_application_cache_enabled_get(const Ewk_Settings *settings);
+
+/**
+ * Enables/disables if the scripts can open new windows.
+ *
+ * By default, the scripts can open new windows.
+ *
+ * @param settings settings object to set if the scripts can open new windows
+ * @param enable @c EINA_TRUE if the scripts can open new windows
+ * @c EINA_FALSE if not
+ *
+ * @return @c EINA_TRUE on success or @c EINA_FALSE on failure (scripts are disabled)
+ */
+EAPI Eina_Bool ewk_settings_scripts_can_open_windows_set(Ewk_Settings *settings, Eina_Bool enable);
+
+/**
+ * Returns whether the scripts can open new windows.
+ *
+ * @param settings settings object to query whether the scripts can open new windows
+ *
+ * @return @c EINA_TRUE if the scripts can open new windows
+ * @c EINA_FALSE if not or on failure (scripts are disabled)
+ */
+EAPI Eina_Bool ewk_settings_scripts_can_open_windows_get(const Ewk_Settings *settings);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_settings_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_settings_private.h
index ea29a8575..3335aad71 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_settings_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_settings_private.h
@@ -37,18 +37,18 @@ class EwkViewImpl;
* \struct Ewk_Settings
* @brief Contains the settings data.
*/
-class Ewk_Settings {
+class EwkSettings {
public:
- static PassOwnPtr<Ewk_Settings> create(EwkViewImpl* viewImpl)
+ static PassOwnPtr<EwkSettings> create(EwkViewImpl* viewImpl)
{
- return adoptPtr(new Ewk_Settings(viewImpl));
+ return adoptPtr(new EwkSettings(viewImpl));
}
const WebKit::WebPreferences* preferences() const;
WebKit::WebPreferences* preferences();
private:
- explicit Ewk_Settings(EwkViewImpl* viewImpl)
+ explicit EwkSettings(EwkViewImpl* viewImpl)
: m_viewImpl(viewImpl)
{
ASSERT(m_viewImpl);
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_storage_manager.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_storage_manager.cpp
index 620f219af..282c7a017 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_storage_manager.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_storage_manager.cpp
@@ -33,20 +33,19 @@
#include "ewk_security_origin.h"
#include "ewk_security_origin_private.h"
#include "ewk_storage_manager_private.h"
-#include <wtf/RefCounted.h>
using namespace WebKit;
-Ewk_Storage_Manager::Ewk_Storage_Manager(WebKeyValueStorageManagerProxy* storageManagerProxy)
+EwkStorageManager::EwkStorageManager(WebKeyValueStorageManagerProxy* storageManagerProxy)
: m_storageManager(storageManagerProxy)
{ }
-void Ewk_Storage_Manager::getStorageOrigins(void* context, WKKeyValueStorageManagerGetKeyValueStorageOriginsFunction callback) const
+void EwkStorageManager::getStorageOrigins(void* context, WKKeyValueStorageManagerGetKeyValueStorageOriginsFunction callback) const
{
WKKeyValueStorageManagerGetKeyValueStorageOrigins(toAPI(m_storageManager.get()), context, callback);
}
-Eina_List* Ewk_Storage_Manager::createOriginList(WKArrayRef origins) const
+Eina_List* EwkStorageManager::createOriginList(WKArrayRef origins) const
{
Eina_List* originList = 0;
const size_t length = WKArrayGetSize(origins);
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_storage_manager.h b/Source/WebKit2/UIProcess/API/efl/ewk_storage_manager.h
index d94a556b6..f9d039bbd 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_storage_manager.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_storage_manager.h
@@ -41,7 +41,7 @@ extern "C" {
#endif
/** Creates a type name for Ewk_Storage_Manager. */
-typedef struct Ewk_Storage_Manager Ewk_Storage_Manager;
+typedef struct EwkStorageManager Ewk_Storage_Manager;
/**
* @typedef Ewk_Storage_Origins_Get_Cb Ewk_Storage_Origins_Get_Cb
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_storage_manager_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_storage_manager_private.h
index 94ba72d9f..5dd4b081e 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_storage_manager_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_storage_manager_private.h
@@ -35,19 +35,19 @@
using namespace WebKit;
-class Ewk_Storage_Manager {
+class EwkStorageManager {
public:
- static PassOwnPtr<Ewk_Storage_Manager> create(PassRefPtr<WebContext> context)
+ static PassOwnPtr<EwkStorageManager> create(PassRefPtr<WebContext> context)
{
ASSERT(context);
- return adoptPtr(new Ewk_Storage_Manager(context->keyValueStorageManagerProxy()));
+ return adoptPtr(new EwkStorageManager(context->keyValueStorageManagerProxy()));
}
Eina_List* createOriginList(WKArrayRef wkList) const;
void getStorageOrigins(void* context, WKKeyValueStorageManagerGetKeyValueStorageOriginsFunction callback) const;
private:
- explicit Ewk_Storage_Manager(WebKeyValueStorageManagerProxy* storageManagerProxy);
+ explicit EwkStorageManager(WebKeyValueStorageManagerProxy* storageManagerProxy);
RefPtr<WebKeyValueStorageManagerProxy> m_storageManager;
mutable HashMap<WKSecurityOriginRef, RefPtr<Ewk_Security_Origin> > m_wrapperCache;
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_text_checker.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_text_checker.cpp
index e15b8fc1a..ce546d56b 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_text_checker.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_text_checker.cpp
@@ -162,6 +162,11 @@ Vector<String> loadedSpellCheckingLanguages()
return textCheckerEnchant()->loadedSpellCheckingLanguages();
}
+bool hasDictionary()
+{
+ return textCheckerEnchant()->hasDictionary();
+}
+
/**
* Initializes spellcheck feature.
*
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_text_checker_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_text_checker_private.h
index 462d314f4..6c4730e2e 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_text_checker_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_text_checker_private.h
@@ -39,6 +39,7 @@ void initialize();
Vector<String> availableSpellCheckingLanguages();
void updateSpellCheckingLanguages(const Vector<String>& languages);
Vector<String> loadedSpellCheckingLanguages();
+bool hasDictionary();
}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_request.h b/Source/WebKit2/UIProcess/API/efl/ewk_url_request.h
index e696dc83d..96b8b4567 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_url_request.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_request.h
@@ -42,7 +42,7 @@ extern "C" {
*
* @see Ewk_Object
*/
-typedef struct Ewk_Object Ewk_Url_Request;
+typedef struct EwkObject Ewk_Url_Request;
/**
* Query URL for this request.
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_request_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_url_request_private.h
index e9911054b..5ba6677a5 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_url_request_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_request_private.h
@@ -37,7 +37,7 @@
* \struct EwkUrlRequest
* @brief Contains the URL request data.
*/
-class EwkUrlRequest : public Ewk_Object {
+class EwkUrlRequest : public EwkObject {
public:
EWK_OBJECT_DECLARE(EwkUrlRequest)
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_response.h b/Source/WebKit2/UIProcess/API/efl/ewk_url_response.h
index 2f34171ee..ecd0796c4 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_url_response.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_response.h
@@ -42,7 +42,7 @@ extern "C" {
*
* @see Ewk_Object
*/
-typedef struct Ewk_Object Ewk_Url_Response;
+typedef struct EwkObject Ewk_Url_Response;
/**
* Query URL for this response.
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_response_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_url_response_private.h
index fc512d127..02763c72f 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_url_response_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_response_private.h
@@ -37,7 +37,7 @@
* \struct EwkUrlResponse
* @brief Contains the URL response data.
*/
-class EwkUrlResponse : public Ewk_Object {
+class EwkUrlResponse : public EwkObject {
public:
EWK_OBJECT_DECLARE(EwkUrlResponse)
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.h b/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.h
index 62b72158b..75fabd2e6 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.h
@@ -42,7 +42,7 @@ extern "C" {
*
* @see Ewk_Object
*/
-typedef struct Ewk_Object Ewk_Url_Scheme_Request;
+typedef struct EwkObject Ewk_Url_Scheme_Request;
/**
* Query the URL scheme for this request.
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request_private.h
index d6fed4a19..051473867 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request_private.h
@@ -37,7 +37,7 @@
* \struct EwkUrlSchemeRequest
* @brief Contains the URL scheme request data.
*/
-class EwkUrlSchemeRequest : public Ewk_Object {
+class EwkUrlSchemeRequest : public EwkObject {
public:
EWK_OBJECT_DECLARE(EwkUrlSchemeRequest)
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
index d214ed692..42a8b1f29 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp
@@ -39,6 +39,7 @@
#include "WKRetainPtr.h"
#include "WKString.h"
#include "WebContext.h"
+#include "WebFullScreenManagerProxy.h"
#include "WebPageGroup.h"
#include "WebPreferences.h"
#include "ewk_back_forward_list_private.h"
@@ -520,9 +521,9 @@ static inline Evas_Object* createEwkView(Evas* canvas, Evas_Smart* smart, PassRe
* @internal
* Constructs a ewk_view Evas_Object with WKType parameters.
*/
-Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef)
+Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef contextRef, WKPageGroupRef pageGroupRef, EwkViewImpl::ViewBehavior behavior)
{
- return createEwkView(canvas, createEwkViewSmartClass(), EwkContext::create(toImpl(contextRef)), pageGroupRef, EwkViewImpl::LegacyBehavior);
+ return createEwkView(canvas, createEwkViewSmartClass(), EwkContext::create(toImpl(contextRef)), pageGroupRef, behavior);
}
Evas_Object* ewk_view_smart_add(Evas* canvas, Evas_Smart* smart, Ewk_Context* context)
@@ -745,14 +746,14 @@ Eina_Bool ewk_view_html_string_load(Evas_Object* ewkView, const char* html, cons
return true;
}
-const char* ewk_view_setting_encoding_custom_get(const Evas_Object* ewkView)
+const char* ewk_view_custom_encoding_get(const Evas_Object* ewkView)
{
EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, 0);
return impl->customTextEncodingName();
}
-Eina_Bool ewk_view_setting_encoding_custom_set(Evas_Object* ewkView, const char* encoding)
+Eina_Bool ewk_view_custom_encoding_set(Evas_Object* ewkView, const char* encoding)
{
EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
@@ -907,3 +908,23 @@ Ewk_Pagination_Mode ewk_view_pagination_mode_get(const Evas_Object* ewkView)
return static_cast<Ewk_Pagination_Mode>(impl->page()->paginationMode());
}
+
+Eina_Bool ewk_view_fullscreen_exit(Evas_Object* ewkView)
+{
+#if ENABLE(FULLSCREEN_API)
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl, false);
+
+ impl->page()->fullScreenManager()->requestExitFullScreen();
+
+ return true;
+#else
+ return false;
+#endif
+}
+
+void ewk_view_draws_page_background_set(Evas_Object *ewkView, Eina_Bool enabled)
+{
+ EWK_VIEW_IMPL_GET_OR_RETURN(ewkView, impl);
+
+ impl->setDrawsBackground(enabled);
+}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.h b/Source/WebKit2/UIProcess/API/efl/ewk_view.h
index 87f36c14e..9a408ab5e 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_view.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.h
@@ -30,8 +30,6 @@
* ewk_auth_request_ref() on the request object to process the authentication asynchronously.
* - "back,forward,list,changed", void: reports that the view's back / forward list had changed.
* - "cancel,vibration", void: request to cancel the vibration.
- * - "close,window", void: window is closed.
- * - "create,window", Evas_Object**: a new window is created.
* - "download,cancelled", Ewk_Download_Job*: reports that a download was effectively cancelled.
* - "download,failed", Ewk_Download_Job_Error*: reports that a download failed with the given error.
* - "download,finished", Ewk_Download_Job*: reports that a download completed successfully.
@@ -84,15 +82,18 @@
#include "ewk_back_forward_list.h"
#include "ewk_color_picker.h"
#include "ewk_context.h"
+#include "ewk_context_menu.h"
#include "ewk_download_job.h"
#include "ewk_error.h"
#include "ewk_intent.h"
#include "ewk_popup_menu.h"
#include "ewk_resource.h"
+#include "ewk_security_origin.h"
#include "ewk_settings.h"
#include "ewk_touch.h"
#include "ewk_url_request.h"
#include "ewk_url_response.h"
+#include "ewk_window_features.h"
#include <Evas.h>
#ifdef __cplusplus
@@ -113,6 +114,9 @@ struct Ewk_View_Smart_Class {
Evas_Smart_Class sc; /**< all but 'data' is free to be changed. */
unsigned long version;
+ Eina_Bool (*context_menu_show)(Ewk_View_Smart_Data *sd, Evas_Coord x, Evas_Coord y, Ewk_Context_Menu *menu);
+ Eina_Bool (*context_menu_hide)(Ewk_View_Smart_Data *sd);
+
Eina_Bool (*popup_menu_show)(Ewk_View_Smart_Data *sd, Eina_Rectangle rect, Ewk_Text_Direction text_direction, double page_scale_factor, Ewk_Popup_Menu *menu);
Eina_Bool (*popup_menu_hide)(Ewk_View_Smart_Data *sd);
@@ -121,7 +125,7 @@ struct Ewk_View_Smart_Class {
// - if overridden, have to call parent method if desired
Eina_Bool (*focus_in)(Ewk_View_Smart_Data *sd);
Eina_Bool (*focus_out)(Ewk_View_Smart_Data *sd);
- Eina_Bool (*fullscreen_enter)(Ewk_View_Smart_Data *sd);
+ Eina_Bool (*fullscreen_enter)(Ewk_View_Smart_Data *sd, Ewk_Security_Origin *origin);
Eina_Bool (*fullscreen_exit)(Ewk_View_Smart_Data *sd);
Eina_Bool (*mouse_wheel)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Wheel *ev);
Eina_Bool (*mouse_down)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Down *ev);
@@ -146,13 +150,18 @@ struct Ewk_View_Smart_Class {
// storage:
// - Web database.
unsigned long long (*exceeded_database_quota)(Ewk_View_Smart_Data *sd, const char *databaseName, const char *displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentDatabaseUsage, unsigned long long expectedUsage);
+
+ // window creation and closing:
+ // - Create a new window with specified features and close window.
+ Evas_Object *(*window_create)(Ewk_View_Smart_Data *sd, const Ewk_Window_Features *window_features);
+ void (*window_close)(Ewk_View_Smart_Data *sd);
};
/**
* The version you have to put into the version field
* in the @a Ewk_View_Smart_Class structure.
*/
-#define EWK_VIEW_SMART_CLASS_VERSION 7UL
+#define EWK_VIEW_SMART_CLASS_VERSION 8UL
/**
* Initializer for whole Ewk_View_Smart_Class structure.
@@ -164,7 +173,7 @@ struct Ewk_View_Smart_Class {
* @see EWK_VIEW_SMART_CLASS_INIT_VERSION
* @see EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION
*/
-#define EWK_VIEW_SMART_CLASS_INIT(smart_class_init) {smart_class_init, EWK_VIEW_SMART_CLASS_VERSION, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+#define EWK_VIEW_SMART_CLASS_INIT(smart_class_init) {smart_class_init, EWK_VIEW_SMART_CLASS_VERSION, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
/**
* Initializer to zero a whole Ewk_View_Smart_Class structure.
@@ -643,7 +652,7 @@ EAPI const char *ewk_view_theme_get(const Evas_Object *o);
* @return @c eina_strinshare containing the current encoding, or
* @c NULL if it's not set
*/
-EAPI const char *ewk_view_setting_encoding_custom_get(const Evas_Object *o);
+EAPI const char *ewk_view_custom_encoding_get(const Evas_Object *o);
/**
* Sets the custom character encoding and reloads the page.
@@ -653,7 +662,7 @@ EAPI const char *ewk_view_setting_encoding_custom_get(const Evas_Object *o);
*
* @return @c EINA_TRUE on success @c EINA_FALSE otherwise
*/
-EAPI Eina_Bool ewk_view_setting_encoding_custom_set(Evas_Object *o, const char *encoding);
+EAPI Eina_Bool ewk_view_custom_encoding_set(Evas_Object *o, const char *encoding);
/**
* Searches and hightlights the given string in the document.
@@ -800,6 +809,31 @@ EAPI Eina_Bool ewk_view_pagination_mode_set(Evas_Object *o, Ewk_Pagination_Mode
*/
EAPI Ewk_Pagination_Mode ewk_view_pagination_mode_get(const Evas_Object *o);
+/**
+ * Exit fullscreen mode.
+ *
+ * @param o view object where to exit fullscreen
+ *
+ * @return @c EINA_TRUE if successful, @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_view_fullscreen_exit(Evas_Object *o);
+
+/**
+ * Sets whether the ewk_view background matches page background color.
+ *
+ * If enabled sets view background color close to page color on page load.
+ * This helps to reduce flicker on page scrolling and repainting in places
+ * where page content is not ready for painting.
+ * View background color can interfere with semi-transparent pages and is
+ * disabled by default.
+ *
+ * @param o view object to enable/disable background matching
+ * @param enabled a state to set
+ *
+ * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
+ */
+EAPI void ewk_view_draws_page_background_set(Evas_Object *o, Eina_Bool enabled);
+
#ifdef __cplusplus
}
#endif
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h
index 28038857f..9a51ef244 100644
--- a/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_view_private.h
@@ -21,9 +21,10 @@
#ifndef ewk_view_private_h
#define ewk_view_private_h
+#include "EwkViewImpl.h"
#include <Evas.h>
#include <WebKit2/WKBase.h>
-Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef, WKPageGroupRef);
+Evas_Object* ewk_view_base_add(Evas* canvas, WKContextRef, WKPageGroupRef, EwkViewImpl::ViewBehavior);
#endif // ewk_view_private_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_window_features.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_window_features.cpp
new file mode 100644
index 000000000..66a6c910f
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_window_features.cpp
@@ -0,0 +1,161 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. 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.
+ */
+
+#include "config.h"
+#include "ewk_window_features.h"
+
+#include "WebNumber.h"
+#include "ewk_window_features_private.h"
+#include <Eina.h>
+
+using namespace WebKit;
+
+EwkWindowFeatures::EwkWindowFeatures(ImmutableDictionary* windowFeatures, EwkViewImpl* viewImpl)
+ : m_viewImpl(viewImpl)
+ , m_geometry(0, 0, 100, 100)
+ , m_toolbarVisible(true)
+ , m_statusBarVisible(true)
+ , m_scrollbarsVisible(true)
+ , m_menuBarVisible(true)
+ , m_locationBarVisible(true)
+ , m_resizable(true)
+ , m_fullScreen(false)
+{
+ if (windowFeatures) {
+ m_geometry.setX(getWindowFeatureValue<double, WebDouble>(windowFeatures, ASCIILiteral("x")));
+ m_geometry.setY(getWindowFeatureValue<double, WebDouble>(windowFeatures, ASCIILiteral("y")));
+ m_geometry.setWidth(getWindowFeatureValue<double, WebDouble>(windowFeatures, ASCIILiteral("width")));
+ m_geometry.setHeight(getWindowFeatureValue<double, WebDouble>(windowFeatures, ASCIILiteral("height")));
+
+ m_toolbarVisible = getWindowFeatureValue<bool, WebBoolean>(windowFeatures, ASCIILiteral("toolBarVisible"));
+ m_statusBarVisible = getWindowFeatureValue<bool, WebBoolean>(windowFeatures, ASCIILiteral("statusBarVisible"));
+ m_scrollbarsVisible = getWindowFeatureValue<bool, WebBoolean>(windowFeatures, ASCIILiteral("scrollbarsVisible"));
+ m_menuBarVisible = getWindowFeatureValue<bool, WebBoolean>(windowFeatures, ASCIILiteral("menuBarVisible"));
+ m_locationBarVisible = getWindowFeatureValue<bool, WebBoolean>(windowFeatures, ASCIILiteral("locationBarVisible"));
+ m_resizable = getWindowFeatureValue<bool, WebBoolean>(windowFeatures, ASCIILiteral("resizable"));
+ m_fullScreen = getWindowFeatureValue<bool, WebBoolean>(windowFeatures, ASCIILiteral("fullscreen"));
+ }
+}
+
+template <typename T1, typename T2>
+T1 EwkWindowFeatures::getWindowFeatureValue(ImmutableDictionary* windowFeatures, const String& featureName)
+{
+ T2* featureValue = static_cast<T2*>(windowFeatures->get(featureName));
+
+ if (!featureValue)
+ return false;
+
+ return featureValue->value();
+}
+
+void EwkWindowFeatures::setToolbarVisible(bool toolbarVisible)
+{
+ m_toolbarVisible = toolbarVisible;
+ m_viewImpl->smartCallback<EwkViewCallbacks::ToolbarVisible>().call(&toolbarVisible);
+}
+
+void EwkWindowFeatures::setStatusBarVisible(bool statusBarVisible)
+{
+ m_statusBarVisible = statusBarVisible;
+ m_viewImpl->smartCallback<EwkViewCallbacks::StatusBarVisible>().call(&statusBarVisible);
+}
+
+void EwkWindowFeatures::setMenuBarVisible(bool menuBarVisible)
+{
+ m_menuBarVisible = menuBarVisible;
+ m_viewImpl->smartCallback<EwkViewCallbacks::MenuBarVisible>().call(&menuBarVisible);
+}
+
+void EwkWindowFeatures::setResizable(bool resizable)
+{
+ m_resizable = resizable;
+ m_viewImpl->smartCallback<EwkViewCallbacks::WindowResizable>().call(&resizable);
+}
+
+Eina_Bool ewk_window_features_toolbar_visible_get(const Ewk_Window_Features* window_features)
+{
+ EWK_OBJ_GET_IMPL_OR_RETURN(const EwkWindowFeatures, window_features, impl, false);
+
+ return impl->toolbarVisible();
+}
+
+Eina_Bool ewk_window_features_statusbar_visible_get(const Ewk_Window_Features* window_features)
+{
+ EWK_OBJ_GET_IMPL_OR_RETURN(const EwkWindowFeatures, window_features, impl, false);
+
+ return impl->statusBarVisible();
+}
+
+Eina_Bool ewk_window_features_scrollbars_visible_get(const Ewk_Window_Features* window_features)
+{
+ EWK_OBJ_GET_IMPL_OR_RETURN(const EwkWindowFeatures, window_features, impl, false);
+
+ return impl->scrollbarsVisible();
+}
+
+Eina_Bool ewk_window_features_menubar_visible_get(const Ewk_Window_Features* window_features)
+{
+ EWK_OBJ_GET_IMPL_OR_RETURN(const EwkWindowFeatures, window_features, impl, false);
+
+ return impl->menuBarVisible();
+}
+
+Eina_Bool ewk_window_features_locationbar_visible_get(const Ewk_Window_Features* window_features)
+{
+ EWK_OBJ_GET_IMPL_OR_RETURN(const EwkWindowFeatures, window_features, impl, false);
+
+ return impl->locationBarVisible();
+}
+
+Eina_Bool ewk_window_features_resizable_get(const Ewk_Window_Features* window_features)
+{
+ EWK_OBJ_GET_IMPL_OR_RETURN(const EwkWindowFeatures, window_features, impl, false);
+
+ return impl->resizable();
+}
+
+Eina_Bool ewk_window_features_fullscreen_get(const Ewk_Window_Features* window_features)
+{
+ EWK_OBJ_GET_IMPL_OR_RETURN(const EwkWindowFeatures, window_features, impl, false);
+
+ return impl->fullScreen();
+}
+
+void ewk_window_features_geometry_get(const Ewk_Window_Features* window_features, Evas_Coord* x, Evas_Coord* y, Evas_Coord* width, Evas_Coord* height)
+{
+ EWK_OBJ_GET_IMPL_OR_RETURN(const EwkWindowFeatures, window_features, impl);
+
+ if (x)
+ *x = static_cast<Evas_Coord>(impl->geometry().x());
+
+ if (y)
+ *y = static_cast<Evas_Coord>(impl->geometry().y());
+
+ if (width)
+ *width = static_cast<Evas_Coord>(impl->geometry().width());
+
+ if (height)
+ *height = static_cast<Evas_Coord>(impl->geometry().height());
+}
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_window_features.h b/Source/WebKit2/UIProcess/API/efl/ewk_window_features.h
new file mode 100644
index 000000000..8e4367506
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_window_features.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. 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.
+ */
+
+/**
+ * @file ewk_window_features.h
+ * @brief Access to the features of window.
+ */
+
+#ifndef ewk_window_features_h
+#define ewk_window_features_h
+
+#include <Eina.h>
+#include <Evas.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Declare Ewk_Window_Features as Ewk_Object.
+ *
+ * @see Ewk_Object
+ */
+typedef struct EwkObject Ewk_Window_Features;
+
+/**
+ * Queries the toolbar visibility of the window feature.
+ *
+ * @param window_features the object to get properties
+ *
+ * @return @c EINA_TRUE is the toolbar should be visible, @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_window_features_toolbar_visible_get(const Ewk_Window_Features *window_features);
+
+/**
+ * Queries the statusbar visibility of the window feature.
+ *
+ * @param window_features the object to get properties
+ *
+ * @return @c EINA_TRUE is the statusbar should be visible, @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_window_features_statusbar_visible_get(const Ewk_Window_Features *window_features);
+
+/**
+ * Queries the scrollbar visibility of the window feature.
+ *
+ * @param window_features the object to get properties
+ *
+ * @return @c EINA_TRUE is the scrollbars should be visible, @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_window_features_scrollbars_visible_get(const Ewk_Window_Features *window_features);
+
+/**
+ * Queries the menubar visibility of the window feature.
+ *
+ * @param window_features the object to get properties
+ *
+ * @return @c EINA_TRUE is the menubar should be visible, @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_window_features_menubar_visible_get(const Ewk_Window_Features *window_features);
+
+/**
+ * Queries the locationbar visibility of the window feature.
+ *
+ * @param window_features the object to get properties
+ *
+ * @return @c EINA_TRUE is the locationbar should be visible, @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_window_features_locationbar_visible_get(const Ewk_Window_Features *window_features);
+
+/**
+ * Queries if the window is resizable.
+ *
+ * @param window_features the object to get properties
+ *
+ * @return @c EINA_TRUE is the window should be resizable, @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_window_features_resizable_get(const Ewk_Window_Features *window_features);
+
+/**
+ * Queries the the window is fullscreen
+ *
+ * @param window_features the object to get properties
+ *
+ * @return @c EINA_TRUE is the window should be fullscreen, @c EINA_FALSE otherwise
+ */
+EAPI Eina_Bool ewk_window_features_fullscreen_get(const Ewk_Window_Features *window_features);
+
+/**
+ * Gets geometry properties of an Ewk_Window_Features.
+ *
+ * Properties are returned in the respective pointers. Passing @c NULL to any of
+ * these pointers will cause that property to not be returned.
+ *
+ * @param window_features the window's features
+ * @param x the pointer to store x position
+ * @param y the pointer to store y position
+ * @param w the pointer to store width
+ * @param h the pointer to store height
+ */
+EAPI void ewk_window_features_geometry_get(const Ewk_Window_Features *window_features, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ewk_window_features_h
diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_window_features_private.h b/Source/WebKit2/UIProcess/API/efl/ewk_window_features_private.h
new file mode 100644
index 000000000..c6bf89232
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/ewk_window_features_private.h
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. 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 ewk_window_features_private_h
+#define ewk_window_features_private_h
+
+#include "EwkViewImpl.h"
+#include "ImmutableDictionary.h"
+#include "WindowFeatures.h"
+#include "ewk_object_private.h"
+#include <WebCore/FloatRect.h>
+#include <wtf/RefCounted.h>
+
+class EwkViewImpl;
+
+class EwkWindowFeatures : public EwkObject {
+public:
+ EWK_OBJECT_DECLARE(EwkWindowFeatures)
+
+ static PassRefPtr<EwkWindowFeatures> create(WebKit::ImmutableDictionary* windowFeatures, EwkViewImpl* viewImpl)
+ {
+ return adoptRef(new EwkWindowFeatures(windowFeatures, viewImpl));
+ }
+
+ WebCore::FloatRect geometry() const { return m_geometry; }
+ void setGeometry(WebCore::FloatRect& geometry) { m_geometry = geometry; }
+
+ bool toolbarVisible() const { return m_toolbarVisible; }
+ void setToolbarVisible(bool toolbarVisible);
+
+ bool statusBarVisible() const { return m_statusBarVisible; }
+ void setStatusBarVisible(bool statusBarVisible);
+
+ bool scrollbarsVisible() const { return m_scrollbarsVisible; }
+ void setScrollbarsVisible(bool scrollbarsVisible) { m_scrollbarsVisible = scrollbarsVisible; }
+
+ bool menuBarVisible() const { return m_menuBarVisible; }
+ void setMenuBarVisible(bool menuBarVisible);
+
+ bool locationBarVisible() const { return m_locationBarVisible; }
+ void setLocationBarVisible(bool locationBarVisible) { m_locationBarVisible = locationBarVisible; }
+
+ bool resizable() const { return m_resizable; }
+ void setResizable(bool resizable);
+
+ bool fullScreen() const { return m_fullScreen; }
+ void setFullScreen(bool fullScreen) { m_fullScreen = fullScreen; }
+
+private:
+ EwkWindowFeatures(WebKit::ImmutableDictionary* windowFeatures, EwkViewImpl* viewImpl);
+ template <typename T1, typename T2>
+ static T1 getWindowFeatureValue(WebKit::ImmutableDictionary* windowFeatures, const String& featureName);
+
+ EwkViewImpl* m_viewImpl;
+
+ WebCore::FloatRect m_geometry;
+ bool m_toolbarVisible;
+ bool m_statusBarVisible;
+ bool m_scrollbarsVisible;
+ bool m_menuBarVisible;
+ bool m_locationBarVisible;
+ bool m_resizable;
+ bool m_fullScreen;
+};
+
+#endif // ewk_window_features_private_h
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp
index 82280fcd4..6ce318f14 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp
@@ -215,26 +215,26 @@ bool EWK2UnitTestBase::waitUntilURLChangedTo(const char* expectedURL, double tim
return !data.didTimeOut();
}
-void EWK2UnitTestBase::mouseClick(int x, int y)
+void EWK2UnitTestBase::mouseClick(int x, int y, int button)
{
Evas* evas = evas_object_evas_get(m_webView);
evas_event_feed_mouse_move(evas, x, y, 0, 0);
- evas_event_feed_mouse_down(evas, /* Left */ 1, EVAS_BUTTON_NONE, 0, 0);
- evas_event_feed_mouse_up(evas, /* Left */ 1, EVAS_BUTTON_NONE, 0, 0);
+ evas_event_feed_mouse_down(evas, button, EVAS_BUTTON_NONE, 0, 0);
+ evas_event_feed_mouse_up(evas, button, EVAS_BUTTON_NONE, 0, 0);
}
-void EWK2UnitTestBase::mouseDown(int x, int y)
+void EWK2UnitTestBase::mouseDown(int x, int y, int button)
{
Evas* evas = evas_object_evas_get(m_webView);
evas_event_feed_mouse_move(evas, x, y, 0, 0);
- evas_event_feed_mouse_down(evas, /* Left */ 1, EVAS_BUTTON_NONE, 0, 0);
+ evas_event_feed_mouse_down(evas, button, EVAS_BUTTON_NONE, 0, 0);
}
-void EWK2UnitTestBase::mouseUp(int x, int y)
+void EWK2UnitTestBase::mouseUp(int x, int y, int button)
{
Evas* evas = evas_object_evas_get(m_webView);
evas_event_feed_mouse_move(evas, x, y, 0, 0);
- evas_event_feed_mouse_up(evas, /* Left */ 1, EVAS_BUTTON_NONE, 0, 0);
+ evas_event_feed_mouse_up(evas, button, EVAS_BUTTON_NONE, 0, 0);
}
void EWK2UnitTestBase::mouseMove(int x, int y)
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h
index 2ebb95093..bd5e4b995 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h
+++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h
@@ -20,8 +20,11 @@
#ifndef EWK2UnitTestBase_h
#define EWK2UnitTestBase_h
+#include "EWK2UnitTestEnvironment.h"
#include <EWebKit2.h>
+#include <Ecore.h>
#include <Ecore_Evas.h>
+#include <Eina.h>
#include <Evas.h>
#include <gtest/gtest.h>
@@ -47,9 +50,9 @@ protected:
bool waitUntilTitleChangedTo(const char* expectedTitle, double timeoutSeconds = defaultTimeoutSeconds);
bool waitUntilURLChangedTo(const char* expectedURL, double timeoutSeconds = defaultTimeoutSeconds);
- void mouseClick(int x, int y);
- void mouseDown(int x, int y);
- void mouseUp(int x, int y);
+ void mouseClick(int x, int y, int button = 1 /*Left*/);
+ void mouseDown(int x, int y, int button = 1 /*Left*/);
+ void mouseUp(int x, int y, int button = 1 /*Left*/);
void mouseMove(int x, int y);
void multiDown(int id, int x, int y);
void multiUp(int id, int x, int y);
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h
index 8b401b56a..b5e4f0270 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h
+++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestEnvironment.h
@@ -19,7 +19,6 @@
#ifndef EWK2UnitTestEnvironment_h
#define EWK2UnitTestEnvironment_h
-#include <Eina.h>
#include <gtest/gtest.h>
#include <wtf/text/CString.h>
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestMain.cpp b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestMain.cpp
index 4f60756e1..5352212fb 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestMain.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestMain.cpp
@@ -20,7 +20,6 @@
#include "EWK2UnitTestBase.h"
#include "EWK2UnitTestEnvironment.h"
#include <getopt.h>
-#include <gtest/gtest.h>
using namespace EWK2UnitTest;
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_auth_request.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_auth_request.cpp
index 093b507e6..cc3502177 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_auth_request.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_auth_request.cpp
@@ -26,10 +26,7 @@
#include "config.h"
#include "UnitTestUtils/EWK2UnitTestBase.h"
-#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
#include "UnitTestUtils/EWK2UnitTestServer.h"
-#include <EWebKit2.h>
-#include <Ecore.h>
#include <wtf/PassOwnPtr.h>
using namespace EWK2UnitTest;
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp
index ec4a4d90a..c0510c594 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp
@@ -26,11 +26,8 @@
#include "config.h"
#include "UnitTestUtils/EWK2UnitTestBase.h"
-#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
#include "UnitTestUtils/EWK2UnitTestServer.h"
#include "WKEinaSharedString.h"
-#include <EWebKit2.h>
-#include <gtest/gtest.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_color_picker.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_color_picker.cpp
index 7f59c33f6..c6d0b32af 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_color_picker.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_color_picker.cpp
@@ -20,9 +20,6 @@
#include "config.h"
#include "UnitTestUtils/EWK2UnitTestBase.h"
-#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
-#include <EWebKit2.h>
-#include <Ecore.h>
using namespace EWK2UnitTest;
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp
index f6bb40c30..9cd4e616d 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp
@@ -27,10 +27,6 @@
#include "config.h"
#include "UnitTestUtils/EWK2UnitTestBase.h"
-#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
-#include <EWebKit2.h>
-#include <Ecore.h>
-#include <gtest/gtest.h>
using namespace EWK2UnitTest;
@@ -129,11 +125,9 @@ TEST_F(EWK2UnitTestBase, ewk_context_additional_plugin_path_set)
{
Ewk_Context* context = ewk_view_context_get(webView());
- char* path = 0;
- ASSERT_FALSE(ewk_context_additional_plugin_path_set(context, path));
+ ASSERT_FALSE(ewk_context_additional_plugin_path_set(context, 0));
- path = "/plugins";
- ASSERT_TRUE(ewk_context_additional_plugin_path_set(context, path));
+ ASSERT_TRUE(ewk_context_additional_plugin_path_set(context, "/plugins"));
/* FIXME: Get additional plugin path and compare with the path. */
}
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context_history_callbacks.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context_history_callbacks.cpp
index f60a16c2f..d08b375dd 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context_history_callbacks.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context_history_callbacks.cpp
@@ -26,11 +26,7 @@
#include "config.h"
#include "UnitTestUtils/EWK2UnitTestBase.h"
-#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
#include "UnitTestUtils/EWK2UnitTestServer.h"
-#include <EWebKit2.h>
-#include <Ecore.h>
-#include <gtest/gtest.h>
using namespace EWK2UnitTest;
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context_menu.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context_menu.cpp
new file mode 100644
index 000000000..78858af1d
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context_menu.cpp
@@ -0,0 +1,109 @@
+/*
+ Copyright (C) 2012 Samsung Electronics
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include "config.h"
+
+#include "UnitTestUtils/EWK2UnitTestBase.h"
+#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
+#include <EWebKit2.h>
+#include <Ecore.h>
+
+using namespace EWK2UnitTest;
+
+extern EWK2UnitTestEnvironment* environment;
+
+static inline void checkBasicContextMenuItem(Ewk_Context_Menu_Item* item, Ewk_Context_Menu_Item_Type type, Ewk_Context_Menu_Item_Action action, const char* title, Eina_Bool checked, Eina_Bool enabled)
+{
+ ASSERT_TRUE(item);
+
+ EXPECT_EQ(type, ewk_context_menu_item_type_get(item));
+ EXPECT_EQ(action, ewk_context_menu_item_action_get(item));
+ EXPECT_STREQ(title, ewk_context_menu_item_title_get(item));
+ EXPECT_EQ(checked, ewk_context_menu_item_checked_get(item));
+ EXPECT_EQ(enabled, ewk_context_menu_item_enabled_get(item));
+}
+
+static Eina_Bool showContextMenu(Ewk_View_Smart_Data* smartData, Evas_Coord x, Evas_Coord y, Ewk_Context_Menu* contextMenu)
+{
+ const Eina_List* list = ewk_context_menu_items_get(contextMenu);
+ EXPECT_EQ(4, eina_list_count(list));
+
+ Ewk_Context_Menu_Item* item = static_cast<Ewk_Context_Menu_Item*>(eina_list_nth(list, 0));
+ checkBasicContextMenuItem(item, EWK_ACTION_TYPE, EWK_CONTEXT_MENU_ITEM_TAG_GO_BACK, "Go Back", false, true);
+
+ item = static_cast<Ewk_Context_Menu_Item*>(eina_list_nth(list, 1));
+ checkBasicContextMenuItem(item, EWK_ACTION_TYPE, EWK_CONTEXT_MENU_ITEM_TAG_GO_FORWARD, "Go Forward", false, true);
+ ewk_context_menu_item_enabled_set(item, false);
+ EXPECT_FALSE(ewk_context_menu_item_enabled_get(item));
+
+ item = static_cast<Ewk_Context_Menu_Item*>(eina_list_nth(list, 2));
+ checkBasicContextMenuItem(item, EWK_ACTION_TYPE, EWK_CONTEXT_MENU_ITEM_TAG_STOP, "Stop", false, true);
+ ewk_context_menu_item_checked_set(item, true);
+ EXPECT_TRUE(ewk_context_menu_item_checked_get(item));
+
+ item = static_cast<Ewk_Context_Menu_Item*>(eina_list_nth(list, 3));
+ checkBasicContextMenuItem(item, EWK_ACTION_TYPE, EWK_CONTEXT_MENU_ITEM_TAG_RELOAD, "Reload", false, true);
+ ewk_context_menu_item_title_set(item, "Refresh");
+ EXPECT_STREQ("Refresh", ewk_context_menu_item_title_get(item));
+
+ // Makes new context menu items.
+ Ewk_Context_Menu_Item* newItem = ewk_context_menu_item_new(EWK_ACTION_TYPE, EWK_CONTEXT_MENU_ITEM_TAG_OTHER, "New Custom Item", false, true);
+ ewk_context_menu_item_append(contextMenu, newItem);
+
+ Eina_List* subMenuItemList = 0;
+ Ewk_Context_Menu_Item* subMenuItem1 = ewk_context_menu_item_new(EWK_ACTION_TYPE, EWK_CONTEXT_MENU_ITEM_TAG_OTHER, "New SubMenu Item 1", false, true);
+ Ewk_Context_Menu_Item* subMenuItem2 = ewk_context_menu_item_new(EWK_ACTION_TYPE, EWK_CONTEXT_MENU_ITEM_TAG_OTHER, "New SubMenu Item 2", false, true);
+ Ewk_Context_Menu_Item* subMenuItem3 = ewk_context_menu_item_new(EWK_ACTION_TYPE, EWK_CONTEXT_MENU_ITEM_TAG_OTHER, "New SubMenu Item 3", false, true);
+ subMenuItemList = eina_list_append(subMenuItemList, subMenuItem1);
+ subMenuItemList = eina_list_append(subMenuItemList, subMenuItem2);
+ subMenuItemList = eina_list_append(subMenuItemList, subMenuItem3);
+ Ewk_Context_Menu* subMenu = ewk_context_menu_new_with_items(subMenuItemList);
+ Ewk_Context_Menu_Item* newItem2 = ewk_context_menu_item_new_with_submenu(EWK_SUBMENU_TYPE, EWK_CONTEXT_MENU_ITEM_TAG_OTHER, "New Custom Item 2", false, true, subMenu);
+ ewk_context_menu_item_append(contextMenu, newItem2);
+
+ Ewk_Context_Menu* subMenu2 = ewk_context_menu_new();
+ Ewk_Context_Menu_Item* newItem3 = ewk_context_menu_item_new_with_submenu(EWK_SUBMENU_TYPE, EWK_CONTEXT_MENU_ITEM_TAG_OTHER, "New Custom Item 3", false, true, subMenu2);
+ ewk_context_menu_item_append(contextMenu, newItem3);
+
+ list = ewk_context_menu_items_get(contextMenu);
+ EXPECT_EQ(7, eina_list_count(list));
+
+ ewk_context_menu_item_remove(contextMenu, newItem);
+ ewk_context_menu_item_remove(contextMenu, newItem2);
+ ewk_context_menu_item_remove(contextMenu, newItem3);
+ list = ewk_context_menu_items_get(contextMenu);
+ EXPECT_EQ(4, eina_list_count(list));
+
+ EXPECT_TRUE(ewk_context_menu_item_select(contextMenu, item));
+
+ return true;
+}
+
+TEST_F(EWK2UnitTestBase, ewk_context_menu_item_select)
+{
+ const char* itemSelectHTML =
+ "<html>"
+ "<body><a href=http://www.google.com>Test Link</a></body>"
+ "</body></html>";
+
+ ewkViewClass()->context_menu_show = showContextMenu;
+
+ ewk_view_html_string_load(webView(), itemSelectHTML, "file:///", 0);
+ mouseClick(20, 30, /*Right*/ 3);
+ ASSERT_TRUE(waitUntilLoadFinished());
+}
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp
index 6d00b8bf3..960675f79 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp
@@ -21,11 +21,7 @@
#include "config.h"
#include "UnitTestUtils/EWK2UnitTestBase.h"
-#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
#include "UnitTestUtils/EWK2UnitTestServer.h"
-#include <EWebKit2.h>
-#include <Ecore.h>
-#include <Eina.h>
#include <stdlib.h>
#include <unistd.h>
#include <wtf/OwnPtr.h>
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_database_manager.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_database_manager.cpp
index dd9b4b079..8860edf42 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_database_manager.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_database_manager.cpp
@@ -26,8 +26,6 @@
#include "config.h"
#include "UnitTestUtils/EWK2UnitTestBase.h"
-#include <EWebKit2.h>
-#include <Ecore.h>
using namespace EWK2UnitTest;
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_download_job.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_download_job.cpp
index 1494926e2..f0e7d1b61 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_download_job.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_download_job.cpp
@@ -26,11 +26,7 @@
#include "config.h"
#include "UnitTestUtils/EWK2UnitTestBase.h"
-#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
#include "UnitTestUtils/EWK2UnitTestServer.h"
-#include <EWebKit2.h>
-#include <Ecore.h>
-#include <gtest/gtest.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_eina_shared_string.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_eina_shared_string.cpp
index c820239a5..258249ccc 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_eina_shared_string.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_eina_shared_string.cpp
@@ -26,13 +26,9 @@
#include "config.h"
#include "UnitTestUtils/EWK2UnitTestBase.h"
-#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
#include "WKEinaSharedString.h"
-#include <EWebKit2.h>
-#include <Ecore.h>
#include <WebKit2/WKString.h>
#include <WebKit2/WKURL.h>
-#include <gtest/gtest.h>
using namespace EWK2UnitTest;
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_favicon_database.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_favicon_database.cpp
index cda6efa06..0ff1df077 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_favicon_database.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_favicon_database.cpp
@@ -26,11 +26,8 @@
#include "config.h"
#include "UnitTestUtils/EWK2UnitTestBase.h"
-#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
#include "UnitTestUtils/EWK2UnitTestServer.h"
#include "WKEinaSharedString.h"
-#include <EWebKit2.h>
-#include <Ecore.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_file_chooser_request.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_file_chooser_request.cpp
index b058d640b..a66520ba3 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_file_chooser_request.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_file_chooser_request.cpp
@@ -26,10 +26,7 @@
#include "config.h"
#include "UnitTestUtils/EWK2UnitTestBase.h"
-#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
#include "UnitTestUtils/EWK2UnitTestServer.h"
-#include <EWebKit2.h>
-#include <Ecore.h>
using namespace EWK2UnitTest;
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp
index 4b46cd883..d7d99eaf4 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp
@@ -26,10 +26,7 @@
#include "config.h"
#include "UnitTestUtils/EWK2UnitTestBase.h"
-#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
#include "UnitTestUtils/EWK2UnitTestServer.h"
-#include <EWebKit2.h>
-#include <Ecore.h>
using namespace EWK2UnitTest;
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_object.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_object.cpp
index 1c96f2e80..70ceea5e5 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_object.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_object.cpp
@@ -26,12 +26,9 @@
#include "config.h"
#include "UnitTestUtils/EWK2UnitTestBase.h"
-#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
#include "UnitTestUtils/EWK2UnitTestServer.h"
#include "WKEinaSharedString.h"
#include "ewk_object_private.h"
-#include <EWebKit2.h>
-#include <gtest/gtest.h>
#include <wtf/PassRefPtr.h>
using namespace EWK2UnitTest;
@@ -39,7 +36,7 @@ using namespace WTF;
extern EWK2UnitTestEnvironment* environment;
-class TestEwkObject1 : public Ewk_Object {
+class TestEwkObject1 : public EwkObject {
public:
EWK_OBJECT_DECLARE(TestEwkObject)
@@ -59,7 +56,7 @@ public:
bool TestEwkObject1::wasDeleted = false;
-class TestEwkObject2 : public Ewk_Object {
+class TestEwkObject2 : public EwkObject {
public:
EWK_OBJECT_DECLARE(TestEwkObject2)
@@ -92,8 +89,8 @@ TEST_F(EWK2UnitTestBase, ewk_object_ref)
TEST_F(EWK2UnitTestBase, ewk_object_is_of_type)
{
- RefPtr<Ewk_Object> object1 = TestEwkObject1::create();
- RefPtr<Ewk_Object> object2 = TestEwkObject2::create();
+ RefPtr<EwkObject> object1 = TestEwkObject1::create();
+ RefPtr<EwkObject> object2 = TestEwkObject2::create();
ASSERT_TRUE(ewk_object_is_of_type<TestEwkObject1*>(object1.get()));
ASSERT_TRUE(ewk_object_is_of_type<TestEwkObject2*>(object2.get()));
@@ -104,8 +101,8 @@ TEST_F(EWK2UnitTestBase, ewk_object_is_of_type)
TEST_F(EWK2UnitTestBase, ewk_object_cast)
{
- RefPtr<Ewk_Object> object1 = TestEwkObject1::create();
- RefPtr<Ewk_Object> object2 = TestEwkObject2::create();
+ RefPtr<EwkObject> object1 = TestEwkObject1::create();
+ RefPtr<EwkObject> object2 = TestEwkObject2::create();
TestEwkObject1* objectRef1 = ewk_object_cast<TestEwkObject1*>(object1.get());
ASSERT_TRUE(objectRef1);
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_popup_menu.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_popup_menu.cpp
index 7a033519a..a2581320a 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_popup_menu.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_popup_menu.cpp
@@ -20,9 +20,6 @@
#include "config.h"
#include "UnitTestUtils/EWK2UnitTestBase.h"
-#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
-#include <EWebKit2.h>
-#include <Ecore.h>
using namespace EWK2UnitTest;
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_refptr_evas_object.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_refptr_evas_object.cpp
index 939d20c6d..de180e41b 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_refptr_evas_object.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_refptr_evas_object.cpp
@@ -26,11 +26,6 @@
#include "config.h"
#include "UnitTestUtils/EWK2UnitTestBase.h"
-#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
-#include <EWebKit2.h>
-#include <Ecore_Evas.h>
-#include <Evas.h>
-#include <gtest/gtest.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/efl/RefPtrEfl.h>
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp
index 435ecc8be..3402e5bcc 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_settings.cpp
@@ -26,9 +26,6 @@
#include "config.h"
#include "UnitTestUtils/EWK2UnitTestBase.h"
-#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
-#include <EWebKit2.h>
-#include <Eina.h>
using namespace EWK2UnitTest;
@@ -182,3 +179,31 @@ TEST_F(EWK2UnitTestBase, ewk_settings_preferred_minimum_contents_width)
ASSERT_TRUE(ewk_settings_preferred_minimum_contents_width_set(settings, 0));
ASSERT_EQ(0, ewk_settings_preferred_minimum_contents_width_get(settings));
}
+
+TEST_F(EWK2UnitTestBase, ewk_settings_offline_web_application_cache_enabled)
+{
+ Ewk_Settings* settings = ewk_view_settings_get(webView());
+
+ // The offline web application cache is enabled by default.
+ ASSERT_TRUE(ewk_settings_offline_web_application_cache_enabled_get(settings));
+
+ ASSERT_TRUE(ewk_settings_offline_web_application_cache_enabled_set(settings, true));
+ ASSERT_TRUE(ewk_settings_offline_web_application_cache_enabled_get(settings));
+
+ ASSERT_TRUE(ewk_settings_offline_web_application_cache_enabled_set(settings, false));
+ ASSERT_FALSE(ewk_settings_offline_web_application_cache_enabled_get(settings));
+}
+
+TEST_F(EWK2UnitTestBase, ewk_settings_scripts_can_open_windows)
+{
+ Ewk_Settings* settings = ewk_view_settings_get(webView());
+
+ // The scripts can open new windows by default.
+ ASSERT_TRUE(ewk_settings_scripts_can_open_windows_get(settings));
+
+ ASSERT_TRUE(ewk_settings_scripts_can_open_windows_set(settings, true));
+ ASSERT_TRUE(ewk_settings_scripts_can_open_windows_get(settings));
+
+ ASSERT_TRUE(ewk_settings_scripts_can_open_windows_set(settings, false));
+ ASSERT_FALSE(ewk_settings_scripts_can_open_windows_get(settings));
+}
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_storage_manager.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_storage_manager.cpp
index ee0c95579..c3da4d6a7 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_storage_manager.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_storage_manager.cpp
@@ -26,9 +26,6 @@
#include "config.h"
#include "UnitTestUtils/EWK2UnitTestBase.h"
-#include <EWebKit2.h>
-#include <Ecore.h>
-#include <gtest/gtest.h>
using namespace EWK2UnitTest;
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_text_checker.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_text_checker.cpp
index 5fcde5cd5..82da09a9e 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_text_checker.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_text_checker.cpp
@@ -31,10 +31,6 @@
#include "config.h"
#include "UnitTestUtils/EWK2UnitTestBase.h"
-#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
-#include <EWebKit2.h>
-#include <Ecore.h>
-#include <Eina.h>
#include <wtf/text/CString.h>
#include <wtf/text/StringBuilder.h>
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp
index 199970d29..1491cc7d9 100644
--- a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp
@@ -20,13 +20,7 @@
#include "config.h"
#include "UnitTestUtils/EWK2UnitTestBase.h"
-#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
#include "UnitTestUtils/EWK2UnitTestServer.h"
-#include <EWebKit2.h>
-#include <Ecore.h>
-#include <Eina.h>
-#include <Evas.h>
-#include <gtest/gtest.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/UnusedParam.h>
@@ -142,12 +136,12 @@ TEST_F(EWK2UnitTestBase, ewk_view_navigation)
TEST_F(EWK2UnitTestBase, ewk_view_setting_encoding_custom)
{
- ASSERT_FALSE(ewk_view_setting_encoding_custom_get(webView()));
- ASSERT_TRUE(ewk_view_setting_encoding_custom_set(webView(), "UTF-8"));
- ASSERT_STREQ("UTF-8", ewk_view_setting_encoding_custom_get(webView()));
+ ASSERT_FALSE(ewk_view_custom_encoding_get(webView()));
+ ASSERT_TRUE(ewk_view_custom_encoding_set(webView(), "UTF-8"));
+ ASSERT_STREQ("UTF-8", ewk_view_custom_encoding_get(webView()));
// Set the default charset.
- ASSERT_TRUE(ewk_view_setting_encoding_custom_set(webView(), 0));
- ASSERT_FALSE(ewk_view_setting_encoding_custom_get(webView()));
+ ASSERT_TRUE(ewk_view_custom_encoding_set(webView(), 0));
+ ASSERT_FALSE(ewk_view_custom_encoding_get(webView()));
}
static void onFormAboutToBeSubmitted(void* userData, Evas_Object*, void* eventInfo)
@@ -242,7 +236,13 @@ TEST_F(EWK2UnitTestBase, ewk_view_mouse_events_enabled)
ASSERT_FALSE(ewk_view_mouse_events_enabled_get(webView()));
}
-static Eina_Bool fullScreenCallback(Ewk_View_Smart_Data* smartData)
+static Eina_Bool fullScreenCallback(Ewk_View_Smart_Data* smartData, Ewk_Security_Origin*)
+{
+ fullScreenCallbackCalled = true;
+ return false;
+}
+
+static Eina_Bool fullScreenExitCallback(Ewk_View_Smart_Data* smartData)
{
fullScreenCallbackCalled = true;
return false;
@@ -278,7 +278,7 @@ TEST_F(EWK2UnitTestBase, ewk_view_full_screen_exit)
"}</script></head>"
"<body><div id=\"fullscreen\" style=\"width:100px; height:100px\" onclick=\"makeFullScreenAndExit()\"></div></body>";
- ewkViewClass()->fullscreen_exit = fullScreenCallback;
+ ewkViewClass()->fullscreen_exit = fullScreenExitCallback;
ewk_view_html_string_load(webView(), fullscreenHTML, "file:///", 0);
ASSERT_TRUE(waitUntilLoadFinished());
diff --git a/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_window_features.cpp b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_window_features.cpp
new file mode 100644
index 000000000..5fb0e5201
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_window_features.cpp
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics. 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.
+ */
+
+#include "config.h"
+
+#include "UnitTestUtils/EWK2UnitTestBase.h"
+#include <EWebKit2.h>
+#include <Ecore.h>
+#include <WebCore/IntRect.h>
+
+using namespace EWK2UnitTest;
+using namespace WebCore;
+
+static Evas_Object* createDefaultWindow(Ewk_View_Smart_Data* smartData, const Ewk_Window_Features* windowFeatures)
+{
+ // default values of WebCore:WindowFeatures()
+ // - menuBarVisible(true)
+ // - statusBarVisible(true)
+ // - toolBarVisible(true)
+ // - locationBarVisible(true)
+ // - scrollbarsVisible(true)
+ // - resizable(true)
+ // - fullscreen(false)
+
+ EXPECT_TRUE(ewk_window_features_toolbar_visible_get(windowFeatures));
+ EXPECT_TRUE(ewk_window_features_statusbar_visible_get(windowFeatures));
+ EXPECT_TRUE(ewk_window_features_scrollbars_visible_get(windowFeatures));
+ EXPECT_TRUE(ewk_window_features_menubar_visible_get(windowFeatures));
+ EXPECT_TRUE(ewk_window_features_locationbar_visible_get(windowFeatures));
+ EXPECT_TRUE(ewk_window_features_resizable_get(windowFeatures));
+
+ EXPECT_FALSE(ewk_window_features_fullscreen_get(windowFeatures));
+
+ int x, y, width, height;
+ ewk_window_features_geometry_get(windowFeatures, &x, &y, &width, &height);
+
+ EXPECT_EQ(0, x);
+ EXPECT_EQ(0, y);
+ EXPECT_EQ(0, width);
+ EXPECT_EQ(0, height);
+
+ return 0;
+}
+
+TEST_F(EWK2UnitTestBase, ewk_window_features_default_property_get)
+{
+ Evas_Object* view = webView();
+
+ const char windowHTML[] = "<html><body onLoad=\"window.open('', '');\"></body></html>";
+
+ ewkViewClass()->window_create = createDefaultWindow;
+
+ ewk_view_html_string_load(view, windowHTML, 0, 0);
+ ASSERT_TRUE(waitUntilLoadFinished());
+}
+
+static Evas_Object* createWindow(Ewk_View_Smart_Data *smartData, const Ewk_Window_Features *windowFeatures)
+{
+ EXPECT_FALSE(ewk_window_features_toolbar_visible_get(windowFeatures));
+ EXPECT_TRUE(ewk_window_features_statusbar_visible_get(windowFeatures));
+ EXPECT_TRUE(ewk_window_features_scrollbars_visible_get(windowFeatures));
+ EXPECT_FALSE(ewk_window_features_menubar_visible_get(windowFeatures));
+ EXPECT_FALSE(ewk_window_features_locationbar_visible_get(windowFeatures));
+ EXPECT_TRUE(ewk_window_features_resizable_get(windowFeatures));
+ EXPECT_FALSE(ewk_window_features_fullscreen_get(windowFeatures));
+
+ int x, y, width, height;
+ ewk_window_features_geometry_get(windowFeatures, &x, &y, &width, &height);
+
+ EXPECT_EQ(100, x);
+ EXPECT_EQ(150, y);
+ EXPECT_EQ(400, width);
+ EXPECT_EQ(400, height);
+
+ return 0;
+}
+
+TEST_F(EWK2UnitTestBase, ewk_window_features_property_get)
+{
+ Evas_Object* view = webView();
+
+ const char windowHTML[] = "<html><body onLoad=\"window.open('', '', 'left=100,top=150,width=400,height=400,location=no,menubar=no,status=yes,toolbar=no,scrollbars=yes,resizable=yes,fullscreen=no');\"></body></html>";
+
+ ewkViewClass()->window_create = createWindow;
+
+ ewk_view_html_string_load(view, windowHTML, 0, 0);
+ ASSERT_TRUE(waitUntilLoadFinished());
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp
new file mode 100644
index 000000000..ef2da1c98
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebKit2GtkAuthenticationDialog.h"
+
+#include "AuthenticationChallengeProxy.h"
+#include "AuthenticationDecisionListener.h"
+#include "WebCredential.h"
+
+namespace WebKit {
+
+WebKit2GtkAuthenticationDialog::WebKit2GtkAuthenticationDialog(AuthenticationChallengeProxy* authenticationChallenge)
+ : GtkAuthenticationDialog(0, authenticationChallenge->core())
+ , m_authenticationChallenge(authenticationChallenge)
+{
+ // We aren't passing a toplevel to the GtkAuthenticationDialog constructor,
+ // because eventually this widget will be embedded into the WebView itself.
+}
+
+void WebKit2GtkAuthenticationDialog::authenticate(const WebCore::Credential& credential)
+{
+ RefPtr<WebCredential> webCredential = WebCredential::create(credential);
+ m_authenticationChallenge->listener()->useCredential(webCredential.get());
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h b/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h
new file mode 100644
index 000000000..60c5e0588
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKit2GtkAuthenticationDialog.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2012 Igalia S.L.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "AuthenticationChallengeProxy.h"
+#include "WKRetainPtr.h"
+#include <WebCore/Credential.h>
+#include <WebCore/GtkAuthenticationDialog.h>
+
+namespace WebKit {
+
+class WebKit2GtkAuthenticationDialog : public WebCore::GtkAuthenticationDialog {
+public:
+ WebKit2GtkAuthenticationDialog(AuthenticationChallengeProxy*);
+
+protected:
+ virtual void authenticate(const WebCore::Credential&);
+
+private:
+ RefPtr<AuthenticationChallengeProxy> m_authenticationChallenge;
+};
+
+} // namespace WebKit
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp
index 0b9275fdf..be06eddf6 100644
--- a/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/WebKitLoaderClient.cpp
@@ -21,6 +21,7 @@
#include "config.h"
#include "WebKitLoaderClient.h"
+#include "WebKit2GtkAuthenticationDialog.h"
#include "WebKitBackForwardListPrivate.h"
#include "WebKitURIResponsePrivate.h"
#include "WebKitWebViewBasePrivate.h"
@@ -115,6 +116,12 @@ static void didChangeBackForwardList(WKPageRef page, WKBackForwardListItemRef ad
webkitBackForwardListChanged(webkit_web_view_get_back_forward_list(WEBKIT_WEB_VIEW(clientInfo)), toImpl(addedItem), toImpl(removedItems));
}
+static void didReceiveAuthenticationChallengeInFrame(WKPageRef page, WKFrameRef frame, WKAuthenticationChallengeRef authenticationChallenge, const void *clientInfo)
+{
+ WebKit2GtkAuthenticationDialog* dialog = new WebKit2GtkAuthenticationDialog(toImpl(authenticationChallenge));
+ dialog->show();
+}
+
void attachLoaderClientToView(WebKitWebView* webView)
{
WKPageLoaderClient wkLoaderClient = {
@@ -135,7 +142,7 @@ void attachLoaderClientToView(WebKitWebView* webView)
0, // didDisplayInsecureContentForFrame
0, // didRunInsecureContentForFrame
0, // canAuthenticateAgainstProtectionSpaceInFrame
- 0, // didReceiveAuthenticationChallengeInFrame
+ didReceiveAuthenticationChallengeInFrame,
didChangeProgress, // didStartProgress
didChangeProgress,
didChangeProgress, // didFinishProgress
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am b/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am
index 1db90a628..a8f9976fd 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/GNUmakefile.am
@@ -1,11 +1,13 @@
if ENABLE_WEBKIT2
TEST_PROGS += \
+ Programs/WebKit2APITests/InspectorTestServer \
Programs/WebKit2APITests/TestBackForwardList \
Programs/WebKit2APITests/TestContextMenu \
Programs/WebKit2APITests/TestCookieManager \
Programs/WebKit2APITests/TestDownloads \
Programs/WebKit2APITests/TestInspector \
+ Programs/WebKit2APITests/TestInspectorServer \
Programs/WebKit2APITests/TestLoaderClient \
Programs/WebKit2APITests/TestPrinting \
Programs/WebKit2APITests/TestResources \
@@ -106,6 +108,12 @@ Programs_WebKit2APITests_TestWebKitSettings_CPPFLAGS = $(webkit2_tests_cppflags)
Programs_WebKit2APITests_TestWebKitSettings_LDADD = $(webkit2_tests_ldadd)
Programs_WebKit2APITests_TestWebKitSettings_LDFLAGS = $(webkit2_tests_ldflags)
+Programs_WebKit2APITests_InspectorTestServer_SOURCES = \
+ Source/WebKit2/UIProcess/API/gtk/tests/InspectorTestServer.cpp
+Programs_WebKit2APITests_InspectorTestServer_CPPFLAGS = $(webkit2_tests_cppflags)
+Programs_WebKit2APITests_InspectorTestServer_LDADD = $(webkit2_tests_ldadd)
+Programs_WebKit2APITests_InspectorTestServer_LDFLAGS = $(webkit2_tests_ldflags)
+
Programs_WebKit2APITests_TestBackForwardList_SOURCES = \
Source/WebKit2/UIProcess/API/gtk/tests/TestBackForwardList.cpp
Programs_WebKit2APITests_TestBackForwardList_CPPFLAGS = $(webkit2_tests_cppflags)
@@ -182,6 +190,12 @@ Programs_WebKit2APITests_TestInspector_CPPFLAGS = \
Programs_WebKit2APITests_TestInspector_LDADD = $(webkit2_tests_ldadd)
Programs_WebKit2APITests_TestInspector_LDFLAGS = $(webkit2_tests_ldflags)
+Programs_WebKit2APITests_TestInspectorServer_SOURCES = \
+ Source/WebKit2/UIProcess/API/gtk/tests/TestInspectorServer.cpp
+Programs_WebKit2APITests_TestInspectorServer_CPPFLAGS = $(webkit2_tests_cppflags)
+Programs_WebKit2APITests_TestInspectorServer_LDADD = $(webkit2_tests_ldadd)
+Programs_WebKit2APITests_TestInspectorServer_LDFLAGS = $(webkit2_tests_ldflags)
+
Programs_WebKit2APITests_TestWebKitVersion_SOURCES = \
Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitVersion.cpp
Programs_WebKit2APITests_TestWebKitVersion_CPPFLAGS = $(webkit2_tests_cppflags)
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/InspectorTestServer.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/InspectorTestServer.cpp
new file mode 100644
index 000000000..f13b043df
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/InspectorTestServer.cpp
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics Ltd. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT OWNER OR 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.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+#include <webkit2/webkit2.h>
+
+static void loadChangedCallback(WebKitWebView*, WebKitLoadEvent loadEvent, gpointer)
+{
+ // Send a message to the parent process when we're ready.
+ if (loadEvent == WEBKIT_LOAD_FINISHED)
+ g_print("OK");
+}
+
+int main(int argc, char** argv)
+{
+ gtk_init(&argc, &argv);
+
+ // Overwrite WEBKIT_INSPECTOR_SERVER variable with default value.
+ g_setenv("WEBKIT_INSPECTOR_SERVER", "127.0.0.1:2999", TRUE);
+
+ WebKitWebView* webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
+ webkit_settings_set_enable_developer_extras(webkit_web_view_get_settings(webView), TRUE);
+ webkit_web_view_load_html(webView,
+ "<html><body><p>WebKitGTK+ Inspector Test Server</p></body></html>",
+ "http://127.0.0.1:2999/");
+
+ GtkWidget* window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(webView));
+ gtk_widget_show_all(window);
+
+ g_signal_connect(window, "delete-event", G_CALLBACK(gtk_main_quit), 0);
+ g_signal_connect(webView, "load-changed", G_CALLBACK(loadChangedCallback), 0);
+
+ gtk_main();
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestInspectorServer.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestInspectorServer.cpp
new file mode 100644
index 000000000..30d8fac0c
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestInspectorServer.cpp
@@ -0,0 +1,264 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics Ltd. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT OWNER OR 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.
+ */
+
+#include "config.h"
+
+#include "WebViewTest.h"
+#include <wtf/gobject/GRefPtr.h>
+#include <wtf/text/WTFString.h>
+
+// Name of the test server application creating the webView object.
+static const char* gTestServerAppName = "InspectorTestServer";
+
+// Max seconds to wait for the test server before inspecting it.
+static const int gMaxWaitForChild = 5;
+
+// The PID for the test server running, so we can kill it if needed.
+static GPid gChildProcessPid = 0;
+
+// Whether the child has replied and it's ready.
+static bool gChildIsReady = false;
+
+static void stopTestServer()
+{
+ // Do nothing if there's no server running.
+ if (!gChildProcessPid)
+ return;
+
+ g_spawn_close_pid(gChildProcessPid);
+ kill(gChildProcessPid, SIGTERM);
+ gChildProcessPid = 0;
+}
+
+static void sigAbortHandler(int sigNum)
+{
+ // Just stop the test server if SIGABRT was received.
+ stopTestServer();
+}
+
+static gpointer testServerMonitorThreadFunc(gpointer)
+{
+ // Wait for the specified timeout to happen.
+ g_usleep(gMaxWaitForChild * G_USEC_PER_SEC);
+
+ // Kill the child process if not ready yet.
+ if (!gChildIsReady)
+ stopTestServer();
+
+ g_thread_exit(0);
+ return 0;
+}
+
+static void startTestServerMonitor()
+{
+ gChildIsReady = false;
+
+#if (!GLIB_CHECK_VERSION(2, 31, 0))
+ g_thread_create(testServerMonitorThreadFunc, 0, FALSE, 0);
+#else
+ g_thread_new("TestServerMonitor", testServerMonitorThreadFunc, 0);
+#endif
+}
+
+static void startTestServer()
+{
+ // Prepare argv[] for spawning the server process.
+ GOwnPtr<char> testServerPath(g_build_filename(WEBKIT_EXEC_PATH, "WebKit2APITests", gTestServerAppName, NULL));
+
+ // We install a handler to ensure that we kill the child process
+ // if the parent dies because of whatever the reason is.
+ signal(SIGABRT, sigAbortHandler);
+
+ char* testServerArgv[2];
+ testServerArgv[0] = testServerPath.get();
+ testServerArgv[1] = 0;
+
+ // Spawn the server, getting its stdout file descriptor to set a
+ // communication channel, so we know when it's ready.
+ int childStdout = 0;
+ g_assert(g_spawn_async_with_pipes(0, testServerArgv, 0, static_cast<GSpawnFlags>(0), 0, 0,
+ &gChildProcessPid, 0, &childStdout, 0, 0));
+
+ // Start monitoring the test server (in a separate thread) to
+ // ensure we don't block on the child process more than a timeout.
+ startTestServerMonitor();
+
+ char msg[2];
+ GIOChannel* ioChannel = g_io_channel_unix_new(childStdout);
+ if (g_io_channel_read_chars(ioChannel, msg, 2, 0, 0) == G_IO_STATUS_NORMAL) {
+ // Check whether the server sent a message saying it's ready
+ // and store the result globally, so the monitor can see it.
+ gChildIsReady = msg[0] == 'O' && msg[1] == 'K';
+ }
+ g_io_channel_unref(ioChannel);
+ close(childStdout);
+
+ // The timeout was reached and the server is not ready yet, so
+ // stop it inmediately, and let the unit tests fail.
+ if (!gChildIsReady)
+ stopTestServer();
+}
+
+class InspectorServerTest: public WebViewTest {
+public:
+ MAKE_GLIB_TEST_FIXTURE(InspectorServerTest);
+
+ InspectorServerTest()
+ : WebViewTest()
+ {
+ }
+
+ bool getPageList()
+ {
+ loadHtml("<script type=\"text/javascript\">\n"
+ "var pages;\n"
+ "var xhr = new XMLHttpRequest;\n"
+ "xhr.open(\"GET\", \"/pagelist.json\");\n"
+ "xhr.onload = function(e) {\n"
+ "if (xhr.status == 200) {\n"
+ "pages = JSON.parse(xhr.responseText);\n"
+ "document.title = \"OK\";\n"
+ "} else \n"
+ "document.title = \"FAIL\";\n"
+ "}\n"
+ "xhr.send();\n"
+ "</script>\n",
+ "http://127.0.0.1:2999/");
+
+ waitUntilTitleChanged();
+
+ if (!strcmp(webkit_web_view_get_title(m_webView), "OK"))
+ return true;
+
+ return false;
+ }
+
+ ~InspectorServerTest()
+ {
+ }
+};
+
+// Test to get inspector server page list from the test server.
+// Should contain only one entry pointing to http://127.0.0.1:2999/webinspector/inspector.html?page=1
+static void testInspectorServerPageList(InspectorServerTest* test, gconstpointer)
+{
+ GOwnPtr<GError> error;
+
+ test->showInWindowAndWaitUntilMapped(GTK_WINDOW_TOPLEVEL);
+ g_assert(test->getPageList());
+
+ WebKitJavascriptResult* javascriptResult = test->runJavaScriptAndWaitUntilFinished("pages.length;", &error.outPtr());
+ g_assert(javascriptResult);
+ g_assert(!error.get());
+ g_assert_cmpint(WebViewTest::javascriptResultToNumber(javascriptResult), ==, 1);
+
+ javascriptResult = test->runJavaScriptAndWaitUntilFinished("pages[0].id;", &error.outPtr());
+ g_assert(javascriptResult);
+ g_assert(!error.get());
+ int pageId = WebViewTest::javascriptResultToNumber(javascriptResult);
+
+ GOwnPtr<char> valueString;
+ javascriptResult = test->runJavaScriptAndWaitUntilFinished("pages[0].url;", &error.outPtr());
+ g_assert(javascriptResult);
+ g_assert(!error.get());
+ valueString.set(WebViewTest::javascriptResultToCString(javascriptResult));
+ g_assert_cmpstr(valueString.get(), ==, "http://127.0.0.1:2999/");
+
+ javascriptResult = test->runJavaScriptAndWaitUntilFinished("pages[0].inspectorUrl;", &error.outPtr());
+ g_assert(javascriptResult);
+ g_assert(!error.get());
+ valueString.set(WebViewTest::javascriptResultToCString(javascriptResult));
+ String validInspectorURL = String("/webinspector/inspector.html?page=") + String::number(pageId);
+ g_assert_cmpstr(valueString.get(), ==, validInspectorURL.utf8().data());
+}
+
+// Test sending a raw remote debugging message through our web socket server.
+// For this specific message see: http://code.google.com/chrome/devtools/docs/protocol/tot/runtime.html#command-evaluate
+static void testRemoteDebuggingMessage(InspectorServerTest* test, gconstpointer)
+{
+ test->showInWindowAndWaitUntilMapped(GTK_WINDOW_TOPLEVEL);
+
+ test->loadHtml("<script type=\"text/javascript\">\n"
+ "var socket = new WebSocket('ws://127.0.0.1:2999/devtools/page/1');\n"
+ "socket.onmessage = function(message) {\n"
+ "var response = JSON.parse(message.data);\n"
+ "if (response.id === 1)\n"
+ "document.title = response.result.result.value;\n"
+ "else\n"
+ "document.title = \"FAIL\";\n"
+ "}\n"
+ "socket.onopen = function() {\n"
+ "socket.send('{\"id\": 1, \"method\": \"Runtime.evaluate\", \"params\": {\"expression\": \"2 + 2\" } }');\n"
+ "}\n"
+ "</script>",
+ "http://127.0.0.1:2999/");
+ test->waitUntilTitleChanged();
+
+ g_assert_cmpstr(webkit_web_view_get_title(test->m_webView), ==, "4");
+}
+
+static void openRemoteDebuggingSession(InspectorServerTest* test, gconstpointer)
+{
+ // To test the whole pipeline this exploits a behavior of the inspector front-end which won't provide any title unless the
+ // debugging session was established correctly through web socket. It should be something like "Web Inspector - <Page URL>".
+ // In our case page URL should be http://127.0.0.1:2999/
+ // So this test case will fail if:
+ // - The page list didn't return a valid inspector URL
+ // - Or the front-end couldn't be loaded through the inspector HTTP server
+ // - Or the web socket connection couldn't be established between the front-end and the page through the inspector server
+ // Let's see if this test isn't raising too many false positives, in which case we should use a better predicate if available.
+
+ test->showInWindowAndWaitUntilMapped(GTK_WINDOW_TOPLEVEL);
+
+ g_assert(test->getPageList());
+
+ GOwnPtr<GError> error;
+ WebKitJavascriptResult* javascriptResult = test->runJavaScriptAndWaitUntilFinished("pages[0].inspectorUrl;", &error.outPtr());
+ g_assert(javascriptResult);
+ g_assert(!error.get());
+
+ String resolvedURL = String("http://127.0.0.1:2999/") + String::fromUTF8(WebViewTest::javascriptResultToCString(javascriptResult));
+ test->loadURI(resolvedURL.utf8().data());
+ test->waitUntilTitleChanged();
+
+ g_assert_cmpstr(webkit_web_view_get_title(test->m_webView), ==, "Web Inspector - http://127.0.0.1:2999/");
+}
+
+
+void beforeAll()
+{
+ // Overwrite WEBKIT_INSPECTOR_SERVER variable with default IP address but different port to avoid conflict with the test inspector server page.
+ g_setenv("WEBKIT_INSPECTOR_SERVER", "127.0.0.1:2998", TRUE);
+
+ startTestServer();
+ InspectorServerTest::add("WebKitWebInspectorServer", "test-page-list", testInspectorServerPageList);
+ InspectorServerTest::add("WebKitWebInspectorServer", "test-remote-debugging-message", testRemoteDebuggingMessage);
+ InspectorServerTest::add("WebKitWebInspectorServer", "test-open-debugging-session", openRemoteDebuggingSession);
+
+}
+
+void afterAll()
+{
+ stopTestServer();
+}
diff --git a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp
index 55350e6c2..08cdbe82a 100644
--- a/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp
+++ b/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitWebView.cpp
@@ -93,7 +93,8 @@ public:
class WindowProperties {
public:
WindowProperties()
- : m_toolbarVisible(true)
+ : m_isNull(true)
+ , m_toolbarVisible(true)
, m_statusbarVisible(true)
, m_scrollbarsVisible(true)
, m_menubarVisible(true)
@@ -105,7 +106,8 @@ public:
}
WindowProperties(WebKitWindowProperties* windowProperties)
- : m_toolbarVisible(webkit_window_properties_get_toolbar_visible(windowProperties))
+ : m_isNull(false)
+ , m_toolbarVisible(webkit_window_properties_get_toolbar_visible(windowProperties))
, m_statusbarVisible(webkit_window_properties_get_statusbar_visible(windowProperties))
, m_scrollbarsVisible(webkit_window_properties_get_scrollbars_visible(windowProperties))
, m_menubarVisible(webkit_window_properties_get_menubar_visible(windowProperties))
@@ -118,7 +120,8 @@ public:
WindowProperties(GdkRectangle* geometry, bool toolbarVisible, bool statusbarVisible, bool scrollbarsVisible, bool menubarVisible,
bool locationbarVisible, bool resizable, bool fullscreen)
- : m_geometry(*geometry)
+ : m_isNull(false)
+ , m_geometry(*geometry)
, m_toolbarVisible(toolbarVisible)
, m_statusbarVisible(statusbarVisible)
, m_scrollbarsVisible(scrollbarsVisible)
@@ -129,10 +132,12 @@ public:
{
}
+ bool isNull() const { return m_isNull; }
+
void assertEqual(const WindowProperties& other) const
{
- // FIXME: We should assert x and y are equal, but we are getting an incorrect
- // value from WebCore (280 instead of 150).
+ g_assert_cmpint(m_geometry.x, ==, other.m_geometry.x);
+ g_assert_cmpint(m_geometry.y, ==, other.m_geometry.y);
g_assert_cmpint(m_geometry.width, ==, other.m_geometry.width);
g_assert_cmpint(m_geometry.height, ==, other.m_geometry.height);
g_assert_cmpint(static_cast<int>(m_toolbarVisible), ==, static_cast<int>(other.m_toolbarVisible));
@@ -145,6 +150,8 @@ public:
}
private:
+ bool m_isNull;
+
GdkRectangle m_geometry;
bool m_toolbarVisible;
@@ -312,7 +319,8 @@ public:
WebKitWindowProperties* windowProperties = webkit_web_view_get_window_properties(webView);
g_assert(windowProperties);
- WindowProperties(windowProperties).assertEqual(m_windowProperties);
+ if (!m_windowProperties.isNull())
+ WindowProperties(windowProperties).assertEqual(m_windowProperties);
m_webViewEvents.append(ReadyToShow);
}
diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
index 18579eee9..b019c68dc 100644
--- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
+++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
@@ -62,6 +62,7 @@ private:
virtual bool isViewInWindow();
virtual LayerHostingMode viewLayerHostingMode() OVERRIDE;
virtual ColorSpaceData colorSpace() OVERRIDE;
+ virtual void setAcceleratedCompositingRootLayer(CALayer *) OVERRIDE;
virtual void processDidCrash();
virtual void pageClosed();
diff --git a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
index 7b54b4bd7..6bdc1b9eb 100644
--- a/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
+++ b/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
@@ -384,22 +384,31 @@ void PageClientImpl::accessibilityWebProcessTokenReceived(const CoreIPC::DataRef
[m_wkView _setAccessibilityWebProcessToken:remoteToken];
}
-#if USE(ACCELERATED_COMPOSITING)
void PageClientImpl::enterAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
{
- [m_wkView _enterAcceleratedCompositingMode:layerTreeContext];
+ ASSERT(!layerTreeContext.isEmpty());
+
+ CALayer *renderLayer = WKMakeRenderLayer(layerTreeContext.contextID);
+ [m_wkView _setAcceleratedCompositingModeRootLayer:renderLayer];
}
void PageClientImpl::exitAcceleratedCompositingMode()
{
- [m_wkView _exitAcceleratedCompositingMode];
+ [m_wkView _setAcceleratedCompositingModeRootLayer:nil];
}
void PageClientImpl::updateAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
{
- [m_wkView _updateAcceleratedCompositingMode:layerTreeContext];
+ ASSERT(!layerTreeContext.isEmpty());
+
+ CALayer *renderLayer = WKMakeRenderLayer(layerTreeContext.contextID);
+ [m_wkView _setAcceleratedCompositingModeRootLayer:renderLayer];
+}
+
+void PageClientImpl::setAcceleratedCompositingRootLayer(CALayer *rootLayer)
+{
+ [m_wkView _setAcceleratedCompositingModeRootLayer:rootLayer];
}
-#endif // USE(ACCELERATED_COMPOSITING)
void PageClientImpl::pluginFocusOrWindowFocusChanged(uint64_t pluginComplexTextInputIdentifier, bool pluginHasFocusAndWindowHasFocus)
{
diff --git a/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.h b/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.h
index c053ae664..07bb9a8d2 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.h
+++ b/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.h
@@ -42,6 +42,9 @@ WK_EXPORT
#pragma mark Loading
++ (void)registerSchemeForCustomProtocol:(NSString *)scheme;
++ (void)unregisterSchemeForCustomProtocol:(NSString *)scheme;
+
/* Load a request. This is only valid for requests of non-file: URLs. Passing a
file: URL will throw an exception. */
- (void)loadRequest:(NSURLRequest *)request;
diff --git a/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm b/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm
index 2d4a94400..8604de876 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm
+++ b/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm
@@ -36,6 +36,7 @@
#import "WKURLCF.h"
#import "WKURLRequest.h"
#import "WKURLRequestNS.h"
+#import "WebContext.h"
#import <wtf/RetainPtr.h>
#import "WKBrowsingContextLoadDelegate.h"
@@ -103,6 +104,20 @@ static inline NSURL *autoreleased(WKURLRef url)
#pragma mark Loading
++ (void)registerSchemeForCustomProtocol:(NSString *)scheme
+{
+ NSString *lowercaseScheme = [scheme lowercaseString];
+ [[WKBrowsingContextController customSchemes] addObject:lowercaseScheme];
+ [[NSNotificationCenter defaultCenter] postNotificationName:WebKit::SchemeForCustomProtocolRegisteredNotificationName object:lowercaseScheme];
+}
+
++ (void)unregisterSchemeForCustomProtocol:(NSString *)scheme
+{
+ NSString *lowercaseScheme = [scheme lowercaseString];
+ [[WKBrowsingContextController customSchemes] removeObject:lowercaseScheme];
+ [[NSNotificationCenter defaultCenter] postNotificationName:WebKit::SchemeForCustomProtocolUnregisteredNotificationName object:lowercaseScheme];
+}
+
- (void)loadRequest:(NSURLRequest *)request
{
WKRetainPtr<WKURLRequestRef> wkRequest = adoptWK(WKURLRequestCreateWithNSURLRequest(request));
@@ -403,4 +418,10 @@ static void setUpPageLoaderClient(WKBrowsingContextController *browsingContext,
return self;
}
++ (NSMutableSet *)customSchemes
+{
+ static NSMutableSet *customSchemes = [[NSMutableSet alloc] init];
+ return customSchemes;
+}
+
@end
diff --git a/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h b/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h
index b9452adfc..d1d20ad04 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h
+++ b/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerInternal.h
@@ -29,5 +29,6 @@
/* This should only be called from associate view. */
- (id)_initWithPageRef:(WKPageRef)pageRef;
++ (NSMutableSet *)customSchemes;
@end
diff --git a/Source/WebKit2/UIProcess/API/mac/WKView.mm b/Source/WebKit2/UIProcess/API/mac/WKView.mm
index 5fd169c84..4e30b3368 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/Source/WebKit2/UIProcess/API/mac/WKView.mm
@@ -2316,7 +2316,7 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
- (void)_processDidCrash
{
if (_data->_layerHostingView)
- [self _exitAcceleratedCompositingMode];
+ [self _setAcceleratedCompositingModeRootLayer:nil];
[self _updateRemoteAccessibilityRegistration:NO];
}
@@ -2562,62 +2562,43 @@ static void drawPageBackground(CGContextRef context, WebPageProxy* page, const I
_data->_findIndicatorWindow->setFindIndicator(findIndicator, fadeOut, animate);
}
-- (void)_enterAcceleratedCompositingMode:(const LayerTreeContext&)layerTreeContext
-{
- ASSERT(!_data->_layerHostingView);
- ASSERT(!layerTreeContext.isEmpty());
-
- // Create an NSView that will host our layer tree.
- _data->_layerHostingView.adoptNS([[WKFlippedView alloc] initWithFrame:[self bounds]]);
- [_data->_layerHostingView.get() setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+- (void)_setAcceleratedCompositingModeRootLayer:(CALayer *)rootLayer
+{
[CATransaction begin];
[CATransaction setDisableActions:YES];
- [self addSubview:_data->_layerHostingView.get() positioned:NSWindowBelow relativeTo:nil];
-
- // Create a root layer that will back the NSView.
- RetainPtr<CALayer> rootLayer(AdoptNS, [[CALayer alloc] init]);
-#ifndef NDEBUG
- [rootLayer.get() setName:@"Hosting root layer"];
-#endif
-
- CALayer *renderLayer = WKMakeRenderLayer(layerTreeContext.contextID);
- [rootLayer.get() addSublayer:renderLayer];
-
- [_data->_layerHostingView.get() setLayer:rootLayer.get()];
- [_data->_layerHostingView.get() setWantsLayer:YES];
-
- [CATransaction commit];
-}
+ if (rootLayer) {
+ if (!_data->_layerHostingView) {
+ // Create an NSView that will host our layer tree.
+ _data->_layerHostingView.adoptNS([[WKFlippedView alloc] initWithFrame:[self bounds]]);
+ [_data->_layerHostingView.get() setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
-- (void)_exitAcceleratedCompositingMode
-{
- ASSERT(_data->_layerHostingView);
- [_data->_layerHostingView.get() removeFromSuperview];
- [_data->_layerHostingView.get() setLayer:nil];
- [_data->_layerHostingView.get() setWantsLayer:NO];
-
- _data->_layerHostingView = nullptr;
-}
+ [self addSubview:_data->_layerHostingView.get() positioned:NSWindowBelow relativeTo:nil];
-- (void)_updateAcceleratedCompositingMode:(const WebKit::LayerTreeContext&)layerTreeContext
-{
- if (_data->_layerHostingView) {
- // Wrap the call to setSublayers: in a CATransaction with actions disabled to
- // keep CA from cross-fading between the two sublayer arrays.
- [CATransaction begin];
- [CATransaction setDisableActions:YES];
+ // Create a root layer that will back the NSView.
+ RetainPtr<CALayer> layer = adoptNS([[CALayer alloc] init]);
+#ifndef NDEBUG
+ [layer setName:@"Hosting root layer"];
+#endif
- CALayer *renderLayer = WKMakeRenderLayer(layerTreeContext.contextID);
- [[_data->_layerHostingView.get() layer] setSublayers:[NSArray arrayWithObject:renderLayer]];
+ [_data->_layerHostingView setLayer:layer.get()];
+ [_data->_layerHostingView setWantsLayer:YES];
+ }
- [CATransaction commit];
+ [_data->_layerHostingView layer].sublayers = [NSArray arrayWithObject:rootLayer];
} else {
- [self _exitAcceleratedCompositingMode];
- [self _enterAcceleratedCompositingMode:layerTreeContext];
+ if (_data->_layerHostingView) {
+ [_data->_layerHostingView removeFromSuperview];
+ [_data->_layerHostingView setLayer:nil];
+ [_data->_layerHostingView setWantsLayer:NO];
+
+ _data->_layerHostingView = nullptr;
+ }
}
+
+ [CATransaction commit];
}
- (void)_setAccessibilityWebProcessToken:(NSData *)data
diff --git a/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h b/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
index 2e99e7976..3f612d240 100644
--- a/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
+++ b/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
@@ -65,9 +65,7 @@ namespace WebKit {
- (NSRect)_convertToUserSpace:(NSRect)rect;
- (void)_setFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate;
-- (void)_enterAcceleratedCompositingMode:(const WebKit::LayerTreeContext&)layerTreeContext;
-- (void)_exitAcceleratedCompositingMode;
-- (void)_updateAcceleratedCompositingMode:(const WebKit::LayerTreeContext&)layerTreeContext;
+- (void)_setAcceleratedCompositingModeRootLayer:(CALayer *)rootLayer;
- (void)_setAccessibilityWebProcessToken:(NSData *)data;
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp
index 71688cbe6..e5f3d3ed4 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebpage.cpp
@@ -87,7 +87,6 @@ QSGNode* QQuickWebPage::updatePaintNode(QSGNode* oldNode, UpdatePaintNodeData*)
if (!node)
node = new QtWebPageSGNode();
node->setRenderer(renderer);
- renderer->syncRemoteContent();
node->setScale(d->contentsScale);
QColor backgroundColor = d->webPageProxy->drawsTransparentBackground() ? Qt::transparent : Qt::white;
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h b/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h
index bfabb69fb..5cbdddd54 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h
@@ -29,7 +29,6 @@
#include <QtCore/QPointer>
#include <QtCore/QSize>
#include <QtCore/QVariant>
-#include <QtQml/QtQml>
#include <QtQuick/qquickitem.h>
class QQuickWebViewPrivate;
diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp
index 5f6c16d56..f5f0bd3f9 100644
--- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp
@@ -376,7 +376,6 @@ void QRawWebView::paint(const QMatrix4x4& transform, float opacity, unsigned pai
return;
renderer->setActive(true);
- renderer->syncRemoteContent();
WebCore::FloatRect rect(0, 0, d->m_size.width(), d->m_size.height());
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_doubleTapToZoom.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_doubleTapToZoom.qml
index d21ef211a..d25f778bd 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_doubleTapToZoom.qml
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_doubleTapToZoom.qml
@@ -8,8 +8,8 @@ import "../common"
Item {
TestWebView {
id: webView
- width: 480
- height: 720
+ width: 320
+ height: 240
property variant result
@@ -19,7 +19,10 @@ Item {
"</head>" +
"<body>" +
" <div id='target' " +
- " style='position:absolute; left:20; top:20; width:200; height:200;'>" +
+ " style='position:absolute; left:20; top:20; width:220; height:80;'>" +
+ " </div>" +
+ " <div id='smalltarget' " +
+ " style='position:absolute; left:20; top:120; width:140; height:80;'>" +
" </div>" +
"</body>"
@@ -49,7 +52,7 @@ Item {
scaleSpy.clear()
}
- function documentSize() {
+ function windowSize() {
resultSpy.clear();
var result;
@@ -77,19 +80,139 @@ Item {
scaleSpy.wait()
}
- function test_basic() {
+ function test_basic_zoomInAndBack() {
webView.url = webView.content
verify(webView.waitForViewportReady())
- compare(documentSize(), "480x720")
+ compare(windowSize(), "320x240")
compare(test.contentsScale, 1.0)
var rect = elementRect("target");
var newScale = webView.width / (rect.width + 2 * 10) // inflated by 10px
- doubleTapAtPoint(rect.left + rect.height / 2, rect.top + rect.width / 2)
+ doubleTapAtPoint(100, 50)
compare(test.contentsScale, newScale)
+
+ doubleTapAtPoint(100, 50)
+
+ compare(test.contentsScale, 1.0)
+ }
+
+ function test_double_zoomInAndBack() {
+ webView.url = webView.content
+ verify(webView.waitForViewportReady())
+
+ compare(windowSize(), "320x240")
+ compare(test.contentsScale, 1.0)
+
+ var target = elementRect("target");
+ var smalltarget = elementRect("smalltarget");
+ var targetScale = webView.width / (target.width + 2 * 10) // inflated by 10px
+ var smallTargetScale = webView.width / (smalltarget.width + 2 * 10) // inflated by 10px
+
+ doubleTapAtPoint(100, 50)
+
+ compare(test.contentsScale, targetScale)
+
+ doubleTapAtPoint(100, 160)
+
+ compare(test.contentsScale, smallTargetScale)
+
+ // Zoom out by double clicking first the small target and then the large target.
+ doubleTapAtPoint(100, 120)
+
+ compare(test.contentsScale, targetScale)
+
+ doubleTapAtPoint(100, 50)
+
+ compare(test.contentsScale, 1.0)
+ }
+
+ function test_double_zoomInAndBack2() {
+ webView.url = webView.content
+ verify(webView.waitForViewportReady())
+
+ compare(windowSize(), "320x240")
+ compare(test.contentsScale, 1.0)
+
+ var target = elementRect("target");
+ var smalltarget = elementRect("smalltarget");
+ var targetScale = webView.width / (target.width + 2 * 10) // inflated by 10px
+ var smallTargetScale = webView.width / (smalltarget.width + 2 * 10) // inflated by 10px
+
+ doubleTapAtPoint(100, 50)
+
+ compare(test.contentsScale, targetScale)
+
+ doubleTapAtPoint(100, 160)
+
+ compare(test.contentsScale, smallTargetScale)
+
+ // Zoom out by double clicking the small target twice.
+ doubleTapAtPoint(100, 120)
+
+ compare(test.contentsScale, targetScale)
+
+ doubleTapAtPoint(100, 160)
+
+ compare(test.contentsScale, 1.0)
+ }
+
+ function test_double_zoomInOutAndBack() {
+ webView.url = webView.content
+ verify(webView.waitForViewportReady())
+
+ compare(windowSize(), "320x240")
+ compare(test.contentsScale, 1.0)
+
+ var target = elementRect("target");
+ var smalltarget = elementRect("smalltarget");
+ var targetScale = webView.width / (target.width + 2 * 10) // inflated by 10px
+ var smallTargetScale = webView.width / (smalltarget.width + 2 * 10) // inflated by 10px
+
+ doubleTapAtPoint(100, 50)
+
+ compare(test.contentsScale, targetScale)
+
+ doubleTapAtPoint(100, 160)
+
+ compare(test.contentsScale, smallTargetScale)
+
+ // Zoom out by double clicking the large target twice.
+ doubleTapAtPoint(100, 40)
+
+ compare(test.contentsScale, targetScale)
+
+ doubleTapAtPoint(100, 50)
+
+ compare(test.contentsScale, 1.0)
+ }
+
+ function test_double_zoomInOutAndBack2() {
+ webView.url = webView.content
+ verify(webView.waitForViewportReady())
+
+ compare(windowSize(), "320x240")
+ compare(test.contentsScale, 1.0)
+
+ var target = elementRect("target");
+ var smalltarget = elementRect("smalltarget");
+ var targetScale = webView.width / (target.width + 2 * 10) // inflated by 10px
+ var smallTargetScale = webView.width / (smalltarget.width + 2 * 10) // inflated by 10px
+
+ // Zoom in directly to the small target, and then out over the large target.
+ doubleTapAtPoint(100, 140)
+
+ compare(test.contentsScale, smallTargetScale)
+
+ doubleTapAtPoint(100, 20)
+
+ compare(test.contentsScale, targetScale)
+
+ doubleTapAtPoint(100, 50)
+
+ compare(test.contentsScale, 1.0)
}
}
}