mshtml: Added IHTMLDocument2::write implementation.
This commit is contained in:
parent
a32e36aee5
commit
b84626bdf0
|
@ -675,8 +675,61 @@ static HRESULT WINAPI HTMLDocument_get_nameProp(IHTMLDocument2 *iface, BSTR *p)
|
|||
|
||||
static HRESULT WINAPI HTMLDocument_write(IHTMLDocument2 *iface, SAFEARRAY *psarray)
|
||||
{
|
||||
FIXME("(%p)->(%p)\n", iface, psarray);
|
||||
return E_NOTIMPL;
|
||||
HTMLDocument *This = HTMLDOC_THIS(iface);
|
||||
nsIDOMDocument *domdoc;
|
||||
nsIDOMHTMLDocument *nsdoc;
|
||||
nsAString nsstr;
|
||||
VARIANT *var;
|
||||
int i;
|
||||
nsresult nsres;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%p)\n", iface, psarray);
|
||||
|
||||
if(psarray->cDims != 1) {
|
||||
FIXME("cDims=%d\n", psarray->cDims);
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
if(!This->nscontainer)
|
||||
return S_OK;
|
||||
|
||||
nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &domdoc);
|
||||
if(NS_FAILED(nsres)) {
|
||||
ERR("GetDocument failed: %08x\n", nsres);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
nsres = nsIDOMDocument_QueryInterface(domdoc, &IID_nsIDOMHTMLDocument, (void**)&nsdoc);
|
||||
nsIDOMDocument_Release(domdoc);
|
||||
if(NS_FAILED(nsres))
|
||||
return S_OK;
|
||||
|
||||
hres = SafeArrayAccessData(psarray, (void**)&var);
|
||||
if(FAILED(hres)) {
|
||||
WARN("SafeArrayAccessData failed: %08x\n", hres);
|
||||
nsIDOMHTMLDocument_Release(nsdoc);
|
||||
return hres;
|
||||
}
|
||||
|
||||
nsAString_Init(&nsstr, NULL);
|
||||
|
||||
for(i=0; i < psarray->rgsabound[0].cElements; i++) {
|
||||
if(V_VT(var+i) == VT_BSTR) {
|
||||
nsAString_SetData(&nsstr, V_BSTR(var+i));
|
||||
nsres = nsIDOMHTMLDocument_Write(nsdoc, &nsstr);
|
||||
if(NS_FAILED(nsres))
|
||||
ERR("Write failed: %08x\n", nsres);
|
||||
}else {
|
||||
FIXME("vt=%d\n", V_VT(var+i));
|
||||
}
|
||||
}
|
||||
|
||||
nsAString_Finish(&nsstr);
|
||||
SafeArrayUnaccessData(psarray);
|
||||
nsIDOMHTMLDocument_Release(nsdoc);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLDocument_writeln(IHTMLDocument2 *iface, SAFEARRAY *psarray)
|
||||
|
|
|
@ -415,6 +415,7 @@ PRUint32 nsACString_GetData(const nsACString*,const char**);
|
|||
void nsACString_Finish(nsACString*);
|
||||
|
||||
void nsAString_Init(nsAString*,const PRUnichar*);
|
||||
void nsAString_SetData(nsAString*,const PRUnichar*);
|
||||
PRUint32 nsAString_GetData(const nsAString*,const PRUnichar**);
|
||||
void nsAString_Finish(nsAString*);
|
||||
|
||||
|
|
|
@ -502,7 +502,12 @@ void nsAString_Init(nsAString *str, const PRUnichar *data)
|
|||
{
|
||||
NS_StringContainerInit(str);
|
||||
if(data)
|
||||
NS_StringSetData(str, data, PR_UINT32_MAX);
|
||||
nsAString_SetData(str, data);
|
||||
}
|
||||
|
||||
void nsAString_SetData(nsAString *str, const PRUnichar *data)
|
||||
{
|
||||
NS_StringSetData(str, data, PR_UINT32_MAX);
|
||||
}
|
||||
|
||||
PRUint32 nsAString_GetData(const nsAString *str, const PRUnichar **data)
|
||||
|
|
Loading…
Reference in New Issue