Module: wine Branch: master Commit: 359a9041b1c4747ee7bcbaae13bf9c3535553968 URL: http://source.winehq.org/git/wine.git/?a=commit;h=359a9041b1c4747ee7bcbaae13...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Oct 2 15:44:10 2012 +0200
mshtml: Store nsIDOMNodeSelector in HTMLDocumentNode.
---
dlls/mshtml/htmldoc.c | 16 ++++++++++++++++ dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/navigate.c | 8 +------- 3 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index 322751a..6954d17 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -2101,6 +2101,11 @@ static void HTMLDocumentNode_destructor(HTMLDOMNode *iface) while(!list_empty(&This->plugin_hosts)) detach_plugin_host(LIST_ENTRY(list_head(&This->plugin_hosts), PluginHost, entry));
+ if(This->nsnode_selector) { + nsIDOMNodeSelector_Release(This->nsnode_selector); + This->nsnode_selector = NULL; + } + if(This->nsdoc) { assert(!This->window); release_document_mutation(This); @@ -2126,6 +2131,8 @@ static void HTMLDocumentNode_traverse(HTMLDOMNode *iface, nsCycleCollectionTrave { HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
+ if(This->nsnode_selector) + note_cc_edge((nsISupports*)This->nsnode_selector, "This->nsnode_selector", cb); if(This->nsdoc) note_cc_edge((nsISupports*)This->nsdoc, "This->nsdoc", cb); } @@ -2134,6 +2141,11 @@ static void HTMLDocumentNode_unlink(HTMLDOMNode *iface) { HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
+ if(This->nsnode_selector) { + nsIDOMNodeSelector_Release(This->nsnode_selector); + This->nsnode_selector = NULL; + } + if(This->nsdoc) { nsIDOMHTMLDocument *nsdoc = This->nsdoc;
@@ -2285,6 +2297,7 @@ static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLInnerWindo HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_obj, HTMLInnerWindow *window, HTMLDocumentNode **ret) { HTMLDocumentNode *doc; + nsresult nsres;
doc = alloc_doc_node(doc_obj, window); if(!doc) @@ -2298,6 +2311,9 @@ HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_ob nsIDOMHTMLDocument_AddRef(nsdoc); doc->nsdoc = nsdoc;
+ nsres = nsIDOMHTMLDocument_QueryInterface(nsdoc, &IID_nsIDOMNodeSelector, (void**)&doc->nsnode_selector); + assert(nsres == NS_OK); + init_document_mutation(doc); doc_init_events(doc);
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index aec754f..dd41224 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -689,6 +689,7 @@ struct HTMLDocumentNode { HTMLInnerWindow *window;
nsIDOMHTMLDocument *nsdoc; + nsIDOMNodeSelector *nsnode_selector; BOOL content_ready; event_target_t *body_event_target;
diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index fea8b4c..bec5ed6 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -2004,19 +2004,13 @@ static HRESULT navigate_fragment(HTMLOuterWindow *window, IUri *uri) */ selector = heap_alloc(sizeof(selector_formatW)+SysStringLen(frag)*sizeof(WCHAR)); if(selector) { - nsIDOMNodeSelector *node_selector; nsIDOMElement *nselem = NULL; nsAString selector_str;
- nsres = nsIDOMHTMLDocument_QueryInterface(window->base.inner_window->doc->nsdoc, &IID_nsIDOMNodeSelector, - (void**)&node_selector); - assert(nsres == NS_OK); - sprintfW(selector, selector_formatW, frag); nsAString_InitDepend(&selector_str, selector); /* NOTE: Gecko doesn't set result to NULL if there is no match, so nselem must be initialized */ - nsres = nsIDOMNodeSelector_QuerySelector(node_selector, &selector_str, &nselem); - nsIDOMNodeSelector_Release(node_selector); + nsres = nsIDOMNodeSelector_QuerySelector(window->base.inner_window->doc->nsnode_selector, &selector_str, &nselem); nsAString_Finish(&selector_str); heap_free(selector); if(NS_SUCCEEDED(nsres) && nselem) {