mshtml: Optimize more nsAString handling.
This commit is contained in:
parent
248db8d806
commit
4b5dcc9e6b
|
@ -283,10 +283,10 @@ static HRESULT WINAPI HTMLFrameBase_put_scrolling(IHTMLFrameBase *iface, BSTR v)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
if(This->nsframe) {
|
if(This->nsframe) {
|
||||||
nsAString_Init(&nsstr, v);
|
nsAString_InitDepend(&nsstr, v);
|
||||||
nsres = nsIDOMHTMLFrameElement_SetScrolling(This->nsframe, &nsstr);
|
nsres = nsIDOMHTMLFrameElement_SetScrolling(This->nsframe, &nsstr);
|
||||||
}else if(This->nsiframe) {
|
}else if(This->nsiframe) {
|
||||||
nsAString_Init(&nsstr, v);
|
nsAString_InitDepend(&nsstr, v);
|
||||||
nsres = nsIDOMHTMLIFrameElement_SetScrolling(This->nsiframe, &nsstr);
|
nsres = nsIDOMHTMLIFrameElement_SetScrolling(This->nsiframe, &nsstr);
|
||||||
}else {
|
}else {
|
||||||
ERR("No attached ns frame object\n");
|
ERR("No attached ns frame object\n");
|
||||||
|
|
|
@ -228,7 +228,7 @@ static HRESULT WINAPI HTMLImgElement_put_alt(IHTMLImgElement *iface, BSTR v)
|
||||||
|
|
||||||
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
||||||
|
|
||||||
nsAString_Init(&alt_str, v);
|
nsAString_InitDepend(&alt_str, v);
|
||||||
nsres = nsIDOMHTMLImageElement_SetAlt(This->nsimg, &alt_str);
|
nsres = nsIDOMHTMLImageElement_SetAlt(This->nsimg, &alt_str);
|
||||||
nsAString_Finish(&alt_str);
|
nsAString_Finish(&alt_str);
|
||||||
if(NS_FAILED(nsres))
|
if(NS_FAILED(nsres))
|
||||||
|
@ -268,7 +268,7 @@ static HRESULT WINAPI HTMLImgElement_put_src(IHTMLImgElement *iface, BSTR v)
|
||||||
|
|
||||||
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
||||||
|
|
||||||
nsAString_Init(&src_str, v);
|
nsAString_InitDepend(&src_str, v);
|
||||||
nsres = nsIDOMHTMLImageElement_SetSrc(This->nsimg, &src_str);
|
nsres = nsIDOMHTMLImageElement_SetSrc(This->nsimg, &src_str);
|
||||||
nsAString_Finish(&src_str);
|
nsAString_Finish(&src_str);
|
||||||
if(NS_FAILED(nsres))
|
if(NS_FAILED(nsres))
|
||||||
|
|
|
@ -143,7 +143,7 @@ static HRESULT WINAPI HTMLInputElement_put_value(IHTMLInputElement *iface, BSTR
|
||||||
|
|
||||||
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
||||||
|
|
||||||
nsAString_Init(&val_str, v);
|
nsAString_InitDepend(&val_str, v);
|
||||||
nsres = nsIDOMHTMLInputElement_SetValue(This->nsinput, &val_str);
|
nsres = nsIDOMHTMLInputElement_SetValue(This->nsinput, &val_str);
|
||||||
nsAString_Finish(&val_str);
|
nsAString_Finish(&val_str);
|
||||||
if(NS_FAILED(nsres))
|
if(NS_FAILED(nsres))
|
||||||
|
@ -512,7 +512,7 @@ static HRESULT WINAPI HTMLInputElement_put_src(IHTMLInputElement *iface, BSTR v)
|
||||||
|
|
||||||
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
||||||
|
|
||||||
nsAString_Init(&nsstr, v);
|
nsAString_InitDepend(&nsstr, v);
|
||||||
nsres = nsIDOMHTMLInputElement_SetSrc(This->nsinput, &nsstr);
|
nsres = nsIDOMHTMLInputElement_SetSrc(This->nsinput, &nsstr);
|
||||||
nsAString_Finish(&nsstr);
|
nsAString_Finish(&nsstr);
|
||||||
if(NS_FAILED(nsres))
|
if(NS_FAILED(nsres))
|
||||||
|
|
|
@ -645,7 +645,7 @@ static HRESULT WINAPI HTMLDOMNode_put_nodeValue(IHTMLDOMNode *iface, VARIANT v)
|
||||||
|
|
||||||
TRACE("bstr %s\n", debugstr_w(V_BSTR(&v)));
|
TRACE("bstr %s\n", debugstr_w(V_BSTR(&v)));
|
||||||
|
|
||||||
nsAString_Init(&val_str, V_BSTR(&v));
|
nsAString_InitDepend(&val_str, V_BSTR(&v));
|
||||||
nsIDOMNode_SetNodeValue(This->nsnode, &val_str);
|
nsIDOMNode_SetNodeValue(This->nsnode, &val_str);
|
||||||
nsAString_Finish(&val_str);
|
nsAString_Finish(&val_str);
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ static HRESULT WINAPI HTMLOptionElement_put_value(IHTMLOptionElement *iface, BST
|
||||||
|
|
||||||
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
||||||
|
|
||||||
nsAString_Init(&value_str, v);
|
nsAString_InitDepend(&value_str, v);
|
||||||
nsres = nsIDOMHTMLOptionElement_SetValue(This->nsoption, &value_str);
|
nsres = nsIDOMHTMLOptionElement_SetValue(This->nsoption, &value_str);
|
||||||
nsAString_Finish(&value_str);
|
nsAString_Finish(&value_str);
|
||||||
if(NS_FAILED(nsres))
|
if(NS_FAILED(nsres))
|
||||||
|
@ -209,7 +209,7 @@ static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAString_Init(&text_str, v);
|
nsAString_InitDepend(&text_str, v);
|
||||||
nsres = nsIDOMHTMLDocument_CreateTextNode(This->element.node.doc->nsdoc, &text_str, &text_node);
|
nsres = nsIDOMHTMLDocument_CreateTextNode(This->element.node.doc->nsdoc, &text_str, &text_node);
|
||||||
nsAString_Finish(&text_str);
|
nsAString_Finish(&text_str);
|
||||||
if(NS_FAILED(nsres)) {
|
if(NS_FAILED(nsres)) {
|
||||||
|
|
|
@ -253,7 +253,7 @@ static HRESULT WINAPI HTMLSelectElement_put_value(IHTMLSelectElement *iface, BST
|
||||||
|
|
||||||
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
||||||
|
|
||||||
nsAString_Init(&value_str, v);
|
nsAString_InitDepend(&value_str, v);
|
||||||
nsres = nsIDOMHTMLSelectElement_SetValue(This->nsselect, &value_str);
|
nsres = nsIDOMHTMLSelectElement_SetValue(This->nsselect, &value_str);
|
||||||
nsAString_Finish(&value_str);
|
nsAString_Finish(&value_str);
|
||||||
if(NS_FAILED(nsres))
|
if(NS_FAILED(nsres))
|
||||||
|
|
|
@ -694,7 +694,7 @@ static HRESULT WINAPI HTMLWindow2_put_name(IHTMLWindow2 *iface, BSTR v)
|
||||||
|
|
||||||
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
||||||
|
|
||||||
nsAString_Init(&name_str, v);
|
nsAString_InitDepend(&name_str, v);
|
||||||
nsres = nsIDOMWindow_SetName(This->nswindow, &name_str);
|
nsres = nsIDOMWindow_SetName(This->nswindow, &name_str);
|
||||||
nsAString_Finish(&name_str);
|
nsAString_Finish(&name_str);
|
||||||
if(NS_FAILED(nsres))
|
if(NS_FAILED(nsres))
|
||||||
|
|
|
@ -168,12 +168,12 @@ static BOOL handle_insert_comment(HTMLDocumentNode *doc, const PRUnichar *commen
|
||||||
|
|
||||||
memcpy(buf, ptr, (end-ptr)*sizeof(WCHAR));
|
memcpy(buf, ptr, (end-ptr)*sizeof(WCHAR));
|
||||||
buf[end-ptr] = 0;
|
buf[end-ptr] = 0;
|
||||||
nsAString_Init(&nsstr, buf);
|
nsAString_InitDepend(&nsstr, buf);
|
||||||
heap_free(buf);
|
|
||||||
|
|
||||||
/* FIXME: Find better way to insert HTML to document. */
|
/* FIXME: Find better way to insert HTML to document. */
|
||||||
nsres = nsIDOMHTMLDocument_Write(doc->nsdoc, &nsstr);
|
nsres = nsIDOMHTMLDocument_Write(doc->nsdoc, &nsstr);
|
||||||
nsAString_Finish(&nsstr);
|
nsAString_Finish(&nsstr);
|
||||||
|
heap_free(buf);
|
||||||
if(NS_FAILED(nsres)) {
|
if(NS_FAILED(nsres)) {
|
||||||
ERR("Write failed: %08x\n", nsres);
|
ERR("Write failed: %08x\n", nsres);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -396,7 +396,7 @@ static nsresult NSAPI nsRunnable_Run(nsIRunnable *iface)
|
||||||
static const PRUnichar remove_comment_magicW[] =
|
static const PRUnichar remove_comment_magicW[] =
|
||||||
{'#','!','w','i','n','e', 'r','e','m','o','v','e','!','#',0};
|
{'#','!','w','i','n','e', 'r','e','m','o','v','e','!','#',0};
|
||||||
|
|
||||||
nsAString_Init(&magic_str, remove_comment_magicW);
|
nsAString_InitDepend(&magic_str, remove_comment_magicW);
|
||||||
nsres = nsIDOMComment_SetData(nscomment, &magic_str);
|
nsres = nsIDOMComment_SetData(nscomment, &magic_str);
|
||||||
nsAString_Finish(&magic_str);
|
nsAString_Finish(&magic_str);
|
||||||
if(NS_FAILED(nsres))
|
if(NS_FAILED(nsres))
|
||||||
|
|
|
@ -426,7 +426,7 @@ static BOOL init_xpcom(const PRUnichar *gre_path)
|
||||||
nsAString path;
|
nsAString path;
|
||||||
nsIFile *gre_dir;
|
nsIFile *gre_dir;
|
||||||
|
|
||||||
nsAString_Init(&path, gre_path);
|
nsAString_InitDepend(&path, gre_path);
|
||||||
nsres = NS_NewLocalFile(&path, FALSE, &gre_dir);
|
nsres = NS_NewLocalFile(&path, FALSE, &gre_dir);
|
||||||
nsAString_Finish(&path);
|
nsAString_Finish(&path);
|
||||||
if(NS_FAILED(nsres)) {
|
if(NS_FAILED(nsres)) {
|
||||||
|
|
|
@ -316,7 +316,7 @@ static void init_event(nsIDOMEventTarget *target, const PRUnichar *type,
|
||||||
nsAString type_str;
|
nsAString type_str;
|
||||||
nsresult nsres;
|
nsresult nsres;
|
||||||
|
|
||||||
nsAString_Init(&type_str, type);
|
nsAString_InitDepend(&type_str, type);
|
||||||
nsres = nsIDOMEventTarget_AddEventListener(target, &type_str, listener, capture);
|
nsres = nsIDOMEventTarget_AddEventListener(target, &type_str, listener, capture);
|
||||||
nsAString_Finish(&type_str);
|
nsAString_Finish(&type_str);
|
||||||
if(NS_FAILED(nsres))
|
if(NS_FAILED(nsres))
|
||||||
|
|
|
@ -758,9 +758,9 @@ static BOOL get_script_guid(nsIDOMHTMLScriptElement *nsscript, GUID *guid)
|
||||||
ERR("GetType failed: %08x\n", nsres);
|
ERR("GetType failed: %08x\n", nsres);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAString_Init(&attr_str, languageW);
|
nsAString_InitDepend(&attr_str, languageW);
|
||||||
|
|
||||||
nsres = nsIDOMHTMLScriptElement_GetAttribute(nsscript, &attr_str, &val_str);
|
nsres = nsIDOMHTMLScriptElement_GetAttribute(nsscript, &attr_str, &val_str);
|
||||||
|
nsAString_Finish(&attr_str);
|
||||||
if(NS_SUCCEEDED(nsres)) {
|
if(NS_SUCCEEDED(nsres)) {
|
||||||
const PRUnichar *language;
|
const PRUnichar *language;
|
||||||
|
|
||||||
|
@ -776,7 +776,6 @@ static BOOL get_script_guid(nsIDOMHTMLScriptElement *nsscript, GUID *guid)
|
||||||
ERR("GetAttribute(language) failed: %08x\n", nsres);
|
ERR("GetAttribute(language) failed: %08x\n", nsres);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAString_Finish(&attr_str);
|
|
||||||
nsAString_Finish(&val_str);
|
nsAString_Finish(&val_str);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -1141,7 +1141,7 @@ static HRESULT WINAPI HTMLTxtRange_put_text(IHTMLTxtRange *iface, BSTR v)
|
||||||
if(!This->doc)
|
if(!This->doc)
|
||||||
return MSHTML_E_NODOC;
|
return MSHTML_E_NODOC;
|
||||||
|
|
||||||
nsAString_Init(&text_str, v);
|
nsAString_InitDepend(&text_str, v);
|
||||||
nsres = nsIDOMHTMLDocument_CreateTextNode(This->doc->nsdoc, &text_str, &text_node);
|
nsres = nsIDOMHTMLDocument_CreateTextNode(This->doc->nsdoc, &text_str, &text_node);
|
||||||
nsAString_Finish(&text_str);
|
nsAString_Finish(&text_str);
|
||||||
if(NS_FAILED(nsres)) {
|
if(NS_FAILED(nsres)) {
|
||||||
|
|
Loading…
Reference in New Issue