Jacek Caban : mshtml: Added possibility to get node object from nsIDOMNode only if available.
Alexandre Julliard
julliard at winehq.org
Fri Apr 18 07:27:17 CDT 2008
Module: wine
Branch: master
Commit: 625ed3d0aa631de0b70fef0a96ba4586b7f86df6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=625ed3d0aa631de0b70fef0a96ba4586b7f86df6
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Apr 17 22:52:49 2008 +0200
mshtml: Added possibility to get node object from nsIDOMNode only if available.
---
dlls/mshtml/htmldoc.c | 4 ++--
dlls/mshtml/htmldoc3.c | 2 +-
dlls/mshtml/htmlelem.c | 4 ++--
dlls/mshtml/htmlnode.c | 4 ++--
dlls/mshtml/htmloption.c | 2 +-
dlls/mshtml/mshtml_private.h | 2 +-
dlls/mshtml/nsembed.c | 2 +-
dlls/mshtml/txtrange.c | 2 +-
8 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c
index 92a7f9a..005c629 100644
--- a/dlls/mshtml/htmldoc.c
+++ b/dlls/mshtml/htmldoc.c
@@ -289,7 +289,7 @@ static HRESULT WINAPI HTMLDocument_get_all(IHTMLDocument2 *iface, IHTMLElementCo
return S_OK;
}
- *p = create_all_collection(get_node(This, (nsIDOMNode*)nselem));
+ *p = create_all_collection(get_node(This, (nsIDOMNode*)nselem, TRUE));
nsIDOMElement_Release(nselem);
return S_OK;
@@ -331,7 +331,7 @@ static HRESULT WINAPI HTMLDocument_get_body(IHTMLDocument2 *iface, IHTMLElement
return S_OK;
}
- node = get_node(This, (nsIDOMNode*)nsbody);
+ node = get_node(This, (nsIDOMNode*)nsbody, TRUE);
nsIDOMHTMLElement_Release(nsbody);
IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)p);
diff --git a/dlls/mshtml/htmldoc3.c b/dlls/mshtml/htmldoc3.c
index 4388000..3b109e9 100644
--- a/dlls/mshtml/htmldoc3.c
+++ b/dlls/mshtml/htmldoc3.c
@@ -137,7 +137,7 @@ static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, I
ERR("GetDocumentElement failed: %08x\n", nsres);
}
if(nselem) {
- node = get_node(This, (nsIDOMNode *)nselem);
+ node = get_node(This, (nsIDOMNode *)nselem, TRUE);
nsIDOMDocument_Release(nsdoc);
IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)p);
diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c
index b7fac23..6dab3a1 100644
--- a/dlls/mshtml/htmlelem.c
+++ b/dlls/mshtml/htmlelem.c
@@ -1067,7 +1067,7 @@ static void create_child_list(HTMLDocument *doc, HTMLElement *elem, elem_vector
nsres = nsIDOMNode_GetNodeType(iter, &node_type);
if(NS_SUCCEEDED(nsres) && node_type == ELEMENT_NODE)
- elem_vector_add(buf, HTMLELEM_NODE_THIS(get_node(doc, iter)));
+ elem_vector_add(buf, HTMLELEM_NODE_THIS(get_node(doc, iter, TRUE)));
}
}
@@ -1111,7 +1111,7 @@ static void create_all_list(HTMLDocument *doc, HTMLDOMNode *elem, elem_vector *b
nsres = nsIDOMNode_GetNodeType(iter, &node_type);
if(NS_SUCCEEDED(nsres) && node_type == ELEMENT_NODE) {
- HTMLDOMNode *node = get_node(doc, iter);
+ HTMLDOMNode *node = get_node(doc, iter, TRUE);
elem_vector_add(buf, HTMLELEM_NODE_THIS(node));
create_all_list(doc, node, buf);
diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c
index e098a83..a5df575 100644
--- a/dlls/mshtml/htmlnode.c
+++ b/dlls/mshtml/htmlnode.c
@@ -370,7 +370,7 @@ static HTMLDOMNode *create_node(HTMLDocument *doc, nsIDOMNode *nsnode)
* (better) find a way to store HTMLDOMelement pointer in nsIDOMNode.
*/
-HTMLDOMNode *get_node(HTMLDocument *This, nsIDOMNode *nsnode)
+HTMLDOMNode *get_node(HTMLDocument *This, nsIDOMNode *nsnode, BOOL create)
{
HTMLDOMNode *iter = This->nodes, *ret;
@@ -380,7 +380,7 @@ HTMLDOMNode *get_node(HTMLDocument *This, nsIDOMNode *nsnode)
iter = iter->next;
}
- if(iter)
+ if(iter || !create)
return iter;
ret = create_node(This, nsnode);
diff --git a/dlls/mshtml/htmloption.c b/dlls/mshtml/htmloption.c
index 73af3b0..20a35ae 100644
--- a/dlls/mshtml/htmloption.c
+++ b/dlls/mshtml/htmloption.c
@@ -469,7 +469,7 @@ static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory
return E_FAIL;
}
- hres = IHTMLDOMNode_QueryInterface(HTMLDOMNODE(get_node(This->doc, (nsIDOMNode*)nselem)),
+ hres = IHTMLDOMNode_QueryInterface(HTMLDOMNODE(get_node(This->doc, (nsIDOMNode*)nselem, TRUE)),
&IID_IHTMLOptionElement, (void**)optelem);
nsIDOMElement_Release(nselem);
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 67e27a4..f7e1e1e 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -464,7 +464,7 @@ void HTMLDOMNode_destructor(HTMLDOMNode*);
HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
void HTMLElement_destructor(HTMLDOMNode*);
-HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*);
+HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*,BOOL);
void release_nodes(HTMLDocument*);
void release_script_hosts(HTMLDocument*);
diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c
index e46b8fa..c172e0d 100644
--- a/dlls/mshtml/nsembed.c
+++ b/dlls/mshtml/nsembed.c
@@ -1073,7 +1073,7 @@ static nsresult NSAPI nsContextMenuListener_OnShowContextMenu(nsIContextMenuList
FIXME("aContextFlags=%08x\n", aContextFlags);
};
- show_context_menu(This->doc, dwID, &pt, (IDispatch*)HTMLDOMNODE(get_node(This->doc, aNode)));
+ show_context_menu(This->doc, dwID, &pt, (IDispatch*)HTMLDOMNODE(get_node(This->doc, aNode, TRUE)));
return NS_OK;
}
diff --git a/dlls/mshtml/txtrange.c b/dlls/mshtml/txtrange.c
index 72b9ce0..2fbc0bf 100644
--- a/dlls/mshtml/txtrange.c
+++ b/dlls/mshtml/txtrange.c
@@ -1183,7 +1183,7 @@ static HRESULT WINAPI HTMLTxtRange_parentElement(IHTMLTxtRange *iface, IHTMLElem
return S_OK;
}
- node = get_node(This->doc, nsnode);
+ node = get_node(This->doc, nsnode, TRUE);
nsIDOMNode_Release(nsnode);
return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)parent);
More information about the wine-cvs
mailing list