[evolution/webkit: 75/124] Add e_web_view_{set, get}_enable_frame_flattening



commit 9e6c9c1cd75303d90aeb8365295207f2ee2292ec
Author: Dan VrÃtil <dvratil redhat com>
Date:   Wed Dec 14 14:37:45 2011 +0100

    Add e_web_view_{set,get}_enable_frame_flattening
    
    By default the value is FALSE but we set it to TRUE in e_web_view_init() to force all
    frames to expand to height of their content automatically.
    
    WebKit seems to have trouble priting documents with this option enabled though, so
    this function makes it easier to disable it when EWebView is used for printing.

 widgets/misc/e-web-view.c |   34 ++++++++++++++++++++++++++++++++++
 widgets/misc/e-web-view.h |    5 +++++
 2 files changed, 39 insertions(+), 0 deletions(-)
---
diff --git a/widgets/misc/e-web-view.c b/widgets/misc/e-web-view.c
index 4cf7294..924a278 100644
--- a/widgets/misc/e-web-view.c
+++ b/widgets/misc/e-web-view.c
@@ -2038,6 +2038,40 @@ e_web_view_set_disable_save_to_disk (EWebView *web_view,
 }
 
 gboolean
+e_web_view_get_enable_frame_flattening (EWebView* web_view)
+{
+        WebKitWebSettings *settings;
+        gboolean flattening;
+
+        /* Return TRUE with fail since it's default value we set in _init(). */
+        g_return_val_if_fail (E_IS_WEB_VIEW (web_view), TRUE);
+
+        settings = webkit_web_view_get_settings (WEBKIT_WEB_VIEW (web_view));
+        g_return_val_if_fail (settings != NULL, TRUE);
+
+        g_object_get (G_OBJECT (settings), "enable-frame-flattening", &flattening, NULL);
+
+        return flattening;
+}
+
+void
+e_web_view_set_enable_frame_flattening (EWebView* web_view,
+                                        gboolean enable_frame_flattening)
+{
+        WebKitWebSettings *settings;
+
+        g_return_if_fail (E_IS_WEB_VIEW (web_view));
+
+        settings = webkit_web_view_get_settings (WEBKIT_WEB_VIEW (web_view));
+        g_return_if_fail (settings != NULL);
+
+        g_object_set (G_OBJECT (settings), "enable-frame-flattening",
+                &enable_frame_flattening, NULL);
+}
+
+
+
+gboolean
 e_web_view_get_editable (EWebView *web_view)
 {
 	g_return_val_if_fail (E_IS_WEB_VIEW (web_view), FALSE);
diff --git a/widgets/misc/e-web-view.h b/widgets/misc/e-web-view.h
index 34bf415..9beed9f 100644
--- a/widgets/misc/e-web-view.h
+++ b/widgets/misc/e-web-view.h
@@ -148,6 +148,11 @@ gboolean	e_web_view_get_disable_save_to_disk
 void		e_web_view_set_disable_save_to_disk
 						(EWebView *web_view,
 						 gboolean disable_save_to_disk);
+gboolean        e_web_view_get_enable_frame_flattening
+                                                (EWebView *web_view);
+void            e_web_view_set_enable_frame_flattening
+                                                (EWebView *web_view,
+                                                 gboolean enable_frame_flattening);
 gboolean	e_web_view_get_editable		(EWebView *web_view);
 void		e_web_view_set_editable		(EWebView *web_view,
 						 gboolean editable);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]