Jacek Caban : mshtml: Use stored nsdoc in set_font_size.

Alexandre Julliard julliard at winehq.org
Thu Oct 9 07:42:46 CDT 2008


Module: wine
Branch: master
Commit: 23937c47049450a637e4a11aee6f93e93fdc17f8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=23937c47049450a637e4a11aee6f93e93fdc17f8

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Oct  8 13:28:08 2008 -0500

mshtml: Use stored nsdoc in set_font_size.

---

 dlls/mshtml/editor.c |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/dlls/mshtml/editor.c b/dlls/mshtml/editor.c
index 5929603..bba9e40 100644
--- a/dlls/mshtml/editor.c
+++ b/dlls/mshtml/editor.c
@@ -341,17 +341,19 @@ static void set_font_size(HTMLDocument *This, LPCWSTR size)
 {
     nsISelection *nsselection;
     PRBool collapsed;
-    nsIDOMDocument *nsdoc;
     nsIDOMElement *elem;
     nsIDOMRange *range;
     PRInt32 range_cnt = 0;
     nsAString font_str;
     nsAString size_str;
     nsAString val_str;
-    nsresult nsres;
 
-    nsselection = get_ns_selection(This);
+    if(!This->nsdoc) {
+        WARN("NULL nsdoc\n");
+        return;
+    }
 
+    nsselection = get_ns_selection(This);
     if(!nsselection)
         return;
 
@@ -364,15 +366,11 @@ static void set_font_size(HTMLDocument *This, LPCWSTR size)
         }
     }
 
-    nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc);
-    if(NS_FAILED(nsres))
-        return;
-
     nsAString_Init(&font_str, wszFont);
     nsAString_Init(&size_str, wszSize);
     nsAString_Init(&val_str, size);
 
-    nsIDOMDocument_CreateElement(nsdoc, &font_str, &elem);
+    nsIDOMDocument_CreateElement(This->nsdoc, &font_str, &elem);
     nsIDOMElement_SetAttribute(elem, &size_str, &val_str);
 
     nsISelection_GetRangeAt(nsselection, 0, &range);
@@ -389,6 +387,7 @@ static void set_font_size(HTMLDocument *This, LPCWSTR size)
         nsISelection_SelectAllChildren(nsselection, (nsIDOMNode*)elem);
     }
 
+    nsISelection_Release(nsselection);
     nsIDOMRange_Release(range);
     nsIDOMElement_Release(elem);
 
@@ -396,9 +395,6 @@ static void set_font_size(HTMLDocument *This, LPCWSTR size)
     nsAString_Finish(&size_str);
     nsAString_Finish(&val_str);
 
-    nsISelection_Release(nsselection);
-    nsIDOMDocument_Release(nsdoc);
-
     set_dirty(This, VARIANT_TRUE);
 }
 




More information about the wine-cvs mailing list