Title: [132354] trunk/Source/WebKit2
Revision
132354
Author
[email protected]
Date
2012-10-24 07:42:54 -0700 (Wed, 24 Oct 2012)

Log Message

[EFL][WK2] Ewk_Settings refactoring
https://bugs.webkit.org/show_bug.cgi?id=100233

Patch by Mikhail Pozdnyakov <[email protected]> on 2012-10-24
Reviewed by Kenneth Rohde Christiansen.

Ewk_Settings private implementation is now C++ class which allows direct internal
access to WebKit::WebPreferences.

* UIProcess/API/efl/EwkViewImpl.cpp:
(EwkViewImpl::EwkViewImpl):
* UIProcess/API/efl/ewk_settings.cpp:
(Ewk_Settings::preferences):
(ewk_settings_fullscreen_enabled_set):
(ewk_settings_fullscreen_enabled_get):
(ewk_settings_javascript_enabled_set):
(ewk_settings_javascript_enabled_get):
(ewk_settings_loads_images_automatically_set):
(ewk_settings_loads_images_automatically_get):
(ewk_settings_developer_extras_enabled_set):
(ewk_settings_developer_extras_enabled_get):
(ewk_settings_file_access_from_file_urls_allowed_set):
(ewk_settings_file_access_from_file_urls_allowed_get):
(ewk_settings_frame_flattening_enabled_set):
(ewk_settings_frame_flattening_enabled_get):
(ewk_settings_dns_prefetching_enabled_set):
(ewk_settings_dns_prefetching_enabled_get):
* UIProcess/API/efl/ewk_settings_private.h:
(WebKit):
(Ewk_Settings):
(Ewk_Settings::Ewk_Settings):
* UIProcess/API/efl/ewk_view.cpp:
(_ewk_view_initialize):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (132353 => 132354)


--- trunk/Source/WebKit2/ChangeLog	2012-10-24 14:41:19 UTC (rev 132353)
+++ trunk/Source/WebKit2/ChangeLog	2012-10-24 14:42:54 UTC (rev 132354)
@@ -1,3 +1,38 @@
+2012-10-24  Mikhail Pozdnyakov  <[email protected]>
+
+        [EFL][WK2] Ewk_Settings refactoring
+        https://bugs.webkit.org/show_bug.cgi?id=100233
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Ewk_Settings private implementation is now C++ class which allows direct internal
+        access to WebKit::WebPreferences.
+
+        * UIProcess/API/efl/EwkViewImpl.cpp:
+        (EwkViewImpl::EwkViewImpl):
+        * UIProcess/API/efl/ewk_settings.cpp:
+        (Ewk_Settings::preferences):
+        (ewk_settings_fullscreen_enabled_set):
+        (ewk_settings_fullscreen_enabled_get):
+        (ewk_settings_javascript_enabled_set):
+        (ewk_settings_javascript_enabled_get):
+        (ewk_settings_loads_images_automatically_set):
+        (ewk_settings_loads_images_automatically_get):
+        (ewk_settings_developer_extras_enabled_set):
+        (ewk_settings_developer_extras_enabled_get):
+        (ewk_settings_file_access_from_file_urls_allowed_set):
+        (ewk_settings_file_access_from_file_urls_allowed_get):
+        (ewk_settings_frame_flattening_enabled_set):
+        (ewk_settings_frame_flattening_enabled_get):
+        (ewk_settings_dns_prefetching_enabled_set):
+        (ewk_settings_dns_prefetching_enabled_get):
+        * UIProcess/API/efl/ewk_settings_private.h:
+        (WebKit):
+        (Ewk_Settings):
+        (Ewk_Settings::Ewk_Settings):
+        * UIProcess/API/efl/ewk_view.cpp:
+        (_ewk_view_initialize):
+
 2012-10-24  Sudarsana Nagineni  <[email protected]>
 
         [EFL][AC] Fix build break when AC is enabled

Modified: trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp (132353 => 132354)


--- trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp	2012-10-24 14:41:19 UTC (rev 132353)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EwkViewImpl.cpp	2012-10-24 14:42:54 UTC (rev 132354)
@@ -105,7 +105,8 @@
 }
 
 EwkViewImpl::EwkViewImpl(Evas_Object* view)
-    : areMouseEventsEnabled(false)
+    : settings(adoptPtr(new Ewk_Settings(this)))
+    , areMouseEventsEnabled(false)
 #if ENABLE(TOUCH_EVENTS)
     , areTouchEventsEnabled(false)
 #endif

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp (132353 => 132354)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp	2012-10-24 14:41:19 UTC (rev 132353)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_settings.cpp	2012-10-24 14:42:54 UTC (rev 132354)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2012 Samsung Electronics
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -26,9 +27,11 @@
 #include "config.h"
 #include "ewk_settings.h"
 
+#include "EwkViewImpl.h"
 #include "ewk_settings_private.h"
-#include <WebKit2/WKPreferences.h>
-#include <WebKit2/WKPreferencesPrivate.h>
+#include <WebKit2/WebPageGroup.h>
+#include <WebKit2/WebPageProxy.h>
+#include <WebKit2/WebPreferences.h>
 
 #if ENABLE(SPELLCHECK)
 #include "WKTextChecker.h"
@@ -40,6 +43,16 @@
 
 using namespace WebKit;
 
+const WebKit::WebPreferences* Ewk_Settings::preferences() const
+{
+    return m_viewImpl->pageProxy->pageGroup()->preferences();
+}
+
+WebKit::WebPreferences* Ewk_Settings::preferences()
+{
+    return m_viewImpl->pageProxy->pageGroup()->preferences();
+}
+
 #if ENABLE(SPELLCHECK)
 static struct {
     bool isContinuousSpellCheckingEnabled : 1;
@@ -73,7 +86,7 @@
 {
 #if ENABLE(FULLSCREEN_API)
     EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
-    WKPreferencesSetFullScreenEnabled(settings->preferences.get(), enable);
+    settings->preferences()->setFullScreenEnabled(enable);
     return true;
 #else
     return false;
@@ -84,7 +97,7 @@
 {
 #if ENABLE(FULLSCREEN_API)
     EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
-    return WKPreferencesGetFullScreenEnabled(settings->preferences.get());
+    return settings->preferences()->fullScreenEnabled();
 #else
     return false;
 #endif
@@ -94,7 +107,7 @@
 {
     EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
 
-    WKPreferencesSetJavaScriptEnabled(settings->preferences.get(), enable);
+    settings->preferences()->setJavaScriptEnabled(enable);
 
     return true;
 }
@@ -103,14 +116,14 @@
 {
     EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
 
-    return WKPreferencesGetJavaScriptEnabled(settings->preferences.get());
+    return settings->preferences()->_javascript_Enabled();
 }
 
 Eina_Bool ewk_settings_loads_images_automatically_set(Ewk_Settings* settings, Eina_Bool automatic)
 {
     EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
 
-    WKPreferencesSetLoadsImagesAutomatically(settings->preferences.get(), automatic);
+    settings->preferences()->setLoadsImagesAutomatically(automatic);
 
     return true;
 }
@@ -119,14 +132,14 @@
 {
     EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
 
-    return WKPreferencesGetLoadsImagesAutomatically(settings->preferences.get());
+    return settings->preferences()->loadsImagesAutomatically();
 }
 
 Eina_Bool ewk_settings_developer_extras_enabled_set(Ewk_Settings* settings, Eina_Bool enable)
 {
     EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
 
-    WKPreferencesSetDeveloperExtrasEnabled(settings->preferences.get(), enable);
+    settings->preferences()->setDeveloperExtrasEnabled(enable);
 
     return true;
 }
@@ -135,14 +148,14 @@
 {
     EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
 
-    return WKPreferencesGetDeveloperExtrasEnabled(settings->preferences.get());
+    return settings->preferences()->developerExtrasEnabled();
 }
 
 Eina_Bool ewk_settings_file_access_from_file_urls_allowed_set(Ewk_Settings* settings, Eina_Bool enable)
 {
     EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
 
-    WKPreferencesSetFileAccessFromFileURLsAllowed(settings->preferences.get(), enable);
+    settings->preferences()->setAllowFileAccessFromFileURLs(enable);
 
     return true;
 }
@@ -151,14 +164,14 @@
 {
     EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
 
-    return WKPreferencesGetFileAccessFromFileURLsAllowed(settings->preferences.get());
+    return settings->preferences()->allowFileAccessFromFileURLs();
 }
 
 Eina_Bool ewk_settings_frame_flattening_enabled_set(Ewk_Settings* settings, Eina_Bool enable)
 {
     EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
 
-    WKPreferencesSetFrameFlatteningEnabled(settings->preferences.get(), enable);
+    settings->preferences()->setFrameFlatteningEnabled(enable);
 
     return true;
 }
@@ -167,14 +180,14 @@
 {
     EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
 
-    return WKPreferencesGetFrameFlatteningEnabled(settings->preferences.get());
+    return settings->preferences()->frameFlatteningEnabled();
 }
 
 Eina_Bool ewk_settings_dns_prefetching_enabled_set(Ewk_Settings* settings, Eina_Bool enable)
 {
     EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
 
-    WKPreferencesSetDNSPrefetchingEnabled(settings->preferences.get(), enable);
+    settings->preferences()->setDNSPrefetchingEnabled(enable);
 
     return true;
 }
@@ -183,7 +196,7 @@
 {
     EINA_SAFETY_ON_NULL_RETURN_VAL(settings, false);
 
-    return WKPreferencesGetDNSPrefetchingEnabled(settings->preferences.get());
+    return settings->preferences()->dnsPrefetchingEnabled();
 }
 
 void ewk_settings_continuous_spell_checking_change_cb_set(Ewk_Settings_Continuous_Spell_Checking_Change_Cb callback)

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_settings_private.h (132353 => 132354)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_settings_private.h	2012-10-24 14:41:19 UTC (rev 132353)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_settings_private.h	2012-10-24 14:42:54 UTC (rev 132354)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2012 Samsung Electronics
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -26,21 +27,29 @@
 #ifndef ewk_settings_private_h
 #define ewk_settings_private_h
 
-#include "ewk_settings.h"
-#include <WebKit2/WKPreferences.h>
-#include <WebKit2/WKRetainPtr.h>
-#include <wtf/PassOwnPtr.h>
+#include <wtf/RefPtr.h>
 
+namespace WebKit {
+class WebPreferences;
+}
+class EwkViewImpl;
 /**
  * \struct  Ewk_Settings
  * @brief   Contains the settings data.
  */
-struct Ewk_Settings {
-    WKRetainPtr<WKPreferencesRef> preferences;
+class Ewk_Settings {
+public:
+    explicit Ewk_Settings(EwkViewImpl* viewImpl)
+        : m_viewImpl(viewImpl)
+    {
+        ASSERT(m_viewImpl);
+    }
 
-    explicit Ewk_Settings(WKPreferencesRef wkPreferences)
-        : preferences(wkPreferences)
-    { }
+    const WebKit::WebPreferences* preferences() const;
+    WebKit::WebPreferences* preferences();
+
+private:
+    EwkViewImpl* m_viewImpl;
 };
 
 #endif // ewk_settings_private_h

Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp (132353 => 132354)


--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp	2012-10-24 14:41:19 UTC (rev 132353)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp	2012-10-24 14:42:54 UTC (rev 132354)
@@ -778,7 +778,7 @@
     priv->pageProxy->initializeWebPage();
 
     priv->backForwardList = Ewk_Back_Forward_List::create(toAPI(priv->pageProxy->backForwardList()));
-    priv->settings = adoptPtr(new Ewk_Settings(WKPageGroupGetPreferences(WKPageGetPageGroup(toAPI(priv->pageProxy.get())))));
+
     priv->context = context;
 
 #if USE(TILED_BACKING_STORE)
@@ -789,7 +789,7 @@
 
 #if ENABLE(FULLSCREEN_API)
     priv->pageProxy->fullScreenManager()->setWebView(ewkView);
-    ewk_settings_fullscreen_enabled_set(priv->settings.get(), true);
+    priv->pageProxy->pageGroup()->preferences()->setFullScreenEnabled(true);
 #endif
 
     // Initialize page clients.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to