Commit 64d4efe9 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Move node list to HTMLDocumentNode.

parent 95080eac
......@@ -606,12 +606,12 @@ static HRESULT WINAPI HTMLBodyElement_createTextRange(IHTMLBodyElement *iface, I
TRACE("(%p)->(%p)\n", This, range);
if(!This->textcont.element.node.doc->nsdoc) {
if(!This->textcont.element.node.doc->basedoc.nsdoc) {
WARN("No nsdoc\n");
return E_UNEXPECTED;
}
nsres = nsIDOMDocument_QueryInterface(This->textcont.element.node.doc->nsdoc, &IID_nsIDOMDocumentRange,
nsres = nsIDOMDocument_QueryInterface(This->textcont.element.node.doc->basedoc.nsdoc, &IID_nsIDOMDocumentRange,
(void**)&nsdocrange);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMDocumentRabge iface: %08x\n", nsres);
......@@ -629,7 +629,7 @@ static HRESULT WINAPI HTMLBodyElement_createTextRange(IHTMLBodyElement *iface, I
nsIDOMDocumentRange_Release(nsdocrange);
hres = HTMLTxtRange_Create(This->textcont.element.node.doc->doc_node, nsrange, range);
hres = HTMLTxtRange_Create(This->textcont.element.node.doc->basedoc.doc_node, nsrange, range);
nsIDOMRange_Release(nsrange);
return hres;
......@@ -725,8 +725,8 @@ static event_target_t **HTMLBodyElement_get_event_target(HTMLDOMNode *iface)
{
HTMLBodyElement *This = HTMLBODY_NODE_THIS(iface);
return This->textcont.element.node.doc && This->textcont.element.node.doc->window
? &This->textcont.element.node.doc->window->event_target
return This->textcont.element.node.doc && This->textcont.element.node.doc->basedoc.window
? &This->textcont.element.node.doc->basedoc.window->event_target
: &This->textcont.element.node.event_target;
}
......
......@@ -186,7 +186,7 @@ static dispex_static_data_t HTMLCommentElement_dispex = {
HTMLCommentElement_iface_tids
};
HTMLElement *HTMLCommentElement_Create(HTMLDocument *doc, nsIDOMNode *nsnode)
HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode)
{
HTMLCommentElement *ret = heap_alloc_zero(sizeof(*ret));
......
......@@ -899,12 +899,12 @@ HRESULT HTMLCurrentStyle_Create(HTMLElement *elem, IHTMLCurrentStyle **p)
HTMLCurrentStyle *ret;
nsresult nsres;
if(!elem->node.doc->nsdoc) {
if(!elem->node.doc->basedoc.nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsres = nsIDOMHTMLDocument_QueryInterface(elem->node.doc->nsdoc, &IID_nsIDOMDocumentView, (void**)&nsdocview);
nsres = nsIDOMHTMLDocument_QueryInterface(elem->node.doc->basedoc.nsdoc, &IID_nsIDOMDocumentView, (void**)&nsdocview);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMDocumentView: %08x\n", nsres);
return E_FAIL;
......
......@@ -124,7 +124,7 @@ static HRESULT WINAPI HTMLDocument_get_all(IHTMLDocument2 *iface, IHTMLElementCo
}
if(nselem) {
*p = create_all_collection(get_node(This, (nsIDOMNode*)nselem, TRUE), TRUE);
*p = create_all_collection(get_node(This->doc_node, (nsIDOMNode*)nselem, TRUE), TRUE);
nsIDOMElement_Release(nselem);
}else {
*p = NULL;
......@@ -154,7 +154,7 @@ static HRESULT WINAPI HTMLDocument_get_body(IHTMLDocument2 *iface, IHTMLElement
}
if(nsbody) {
node = get_node(This, (nsIDOMNode*)nsbody, TRUE);
node = get_node(This->doc_node, (nsIDOMNode*)nsbody, TRUE);
nsIDOMHTMLElement_Release(nsbody);
IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)p);
......@@ -198,7 +198,7 @@ static HRESULT WINAPI HTMLDocument_get_images(IHTMLDocument2 *iface, IHTMLElemen
}
if(nscoll) {
*p = create_collection_from_htmlcol(This, (IUnknown*)HTMLDOC(This), nscoll);
*p = create_collection_from_htmlcol(This->doc_node, (IUnknown*)HTMLDOC(This), nscoll);
nsIDOMElement_Release(nscoll);
}
......@@ -230,7 +230,7 @@ static HRESULT WINAPI HTMLDocument_get_applets(IHTMLDocument2 *iface, IHTMLEleme
}
if(nscoll) {
*p = create_collection_from_htmlcol(This, (IUnknown*)HTMLDOC(This), nscoll);
*p = create_collection_from_htmlcol(This->doc_node, (IUnknown*)HTMLDOC(This), nscoll);
nsIDOMElement_Release(nscoll);
}
......@@ -262,7 +262,7 @@ static HRESULT WINAPI HTMLDocument_get_links(IHTMLDocument2 *iface, IHTMLElement
}
if(nscoll) {
*p = create_collection_from_htmlcol(This, (IUnknown*)HTMLDOC(This), nscoll);
*p = create_collection_from_htmlcol(This->doc_node, (IUnknown*)HTMLDOC(This), nscoll);
nsIDOMElement_Release(nscoll);
}
......@@ -294,7 +294,7 @@ static HRESULT WINAPI HTMLDocument_get_forms(IHTMLDocument2 *iface, IHTMLElement
}
if(nscoll) {
*p = create_collection_from_htmlcol(This, (IUnknown*)HTMLDOC(This), nscoll);
*p = create_collection_from_htmlcol(This->doc_node, (IUnknown*)HTMLDOC(This), nscoll);
nsIDOMElement_Release(nscoll);
}
......@@ -326,7 +326,7 @@ static HRESULT WINAPI HTMLDocument_get_anchors(IHTMLDocument2 *iface, IHTMLEleme
}
if(nscoll) {
*p = create_collection_from_htmlcol(This, (IUnknown*)HTMLDOC(This), nscoll);
*p = create_collection_from_htmlcol(This->doc_node, (IUnknown*)HTMLDOC(This), nscoll);
nsIDOMElement_Release(nscoll);
}
......@@ -930,7 +930,7 @@ static HRESULT WINAPI HTMLDocument_createElement(IHTMLDocument2 *iface, BSTR eTa
return E_FAIL;
}
elem = HTMLElement_Create(This, (nsIDOMNode*)nselem, TRUE);
elem = HTMLElement_Create(This->doc_node, (nsIDOMNode*)nselem, TRUE);
nsIDOMElement_Release(nselem);
*newElem = HTMLELEM(elem);
......@@ -1763,7 +1763,6 @@ static void destroy_htmldoc(HTMLDocument *This)
if(This->event_target)
release_event_target(This->event_target);
release_nodes(This);
release_dispex(&This->dispex);
ConnectionPointContainer_Destroy(&This->cp_container);
......@@ -1801,6 +1800,7 @@ static ULONG HTMLDocumentNode_Release(HTMLDocument *base)
if(!ref) {
detach_selection(This);
detach_ranges(This);
release_nodes(This);
destroy_htmldoc(&This->basedoc);
heap_free(This);
}
......
......@@ -123,7 +123,7 @@ static HRESULT WINAPI HTMLDocument3_createTextNode(IHTMLDocument3 *iface, BSTR t
return E_FAIL;
}
node = HTMLDOMTextNode_Create(This, (nsIDOMNode*)nstext);
node = HTMLDOMTextNode_Create(This->doc_node, (nsIDOMNode*)nstext);
nsIDOMElement_Release(nstext);
*newTextNode = HTMLDOMNODE(node);
......@@ -152,7 +152,7 @@ static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, I
}
if(nselem) {
node = get_node(This, (nsIDOMNode *)nselem, TRUE);
node = get_node(This->doc_node, (nsIDOMNode *)nselem, TRUE);
nsIDOMElement_Release(nselem);
IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)p);
}else {
......@@ -442,7 +442,7 @@ static HRESULT WINAPI HTMLDocument3_getElementById(IHTMLDocument3 *iface, BSTR v
}
if(nselem) {
node = get_node(This, (nsIDOMNode*)nselem, TRUE);
node = get_node(This->doc_node, (nsIDOMNode*)nselem, TRUE);
nsIDOMElement_Release(nselem);
IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)pel);
......@@ -480,7 +480,7 @@ static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface,
return E_FAIL;
}
*pelColl = (IHTMLElementCollection*)create_collection_from_nodelist(This, (IUnknown*)HTMLDOC3(This), nslist);
*pelColl = (IHTMLElementCollection*)create_collection_from_nodelist(This->doc_node, (IUnknown*)HTMLDOC3(This), nslist);
nsIDOMNodeList_Release(nslist);
return S_OK;
......
......@@ -144,7 +144,7 @@ static HRESULT WINAPI HTMLDocument5_createComment(IHTMLDocument5 *iface, BSTR bs
return E_FAIL;
}
node = &HTMLCommentElement_Create(This, (nsIDOMNode*)nscomment)->node;
node = &HTMLCommentElement_Create(This->doc_node, (nsIDOMNode*)nscomment)->node;
nsIDOMElement_Release(nscomment);
*ppRetNode = HTMLDOMNODE(node);
......
......@@ -171,7 +171,7 @@ static HRESULT WINAPI HTMLElement_getAttribute(IHTMLElement *iface, BSTR strAttr
WCHAR buffer[256];
DWORD len;
BSTR bstrBaseUrl;
hres = IHTMLDocument2_get_URL(HTMLDOC(This->node.doc), &bstrBaseUrl);
hres = IHTMLDocument2_get_URL(HTMLDOC(&This->node.doc->basedoc), &bstrBaseUrl);
if(SUCCEEDED(hres)) {
hres = CoInternetCombineUrl(bstrBaseUrl, value,
URL_ESCAPE_SPACES_ONLY|URL_DONT_ESCAPE_EXTRA_INFO,
......@@ -589,7 +589,7 @@ static HRESULT WINAPI HTMLElement_get_document(IHTMLElement *iface, IDispatch **
if(!p)
return E_POINTER;
*p = (IDispatch*)HTMLDOC(This->node.doc);
*p = (IDispatch*)HTMLDOC(&This->node.doc->basedoc);
IDispatch_AddRef(*p);
return S_OK;
......@@ -899,7 +899,7 @@ static HRESULT WINAPI HTMLElement_put_innerText(IHTMLElement *iface, BSTR v)
}
nsAString_Init(&text_str, v);
nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->nsdoc, &text_str, &text_node);
nsres = nsIDOMHTMLDocument_CreateTextNode(This->node.doc->basedoc.nsdoc, &text_str, &text_node);
nsAString_Finish(&text_str);
if(NS_FAILED(nsres)) {
ERR("CreateTextNode failed: %08x\n", nsres);
......@@ -1055,12 +1055,12 @@ static HRESULT WINAPI HTMLElement_insertAdjacentHTML(IHTMLElement *iface, BSTR w
TRACE("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(html));
if(!This->node.doc->nsdoc) {
if(!This->node.doc->basedoc.nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsres = nsIDOMDocument_QueryInterface(This->node.doc->nsdoc, &IID_nsIDOMDocumentRange, (void **)&nsdocrange);
nsres = nsIDOMDocument_QueryInterface(This->node.doc->basedoc.nsdoc, &IID_nsIDOMDocumentRange, (void **)&nsdocrange);
if(NS_FAILED(nsres))
{
ERR("getting nsIDOMDocumentRange failed: %08x\n", nsres);
......@@ -1113,14 +1113,14 @@ static HRESULT WINAPI HTMLElement_insertAdjacentText(IHTMLElement *iface, BSTR w
TRACE("(%p)->(%s %s)\n", This, debugstr_w(where), debugstr_w(text));
if(!This->node.doc->nsdoc) {
if(!This->node.doc->basedoc.nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
nsAString_Init(&ns_text, text);
nsres = nsIDOMDocument_CreateTextNode(This->node.doc->nsdoc, &ns_text, (nsIDOMText **)&nsnode);
nsres = nsIDOMDocument_CreateTextNode(This->node.doc->basedoc.nsdoc, &ns_text, (nsIDOMText **)&nsnode);
nsAString_Finish(&ns_text);
if(NS_FAILED(nsres) || !nsnode)
......@@ -1520,7 +1520,7 @@ void HTMLElement_Init(HTMLElement *This)
init_dispex(&This->node.dispex, (IUnknown*)HTMLELEM(This), &HTMLElement_dispex);
}
HTMLElement *HTMLElement_Create(HTMLDocument *doc, nsIDOMNode *nsnode, BOOL use_generic)
HTMLElement *HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL use_generic)
{
nsIDOMHTMLElement *nselem;
HTMLElement *ret = NULL;
......
......@@ -608,7 +608,7 @@ static HRESULT WINAPI HTMLElement2_attachEvent(IHTMLElement2 *iface, BSTR event,
TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
return attach_event(get_node_event_target(&This->node), This->node.doc, event, pDisp, pfResult);
return attach_event(get_node_event_target(&This->node), &This->node.doc->basedoc, event, pDisp, pfResult);
}
static HRESULT WINAPI HTMLElement2_detachEvent(IHTMLElement2 *iface, BSTR event, IDispatch *pDisp)
......
......@@ -445,7 +445,7 @@ static dispex_static_data_t HTMLElementCollection_dispex = {
HTMLElementCollection_iface_tids
};
static void create_all_list(HTMLDocument *doc, HTMLDOMNode *elem, elem_vector_t *buf)
static void create_all_list(HTMLDocumentNode *doc, HTMLDOMNode *elem, elem_vector_t *buf)
{
nsIDOMNodeList *nsnode_list;
nsIDOMNode *iter;
......@@ -492,7 +492,7 @@ IHTMLElementCollection *create_all_collection(HTMLDOMNode *node, BOOL include_ro
return HTMLElementCollection_Create((IUnknown*)HTMLDOMNODE(node), buf.buf, buf.len);
}
IHTMLElementCollection *create_collection_from_nodelist(HTMLDocument *doc, IUnknown *unk, nsIDOMNodeList *nslist)
IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode *doc, IUnknown *unk, nsIDOMNodeList *nslist)
{
PRUint32 length = 0, i;
elem_vector_t buf;
......@@ -521,7 +521,7 @@ IHTMLElementCollection *create_collection_from_nodelist(HTMLDocument *doc, IUnkn
return HTMLElementCollection_Create(unk, buf.buf, buf.len);
}
IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocument *doc, IUnknown *unk, nsIDOMHTMLCollection *nscol)
IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode *doc, IUnknown *unk, nsIDOMHTMLCollection *nscol)
{
PRUint32 length = 0, i;
elem_vector_t buf;
......
......@@ -695,7 +695,7 @@ static IHTMLEventObj *create_event(HTMLDOMNode *target, eventid_t eid, nsIDOMEve
return HTMLEVENTOBJ(ret);
}
static void call_event_handlers(HTMLDocument *doc, IHTMLEventObj *event_obj, event_target_t *event_target,
static void call_event_handlers(HTMLDocumentNode *doc, IHTMLEventObj *event_obj, event_target_t *event_target,
eventid_t eid, IDispatch *this_obj)
{
handler_vector_t *handler_vector;
......@@ -741,7 +741,7 @@ static void call_event_handlers(HTMLDocument *doc, IHTMLEventObj *event_obj, eve
}
}
void fire_event(HTMLDocument *doc, eventid_t eid, nsIDOMNode *target, nsIDOMEvent *nsevent)
void fire_event(HTMLDocumentNode *doc, eventid_t eid, nsIDOMNode *target, nsIDOMEvent *nsevent)
{
IHTMLEventObj *prev_event, *event_obj = NULL;
nsIDOMNode *parent, *nsnode;
......@@ -750,8 +750,8 @@ void fire_event(HTMLDocument *doc, eventid_t eid, nsIDOMNode *target, nsIDOMEven
TRACE("(%p) %s\n", doc, debugstr_w(event_info[eid].name));
prev_event = doc->window->event;
event_obj = doc->window->event = create_event(get_node(doc, target, TRUE), eid, nsevent);
prev_event = doc->basedoc.window->event;
event_obj = doc->basedoc.window->event = create_event(get_node(doc, target, TRUE), eid, nsevent);
nsIDOMNode_GetNodeType(target, &node_type);
nsnode = target;
......@@ -784,7 +784,7 @@ void fire_event(HTMLDocument *doc, eventid_t eid, nsIDOMNode *target, nsIDOMEven
nsIDOMHTMLElement *nsbody;
nsresult nsres;
nsres = nsIDOMHTMLDocument_GetBody(doc->nsdoc, &nsbody);
nsres = nsIDOMHTMLDocument_GetBody(doc->basedoc.nsdoc, &nsbody);
if(NS_SUCCEEDED(nsres) && nsbody) {
node = get_node(doc, (nsIDOMNode*)nsbody, FALSE);
if(node)
......@@ -795,7 +795,7 @@ void fire_event(HTMLDocument *doc, eventid_t eid, nsIDOMNode *target, nsIDOMEven
}
}
call_event_handlers(doc, event_obj, doc->event_target, eid, (IDispatch*)HTMLDOC(doc));
call_event_handlers(doc, event_obj, doc->basedoc.event_target, eid, (IDispatch*)HTMLDOC(&doc->basedoc));
break;
default:
......@@ -806,7 +806,7 @@ void fire_event(HTMLDocument *doc, eventid_t eid, nsIDOMNode *target, nsIDOMEven
nsIDOMNode_Release(nsnode);
IHTMLEventObj_Release(event_obj);
doc->window->event = prev_event;
doc->basedoc.window->event = prev_event;
}
static inline event_target_t *get_event_target(event_target_t **event_target_ptr)
......@@ -837,7 +837,7 @@ static BOOL alloc_handler_vector(event_target_t *event_target, eventid_t eid, in
return TRUE;
}
static HRESULT set_event_handler_disp(event_target_t **event_target_ptr, HTMLDocument *doc, eventid_t eid, IDispatch *disp)
static HRESULT set_event_handler_disp(event_target_t **event_target_ptr, HTMLWindow *window, eventid_t eid, IDispatch *disp)
{
event_target_t *event_target;
......@@ -856,16 +856,16 @@ static HRESULT set_event_handler_disp(event_target_t **event_target_ptr, HTMLDoc
return S_OK;
IDispatch_AddRef(disp);
if(doc->window->nswindow && (event_info[eid].flags & EVENT_DEFAULTLISTENER)) {
if(!doc->window->event_vector) {
doc->window->event_vector = heap_alloc_zero(EVENTID_LAST*sizeof(BOOL));
if(!doc->window->event_vector)
if(window->nswindow && (event_info[eid].flags & EVENT_DEFAULTLISTENER)) {
if(!window->event_vector) {
window->event_vector = heap_alloc_zero(EVENTID_LAST*sizeof(BOOL));
if(!window->event_vector)
return E_OUTOFMEMORY;
}
if(!doc->window->event_vector[eid]) {
doc->window->event_vector[eid] = TRUE;
add_nsevent_listener(doc->window, event_info[eid].name);
if(!window->event_vector[eid]) {
window->event_vector[eid] = TRUE;
add_nsevent_listener(window, event_info[eid].name);
}
}
......@@ -883,7 +883,7 @@ HRESULT set_event_handler(event_target_t **event_target, HTMLDocument *doc, even
break;
case VT_DISPATCH:
return set_event_handler_disp(event_target, doc, eid, V_DISPATCH(var));
return set_event_handler_disp(event_target, doc->window, eid, V_DISPATCH(var));
default:
FIXME("not supported vt=%d\n", V_VT(var));
......@@ -939,7 +939,7 @@ HRESULT attach_event(event_target_t **event_target_ptr, HTMLDocument *doc, BSTR
return S_OK;
}
void check_event_attr(HTMLDocument *doc, nsIDOMElement *nselem)
void check_event_attr(HTMLDocumentNode *doc, nsIDOMElement *nselem)
{
const PRUnichar *attr_value;
nsAString attr_name_str, attr_value_str;
......@@ -961,10 +961,10 @@ void check_event_attr(HTMLDocument *doc, nsIDOMElement *nselem)
TRACE("%p.%s = %s\n", nselem, debugstr_w(event_info[i].attr_name), debugstr_w(attr_value));
disp = script_parse_event(doc->window, attr_value);
disp = script_parse_event(doc->basedoc.window, attr_value);
if(disp) {
node = get_node(doc, (nsIDOMNode*)nselem, TRUE);
set_event_handler_disp(get_node_event_target(node), node->doc, i, disp);
set_event_handler_disp(get_node_event_target(node), node->doc->basedoc.window, i, disp);
IDispatch_Release(disp);
}
}
......
......@@ -39,9 +39,9 @@ typedef enum {
} eventid_t;
eventid_t str_to_eid(LPCWSTR);
void check_event_attr(HTMLDocument*,nsIDOMElement*);
void check_event_attr(HTMLDocumentNode*,nsIDOMElement*);
void release_event_target(event_target_t*);
void fire_event(HTMLDocument*,eventid_t,nsIDOMNode*,nsIDOMEvent*);
void fire_event(HTMLDocumentNode*,eventid_t,nsIDOMNode*,nsIDOMEvent*);
HRESULT set_event_handler(event_target_t**,HTMLDocument*,eventid_t,VARIANT*);
HRESULT get_event_handler(event_target_t**,eventid_t,VARIANT*);
HRESULT attach_event(event_target_t**,HTMLDocument*,BSTR,IDispatch*,VARIANT_BOOL*);
......@@ -53,7 +53,7 @@ static inline event_target_t **get_node_event_target(HTMLDOMNode *node)
static inline HRESULT set_node_event(HTMLDOMNode *node, eventid_t eid, VARIANT *var)
{
return set_event_handler(get_node_event_target(node), node->doc, eid, var);
return set_event_handler(get_node_event_target(node), &node->doc->basedoc, eid, var);
}
static inline HRESULT get_node_event(HTMLDOMNode *node, eventid_t eid, VARIANT *var)
......
......@@ -130,13 +130,13 @@ static HRESULT WINAPI HTMLIFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface,
return E_FAIL;
}
hres = HTMLWindow_Create(This->element.node.doc->doc_obj, NULL, &window);
hres = HTMLWindow_Create(This->element.node.doc->basedoc.doc_obj, NULL, &window);
if(FAILED(hres)) {
nsIDOMDocument_Release(nsdoc);
return hres;
}
hres = create_doc_from_nsdoc(nshtmldoc, This->element.node.doc->doc_obj, window, &content_doc);
hres = create_doc_from_nsdoc(nshtmldoc, This->element.node.doc->basedoc.doc_obj, window, &content_doc);
nsIDOMHTMLDocument_Release(nshtmldoc);
if(SUCCEEDED(hres))
window_set_docnode(window, content_doc);
......
......@@ -32,7 +32,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
static HTMLDOMNode *get_node_obj(HTMLDocument*,IUnknown*);
static HTMLDOMNode *get_node_obj(HTMLDocumentNode*,IUnknown*);
typedef struct {
DispatchEx dispex;
......@@ -41,7 +41,7 @@ typedef struct {
LONG ref;
/* FIXME: implement weak reference */
HTMLDocument *doc;
HTMLDocumentNode *doc;
nsIDOMNodeList *nslist;
} HTMLDOMChildrenCollection;
......@@ -262,7 +262,7 @@ static dispex_static_data_t HTMLDOMChildrenCollection_dispex = {
HTMLDOMChildrenCollection_iface_tids
};
static IHTMLDOMChildrenCollection *create_child_collection(HTMLDocument *doc, nsIDOMNodeList *nslist)
static IHTMLDOMChildrenCollection *create_child_collection(HTMLDocumentNode *doc, nsIDOMNodeList *nslist)
{
HTMLDOMChildrenCollection *ret;
......@@ -875,7 +875,7 @@ static const NodeImplVtbl HTMLDOMNodeImplVtbl = {
HTMLDOMNode_destructor
};
void HTMLDOMNode_Init(HTMLDocument *doc, HTMLDOMNode *node, nsIDOMNode *nsnode)
void HTMLDOMNode_Init(HTMLDocumentNode *doc, HTMLDOMNode *node, nsIDOMNode *nsnode)
{
node->lpHTMLDOMNodeVtbl = &HTMLDOMNodeVtbl;
node->lpHTMLDOMNode2Vtbl = &HTMLDOMNode2Vtbl;
......@@ -889,7 +889,7 @@ void HTMLDOMNode_Init(HTMLDocument *doc, HTMLDOMNode *node, nsIDOMNode *nsnode)
doc->nodes = node;
}
static HTMLDOMNode *create_node(HTMLDocument *doc, nsIDOMNode *nsnode)
static HTMLDOMNode *create_node(HTMLDocumentNode *doc, nsIDOMNode *nsnode)
{
HTMLDOMNode *ret;
PRUint16 node_type;
......@@ -923,7 +923,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, BOOL create)
HTMLDOMNode *get_node(HTMLDocumentNode *This, nsIDOMNode *nsnode, BOOL create)
{
HTMLDOMNode *iter = This->nodes;
......@@ -944,7 +944,7 @@ HTMLDOMNode *get_node(HTMLDocument *This, nsIDOMNode *nsnode, BOOL create)
* We should use better way for getting node object (like private interface)
* or avoid it at all.
*/
static HTMLDOMNode *get_node_obj(HTMLDocument *This, IUnknown *iface)
static HTMLDOMNode *get_node_obj(HTMLDocumentNode *This, IUnknown *iface)
{
HTMLDOMNode *iter = This->nodes;
IHTMLDOMNode *node;
......@@ -962,7 +962,7 @@ static HTMLDOMNode *get_node_obj(HTMLDocument *This, IUnknown *iface)
return NULL;
}
void release_nodes(HTMLDocument *This)
void release_nodes(HTMLDocumentNode *This)
{
HTMLDOMNode *iter, *next;
......
......@@ -187,7 +187,7 @@ static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
if(!This->element.node.doc->nsdoc) {
if(!This->element.node.doc->basedoc.nsdoc) {
WARN("NULL nsdoc\n");
return E_UNEXPECTED;
}
......@@ -210,7 +210,7 @@ static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR
}
nsAString_Init(&text_str, v);
nsres = nsIDOMHTMLDocument_CreateTextNode(This->element.node.doc->nsdoc, &text_str, &text_node);
nsres = nsIDOMHTMLDocument_CreateTextNode(This->element.node.doc->basedoc.nsdoc, &text_str, &text_node);
nsAString_Finish(&text_str);
if(NS_FAILED(nsres)) {
ERR("CreateTextNode failed: %08x\n", nsres);
......@@ -474,7 +474,7 @@ static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory
return E_FAIL;
}
hres = IHTMLDOMNode_QueryInterface(HTMLDOMNODE(get_node(&This->window->doc_obj->basedoc, (nsIDOMNode*)nselem, TRUE)),
hres = IHTMLDOMNode_QueryInterface(HTMLDOMNODE(get_node(This->window->doc, (nsIDOMNode*)nselem, TRUE)),
&IID_IHTMLOptionElement, (void**)optelem);
nsIDOMElement_Release(nselem);
......
......@@ -193,7 +193,7 @@ static dispex_static_data_t HTMLDOMTextNode_dispex = {
HTMLDOMTextNode_iface_tids
};
HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocument *doc, nsIDOMNode *nsnode)
HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode)
{
HTMLDOMTextNode *ret ;
......
......@@ -289,8 +289,6 @@ struct HTMLDocument {
ConnectionPoint cp_htmldocevents;
ConnectionPoint cp_htmldocevents2;
ConnectionPoint cp_propnotif;
HTMLDOMNode *nodes;
};
static inline HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
......@@ -313,6 +311,8 @@ struct HTMLDocumentNode {
LONG ref;
HTMLDOMNode *nodes;
struct list selection_list;
struct list range_list;
};
......@@ -452,7 +452,7 @@ struct HTMLDOMNode {
LONG ref;
nsIDOMNode *nsnode;
HTMLDocument *doc;
HTMLDocumentNode *doc;
event_target_t *event_target;
HTMLDOMNode *next;
......@@ -647,10 +647,10 @@ void detach_selection(HTMLDocumentNode*);
void detach_ranges(HTMLDocumentNode*);
HRESULT get_node_text(HTMLDOMNode*,BSTR*);
HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocument*,nsIDOMNode*);
HTMLDOMNode *HTMLDOMTextNode_Create(HTMLDocumentNode*,nsIDOMNode*);
HTMLElement *HTMLElement_Create(HTMLDocument*,nsIDOMNode*,BOOL);
HTMLElement *HTMLCommentElement_Create(HTMLDocument*,nsIDOMNode*);
HTMLElement *HTMLElement_Create(HTMLDocumentNode*,nsIDOMNode*,BOOL);
HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode*,nsIDOMNode*);
HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement*);
HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement*);
HTMLElement *HTMLIFrame_Create(nsIDOMHTMLElement*);
......@@ -664,7 +664,7 @@ HTMLElement *HTMLTableRow_Create(nsIDOMHTMLElement*);
HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
HTMLElement *HTMLGenericElement_Create(nsIDOMHTMLElement*);
void HTMLDOMNode_Init(HTMLDocument*,HTMLDOMNode*,nsIDOMNode*);
void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*);
void HTMLElement_Init(HTMLElement*);
void HTMLElement2_Init(HTMLElement*);
void HTMLElement3_Init(HTMLElement*);
......@@ -676,8 +676,8 @@ void HTMLDOMNode_destructor(HTMLDOMNode*);
HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
void HTMLElement_destructor(HTMLDOMNode*);
HTMLDOMNode *get_node(HTMLDocument*,nsIDOMNode*,BOOL);
void release_nodes(HTMLDocument*);
HTMLDOMNode *get_node(HTMLDocumentNode*,nsIDOMNode*,BOOL);
void release_nodes(HTMLDocumentNode*);
void release_script_hosts(HTMLWindow*);
void connect_scripts(HTMLWindow*);
......@@ -688,8 +688,8 @@ BOOL find_global_prop(HTMLWindow*,BSTR,DWORD,ScriptHost**,DISPID*);
IDispatch *get_script_disp(ScriptHost*);
IHTMLElementCollection *create_all_collection(HTMLDOMNode*,BOOL);
IHTMLElementCollection *create_collection_from_nodelist(HTMLDocument*,IUnknown*,nsIDOMNodeList*);
IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocument*,IUnknown*,nsIDOMHTMLCollection*);
IHTMLElementCollection *create_collection_from_nodelist(HTMLDocumentNode*,IUnknown*,nsIDOMNodeList*);
IHTMLElementCollection *create_collection_from_htmlcol(HTMLDocumentNode*,IUnknown*,nsIDOMHTMLCollection*);
/* commands */
typedef struct {
......
......@@ -545,7 +545,7 @@ static void NSAPI nsDocumentObserver_BindToDocument(nsIDocumentObserver *iface,
nsres = nsISupports_QueryInterface(aContent, &IID_nsIDOMElement, (void**)&nselem);
if(NS_SUCCEEDED(nsres)) {
check_event_attr(&This->doc->basedoc, nselem);
check_event_attr(This->doc->basedoc.doc_node, nselem);
nsIDOMElement_Release(nselem);
}
......
......@@ -1139,7 +1139,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->basedoc, aNode, TRUE)));
show_context_menu(This->doc, dwID, &pt, (IDispatch*)HTMLDOMNODE(get_node(This->doc->basedoc.doc_node, aNode, TRUE)));
return NS_OK;
}
......
......@@ -155,7 +155,7 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
nsIDOMHTMLDocument_GetBody(This->doc->basedoc.nsdoc, &nsbody);
if(nsbody) {
fire_event(&This->doc->basedoc, EVENTID_LOAD, (nsIDOMNode*)nsbody, event);
fire_event(This->doc->basedoc.doc_node, EVENTID_LOAD, (nsIDOMNode*)nsbody, event);
nsIDOMHTMLElement_Release(nsbody);
}
......@@ -191,7 +191,7 @@ static nsresult NSAPI handle_htmlevent(nsIDOMEventListener *iface, nsIDOMEvent *
return NS_OK;
}
fire_event(&This->doc->basedoc, eid, nsnode, event);
fire_event(This->doc->basedoc.doc_node, eid, nsnode, event);
nsIDOMNode_Release(nsnode);
......
......@@ -1201,7 +1201,7 @@ static HRESULT WINAPI HTMLTxtRange_parentElement(IHTMLTxtRange *iface, IHTMLElem
return S_OK;
}
node = get_node(&This->doc->basedoc, nsnode, TRUE);
node = get_node(This->doc, nsnode, TRUE);
nsIDOMNode_Release(nsnode);
return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)parent);
......
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