Commit f351dc5e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Moved cloneNode implementation to vtbl.

parent 6a37caae
......@@ -515,7 +515,8 @@ static void HTMLAnchorElement_destructor(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLAnchorElementImplVtbl = {
HTMLAnchorElement_QI,
HTMLAnchorElement_destructor
HTMLAnchorElement_destructor,
HTMLElement_clone
};
static const tid_t HTMLAnchorElement_iface_tids[] = {
......
......@@ -792,6 +792,7 @@ static event_target_t **HTMLBodyElement_get_event_target(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLBodyElementImplVtbl = {
HTMLBodyElement_QI,
HTMLBodyElement_destructor,
HTMLElement_clone,
HTMLBodyElement_get_event_target
};
......
......@@ -169,7 +169,8 @@ static void HTMLCommentElement_destructor(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLCommentElementImplVtbl = {
HTMLCommentElement_QI,
HTMLCommentElement_destructor
HTMLCommentElement_destructor,
HTMLElement_clone
};
static const tid_t HTMLCommentElement_iface_tids[] = {
......
......@@ -1898,11 +1898,19 @@ static void HTMLDocumentNode_destructor(HTMLDOMNode *iface)
destroy_htmldoc(&This->basedoc);
}
static HRESULT HTMLDocumentNode_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
{
HTMLDocumentNode *This = HTMLDOCNODE_NODE_THIS(iface);
FIXME("%p\n", This);
return E_NOTIMPL;
}
#undef HTMLDOCNODE_NODE_THIS
static const NodeImplVtbl HTMLDocumentNodeImplVtbl = {
HTMLDocumentNode_QI,
HTMLDocumentNode_destructor
HTMLDocumentNode_destructor,
HTMLDocumentNode_clone
};
static const tid_t HTMLDocumentNode_iface_tids[] = {
......
......@@ -1601,9 +1601,22 @@ void HTMLElement_destructor(HTMLDOMNode *iface)
HTMLDOMNode_destructor(&This->node);
}
HRESULT HTMLElement_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
{
HTMLElement *This = HTMLELEM_NODE_THIS(iface);
HTMLElement *new_elem;
new_elem = HTMLElement_Create(This->node.doc, nsnode, FALSE);
IHTMLElement_AddRef(HTMLELEM(new_elem));
*ret = &new_elem->node;
return S_OK;
}
static const NodeImplVtbl HTMLElementImplVtbl = {
HTMLElement_QI,
HTMLElement_destructor
HTMLElement_destructor,
HTMLElement_clone
};
static const tid_t HTMLElement_iface_tids[] = {
......
......@@ -251,7 +251,8 @@ static void HTMLEmbedElement_destructor(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLEmbedElementImplVtbl = {
HTMLEmbedElement_QI,
HTMLEmbedElement_destructor
HTMLEmbedElement_destructor,
HTMLElement_clone
};
static const tid_t HTMLEmbedElement_iface_tids[] = {
......
......@@ -638,6 +638,7 @@ static HRESULT HTMLFormElement_invoke(HTMLDOMNode *iface,
static const NodeImplVtbl HTMLFormElementImplVtbl = {
HTMLFormElement_QI,
HTMLFormElement_destructor,
HTMLElement_clone,
NULL,
NULL,
NULL,
......
......@@ -258,6 +258,7 @@ static HRESULT HTMLFrameElement_bind_to_tree(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLFrameElementImplVtbl = {
HTMLFrameElement_QI,
HTMLFrameElement_destructor,
HTMLElement_clone,
NULL,
NULL,
NULL,
......
......@@ -149,7 +149,8 @@ static void HTMLGenericElement_destructor(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLGenericElementImplVtbl = {
HTMLGenericElement_QI,
HTMLGenericElement_destructor
HTMLGenericElement_destructor,
HTMLElement_clone
};
static const tid_t HTMLGenericElement_iface_tids[] = {
......
......@@ -243,6 +243,7 @@ static HRESULT HTMLIFrame_bind_to_tree(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLIFrameImplVtbl = {
HTMLIFrame_QI,
HTMLIFrame_destructor,
HTMLElement_clone,
NULL,
NULL,
NULL,
......
......@@ -645,6 +645,7 @@ static HRESULT HTMLImgElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
static const NodeImplVtbl HTMLImgElementImplVtbl = {
HTMLImgElement_QI,
HTMLImgElement_destructor,
HTMLElement_clone,
NULL,
NULL,
NULL,
......
......@@ -1193,6 +1193,7 @@ static HRESULT HTMLInputElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_BOO
static const NodeImplVtbl HTMLInputElementImplVtbl = {
HTMLInputElement_QI,
HTMLInputElement_destructor,
HTMLElement_clone,
NULL,
HTMLInputElementImpl_call_event,
HTMLInputElementImpl_put_disabled,
......
......@@ -33,6 +33,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
static HTMLDOMNode *get_node_obj(HTMLDocumentNode*,IUnknown*);
static HTMLDOMNode *create_node(HTMLDocumentNode*,nsIDOMNode*);
typedef struct {
DispatchEx dispex;
......@@ -536,9 +537,10 @@ static HRESULT WINAPI HTMLDOMNode_cloneNode(IHTMLDOMNode *iface, VARIANT_BOOL fD
IHTMLDOMNode **clonedNode)
{
HTMLDOMNode *This = HTMLDOMNODE_THIS(iface);
HTMLDOMNode *new_node;
nsIDOMNode *nsnode;
HTMLDOMNode *node;
nsresult nsres;
HRESULT hres;
TRACE("(%p)->(%x %p)\n", This, fDeep, clonedNode);
......@@ -548,9 +550,11 @@ static HRESULT WINAPI HTMLDOMNode_cloneNode(IHTMLDOMNode *iface, VARIANT_BOOL fD
return E_FAIL;
}
node = get_node(This->doc, nsnode, TRUE);
IHTMLDOMNode_AddRef(HTMLDOMNODE(node));
*clonedNode = HTMLDOMNODE(node);
hres = This->vtbl->clone(This, nsnode, &new_node);
if(FAILED(hres))
return hres;
*clonedNode = HTMLDOMNODE(new_node);
return S_OK;
}
......@@ -904,9 +908,17 @@ void HTMLDOMNode_destructor(HTMLDOMNode *This)
release_event_target(This->event_target);
}
static HRESULT HTMLDOMNode_clone(HTMLDOMNode *This, nsIDOMNode *nsnode, HTMLDOMNode **ret)
{
*ret = create_node(This->doc, nsnode);
IHTMLDOMNode_AddRef(HTMLDOMNODE(*ret));
return S_OK;
}
static const NodeImplVtbl HTMLDOMNodeImplVtbl = {
HTMLDOMNode_QI,
HTMLDOMNode_destructor
HTMLDOMNode_destructor,
HTMLDOMNode_clone
};
void HTMLDOMNode_Init(HTMLDocumentNode *doc, HTMLDOMNode *node, nsIDOMNode *nsnode)
......
......@@ -428,7 +428,8 @@ static void HTMLObjectElement_destructor(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLObjectElementImplVtbl = {
HTMLObjectElement_QI,
HTMLObjectElement_destructor
HTMLObjectElement_destructor,
HTMLElement_clone
};
static const tid_t HTMLObjectElement_iface_tids[] = {
......
......@@ -340,7 +340,8 @@ static void HTMLOptionElement_destructor(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLOptionElementImplVtbl = {
HTMLOptionElement_QI,
HTMLOptionElement_destructor
HTMLOptionElement_destructor,
HTMLElement_clone
};
static const tid_t HTMLOptionElement_iface_tids[] = {
......
......@@ -321,6 +321,7 @@ static HRESULT HTMLScriptElement_get_readystate(HTMLDOMNode *iface, BSTR *p)
static const NodeImplVtbl HTMLScriptElementImplVtbl = {
HTMLScriptElement_QI,
HTMLScriptElement_destructor,
HTMLElement_clone,
NULL,
NULL,
NULL,
......
......@@ -613,6 +613,7 @@ static HRESULT HTMLSelectElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid
static const NodeImplVtbl HTMLSelectElementImplVtbl = {
HTMLSelectElement_QI,
HTMLSelectElement_destructor,
HTMLElement_clone,
NULL,
NULL,
HTMLSelectElementImpl_put_disabled,
......
......@@ -251,7 +251,8 @@ static void HTMLStyleElement_destructor(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLStyleElementImplVtbl = {
HTMLStyleElement_QI,
HTMLStyleElement_destructor
HTMLStyleElement_destructor,
HTMLElement_clone
};
static const tid_t HTMLStyleElement_iface_tids[] = {
......
......@@ -554,7 +554,8 @@ static void HTMLTable_destructor(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLTableImplVtbl = {
HTMLTable_QI,
HTMLTable_destructor
HTMLTable_destructor,
HTMLElement_clone,
};
static const tid_t HTMLTable_iface_tids[] = {
......
......@@ -297,7 +297,8 @@ static void HTMLTableRow_destructor(HTMLDOMNode *iface)
static const NodeImplVtbl HTMLTableRowImplVtbl = {
HTMLTableRow_QI,
HTMLTableRow_destructor
HTMLTableRow_destructor,
HTMLElement_clone
};
static const tid_t HTMLTableRow_iface_tids[] = {
......
......@@ -444,6 +444,7 @@ static HRESULT HTMLTextAreaElementImpl_get_disabled(HTMLDOMNode *iface, VARIANT_
static const NodeImplVtbl HTMLTextAreaElementImplVtbl = {
HTMLTextAreaElement_QI,
HTMLTextAreaElement_destructor,
HTMLElement_clone,
NULL,
NULL,
HTMLTextAreaElementImpl_put_disabled,
......
......@@ -187,11 +187,21 @@ static void HTMLDOMTextNode_destructor(HTMLDOMNode *iface)
HTMLDOMNode_destructor(&This->node);
}
static HRESULT HTMLDOMTextNode_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
{
HTMLDOMTextNode *This = HTMLTEXT_NODE_THIS(iface);
*ret = HTMLDOMTextNode_Create(This->node.doc, nsnode);
IHTMLDOMNode_AddRef(HTMLDOMNODE(*ret));
return S_OK;
}
#undef HTMLTEXT_NODE_THIS
static const NodeImplVtbl HTMLDOMTextNodeImplVtbl = {
HTMLDOMTextNode_QI,
HTMLDOMTextNode_destructor
HTMLDOMTextNode_destructor,
HTMLDOMTextNode_clone
};
static const tid_t HTMLDOMTextNode_iface_tids[] = {
......
......@@ -513,6 +513,7 @@ HRESULT set_http_header(struct list*,const WCHAR*,int,const WCHAR*,int);
typedef struct {
HRESULT (*qi)(HTMLDOMNode*,REFIID,void**);
void (*destructor)(HTMLDOMNode*);
HRESULT (*clone)(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
event_target_t **(*get_event_target)(HTMLDOMNode*);
HRESULT (*call_event)(HTMLDOMNode*,DWORD,BOOL*);
HRESULT (*put_disabled)(HTMLDOMNode*,VARIANT_BOOL);
......@@ -849,6 +850,7 @@ void HTMLDOMNode_destructor(HTMLDOMNode*);
HRESULT HTMLElement_QI(HTMLDOMNode*,REFIID,void**);
void HTMLElement_destructor(HTMLDOMNode*);
HRESULT HTMLElement_clone(HTMLDOMNode*,nsIDOMNode*,HTMLDOMNode**);
HRESULT HTMLFrameBase_QI(HTMLFrameBase*,REFIID,void**);
void HTMLFrameBase_destructor(HTMLFrameBase*);
......
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