[geary] Correctly get the composer's style properties. Bug 770356.



commit 36702114f0f3fb0026c076059c3472cb154fb4b7
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Sat Sep 17 23:26:29 2016 +0200

    Correctly get the composer's style properties. Bug 770356.
    
    Signed-off-by: Niels De Graef <nielsdegraef gmail com>

 src/client/composer/composer-widget.vala |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala
index 047b3c7..58b0dc2 100644
--- a/src/client/composer/composer-widget.vala
+++ b/src/client/composer/composer-widget.vala
@@ -2151,7 +2151,8 @@ public class ComposerWidget : Gtk.EventBox {
             && get_action(ACTION_COMPOSE_AS_HTML).state.get_boolean());
 
         // Style formatting actions.
-        WebKit.DOM.DOMWindow window = this.editor.get_dom_document().get_default_view();
+        WebKit.DOM.Document document = this.editor.get_dom_document();
+        WebKit.DOM.DOMWindow window = document.get_default_view();
         WebKit.DOM.DOMSelection? selection = window.get_selection();
         if (selection == null)
             return;
@@ -2166,14 +2167,13 @@ public class ComposerWidget : Gtk.EventBox {
         if (active != null) {
             WebKit.DOM.CSSStyleDeclaration styles = window.get_computed_style(active, "");
 
-            this.actions.change_action_state(ACTION_BOLD,
-                styles.get_property_value("font-weight") == "bold");
+            this.actions.change_action_state(ACTION_BOLD, document.query_command_state("bold"));
             this.actions.change_action_state(ACTION_ITALIC,
-                styles.get_property_value("font-style") == "italic");
+                document.query_command_state("italic"));
             this.actions.change_action_state(ACTION_UNDERLINE,
-                styles.get_property_value("text-decoration") == "underline");
+                document.query_command_state("underline"));
             this.actions.change_action_state(ACTION_STRIKETHROUGH,
-                styles.get_property_value("text-decoration") == "line-through");
+                document.query_command_state("strikethrough"));
 
             // Font family.
             string font_name = styles.get_property_value("font-family").down();


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