mshtml: Added IHTMLElement::get_outerHTML implementation.
This commit is contained in:
parent
60db5edaf5
commit
fbe9845890
|
@ -931,8 +931,26 @@ static HRESULT WINAPI HTMLElement_put_outerHTML(IHTMLElement *iface, BSTR v)
|
|||
static HRESULT WINAPI HTMLElement_get_outerHTML(IHTMLElement *iface, BSTR *p)
|
||||
{
|
||||
HTMLElement *This = HTMLELEM_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, p);
|
||||
return E_NOTIMPL;
|
||||
nsAString html_str;
|
||||
HRESULT hres;
|
||||
|
||||
WARN("(%p)->(%p) semi-stub\n", This, p);
|
||||
|
||||
nsAString_Init(&html_str, NULL);
|
||||
hres = nsnode_to_nsstring(This->node.nsnode, &html_str);
|
||||
if(SUCCEEDED(hres)) {
|
||||
const PRUnichar *html;
|
||||
|
||||
nsAString_GetData(&html_str, &html);
|
||||
*p = SysAllocString(html);
|
||||
if(!*p)
|
||||
hres = E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
nsAString_Finish(&html_str);
|
||||
|
||||
TRACE("ret %s\n", debugstr_w(*p));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLElement_put_outerText(IHTMLElement *iface, BSTR v)
|
||||
|
|
|
@ -562,7 +562,7 @@ void nsAString_Finish(nsAString*);
|
|||
|
||||
nsIInputStream *create_nsstream(const char*,PRInt32);
|
||||
nsICommandParams *create_nscommand_params(void);
|
||||
void nsnode_to_nsstring(nsIDOMNode*,nsAString*);
|
||||
HRESULT nsnode_to_nsstring(nsIDOMNode*,nsAString*);
|
||||
void get_editor_controller(NSContainer*);
|
||||
void init_nsevents(NSContainer*);
|
||||
void add_nsevent_listener(NSContainer*,LPCWSTR);
|
||||
|
|
|
@ -633,7 +633,7 @@ nsresult get_nsinterface(nsISupports *iface, REFIID riid, void **ppv)
|
|||
return nsres;
|
||||
}
|
||||
|
||||
static void nsnode_to_nsstring_rec(nsIContentSerializer *serializer, nsIDOMNode *nsnode, nsAString *str)
|
||||
static HRESULT nsnode_to_nsstring_rec(nsIContentSerializer *serializer, nsIDOMNode *nsnode, nsAString *str)
|
||||
{
|
||||
nsIDOMNodeList *node_list = NULL;
|
||||
PRBool has_children = FALSE;
|
||||
|
@ -645,7 +645,7 @@ static void nsnode_to_nsstring_rec(nsIContentSerializer *serializer, nsIDOMNode
|
|||
nsres = nsIDOMNode_GetNodeType(nsnode, &type);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("GetType failed: %08x\n", nsres);
|
||||
return;
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
switch(type) {
|
||||
|
@ -711,35 +711,37 @@ static void nsnode_to_nsstring_rec(nsIContentSerializer *serializer, nsIDOMNode
|
|||
nsIContentSerializer_AppendElementEnd(serializer, nselem, str);
|
||||
nsIDOMElement_Release(nselem);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void nsnode_to_nsstring(nsIDOMNode *nsdoc, nsAString *str)
|
||||
HRESULT nsnode_to_nsstring(nsIDOMNode *nsnode, nsAString *str)
|
||||
{
|
||||
nsIContentSerializer *serializer;
|
||||
nsIDOMNode *nsnode;
|
||||
nsresult nsres;
|
||||
HRESULT hres;
|
||||
|
||||
nsres = nsIComponentManager_CreateInstanceByContractID(pCompMgr,
|
||||
NS_HTMLSERIALIZER_CONTRACTID, NULL, &IID_nsIContentSerializer,
|
||||
(void**)&serializer);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("Could not get nsIContentSerializer: %08x\n", nsres);
|
||||
return;
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
nsres = nsIContentSerializer_Init(serializer, 0, 100, NULL, FALSE, FALSE /* FIXME */);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("Init failed: %08x\n", nsres);
|
||||
|
||||
nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMNode, (void**)&nsnode);
|
||||
nsnode_to_nsstring_rec(serializer, nsnode, str);
|
||||
nsIDOMNode_Release(nsnode);
|
||||
|
||||
nsres = nsIContentSerializer_Flush(serializer, str);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("Flush failed: %08x\n", nsres);
|
||||
hres = nsnode_to_nsstring_rec(serializer, nsnode, str);
|
||||
if(SUCCEEDED(hres)) {
|
||||
nsres = nsIContentSerializer_Flush(serializer, str);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("Flush failed: %08x\n", nsres);
|
||||
}
|
||||
|
||||
nsIContentSerializer_Release(serializer);
|
||||
return hres;
|
||||
}
|
||||
|
||||
void get_editor_controller(NSContainer *This)
|
||||
|
|
Loading…
Reference in New Issue