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)
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);
......
......@@ -689,6 +689,7 @@ struct HTMLDocumentNode {
HTMLInnerWindow *window;
nsIDOMHTMLDocument *nsdoc;
nsIDOMNodeSelector *nsnode_selector;
BOOL content_ready;
event_target_t *body_event_target;
......
......@@ -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) {
......
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