mshtml: Return element as ndIDOMElement from create_nselem.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3e4565f5d7
commit
300c64603f
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue