Commit 359a9041 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Store nsIDOMNodeSelector in HTMLDocumentNode.

parent e3607c98
...@@ -2101,6 +2101,11 @@ static void HTMLDocumentNode_destructor(HTMLDOMNode *iface) ...@@ -2101,6 +2101,11 @@ static void HTMLDocumentNode_destructor(HTMLDOMNode *iface)
while(!list_empty(&This->plugin_hosts)) while(!list_empty(&This->plugin_hosts))
detach_plugin_host(LIST_ENTRY(list_head(&This->plugin_hosts), PluginHost, entry)); 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) { if(This->nsdoc) {
assert(!This->window); assert(!This->window);
release_document_mutation(This); release_document_mutation(This);
...@@ -2126,6 +2131,8 @@ static void HTMLDocumentNode_traverse(HTMLDOMNode *iface, nsCycleCollectionTrave ...@@ -2126,6 +2131,8 @@ static void HTMLDocumentNode_traverse(HTMLDOMNode *iface, nsCycleCollectionTrave
{ {
HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface); HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
if(This->nsnode_selector)
note_cc_edge((nsISupports*)This->nsnode_selector, "This->nsnode_selector", cb);
if(This->nsdoc) if(This->nsdoc)
note_cc_edge((nsISupports*)This->nsdoc, "This->nsdoc", cb); note_cc_edge((nsISupports*)This->nsdoc, "This->nsdoc", cb);
} }
...@@ -2134,6 +2141,11 @@ static void HTMLDocumentNode_unlink(HTMLDOMNode *iface) ...@@ -2134,6 +2141,11 @@ static void HTMLDocumentNode_unlink(HTMLDOMNode *iface)
{ {
HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface); HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
if(This->nsnode_selector) {
nsIDOMNodeSelector_Release(This->nsnode_selector);
This->nsnode_selector = NULL;
}
if(This->nsdoc) { if(This->nsdoc) {
nsIDOMHTMLDocument *nsdoc = This->nsdoc; nsIDOMHTMLDocument *nsdoc = This->nsdoc;
...@@ -2285,6 +2297,7 @@ static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLInnerWindo ...@@ -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) HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_obj, HTMLInnerWindow *window, HTMLDocumentNode **ret)
{ {
HTMLDocumentNode *doc; HTMLDocumentNode *doc;
nsresult nsres;
doc = alloc_doc_node(doc_obj, window); doc = alloc_doc_node(doc_obj, window);
if(!doc) if(!doc)
...@@ -2298,6 +2311,9 @@ HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_ob ...@@ -2298,6 +2311,9 @@ HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_ob
nsIDOMHTMLDocument_AddRef(nsdoc); nsIDOMHTMLDocument_AddRef(nsdoc);
doc->nsdoc = nsdoc; doc->nsdoc = nsdoc;
nsres = nsIDOMHTMLDocument_QueryInterface(nsdoc, &IID_nsIDOMNodeSelector, (void**)&doc->nsnode_selector);
assert(nsres == NS_OK);
init_document_mutation(doc); init_document_mutation(doc);
doc_init_events(doc); doc_init_events(doc);
......
...@@ -689,6 +689,7 @@ struct HTMLDocumentNode { ...@@ -689,6 +689,7 @@ struct HTMLDocumentNode {
HTMLInnerWindow *window; HTMLInnerWindow *window;
nsIDOMHTMLDocument *nsdoc; nsIDOMHTMLDocument *nsdoc;
nsIDOMNodeSelector *nsnode_selector;
BOOL content_ready; BOOL content_ready;
event_target_t *body_event_target; event_target_t *body_event_target;
......
...@@ -2004,19 +2004,13 @@ static HRESULT navigate_fragment(HTMLOuterWindow *window, IUri *uri) ...@@ -2004,19 +2004,13 @@ static HRESULT navigate_fragment(HTMLOuterWindow *window, IUri *uri)
*/ */
selector = heap_alloc(sizeof(selector_formatW)+SysStringLen(frag)*sizeof(WCHAR)); selector = heap_alloc(sizeof(selector_formatW)+SysStringLen(frag)*sizeof(WCHAR));
if(selector) { if(selector) {
nsIDOMNodeSelector *node_selector;
nsIDOMElement *nselem = NULL; nsIDOMElement *nselem = NULL;
nsAString selector_str; 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); sprintfW(selector, selector_formatW, frag);
nsAString_InitDepend(&selector_str, selector); nsAString_InitDepend(&selector_str, selector);
/* NOTE: Gecko doesn't set result to NULL if there is no match, so nselem must be initialized */ /* 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); nsres = nsIDOMNodeSelector_QuerySelector(window->base.inner_window->doc->nsnode_selector, &selector_str, &nselem);
nsIDOMNodeSelector_Release(node_selector);
nsAString_Finish(&selector_str); nsAString_Finish(&selector_str);
heap_free(selector); heap_free(selector);
if(NS_SUCCEEDED(nsres) && nselem) { if(NS_SUCCEEDED(nsres) && nselem) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment