mshtml: Optimize more nsAString handling.
This commit is contained in:
parent
673c90382d
commit
456e53bcf9
|
@ -298,7 +298,7 @@ static void get_font_size(HTMLDocument *This, WCHAR *ret)
|
|||
|
||||
TRACE("found font tag %p\n", elem);
|
||||
|
||||
nsAString_Init(&size_str, sizeW);
|
||||
nsAString_InitDepend(&size_str, sizeW);
|
||||
nsAString_Init(&val_str, NULL);
|
||||
|
||||
nsIDOMElement_GetAttribute(elem, &size_str, &val_str);
|
||||
|
@ -360,10 +360,11 @@ static void set_font_size(HTMLDocument *This, LPCWSTR size)
|
|||
|
||||
create_nselem(This->doc_node, fontW, &elem);
|
||||
|
||||
nsAString_Init(&size_str, sizeW);
|
||||
nsAString_Init(&val_str, size);
|
||||
nsAString_InitDepend(&size_str, sizeW);
|
||||
nsAString_InitDepend(&val_str, size);
|
||||
|
||||
nsIDOMElement_SetAttribute(elem, &size_str, &val_str);
|
||||
nsAString_Finish(&val_str);
|
||||
|
||||
nsISelection_GetRangeAt(nsselection, 0, &range);
|
||||
nsISelection_GetIsCollapsed(nsselection, &collapsed);
|
||||
|
@ -384,7 +385,6 @@ static void set_font_size(HTMLDocument *This, LPCWSTR size)
|
|||
nsIDOMElement_Release(elem);
|
||||
|
||||
nsAString_Finish(&size_str);
|
||||
nsAString_Finish(&val_str);
|
||||
|
||||
set_dirty(This, VARIANT_TRUE);
|
||||
}
|
||||
|
@ -1167,8 +1167,8 @@ static HRESULT exec_hyperlink(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
|
|||
/* create an element for the link */
|
||||
create_nselem(This->doc_node, aW, &anchor_elem);
|
||||
|
||||
nsAString_Init(&href_str, hrefW);
|
||||
nsAString_Init(&ns_url, url);
|
||||
nsAString_InitDepend(&href_str, hrefW);
|
||||
nsAString_InitDepend(&ns_url, url);
|
||||
nsIDOMElement_SetAttribute(anchor_elem, &href_str, &ns_url);
|
||||
nsAString_Finish(&href_str);
|
||||
|
||||
|
|
|
@ -252,23 +252,18 @@ static HRESULT WINAPI HTMLBodyElement_Invoke(IHTMLBodyElement *iface, DISPID dis
|
|||
static HRESULT WINAPI HTMLBodyElement_put_background(IHTMLBodyElement *iface, BSTR v)
|
||||
{
|
||||
HTMLBodyElement *This = HTMLBODY_THIS(iface);
|
||||
HRESULT hr = S_OK;
|
||||
nsAString nsstr;
|
||||
nsresult nsres;
|
||||
|
||||
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
||||
|
||||
nsAString_Init(&nsstr, v);
|
||||
|
||||
nsAString_InitDepend(&nsstr, v);
|
||||
nsres = nsIDOMHTMLBodyElement_SetBackground(This->nsbody, &nsstr);
|
||||
if(!NS_SUCCEEDED(nsres))
|
||||
{
|
||||
hr = E_FAIL;
|
||||
}
|
||||
|
||||
nsAString_Finish(&nsstr);
|
||||
if(NS_FAILED(nsres))
|
||||
return E_FAIL;
|
||||
|
||||
return hr;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI HTMLBodyElement_get_background(IHTMLBodyElement *iface, BSTR *p)
|
||||
|
|
|
@ -348,7 +348,7 @@ static HRESULT WINAPI HTMLDocument_put_title(IHTMLDocument2 *iface, BSTR v)
|
|||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsAString_Init(&nsstr, v);
|
||||
nsAString_InitDepend(&nsstr, v);
|
||||
nsres = nsIDOMHTMLDocument_SetTitle(This->doc_node->nsdoc, &nsstr);
|
||||
nsAString_Finish(&nsstr);
|
||||
if(NS_FAILED(nsres))
|
||||
|
|
|
@ -116,7 +116,7 @@ static HRESULT WINAPI HTMLDocument3_createTextNode(IHTMLDocument3 *iface, BSTR t
|
|||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsAString_Init(&text_str, text);
|
||||
nsAString_InitDepend(&text_str, text);
|
||||
nsres = nsIDOMHTMLDocument_CreateTextNode(This->doc_node->nsdoc, &text_str, &nstext);
|
||||
nsAString_Finish(&text_str);
|
||||
if(NS_FAILED(nsres)) {
|
||||
|
@ -443,7 +443,7 @@ static HRESULT WINAPI HTMLDocument3_getElementById(IHTMLDocument3 *iface, BSTR v
|
|||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsAString_Init(&id_str, v);
|
||||
nsAString_InitDepend(&id_str, v);
|
||||
/* get element by id attribute */
|
||||
nsres = nsIDOMHTMLDocument_GetElementById(This->doc_node->nsdoc, &id_str, &nselem);
|
||||
if(FAILED(nsres)) {
|
||||
|
@ -455,9 +455,9 @@ static HRESULT WINAPI HTMLDocument3_getElementById(IHTMLDocument3 *iface, BSTR v
|
|||
|
||||
/* get first element by name attribute */
|
||||
nsres = nsIDOMHTMLDocument_GetElementsByName(This->doc_node->nsdoc, &id_str, &nsnode_list);
|
||||
nsAString_Finish(&id_str);
|
||||
if(FAILED(nsres)) {
|
||||
ERR("getElementsByName failed: %08x\n", nsres);
|
||||
nsAString_Finish(&id_str);
|
||||
if(nsnode_by_id)
|
||||
nsIDOMNode_Release(nsnode_by_id);
|
||||
return E_FAIL;
|
||||
|
@ -465,7 +465,6 @@ static HRESULT WINAPI HTMLDocument3_getElementById(IHTMLDocument3 *iface, BSTR v
|
|||
nsIDOMNodeList_Item(nsnode_list, 0, &nsnode_by_name);
|
||||
nsIDOMNodeList_Release(nsnode_list);
|
||||
|
||||
nsAString_Finish(&id_str);
|
||||
|
||||
if(nsnode_by_name && nsnode_by_id) {
|
||||
nsIDOM3Node *node3;
|
||||
|
@ -528,8 +527,8 @@ static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface,
|
|||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsAString_Init(&id_str, v);
|
||||
nsAString_Init(&ns_str, str);
|
||||
nsAString_InitDepend(&id_str, v);
|
||||
nsAString_InitDepend(&ns_str, str);
|
||||
nsres = nsIDOMHTMLDocument_GetElementsByTagNameNS(This->doc_node->nsdoc, &ns_str, &id_str, &nslist);
|
||||
nsAString_Finish(&id_str);
|
||||
nsAString_Finish(&ns_str);
|
||||
|
|
|
@ -136,7 +136,7 @@ static HRESULT WINAPI HTMLDocument5_createComment(IHTMLDocument5 *iface, BSTR bs
|
|||
return E_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsAString_Init(&str, bstrdata);
|
||||
nsAString_InitDepend(&str, bstrdata);
|
||||
nsres = nsIDOMHTMLDocument_CreateComment(This->doc_node->nsdoc, &str, &nscomment);
|
||||
nsAString_Finish(&str);
|
||||
if(NS_FAILED(nsres)) {
|
||||
|
|
|
@ -245,7 +245,7 @@ static BOOL is_elem_name(HTMLElement *elem, LPCWSTR name)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
nsAString_Init(&nsname, nameW);
|
||||
nsAString_InitDepend(&nsname, nameW);
|
||||
nsres = nsIDOMHTMLElement_GetAttribute(elem->nselem, &nsname, &nsstr);
|
||||
nsAString_Finish(&nsname);
|
||||
if(NS_SUCCEEDED(nsres)) {
|
||||
|
|
|
@ -743,7 +743,7 @@ static IHTMLEventObj *create_event(HTMLDOMNode *target, eventid_t eid, nsIDOMEve
|
|||
if(NS_SUCCEEDED(nsres)) {
|
||||
nsAString type_str;
|
||||
|
||||
nsAString_Init(&type_str, event_types[event_info[eid].type]);
|
||||
nsAString_InitDepend(&type_str, event_types[event_info[eid].type]);
|
||||
nsres = nsIDOMDocumentEvent_CreateEvent(doc_event, &type_str, &ret->nsevent);
|
||||
nsAString_Finish(&type_str);
|
||||
nsIDOMDocumentEvent_Release(doc_event);
|
||||
|
|
Loading…
Reference in New Issue