Jacek Caban : mshtml: Return element as ndIDOMElement from create_nselem.

Alexandre Julliard julliard at winehq.org
Mon Feb 12 16:10:36 CST 2018


Module: wine
Branch: master
Commit: 300c64603fb41fc93c838e0c1c72d9be5c6465fd
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=300c64603fb41fc93c838e0c1c72d9be5c6465fd

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Feb 12 01:30:27 2018 +0100

mshtml: Return element as ndIDOMElement from create_nselem.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mshtml/editor.c         | 14 +++++++-------
 dlls/mshtml/htmlelem.c       | 16 ++++------------
 dlls/mshtml/htmlimg.c        |  4 ++--
 dlls/mshtml/htmloption.c     |  4 ++--
 dlls/mshtml/mshtml_private.h |  2 +-
 dlls/mshtml/txtrange.c       | 10 +++++-----
 6 files changed, 21 insertions(+), 29 deletions(-)

diff --git a/dlls/mshtml/editor.c b/dlls/mshtml/editor.c
index 0db8821..6838433 100644
--- a/dlls/mshtml/editor.c
+++ b/dlls/mshtml/editor.c
@@ -324,7 +324,7 @@ static void set_font_size(HTMLDocument *This, LPCWSTR size)
 {
     nsISelection *nsselection;
     cpp_bool collapsed;
-    nsIDOMHTMLElement *elem;
+    nsIDOMElement *elem;
     nsIDOMRange *range;
     LONG range_cnt = 0;
     nsAString size_str;
@@ -353,7 +353,7 @@ static void set_font_size(HTMLDocument *This, LPCWSTR size)
     nsAString_InitDepend(&size_str, sizeW);
     nsAString_InitDepend(&val_str, size);
 
-    nsIDOMHTMLElement_SetAttribute(elem, &size_str, &val_str);
+    nsIDOMElement_SetAttribute(elem, &size_str, &val_str);
     nsAString_Finish(&val_str);
 
     nsISelection_GetRangeAt(nsselection, 0, &range);
@@ -372,7 +372,7 @@ static void set_font_size(HTMLDocument *This, LPCWSTR size)
 
     nsISelection_Release(nsselection);
     nsIDOMRange_Release(range);
-    nsIDOMHTMLElement_Release(elem);
+    nsIDOMElement_Release(elem);
 
     nsAString_Finish(&size_str);
 
@@ -1106,7 +1106,7 @@ static HRESULT exec_hyperlink(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
 {
     nsAString href_str, ns_url;
     nsIHTMLEditor *html_editor;
-    nsIDOMHTMLElement *anchor_elem;
+    nsIDOMElement *anchor_elem;
     cpp_bool insert_link_at_caret;
     nsISelection *nsselection;
     BSTR url = NULL;
@@ -1148,7 +1148,7 @@ static HRESULT exec_hyperlink(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
 
     nsAString_InitDepend(&href_str, hrefW);
     nsAString_InitDepend(&ns_url, url);
-    nsIDOMHTMLElement_SetAttribute(anchor_elem, &href_str, &ns_url);
+    nsIDOMElement_SetAttribute(anchor_elem, &href_str, &ns_url);
     nsAString_Finish(&href_str);
 
     nsISelection_GetIsCollapsed(nsselection, &insert_link_at_caret);
@@ -1161,7 +1161,7 @@ static HRESULT exec_hyperlink(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
         nsIDOMHTMLDocument_CreateTextNode(This->doc_node->nsdoc, &ns_url, &text_node);
 
         /* wrap the <a> tags around the text element */
-        nsIDOMHTMLElement_AppendChild(anchor_elem, (nsIDOMNode*)text_node, &unused_node);
+        nsIDOMElement_AppendChild(anchor_elem, (nsIDOMNode*)text_node, &unused_node);
         nsIDOMText_Release(text_node);
         nsIDOMNode_Release(unused_node);
     }
@@ -1184,7 +1184,7 @@ static HRESULT exec_hyperlink(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
     }
 
     nsISelection_Release(nsselection);
-    nsIDOMHTMLElement_Release(anchor_elem);
+    nsIDOMElement_Release(anchor_elem);
 
     if (cmdexecopt != OLECMDEXECOPT_DONTPROMPTUSER)
         SysFreeString(url);
diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index 8be0fe5..b0545a3 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -269,9 +269,8 @@ static inline HTMLElement *impl_from_IHTMLElement(IHTMLElement *iface)
     return CONTAINING_RECORD(iface, HTMLElement, IHTMLElement_iface);
 }
 
-HRESULT create_nselem(HTMLDocumentNode *doc, const WCHAR *tag, nsIDOMHTMLElement **ret)
+HRESULT create_nselem(HTMLDocumentNode *doc, const WCHAR *tag, nsIDOMElement **ret)
 {
-    nsIDOMElement *nselem;
     nsAString tag_str;
     nsresult nsres;
 
@@ -281,26 +280,19 @@ HRESULT create_nselem(HTMLDocumentNode *doc, const WCHAR *tag, nsIDOMHTMLElement
     }
 
     nsAString_InitDepend(&tag_str, tag);
-    nsres = nsIDOMHTMLDocument_CreateElement(doc->nsdoc, &tag_str, &nselem);
+    nsres = nsIDOMHTMLDocument_CreateElement(doc->nsdoc, &tag_str, ret);
     nsAString_Finish(&tag_str);
     if(NS_FAILED(nsres)) {
         ERR("CreateElement failed: %08x\n", nsres);
         return E_FAIL;
     }
 
-    nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLElement, (void**)ret);
-    nsIDOMElement_Release(nselem);
-    if(NS_FAILED(nsres)) {
-        ERR("Could not get nsIDOMHTMLElement iface: %08x\n", nsres);
-        return E_FAIL;
-    }
-
     return S_OK;
 }
 
 HRESULT create_element(HTMLDocumentNode *doc, const WCHAR *tag, HTMLElement **ret)
 {
-    nsIDOMHTMLElement *nselem;
+    nsIDOMElement *nselem;
     HRESULT hres;
 
     /* Use owner doc if called on document fragment */
@@ -312,7 +304,7 @@ HRESULT create_element(HTMLDocumentNode *doc, const WCHAR *tag, HTMLElement **re
         return hres;
 
     hres = HTMLElement_Create(doc, (nsIDOMNode*)nselem, TRUE, ret);
-    nsIDOMHTMLElement_Release(nselem);
+    nsIDOMElement_Release(nselem);
     return hres;
 }
 
diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c
index 6421440..90681e4 100644
--- a/dlls/mshtml/htmlimg.c
+++ b/dlls/mshtml/htmlimg.c
@@ -874,7 +874,7 @@ static HRESULT WINAPI HTMLImageElementFactory_create(IHTMLImageElementFactory *i
     HTMLDocumentNode *doc;
     IHTMLImgElement *img;
     HTMLElement *elem;
-    nsIDOMHTMLElement *nselem;
+    nsIDOMElement *nselem;
     LONG l;
     HRESULT hres;
 
@@ -897,7 +897,7 @@ static HRESULT WINAPI HTMLImageElementFactory_create(IHTMLImageElementFactory *i
         return hres;
 
     hres = HTMLElement_Create(doc, (nsIDOMNode*)nselem, FALSE, &elem);
-    nsIDOMHTMLElement_Release(nselem);
+    nsIDOMElement_Release(nselem);
     if(FAILED(hres)) {
         ERR("HTMLElement_Create failed\n");
         return hres;
diff --git a/dlls/mshtml/htmloption.c b/dlls/mshtml/htmloption.c
index b0c35e5..43661b7 100644
--- a/dlls/mshtml/htmloption.c
+++ b/dlls/mshtml/htmloption.c
@@ -559,7 +559,7 @@ static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory
         IHTMLOptionElement **optelem)
 {
     HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
-    nsIDOMHTMLElement *nselem;
+    nsIDOMElement *nselem;
     HTMLDOMNode *node;
     HRESULT hres;
 
@@ -580,7 +580,7 @@ static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory
         return hres;
 
     hres = get_node(This->window->doc, (nsIDOMNode*)nselem, TRUE, &node);
-    nsIDOMHTMLElement_Release(nselem);
+    nsIDOMElement_Release(nselem);
     if(FAILED(hres))
         return hres;
 
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index be60375..a0d9221 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -979,7 +979,7 @@ void detach_ranges(HTMLDocumentNode*) DECLSPEC_HIDDEN;
 HRESULT get_node_text(HTMLDOMNode*,BSTR*) DECLSPEC_HIDDEN;
 HRESULT replace_node_by_html(nsIDOMHTMLDocument*,nsIDOMNode*,const WCHAR*) DECLSPEC_HIDDEN;
 
-HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMHTMLElement**) DECLSPEC_HIDDEN;
+HRESULT create_nselem(HTMLDocumentNode*,const WCHAR*,nsIDOMElement**) DECLSPEC_HIDDEN;
 HRESULT create_element(HTMLDocumentNode*,const WCHAR*,HTMLElement**) DECLSPEC_HIDDEN;
 
 HRESULT HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*,HTMLDOMNode**) DECLSPEC_HIDDEN;
diff --git a/dlls/mshtml/txtrange.c b/dlls/mshtml/txtrange.c
index aa40e4c..c54cbbb 100644
--- a/dlls/mshtml/txtrange.c
+++ b/dlls/mshtml/txtrange.c
@@ -1661,7 +1661,7 @@ static HRESULT WINAPI RangeCommandTarget_QueryStatus(IOleCommandTarget *iface, c
 
 static HRESULT exec_indent(HTMLTxtRange *This, VARIANT *in, VARIANT *out)
 {
-    nsIDOMHTMLElement *blockquote_elem, *p_elem;
+    nsIDOMElement *blockquote_elem, *p_elem;
     nsIDOMDocumentFragment *fragment;
     nsIDOMNode *tmp;
 
@@ -1679,16 +1679,16 @@ static HRESULT exec_indent(HTMLTxtRange *This, VARIANT *in, VARIANT *out)
     create_nselem(This->doc, pW, &p_elem);
 
     nsIDOMRange_ExtractContents(This->nsrange, &fragment);
-    nsIDOMHTMLElement_AppendChild(p_elem, (nsIDOMNode*)fragment, &tmp);
+    nsIDOMElement_AppendChild(p_elem, (nsIDOMNode*)fragment, &tmp);
     nsIDOMDocumentFragment_Release(fragment);
     nsIDOMNode_Release(tmp);
 
-    nsIDOMHTMLElement_AppendChild(blockquote_elem, (nsIDOMNode*)p_elem, &tmp);
-    nsIDOMHTMLElement_Release(p_elem);
+    nsIDOMElement_AppendChild(blockquote_elem, (nsIDOMNode*)p_elem, &tmp);
+    nsIDOMElement_Release(p_elem);
     nsIDOMNode_Release(tmp);
 
     nsIDOMRange_InsertNode(This->nsrange, (nsIDOMNode*)blockquote_elem);
-    nsIDOMHTMLElement_Release(blockquote_elem);
+    nsIDOMElement_Release(blockquote_elem);
 
     return S_OK;
 }




More information about the wine-cvs mailing list