[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 12:47:36 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit f6833ec5690f21521dfebdc8d9b17e8ec3b6a299
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Aug 30 09:13:27 2010 +0000

    2010-08-30  Mikołaj Małecki  <m.malecki at samsung.com>
    
            Reviewed by Kenneth Rohde Christiansen
    
            [EFL] Added initial setting to turn on offline pages.
            https://bugs.webkit.org/show_bug.cgi?id=44239
    
            * ewk/ewk_main.cpp: Torn off non-EFL init to _ewk_init_body
            (ewk_init): Changed non-EFL init to call _ewk_init_body
            (_ewk_init_body): Moved internal init here and added cache directory path setting.
            * ewk/ewk_view.cpp: Added new config items: offline_app_cache and cache_directory
            (_ewk_view_priv_new): creating cache_directory string
            (_ewk_view_priv_del): deleting cache_directory string
            (ewk_view_setting_offline_app_cache_get):
            (ewk_view_setting_offline_app_cache_set):
            (ewk_view_setting_cache_directory_get):
            (ewk_view_setting_cache_directory_set):
            * ewk/ewk_view.h: added offline_app_cache and cache_directory props to ewk API
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66377 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/efl/ChangeLog b/WebKit/efl/ChangeLog
index c18549b..5f4ae5f 100644
--- a/WebKit/efl/ChangeLog
+++ b/WebKit/efl/ChangeLog
@@ -1,3 +1,22 @@
+2010-08-30  Mikołaj Małecki  <m.malecki at samsung.com>
+
+        Reviewed by Kenneth Rohde Christiansen
+
+        [EFL] Added initial setting to turn on offline pages.
+        https://bugs.webkit.org/show_bug.cgi?id=44239
+
+        * ewk/ewk_main.cpp: Torn off non-EFL init to _ewk_init_body
+        (ewk_init): Changed non-EFL init to call _ewk_init_body
+        (_ewk_init_body): Moved internal init here and added cache directory path setting.
+        * ewk/ewk_view.cpp: Added new config items: offline_app_cache and cache_directory
+        (_ewk_view_priv_new): creating cache_directory string
+        (_ewk_view_priv_del): deleting cache_directory string
+        (ewk_view_setting_offline_app_cache_get):
+        (ewk_view_setting_offline_app_cache_set):
+        (ewk_view_setting_cache_directory_get):
+        (ewk_view_setting_cache_directory_set):
+        * ewk/ewk_view.h: added offline_app_cache and cache_directory props to ewk API
+
 2010-08-26  Miroslaw Szymanski  <miroslaw.s at samsung.com>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebKit/efl/ewk/ewk_main.cpp b/WebKit/efl/ewk/ewk_main.cpp
index 1cd5e42..8c27478 100644
--- a/WebKit/efl/ewk/ewk_main.cpp
+++ b/WebKit/efl/ewk/ewk_main.cpp
@@ -21,6 +21,7 @@
 #include "config.h"
 #include "ewk_main.h"
 
+#include "appcache/ApplicationCacheStorage.h"
 #include "EWebKit.h"
 #include "Logging.h"
 #include "PageCache.h"
@@ -36,6 +37,7 @@
 #include <Eina.h>
 #include <Evas.h>
 #include <stdlib.h>
+#include <sys/stat.h>
 
 #if ENABLE(GLIB_SUPPORT)
 #include <glib-object.h>
@@ -56,6 +58,8 @@
 static int _ewk_init_count = 0;
 int _ewk_log_dom = -1;
 
+static Eina_Bool _ewk_init_body(void);
+
 int ewk_init(void)
 {
     if (_ewk_init_count)
@@ -90,6 +94,44 @@ int ewk_init(void)
         goto error_edje;
     }
 
+    _ewk_init_body();
+
+    return ++_ewk_init_count;
+
+error_edje:
+    ecore_evas_shutdown();
+error_ecore_evas:
+    ecore_shutdown();
+error_ecore:
+    evas_shutdown();
+error_evas:
+    eina_log_domain_unregister(_ewk_log_dom);
+    _ewk_log_dom = -1;
+error_log_domain:
+    eina_shutdown();
+error_eina:
+    return 0;
+}
+
+int ewk_shutdown(void)
+{
+    _ewk_init_count--;
+    if (_ewk_init_count)
+        return _ewk_init_count;
+
+    ecore_evas_shutdown();
+    ecore_shutdown();
+    evas_shutdown();
+    eina_log_domain_unregister(_ewk_log_dom);
+    _ewk_log_dom = -1;
+    eina_shutdown();
+
+    return 0;
+}
+
+Eina_Bool _ewk_init_body(void)
+{
+
 #if ENABLE(GLIB_SUPPORT)
     g_type_init();
 
@@ -117,8 +159,24 @@ int ewk_init(void)
     WebCore::pageCache()->setCapacity(3);
     WebCore::PageGroup::setShouldTrackVisitedLinks(true);
 
-    // set default location of web database path
-    ewk_settings_web_database_path_set(getenv("HOME"));
+    // set default location of web database path and appcache dir
+    const char* home = getenv("HOME");
+    if (!home) // don't forget about the homeless
+        home = "/tmp"; // this directory must always exist
+
+    // anyway, check it first
+    struct stat state;
+    if (stat(home, &state) == -1) {
+        // Exit now - otherwise you may have some crash later
+        int errnowas = errno;
+        CRITICAL("Can't access HOME dir (or /tmp) - no place to save databases: %s", strerror(errnowas));
+        return EINA_FALSE;
+    }
+
+    WTF::String wkdir = WTF::String(home) + "/.webkit";
+    ewk_settings_web_database_path_set(wkdir.utf8().data());
+
+    WebCore::cacheStorage().setCacheDirectory(wkdir);
 
     // TODO: this should move to WebCore, already reported to webkit-gtk folks:
 #ifdef WTF_USE_SOUP
@@ -129,36 +187,6 @@ int ewk_init(void)
     }
 #endif
 
-    return ++_ewk_init_count;
-
-error_edje:
-    ecore_evas_shutdown();
-error_ecore_evas:
-    ecore_shutdown();
-error_ecore:
-    evas_shutdown();
-error_evas:
-    eina_log_domain_unregister(_ewk_log_dom);
-    _ewk_log_dom = -1;
-error_log_domain:
-    eina_shutdown();
-error_eina:
-    return 0;
-}
-
-int ewk_shutdown(void)
-{
-    _ewk_init_count--;
-    if (_ewk_init_count)
-        return _ewk_init_count;
-
-    ecore_evas_shutdown();
-    ecore_shutdown();
-    evas_shutdown();
-    eina_log_domain_unregister(_ewk_log_dom);
-    _ewk_log_dom = -1;
-    eina_shutdown();
-
-    return 0;
+    return EINA_TRUE;
 }
 
diff --git a/WebKit/efl/ewk/ewk_view.cpp b/WebKit/efl/ewk/ewk_view.cpp
index b68ddb6..7092d8c 100644
--- a/WebKit/efl/ewk/ewk_view.cpp
+++ b/WebKit/efl/ewk/ewk_view.cpp
@@ -22,6 +22,7 @@
 #include "config.h"
 #include "ewk_view.h"
 
+#include "appcache/ApplicationCacheStorage.h"
 #include "ChromeClientEfl.h"
 #include "ContextMenuClientEfl.h"
 #include "ContextMenuController.h"
@@ -88,6 +89,7 @@ struct _Ewk_View_Private_Data {
         const char* user_stylesheet;
         const char* encoding_default;
         const char* encoding_custom;
+        const char* cache_directory;
         int font_minimum_size;
         int font_minimum_logical_size;
         int font_default_size;
@@ -109,6 +111,7 @@ struct _Ewk_View_Private_Data {
         Eina_Bool caret_browsing:1;
         Eina_Bool spatial_navigation:1;
         Eina_Bool local_storage:1;
+        Eina_Bool offline_app_cache: 1;
         struct {
             float w;
             float h;
@@ -561,6 +564,7 @@ static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* sd)
     priv->page_settings->setJavaScriptEnabled(true);
     priv->page_settings->setPluginsEnabled(true);
     priv->page_settings->setLocalStorageEnabled(true);
+    priv->page_settings->setOfflineWebApplicationCacheEnabled(true);
 
     url = priv->page_settings->userStyleSheetLocation();
     priv->settings.user_stylesheet = eina_stringshare_add(url.prettyURL().utf8().data());
@@ -569,6 +573,9 @@ static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* sd)
         (priv->page_settings->defaultTextEncodingName().utf8().data());
     priv->settings.encoding_custom = 0;
 
+    priv->settings.cache_directory = eina_stringshare_add
+        (WebCore::cacheStorage().cacheDirectory().utf8().data());
+
     priv->settings.font_minimum_size = priv->page_settings->minimumFontSize();
     priv->settings.font_minimum_logical_size = priv->page_settings->minimumLogicalFontSize();
     priv->settings.font_default_size = priv->page_settings->defaultFontSize();
@@ -597,6 +604,7 @@ static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* sd)
     priv->settings.private_browsing = priv->page_settings->privateBrowsingEnabled();
     priv->settings.caret_browsing = priv->page_settings->caretBrowsingEnabled();
     priv->settings.local_storage = priv->page_settings->localStorageEnabled();
+    priv->settings.offline_app_cache = true; // XXX no function to read setting; this keeps the original setting
 
     // Since there's no scale separated from zooming in webkit-efl, this functionality of
     // viewport meta tag is implemented using zoom. When scale zoom is supported by webkit-efl,
@@ -643,6 +651,7 @@ static void _ewk_view_priv_del(Ewk_View_Private_Data* priv)
     eina_stringshare_del(priv->settings.user_stylesheet);
     eina_stringshare_del(priv->settings.encoding_default);
     eina_stringshare_del(priv->settings.encoding_custom);
+    eina_stringshare_del(priv->settings.cache_directory);
     eina_stringshare_del(priv->settings.font_standard);
     eina_stringshare_del(priv->settings.font_cursive);
     eina_stringshare_del(priv->settings.font_monospace);
@@ -2390,6 +2399,26 @@ Eina_Bool ewk_view_setting_private_browsing_set(Evas_Object* o, Eina_Bool enable
     return EINA_TRUE;
 }
 
+Eina_Bool ewk_view_setting_offline_app_cache_get(const Evas_Object* o)
+{
+    EWK_VIEW_SD_GET_OR_RETURN(o, sd, EINA_FALSE);
+    EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, EINA_FALSE);
+    return priv->settings.offline_app_cache;
+}
+
+Eina_Bool ewk_view_setting_offline_app_cache_set(Evas_Object* o, Eina_Bool enable)
+{
+    EWK_VIEW_SD_GET_OR_RETURN(o, sd, EINA_FALSE);
+    EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, EINA_FALSE);
+    enable = !!enable;
+    if (priv->settings.offline_app_cache != enable) {
+        priv->page_settings->setOfflineWebApplicationCacheEnabled(enable);
+        priv->settings.offline_app_cache = enable;
+    }
+    return EINA_TRUE;
+}
+
+
 Eina_Bool ewk_view_setting_caret_browsing_get(const Evas_Object* o)
 {
     EWK_VIEW_SD_GET_OR_RETURN(o, sd, EINA_FALSE);
@@ -2470,6 +2499,22 @@ Eina_Bool ewk_view_setting_encoding_default_set(Evas_Object* o, const char* enco
     return EINA_TRUE;
 }
 
+const char* ewk_view_setting_cache_directory_get(const Evas_Object* o)
+{
+    EWK_VIEW_SD_GET_OR_RETURN(o, sd, 0);
+    EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, 0);
+    return priv->settings.cache_directory;
+}
+
+Eina_Bool ewk_view_setting_cache_directory_set(Evas_Object* o, const char* path)
+{
+    EWK_VIEW_SD_GET_OR_RETURN(o, sd, EINA_FALSE);
+    EWK_VIEW_PRIV_GET_OR_RETURN(sd, priv, EINA_FALSE);
+    if (eina_stringshare_replace(&priv->settings.cache_directory, path))
+        WebCore::cacheStorage().setCacheDirectory(WTF::String::fromUTF8(path));
+    return EINA_TRUE;
+}
+
 int ewk_view_setting_font_minimum_size_get(const Evas_Object* o)
 {
     EWK_VIEW_SD_GET_OR_RETURN(o, sd, 0);
diff --git a/WebKit/efl/ewk/ewk_view.h b/WebKit/efl/ewk/ewk_view.h
index 9924642..c5d2d45 100644
--- a/WebKit/efl/ewk/ewk_view.h
+++ b/WebKit/efl/ewk/ewk_view.h
@@ -404,6 +404,8 @@ EAPI Eina_Bool    ewk_view_setting_user_stylesheet_set(Evas_Object *o, const cha
 
 EAPI Eina_Bool    ewk_view_setting_private_browsing_get(const Evas_Object *o);
 EAPI Eina_Bool    ewk_view_setting_private_browsing_set(Evas_Object *o, Eina_Bool enable);
+EAPI Eina_Bool    ewk_view_setting_offline_app_cache_get(const Evas_Object *o);
+EAPI Eina_Bool    ewk_view_setting_offline_app_cache_set(Evas_Object *o, Eina_Bool enable);
 
 EAPI Eina_Bool    ewk_view_setting_caret_browsing_get(const Evas_Object *o);
 EAPI Eina_Bool    ewk_view_setting_caret_browsing_set(Evas_Object *o, Eina_Bool enable);
@@ -412,6 +414,8 @@ EAPI const char  *ewk_view_setting_encoding_custom_get(const Evas_Object *o);
 EAPI Eina_Bool    ewk_view_setting_encoding_custom_set(Evas_Object *o, const char *encoding);
 EAPI const char  *ewk_view_setting_encoding_default_get(const Evas_Object *o);
 EAPI Eina_Bool    ewk_view_setting_encoding_default_set(Evas_Object *o, const char *encoding);
+EAPI const char  *ewk_view_setting_cache_directory_get(const Evas_Object *o);
+EAPI Eina_Bool    ewk_view_setting_cache_directory_set(Evas_Object *o, const char *path);
 
 EAPI int          ewk_view_setting_font_minimum_size_get(const Evas_Object *o);
 EAPI Eina_Bool    ewk_view_setting_font_minimum_size_set(Evas_Object *o, int size);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list