mshtml: Added IHTMLTxtRange::put_text implementation.
This commit is contained in:
parent
cfaf00fa51
commit
77e8a6800d
|
@ -50,6 +50,8 @@
|
|||
#define NS_ELEMENT_NODE 1
|
||||
#define NS_DOCUMENT_NODE 9
|
||||
|
||||
#define MSHTML_E_NODOC 0x800a025c
|
||||
|
||||
typedef struct HTMLDOMNode HTMLDOMNode;
|
||||
typedef struct ConnectionPoint ConnectionPoint;
|
||||
typedef struct BSCallback BSCallback;
|
||||
|
|
|
@ -180,8 +180,38 @@ static HRESULT WINAPI HTMLTxtRange_get_htmlText(IHTMLTxtRange *iface, BSTR *p)
|
|||
static HRESULT WINAPI HTMLTxtRange_put_text(IHTMLTxtRange *iface, BSTR v)
|
||||
{
|
||||
HTMLTxtRange *This = HTMLTXTRANGE_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
return E_NOTIMPL;
|
||||
nsIDOMDocument *nsdoc;
|
||||
nsIDOMText *text_node;
|
||||
nsAString text_str;
|
||||
nsresult nsres;
|
||||
|
||||
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
|
||||
if(!This->doc)
|
||||
return MSHTML_E_NODOC;
|
||||
|
||||
nsres = nsIWebNavigation_GetDocument(This->doc->nscontainer->navigation, &nsdoc);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("GetDocument failed: %08x\n", nsres);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
nsAString_Init(&text_str, v);
|
||||
nsres = nsIDOMDocument_CreateTextNode(nsdoc, &text_str, &text_node);
|
||||
nsAString_Finish(&text_str);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("CreateTextNode failed: %08x\n", nsres);
|
||||
return S_OK;
|
||||
}
|
||||
nsres = nsIDOMRange_DeleteContents(This->nsrange);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("DeleteContents failed: %08x\n", nsres);
|
||||
|
||||
nsres = nsIDOMRange_InsertNode(This->nsrange, (nsIDOMNode*)text_node);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("InsertNode failed: %08x\n", nsres);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLTxtRange_get_text(IHTMLTxtRange *iface, BSTR *p)
|
||||
|
|
Loading…
Reference in New Issue