pidgin: f6dea52f: Clear formatting should also obey WBFO.

qulogic at pidgin.im qulogic at pidgin.im
Mon Jun 4 04:26:03 EDT 2012


----------------------------------------------------------------------
Revision: f6dea52f525502a9b7afb3567a22af0e007d39a5
Parent:   bab3d17b13118e2fe665b50f92982027f9514ec5
Author:   qulogic at pidgin.im
Date:     06/03/12 16:01:56
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/f6dea52f525502a9b7afb3567a22af0e007d39a5

Changelog: 

Clear formatting should also obey WBFO.

Changes against parent bab3d17b13118e2fe665b50f92982027f9514ec5

  patched  pidgin/gtkwebview.c

-------------- next part --------------
============================================================
--- pidgin/gtkwebview.c	89c5d1b178c9ad9434ea944bb52eb9eaa307cf97
+++ pidgin/gtkwebview.c	39161f4c3046fc6e88a7b3d26bca5ec404f8f3a6
@@ -302,15 +302,39 @@ static void
 }
 
 static void
-webview_clear_formatting(GtkWebView *webview)
+do_formatting(GtkWebView *webview, const char *name, const char *value)
 {
+	GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview);
 	WebKitDOMDocument *dom;
+	WebKitDOMDOMWindow *win = NULL;
+	WebKitDOMDOMSelection *sel;
+	WebKitDOMRange *range = NULL;
 
+	dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview));
+
+	if (priv->edit.wbfo) {
+		win = webkit_dom_document_get_default_view(dom);
+		sel = webkit_dom_dom_window_get_selection(win);
+		range = webkit_dom_dom_selection_get_range_at(sel, 0, NULL);
+		webkit_web_view_select_all(WEBKIT_WEB_VIEW(webview));
+	}
+
+	webkit_dom_document_exec_command(dom, name, FALSE, value);
+
+	if (priv->edit.wbfo) {
+		sel = webkit_dom_dom_window_get_selection(win);
+		webkit_dom_dom_selection_remove_all_ranges(sel);
+		webkit_dom_dom_selection_add_range(sel, range);
+	}
+}
+
+static void
+webview_clear_formatting(GtkWebView *webview)
+{
 	if (!webkit_web_view_get_editable(WEBKIT_WEB_VIEW(webview)))
 		return;
 
-	dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview));
-	webkit_dom_document_exec_command(dom, "removeFormat", FALSE, "");
+	do_formatting(webview, "removeFormat", "");
 }
 
 static void
@@ -894,33 +918,6 @@ gtk_webview_clear_formatting(GtkWebView 
 	g_object_unref(object);
 }
 
-static void
-do_formatting(GtkWebView *webview, const char *name, const char *value)
-{
-	GtkWebViewPriv *priv = GTK_WEBVIEW_GET_PRIVATE(webview);
-	WebKitDOMDocument *dom;
-	WebKitDOMDOMWindow *win = NULL;
-	WebKitDOMDOMSelection *sel;
-	WebKitDOMRange *range = NULL;
-
-	dom = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(webview));
-
-	if (priv->edit.wbfo) {
-		win = webkit_dom_document_get_default_view(dom);
-		sel = webkit_dom_dom_window_get_selection(win);
-		range = webkit_dom_dom_selection_get_range_at(sel, 0, NULL);
-		webkit_web_view_select_all(WEBKIT_WEB_VIEW(webview));
-	}
-
-	webkit_dom_document_exec_command(dom, name, FALSE, value);
-
-	if (priv->edit.wbfo) {
-		sel = webkit_dom_dom_window_get_selection(win);
-		webkit_dom_dom_selection_remove_all_ranges(sel);
-		webkit_dom_dom_selection_add_range(sel, range);
-	}
-}
-
 void
 gtk_webview_toggle_bold(GtkWebView *webview)
 {


More information about the Commits mailing list