static HRESULT WINAPI HTMLFormElement_QueryInterface(IHTMLFormElement *iface, REFIID riid, void **ppv) { HTMLFormElement *This = HTMLFORM_THIS(iface); return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv); }
static HRESULT WINAPI HTMLDOMTextNode_QueryInterface(IHTMLDOMTextNode *iface, REFIID riid, void **ppv) { HTMLDOMTextNode *This = impl_from_IHTMLDOMTextNode(iface); return IHTMLDOMNode_QueryInterface(&This->node.IHTMLDOMNode_iface, riid, ppv); }
static HRESULT WINAPI HTMLTextAreaElement_get_form(IHTMLTextAreaElement *iface, IHTMLFormElement **p) { HTMLTextAreaElement *This = impl_from_IHTMLTextAreaElement(iface); nsIDOMHTMLFormElement *nsform; nsIDOMNode *nsnode; HTMLDOMNode *node; nsresult nsres; HRESULT hres; TRACE("(%p)->(%p)\n", This, p); nsres = nsIDOMHTMLTextAreaElement_GetForm(This->nstextarea, &nsform); assert(nsres == NS_OK); if(!nsform) { *p = NULL; return S_OK; } nsres = nsIDOMHTMLFormElement_QueryInterface(nsform, &IID_nsIDOMNode, (void**)&nsnode); nsIDOMHTMLFormElement_Release(nsform); assert(nsres == NS_OK); hres = get_node(This->element.node.doc, nsnode, TRUE, &node); nsIDOMNode_Release(nsnode); if(FAILED(hres)) return hres; hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLFormElement, (void**)p); IHTMLDOMNode_Release(&node->IHTMLDOMNode_iface); return hres; }
static HRESULT WINAPI HTMLFormElement_QueryInterface(IHTMLFormElement *iface, REFIID riid, void **ppv) { HTMLFormElement *This = impl_from_IHTMLFormElement(iface); return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv); }
static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, IHTMLElement **p) { HTMLDocument *This = HTMLDOC3_THIS(iface); nsIDOMDocument *nsdoc; HTMLDOMNode *node; nsresult nsres; TRACE("(%p)->(%p)\n", This, p); if(!This->nscontainer) { *p = NULL; return S_OK; } nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc); if(NS_FAILED(nsres)) ERR("GetDocument failed: %08lx\n", nsres); if(nsdoc) { node = get_node(This, (nsIDOMNode*)nsdoc); nsIDOMDocument_Release(nsdoc); IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)p); }else { *p = NULL; } return S_OK; }
static HRESULT WINAPI HTMLTableRow_QueryInterface(IHTMLTableRow *iface, REFIID riid, void **ppv) { HTMLTableRow *This = HTMLTABLEROW_THIS(iface); return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv); }
static HRESULT WINAPI HTMLInputTextElement_QueryInterface(IHTMLInputTextElement *iface, REFIID riid, void **ppv) { HTMLInputElement *This = HTMLINPUTTEXT_THIS(iface); return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv); }
static HRESULT WINAPI HTMLDOMTextNode_QueryInterface(IHTMLDOMTextNode *iface, REFIID riid, void **ppv) { HTMLDOMTextNode *This = HTMLTEXT_THIS(iface); return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->node), riid, ppv); }
static HRESULT WINAPI HTMLFrameElement3_QueryInterface(IHTMLFrameElement3 *iface, REFIID riid, void **ppv) { HTMLFrameElement *This = impl_from_IHTMLFrameElement3(iface); return IHTMLDOMNode_QueryInterface(&This->framebase.element.node.IHTMLDOMNode_iface, riid, ppv); }
static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, IHTMLElement **p) { HTMLDocument *This = HTMLDOC3_THIS(iface); nsIDOMElement *nselem = NULL; HTMLDOMNode *node; nsresult nsres; TRACE("(%p)->(%p)\n", This, p); if(This->window->readystate == READYSTATE_UNINITIALIZED) { *p = NULL; return S_OK; } if(!This->doc_node->nsdoc) { WARN("NULL nsdoc\n"); return E_UNEXPECTED; } nsres = nsIDOMHTMLDocument_GetDocumentElement(This->doc_node->nsdoc, &nselem); if(NS_FAILED(nsres)) { ERR("GetDocumentElement failed: %08x\n", nsres); return E_FAIL; } if(nselem) { node = get_node(This->doc_node, (nsIDOMNode *)nselem, TRUE); nsIDOMElement_Release(nselem); IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)p); }else { *p = NULL; } return S_OK; }
static HRESULT WINAPI HTMLObjectElement2_QueryInterface(IHTMLObjectElement2 *iface, REFIID riid, void **ppv) { HTMLObjectElement *This = impl_from_IHTMLObjectElement2(iface); return IHTMLDOMNode_QueryInterface(&This->plugin_container.element.node.IHTMLDOMNode_iface, riid, ppv); }
static HRESULT WINAPI HTMLEventObj_get_srcElement(IHTMLEventObj *iface, IHTMLElement **p) { HTMLEventObj *This = impl_from_IHTMLEventObj(iface); TRACE("(%p)->(%p)\n", This, p); return IHTMLDOMNode_QueryInterface(&This->target->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p); }
static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory *iface, VARIANT text, VARIANT value, VARIANT defaultselected, VARIANT selected, IHTMLOptionElement **optelem) { HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface); nsIDOMHTMLElement *nselem; HTMLDOMNode *node; HRESULT hres; static const PRUnichar optionW[] = {'O','P','T','I','O','N',0}; TRACE("(%p)->(%s %s %s %s %p)\n", This, debugstr_variant(&text), debugstr_variant(&value), debugstr_variant(&defaultselected), debugstr_variant(&selected), optelem); if(!This->window || !This->window->doc) { WARN("NULL doc\n"); return E_UNEXPECTED; } *optelem = NULL; hres = create_nselem(This->window->doc, optionW, &nselem); if(FAILED(hres)) return hres; hres = get_node(This->window->doc, (nsIDOMNode*)nselem, TRUE, &node); nsIDOMHTMLElement_Release(nselem); if(FAILED(hres)) return hres; hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLOptionElement, (void**)optelem); node_release(node); if(V_VT(&text) == VT_BSTR) IHTMLOptionElement_put_text(*optelem, V_BSTR(&text)); else if(V_VT(&text) != VT_EMPTY) FIXME("Unsupported text %s\n", debugstr_variant(&text)); if(V_VT(&value) == VT_BSTR) IHTMLOptionElement_put_value(*optelem, V_BSTR(&value)); else if(V_VT(&value) != VT_EMPTY) FIXME("Unsupported value %s\n", debugstr_variant(&value)); if(V_VT(&defaultselected) != VT_EMPTY) FIXME("Unsupported defaultselected %s\n", debugstr_variant(&defaultselected)); if(V_VT(&selected) != VT_EMPTY) FIXME("Unsupported selected %s\n", debugstr_variant(&selected)); return S_OK; }
static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory *iface, VARIANT text, VARIANT value, VARIANT defaultselected, VARIANT selected, IHTMLOptionElement **optelem) { HTMLOptionElementFactory *This = HTMLOPTFACTORY_THIS(iface); nsIDOMElement *nselem; nsAString option_str; nsresult nsres; HRESULT hres; static const PRUnichar optionW[] = {'O','P','T','I','O','N',0}; TRACE("(%p)->(%s %s %s %s %p)\n", This, debugstr_variant(&text), debugstr_variant(&value), debugstr_variant(&defaultselected), debugstr_variant(&selected), optelem); if(!This->doc->nsdoc) { WARN("NULL nsdoc\n"); return E_UNEXPECTED; } *optelem = NULL; nsAString_Init(&option_str, optionW); nsres = nsIDOMHTMLDocument_CreateElement(This->doc->nsdoc, &option_str, &nselem); nsAString_Finish(&option_str); if(NS_FAILED(nsres)) { ERR("CreateElement failed: %08x\n", nsres); return E_FAIL; } hres = IHTMLDOMNode_QueryInterface(HTMLDOMNODE(get_node(This->doc, (nsIDOMNode*)nselem, TRUE)), &IID_IHTMLOptionElement, (void**)optelem); nsIDOMElement_Release(nselem); if(V_VT(&text) == VT_BSTR) IHTMLOptionElement_put_text(*optelem, V_BSTR(&text)); else if(V_VT(&text) != VT_EMPTY) FIXME("Unsupported text vt=%d\n", V_VT(&text)); if(V_VT(&value) == VT_BSTR) IHTMLOptionElement_put_value(*optelem, V_BSTR(&value)); else if(V_VT(&value) != VT_EMPTY) FIXME("Unsupported value vt=%d\n", V_VT(&value)); if(V_VT(&defaultselected) != VT_EMPTY) FIXME("Unsupported defaultselected vt=%d\n", V_VT(&defaultselected)); if(V_VT(&selected) != VT_EMPTY) FIXME("Unsupported selected vt=%d\n", V_VT(&selected)); return S_OK; }
static HRESULT WINAPI HTMLSelectElement_get_form(IHTMLSelectElement *iface, IHTMLFormElement **p) { HTMLSelectElement *This = impl_from_IHTMLSelectElement(iface); nsIDOMHTMLFormElement *nsform; nsIDOMNode *form_node; HTMLDOMNode *node; HRESULT hres; nsresult nsres; TRACE("(%p)->(%p)\n", This, p); if(!p) return E_POINTER; nsres = nsIDOMHTMLSelectElement_GetForm(This->nsselect, &nsform); FIXME("get form %08x : %p\n", nsres, nsform); if (NS_FAILED(nsres)) { ERR("GetForm failed: %08x, nsform: %p\n", nsres, nsform); *p = NULL; return E_FAIL; } if (nsform == NULL) { TRACE("nsform not found\n"); *p = NULL; return S_OK; } nsres = nsIDOMHTMLFormElement_QueryInterface(nsform, &IID_nsIDOMNode, (void**)&form_node); nsIDOMHTMLFormElement_Release(nsform); assert(nsres == NS_OK); hres = get_node(This->element.node.doc, form_node, TRUE, &node); nsIDOMNode_Release(form_node); if (FAILED(hres)) return hres; hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p); node_release(node); return hres; }
static HRESULT assoc_element(PluginHost *host, HTMLDocumentNode *doc, nsIDOMElement *nselem) { HTMLPluginContainer *container_elem; HTMLDOMNode *node; HRESULT hres; hres = get_node(doc, (nsIDOMNode*)nselem, TRUE, &node); if(FAILED(hres)) return hres; hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_HTMLPluginContainer, (void**)&container_elem); if(FAILED(hres)) { ERR("Not an object element\n"); return hres; } container_elem->plugin_host = host; host->element = container_elem; return S_OK; }
static HRESULT WINAPI HTMLElement2_insertAdjacentElement(IHTMLElement2 *iface, BSTR where, IHTMLElement *insertedElement, IHTMLElement **inserted) { HTMLElement *This = impl_from_IHTMLElement2(iface); HTMLDOMNode *ret_node; HTMLElement *elem; HRESULT hres; TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(where), insertedElement, inserted); elem = unsafe_impl_from_IHTMLElement(insertedElement); if(!elem) return E_INVALIDARG; hres = insert_adjacent_node(This, where, elem->node.nsnode, &ret_node); if(FAILED(hres)) return hres; hres = IHTMLDOMNode_QueryInterface(&ret_node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)inserted); IHTMLDOMNode_Release(&ret_node->IHTMLDOMNode_iface); return hres; }
static HRESULT WINAPI SVGTextContentElement_QueryInterface(ISVGTextContentElement *iface, REFIID riid, void **ppv) { SVGTextContentElement *This = impl_from_ISVGTextContentElement(iface); return IHTMLDOMNode_QueryInterface(&This->svg_element->element.node.IHTMLDOMNode_iface, riid, ppv); }
static HRESULT WINAPI HTMLDocument3_getElementById(IHTMLDocument3 *iface, BSTR v, IHTMLElement **pel) { HTMLDocument *This = HTMLDOC3_THIS(iface); nsIDOMElement *nselem; HTMLDOMNode *node; nsIDOMNode *nsnode, *nsnode_by_id, *nsnode_by_name; nsIDOMNodeList *nsnode_list; nsAString id_str; nsresult nsres; TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel); if(!This->doc_node->nsdoc) { WARN("NULL nsdoc\n"); return E_UNEXPECTED; } nsAString_InitDepend(&id_str, v); /* get element by id attribute */ nsres = nsIDOMHTMLDocument_GetElementById(This->doc_node->nsdoc, &id_str, &nselem); if(FAILED(nsres)) { ERR("GetElementById failed: %08x\n", nsres); nsAString_Finish(&id_str); return E_FAIL; } nsnode_by_id = (nsIDOMNode*)nselem; /* get first element by name attribute */ nsres = nsIDOMHTMLDocument_GetElementsByName(This->doc_node->nsdoc, &id_str, &nsnode_list); nsAString_Finish(&id_str); if(FAILED(nsres)) { ERR("getElementsByName failed: %08x\n", nsres); if(nsnode_by_id) nsIDOMNode_Release(nsnode_by_id); return E_FAIL; } nsIDOMNodeList_Item(nsnode_list, 0, &nsnode_by_name); nsIDOMNodeList_Release(nsnode_list); if(nsnode_by_name && nsnode_by_id) { nsIDOM3Node *node3; PRUint16 pos; nsres = nsIDOMNode_QueryInterface(nsnode_by_name, &IID_nsIDOM3Node, (void**)&node3); if(NS_FAILED(nsres)) { FIXME("failed to get nsIDOM3Node interface: 0x%08x\n", nsres); nsIDOMNode_Release(nsnode_by_name); nsIDOMNode_Release(nsnode_by_id); return E_FAIL; } nsres = nsIDOM3Node_CompareDocumentPosition(node3, nsnode_by_id, &pos); nsIDOM3Node_Release(node3); if(NS_FAILED(nsres)) { FIXME("nsIDOM3Node_CompareDocumentPosition failed: 0x%08x\n", nsres); nsIDOMNode_Release(nsnode_by_name); nsIDOMNode_Release(nsnode_by_id); return E_FAIL; } TRACE("CompareDocumentPosition gave: 0x%x\n", pos); if(pos & PRECEDING || pos & CONTAINS) { nsnode = nsnode_by_id; nsIDOMNode_Release(nsnode_by_name); }else { nsnode = nsnode_by_name; nsIDOMNode_Release(nsnode_by_id); } }else nsnode = nsnode_by_name ? nsnode_by_name : nsnode_by_id; if(nsnode) { node = get_node(This->doc_node, nsnode, TRUE); nsIDOMNode_Release(nsnode); IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)pel); }else { *pel = NULL; } return S_OK; }
static HRESULT WINAPI InternetHostSecurityManager_QueryInterface(IInternetHostSecurityManager *iface, REFIID riid, void **ppv) { HTMLDocumentNode *This = impl_from_IInternetHostSecurityManager(iface); return IHTMLDOMNode_QueryInterface(&This->node.IHTMLDOMNode_iface, riid, ppv); }