2008-04-11 12:45:31 +00:00
|
|
|
/*
|
2009-10-20 19:28:02 +00:00
|
|
|
* Copyright 2005-2009 Jacek Caban for CodeWeavers
|
2008-04-11 12:45:31 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "mshtml_private.h"
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
static inline HTMLDocument *impl_from_IHTMLDocument2(IHTMLDocument2 *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLDocument, IHTMLDocument2_iface);
|
|
|
|
}
|
2008-04-11 12:45:31 +00:00
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
static HRESULT WINAPI HTMLDocument_QueryInterface(IHTMLDocument2 *iface, REFIID riid, void **ppv)
|
2008-04-11 12:45:31 +00:00
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
return htmldoc_query_interface(This, riid, ppv);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLDocument_AddRef(IHTMLDocument2 *iface)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-10-20 19:28:02 +00:00
|
|
|
|
|
|
|
return htmldoc_addref(This);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
return htmldoc_release(This);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_GetTypeInfoCount(IHTMLDocument2 *iface, UINT *pctinfo)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
return IDispatchEx_GetTypeInfoCount(&This->IDispatchEx_iface, pctinfo);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_GetTypeInfo(IHTMLDocument2 *iface, UINT iTInfo,
|
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
return IDispatchEx_GetTypeInfo(&This->IDispatchEx_iface, iTInfo, lcid, ppTInfo);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_GetIDsOfNames(IHTMLDocument2 *iface, REFIID riid,
|
|
|
|
LPOLESTR *rgszNames, UINT cNames,
|
|
|
|
LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
return IDispatchEx_GetIDsOfNames(&This->IDispatchEx_iface, riid, rgszNames, cNames, lcid,
|
|
|
|
rgDispId);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_Invoke(IHTMLDocument2 *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
return IDispatchEx_Invoke(&This->IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
|
|
|
|
pDispParams, pVarResult, pExcepInfo, puArgErr);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_Script(IHTMLDocument2 *iface, IDispatch **p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-09-10 07:44:02 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
*p = (IDispatch*)&This->window->base.IHTMLWindow2_iface;
|
2008-09-10 07:44:02 +00:00
|
|
|
IDispatch_AddRef(*p);
|
|
|
|
return S_OK;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_all(IHTMLDocument2 *iface, IHTMLElementCollection **p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
nsIDOMElement *nselem = NULL;
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDOMNode *node;
|
2008-04-11 12:45:31 +00:00
|
|
|
nsresult nsres;
|
2013-05-19 21:21:20 +00:00
|
|
|
HRESULT hres;
|
2008-04-11 12:45:31 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
if(!This->doc_node->nsdoc) {
|
2009-02-04 14:35:06 +00:00
|
|
|
WARN("NULL nsdoc\n");
|
|
|
|
return E_UNEXPECTED;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
nsres = nsIDOMHTMLDocument_GetDocumentElement(This->doc_node->nsdoc, &nselem);
|
2009-02-04 14:35:06 +00:00
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("GetDocumentElement failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
if(!nselem) {
|
2008-04-11 12:45:31 +00:00
|
|
|
*p = NULL;
|
2013-05-19 21:21:20 +00:00
|
|
|
return S_OK;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
hres = get_node(This->doc_node, (nsIDOMNode*)nselem, TRUE, &node);
|
|
|
|
nsIDOMElement_Release(nselem);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
*p = create_all_collection(node, TRUE);
|
|
|
|
node_release(node);
|
|
|
|
return hres;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_body(IHTMLDocument2 *iface, IHTMLElement **p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
nsIDOMHTMLElement *nsbody = NULL;
|
|
|
|
HTMLDOMNode *node;
|
2013-05-19 21:21:20 +00:00
|
|
|
HRESULT hres;
|
2008-04-11 12:45:31 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
if(This->doc_node->nsdoc) {
|
|
|
|
nsresult nsres;
|
2008-04-11 12:45:31 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
nsres = nsIDOMHTMLDocument_GetBody(This->doc_node->nsdoc, &nsbody);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
TRACE("Could not get body: %08x\n", nsres);
|
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
if(!nsbody) {
|
2009-02-04 14:35:06 +00:00
|
|
|
*p = NULL;
|
2013-05-19 21:21:20 +00:00
|
|
|
return S_OK;
|
2009-02-04 14:35:06 +00:00
|
|
|
}
|
2008-04-11 12:45:31 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
hres = get_node(This->doc_node, (nsIDOMNode*)nsbody, TRUE, &node);
|
|
|
|
nsIDOMHTMLElement_Release(nsbody);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)p);
|
|
|
|
node_release(node);
|
|
|
|
return hres;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_activeElement(IHTMLDocument2 *iface, IHTMLElement **p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_images(IHTMLDocument2 *iface, IHTMLElementCollection **p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-02-04 14:35:06 +00:00
|
|
|
nsIDOMHTMLCollection *nscoll = NULL;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
if(!p)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
*p = NULL;
|
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
if(!This->doc_node->nsdoc) {
|
2009-02-04 14:35:06 +00:00
|
|
|
WARN("NULL nsdoc\n");
|
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
nsres = nsIDOMHTMLDocument_GetImages(This->doc_node->nsdoc, &nscoll);
|
2009-02-04 14:35:06 +00:00
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("GetImages failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(nscoll) {
|
2013-05-19 21:21:20 +00:00
|
|
|
*p = create_collection_from_htmlcol(This->doc_node, nscoll);
|
|
|
|
nsIDOMHTMLCollection_Release(nscoll);
|
2009-02-04 14:35:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_applets(IHTMLDocument2 *iface, IHTMLElementCollection **p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-02-04 14:35:06 +00:00
|
|
|
nsIDOMHTMLCollection *nscoll = NULL;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
if(!p)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
*p = NULL;
|
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
if(!This->doc_node->nsdoc) {
|
2009-02-04 14:35:06 +00:00
|
|
|
WARN("NULL nsdoc\n");
|
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
nsres = nsIDOMHTMLDocument_GetApplets(This->doc_node->nsdoc, &nscoll);
|
2009-02-04 14:35:06 +00:00
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("GetApplets failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(nscoll) {
|
2013-05-19 21:21:20 +00:00
|
|
|
*p = create_collection_from_htmlcol(This->doc_node, nscoll);
|
|
|
|
nsIDOMHTMLCollection_Release(nscoll);
|
2009-02-04 14:35:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_links(IHTMLDocument2 *iface, IHTMLElementCollection **p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-02-04 14:35:06 +00:00
|
|
|
nsIDOMHTMLCollection *nscoll = NULL;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
if(!p)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
*p = NULL;
|
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
if(!This->doc_node->nsdoc) {
|
2009-02-04 14:35:06 +00:00
|
|
|
WARN("NULL nsdoc\n");
|
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
nsres = nsIDOMHTMLDocument_GetLinks(This->doc_node->nsdoc, &nscoll);
|
2009-02-04 14:35:06 +00:00
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("GetLinks failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(nscoll) {
|
2013-05-19 21:21:20 +00:00
|
|
|
*p = create_collection_from_htmlcol(This->doc_node, nscoll);
|
|
|
|
nsIDOMHTMLCollection_Release(nscoll);
|
2009-02-04 14:35:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_forms(IHTMLDocument2 *iface, IHTMLElementCollection **p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-02-04 14:35:06 +00:00
|
|
|
nsIDOMHTMLCollection *nscoll = NULL;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
if(!p)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
*p = NULL;
|
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
if(!This->doc_node->nsdoc) {
|
2009-02-04 14:35:06 +00:00
|
|
|
WARN("NULL nsdoc\n");
|
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
nsres = nsIDOMHTMLDocument_GetForms(This->doc_node->nsdoc, &nscoll);
|
2009-02-04 14:35:06 +00:00
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("GetForms failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(nscoll) {
|
2013-05-19 21:21:20 +00:00
|
|
|
*p = create_collection_from_htmlcol(This->doc_node, nscoll);
|
|
|
|
nsIDOMHTMLCollection_Release(nscoll);
|
2009-02-04 14:35:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_anchors(IHTMLDocument2 *iface, IHTMLElementCollection **p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-02-04 14:35:06 +00:00
|
|
|
nsIDOMHTMLCollection *nscoll = NULL;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
if(!p)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
*p = NULL;
|
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
if(!This->doc_node->nsdoc) {
|
2009-02-04 14:35:06 +00:00
|
|
|
WARN("NULL nsdoc\n");
|
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
nsres = nsIDOMHTMLDocument_GetAnchors(This->doc_node->nsdoc, &nscoll);
|
2009-02-04 14:35:06 +00:00
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("GetAnchors failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(nscoll) {
|
2013-05-19 21:21:20 +00:00
|
|
|
*p = create_collection_from_htmlcol(This->doc_node, nscoll);
|
|
|
|
nsIDOMHTMLCollection_Release(nscoll);
|
2009-02-04 14:35:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_title(IHTMLDocument2 *iface, BSTR v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-09-10 07:44:02 +00:00
|
|
|
nsAString nsstr;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
if(!This->doc_node->nsdoc) {
|
2009-02-04 14:35:06 +00:00
|
|
|
WARN("NULL nsdoc\n");
|
|
|
|
return E_UNEXPECTED;
|
2008-09-10 07:44:02 +00:00
|
|
|
}
|
|
|
|
|
2010-03-02 14:08:15 +00:00
|
|
|
nsAString_InitDepend(&nsstr, v);
|
2009-11-15 23:44:20 +00:00
|
|
|
nsres = nsIDOMHTMLDocument_SetTitle(This->doc_node->nsdoc, &nsstr);
|
2008-09-10 07:44:02 +00:00
|
|
|
nsAString_Finish(&nsstr);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
ERR("SetTitle failed: %08x\n", nsres);
|
|
|
|
|
|
|
|
return S_OK;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_title(IHTMLDocument2 *iface, BSTR *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-09-10 07:44:02 +00:00
|
|
|
const PRUnichar *ret;
|
|
|
|
nsAString nsstr;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
if(!This->doc_node->nsdoc) {
|
2009-02-04 14:35:06 +00:00
|
|
|
WARN("NULL nsdoc\n");
|
|
|
|
return E_UNEXPECTED;
|
2008-09-10 07:44:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nsAString_Init(&nsstr, NULL);
|
2009-11-15 23:44:20 +00:00
|
|
|
nsres = nsIDOMHTMLDocument_GetTitle(This->doc_node->nsdoc, &nsstr);
|
2009-02-04 14:35:06 +00:00
|
|
|
if (NS_SUCCEEDED(nsres)) {
|
|
|
|
nsAString_GetData(&nsstr, &ret);
|
|
|
|
*p = SysAllocString(ret);
|
|
|
|
}
|
|
|
|
nsAString_Finish(&nsstr);
|
2008-09-10 07:44:02 +00:00
|
|
|
|
2009-02-04 14:35:06 +00:00
|
|
|
if(NS_FAILED(nsres)) {
|
2008-09-10 07:44:02 +00:00
|
|
|
ERR("GetTitle failed: %08x\n", nsres);
|
2009-02-04 14:35:06 +00:00
|
|
|
return E_FAIL;
|
|
|
|
}
|
2008-09-10 07:44:02 +00:00
|
|
|
|
|
|
|
return S_OK;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_scripts(IHTMLDocument2 *iface, IHTMLElementCollection **p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2013-10-07 14:22:37 +00:00
|
|
|
nsIDOMHTMLCollection *nscoll = NULL;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
if(!p)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
*p = NULL;
|
|
|
|
|
|
|
|
if(!This->doc_node->nsdoc) {
|
|
|
|
WARN("NULL nsdoc\n");
|
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLDocument_GetScripts(This->doc_node->nsdoc, &nscoll);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("GetImages failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(nscoll) {
|
|
|
|
*p = create_collection_from_htmlcol(This->doc_node, nscoll);
|
|
|
|
nsIDOMHTMLCollection_Release(nscoll);
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_designMode(IHTMLDocument2 *iface, BSTR v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2013-10-07 14:22:37 +00:00
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
static const WCHAR onW[] = {'o','n',0};
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
|
|
|
if(strcmpiW(v, onW)) {
|
|
|
|
FIXME("Unsupported arg %s\n", debugstr_w(v));
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = setup_edit_mode(This->doc_obj);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
call_property_onchanged(&This->cp_container, DISPID_IHTMLDOCUMENT2_DESIGNMODE);
|
|
|
|
return S_OK;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_designMode(IHTMLDocument2 *iface, BSTR *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-02-04 14:35:06 +00:00
|
|
|
static WCHAR szOff[] = {'O','f','f',0};
|
|
|
|
FIXME("(%p)->(%p) always returning Off\n", This, p);
|
|
|
|
|
|
|
|
if(!p)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
*p = SysAllocString(szOff);
|
|
|
|
|
|
|
|
return S_OK;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_selection(IHTMLDocument2 *iface, IHTMLSelectionObject **p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-10-20 19:28:02 +00:00
|
|
|
nsISelection *nsselection;
|
|
|
|
nsresult nsres;
|
2008-04-11 12:45:31 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
nsres = nsIDOMWindow_GetSelection(This->window->nswindow, &nsselection);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("GetSelection failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
return HTMLSelectionObject_Create(This->doc_node, nsselection, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_readyState(IHTMLDocument2 *iface, BSTR *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
|
|
|
|
static const WCHAR wszUninitialized[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0};
|
|
|
|
static const WCHAR wszLoading[] = {'l','o','a','d','i','n','g',0};
|
|
|
|
static const WCHAR wszLoaded[] = {'l','o','a','d','e','d',0};
|
|
|
|
static const WCHAR wszInteractive[] = {'i','n','t','e','r','a','c','t','i','v','e',0};
|
|
|
|
static const WCHAR wszComplete[] = {'c','o','m','p','l','e','t','e',0};
|
|
|
|
|
|
|
|
static const LPCWSTR readystate_str[] = {
|
|
|
|
wszUninitialized,
|
|
|
|
wszLoading,
|
|
|
|
wszLoaded,
|
|
|
|
wszInteractive,
|
|
|
|
wszComplete
|
|
|
|
};
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", iface, p);
|
|
|
|
|
|
|
|
if(!p)
|
|
|
|
return E_POINTER;
|
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
*p = SysAllocString(readystate_str[This->window->readystate]);
|
2008-04-11 12:45:31 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_frames(IHTMLDocument2 *iface, IHTMLFramesCollection2 **p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return IHTMLWindow2_get_frames(&This->window->base.IHTMLWindow2_iface, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_embeds(IHTMLDocument2 *iface, IHTMLElementCollection **p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_plugins(IHTMLDocument2 *iface, IHTMLElementCollection **p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_alinkColor(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_alinkColor(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_bgColor(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_bgColor(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_fgColor(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_fgColor(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_linkColor(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_linkColor(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_vlinkColor(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_vlinkColor(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_referrer(IHTMLDocument2 *iface, BSTR *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2010-03-21 15:12:30 +00:00
|
|
|
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2010-03-21 15:12:30 +00:00
|
|
|
|
|
|
|
*p = NULL;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2008-04-11 12:45:31 +00:00
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_location(IHTMLDocument2 *iface, IHTMLLocation **p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
if(!This->doc_node->nsdoc) {
|
|
|
|
WARN("NULL nsdoc\n");
|
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return IHTMLWindow2_get_location(&This->window->base.IHTMLWindow2_iface, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_lastModified(IHTMLDocument2 *iface, BSTR *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_URL(IHTMLDocument2 *iface, BSTR v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
|
|
|
if(!This->window) {
|
|
|
|
FIXME("No window available\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return navigate_url(This->window, v, This->window->uri, BINDING_NAVIGATED);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_URL(IHTMLDocument2 *iface, BSTR *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
|
|
|
|
static const WCHAR about_blank_url[] =
|
|
|
|
{'a','b','o','u','t',':','b','l','a','n','k',0};
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", iface, p);
|
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
*p = SysAllocString(This->window->url ? This->window->url : about_blank_url);
|
2009-10-20 19:28:02 +00:00
|
|
|
return *p ? S_OK : E_OUTOFMEMORY;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_domain(IHTMLDocument2 *iface, BSTR v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_domain(IHTMLDocument2 *iface, BSTR *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
if(!This->window || !This->window->uri) {
|
|
|
|
FIXME("No current URI\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = IUri_GetHost(This->window->uri, p);
|
|
|
|
return FAILED(hres) ? hres : S_OK;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_cookie(IHTMLDocument2 *iface, BSTR v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2010-01-18 16:27:14 +00:00
|
|
|
BOOL bret;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_w(v));
|
|
|
|
|
|
|
|
bret = InternetSetCookieExW(This->window->url, NULL, v, 0, 0);
|
|
|
|
if(!bret) {
|
|
|
|
FIXME("InternetSetCookieExW failed: %u\n", GetLastError());
|
|
|
|
return HRESULT_FROM_WIN32(GetLastError());
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_cookie(IHTMLDocument2 *iface, BSTR *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2010-01-18 16:27:14 +00:00
|
|
|
DWORD size;
|
|
|
|
BOOL bret;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
size = 0;
|
|
|
|
bret = InternetGetCookieExW(This->window->url, NULL, NULL, &size, 0, NULL);
|
|
|
|
if(!bret) {
|
|
|
|
switch(GetLastError()) {
|
|
|
|
case ERROR_INSUFFICIENT_BUFFER:
|
|
|
|
break;
|
|
|
|
case ERROR_NO_MORE_ITEMS:
|
|
|
|
*p = NULL;
|
|
|
|
return S_OK;
|
|
|
|
default:
|
|
|
|
FIXME("InternetGetCookieExW failed: %u\n", GetLastError());
|
|
|
|
return HRESULT_FROM_WIN32(GetLastError());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!size) {
|
|
|
|
*p = NULL;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2013-10-07 14:22:37 +00:00
|
|
|
*p = SysAllocStringLen(NULL, size/sizeof(WCHAR)-1);
|
2010-01-18 16:27:14 +00:00
|
|
|
if(!*p)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
bret = InternetGetCookieExW(This->window->url, NULL, *p, &size, 0, NULL);
|
|
|
|
if(!bret) {
|
|
|
|
ERR("InternetGetCookieExW failed: %u\n", GetLastError());
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_expando(IHTMLDocument2 *iface, VARIANT_BOOL v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%x)\n", This, v);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_expando(IHTMLDocument2 *iface, VARIANT_BOOL *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_charset(IHTMLDocument2 *iface, BSTR v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_charset(IHTMLDocument2 *iface, BSTR *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
nsAString charset_str;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
if(!This->doc_node->nsdoc) {
|
|
|
|
FIXME("NULL nsdoc\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAString_Init(&charset_str, NULL);
|
|
|
|
nsres = nsIDOMHTMLDocument_GetCharacterSet(This->doc_node->nsdoc, &charset_str);
|
|
|
|
return return_nsstr(nsres, &charset_str, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_defaultCharset(IHTMLDocument2 *iface, BSTR v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_w(v));
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_defaultCharset(IHTMLDocument2 *iface, BSTR *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_mimeType(IHTMLDocument2 *iface, BSTR *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_fileSize(IHTMLDocument2 *iface, BSTR *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_fileCreatedDate(IHTMLDocument2 *iface, BSTR *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_fileModifiedDate(IHTMLDocument2 *iface, BSTR *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_fileUpdatedDate(IHTMLDocument2 *iface, BSTR *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_security(IHTMLDocument2 *iface, BSTR *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_protocol(IHTMLDocument2 *iface, BSTR *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_nameProp(IHTMLDocument2 *iface, BSTR *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2009-09-05 15:02:49 +00:00
|
|
|
static HRESULT document_write(HTMLDocument *This, SAFEARRAY *psarray, BOOL ln)
|
2008-04-11 12:45:31 +00:00
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
VARIANT *var, tmp;
|
2013-10-07 14:22:37 +00:00
|
|
|
JSContext *jsctx;
|
2008-04-11 12:45:31 +00:00
|
|
|
nsAString nsstr;
|
2009-09-05 15:02:49 +00:00
|
|
|
ULONG i, argc;
|
2008-04-11 12:45:31 +00:00
|
|
|
nsresult nsres;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
if(!This->doc_node->nsdoc) {
|
2009-02-04 14:35:06 +00:00
|
|
|
WARN("NULL nsdoc\n");
|
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
2010-03-02 14:08:15 +00:00
|
|
|
if (!psarray)
|
|
|
|
return S_OK;
|
|
|
|
|
2008-04-11 12:45:31 +00:00
|
|
|
if(psarray->cDims != 1) {
|
|
|
|
FIXME("cDims=%d\n", psarray->cDims);
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = SafeArrayAccessData(psarray, (void**)&var);
|
|
|
|
if(FAILED(hres)) {
|
|
|
|
WARN("SafeArrayAccessData failed: %08x\n", hres);
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
V_VT(&tmp) = VT_EMPTY;
|
2008-04-11 12:45:31 +00:00
|
|
|
|
2013-10-07 14:22:37 +00:00
|
|
|
jsctx = get_context_from_document(This->doc_node->nsdoc);
|
2009-09-05 15:02:49 +00:00
|
|
|
argc = psarray->rgsabound[0].cElements;
|
|
|
|
for(i=0; i < argc; i++) {
|
2008-04-11 12:45:31 +00:00
|
|
|
if(V_VT(var+i) == VT_BSTR) {
|
2013-05-19 21:21:20 +00:00
|
|
|
nsAString_InitDepend(&nsstr, V_BSTR(var+i));
|
2008-04-11 12:45:31 +00:00
|
|
|
}else {
|
2013-05-19 21:21:20 +00:00
|
|
|
hres = VariantChangeTypeEx(&tmp, var+i, MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT), 0, VT_BSTR);
|
|
|
|
if(FAILED(hres)) {
|
|
|
|
WARN("Could not convert %s to string\n", debugstr_variant(var+i));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
nsAString_InitDepend(&nsstr, V_BSTR(&tmp));
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!ln || i != argc-1)
|
2013-10-07 14:22:37 +00:00
|
|
|
nsres = nsIDOMHTMLDocument_Write(This->doc_node->nsdoc, &nsstr, jsctx);
|
2013-05-19 21:21:20 +00:00
|
|
|
else
|
2013-10-07 14:22:37 +00:00
|
|
|
nsres = nsIDOMHTMLDocument_Writeln(This->doc_node->nsdoc, &nsstr, jsctx);
|
2013-05-19 21:21:20 +00:00
|
|
|
nsAString_Finish(&nsstr);
|
|
|
|
if(V_VT(var+i) != VT_BSTR)
|
|
|
|
VariantClear(&tmp);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("Write failed: %08x\n", nsres);
|
|
|
|
hres = E_FAIL;
|
|
|
|
break;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SafeArrayUnaccessData(psarray);
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
return hres;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
2009-09-05 15:02:49 +00:00
|
|
|
static HRESULT WINAPI HTMLDocument_write(IHTMLDocument2 *iface, SAFEARRAY *psarray)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-09-05 15:02:49 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", iface, psarray);
|
|
|
|
|
|
|
|
return document_write(This, psarray, FALSE);
|
|
|
|
}
|
|
|
|
|
2008-04-11 12:45:31 +00:00
|
|
|
static HRESULT WINAPI HTMLDocument_writeln(IHTMLDocument2 *iface, SAFEARRAY *psarray)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-09-05 15:02:49 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, psarray);
|
|
|
|
|
|
|
|
return document_write(This, psarray, TRUE);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT name,
|
|
|
|
VARIANT features, VARIANT replace, IDispatch **pomWindowResult)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
nsISupports *tmp;
|
2009-02-04 14:35:06 +00:00
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
static const WCHAR text_htmlW[] = {'t','e','x','t','/','h','t','m','l',0};
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s %s %s %s %p)\n", This, debugstr_w(url), debugstr_variant(&name),
|
|
|
|
debugstr_variant(&features), debugstr_variant(&replace), pomWindowResult);
|
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
if(!This->doc_node->nsdoc) {
|
2009-02-04 14:35:06 +00:00
|
|
|
ERR("!nsdoc\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!url || strcmpW(url, text_htmlW) || V_VT(&name) != VT_ERROR
|
|
|
|
|| V_VT(&features) != VT_ERROR || V_VT(&replace) != VT_ERROR)
|
|
|
|
FIXME("unsupported args\n");
|
|
|
|
|
2013-10-07 14:22:37 +00:00
|
|
|
nsres = nsIDOMHTMLDocument_Open(This->doc_node->nsdoc, NULL, NULL, NULL,
|
|
|
|
get_context_from_document(This->doc_node->nsdoc), 0, &tmp);
|
2009-02-04 14:35:06 +00:00
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("Open failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
if(tmp)
|
|
|
|
nsISupports_Release(tmp);
|
|
|
|
|
|
|
|
*pomWindowResult = (IDispatch*)&This->window->base.IHTMLWindow2_iface;
|
|
|
|
IHTMLWindow2_AddRef(&This->window->base.IHTMLWindow2_iface);
|
2009-02-04 14:35:06 +00:00
|
|
|
return S_OK;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_close(IHTMLDocument2 *iface)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-02-04 14:35:06 +00:00
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
if(!This->doc_node->nsdoc) {
|
2009-02-04 14:35:06 +00:00
|
|
|
ERR("!nsdoc\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
nsres = nsIDOMHTMLDocument_Close(This->doc_node->nsdoc);
|
2009-02-04 14:35:06 +00:00
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("Close failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_clear(IHTMLDocument2 *iface)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2010-05-29 14:54:55 +00:00
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
nsres = nsIDOMHTMLDocument_Clear(This->doc_node->nsdoc);
|
2010-05-29 14:54:55 +00:00
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("Clear failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_queryCommandSupported(IHTMLDocument2 *iface, BSTR cmdID,
|
|
|
|
VARIANT_BOOL *pfRet)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_queryCommandEnabled(IHTMLDocument2 *iface, BSTR cmdID,
|
|
|
|
VARIANT_BOOL *pfRet)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_queryCommandState(IHTMLDocument2 *iface, BSTR cmdID,
|
|
|
|
VARIANT_BOOL *pfRet)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_queryCommandIndeterm(IHTMLDocument2 *iface, BSTR cmdID,
|
|
|
|
VARIANT_BOOL *pfRet)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_queryCommandText(IHTMLDocument2 *iface, BSTR cmdID,
|
|
|
|
BSTR *pfRet)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_queryCommandValue(IHTMLDocument2 *iface, BSTR cmdID,
|
|
|
|
VARIANT *pfRet)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_execCommand(IHTMLDocument2 *iface, BSTR cmdID,
|
|
|
|
VARIANT_BOOL showUI, VARIANT value, VARIANT_BOOL *pfRet)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
FIXME("(%p)->(%s %x %s %p)\n", This, debugstr_w(cmdID), showUI, debugstr_variant(&value), pfRet);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_execCommandShowHelp(IHTMLDocument2 *iface, BSTR cmdID,
|
|
|
|
VARIANT_BOOL *pfRet)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_createElement(IHTMLDocument2 *iface, BSTR eTag,
|
|
|
|
IHTMLElement **newElem)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
HTMLElement *elem;
|
2009-11-15 23:44:20 +00:00
|
|
|
HRESULT hres;
|
2008-07-08 16:39:29 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_w(eTag), newElem);
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
hres = create_element(This->doc_node, eTag, &elem);
|
2009-11-15 23:44:20 +00:00
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
2008-07-08 16:39:29 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
*newElem = &elem->IHTMLElement_iface;
|
2008-07-08 16:39:29 +00:00
|
|
|
return S_OK;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_onhelp(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_onhelp(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_onclick(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-10-20 19:28:02 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
|
|
|
|
|
|
|
return set_doc_event(This, EVENTID_CLICK, &v);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_onclick(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-10-20 19:28:02 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_doc_event(This, EVENTID_CLICK, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_ondblclick(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_ondblclick(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_onkeyup(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-02-04 14:35:06 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
|
|
|
|
|
|
|
return set_doc_event(This, EVENTID_KEYUP, &v);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_onkeyup(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-02-04 14:35:06 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_doc_event(This, EVENTID_KEYUP, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_onkeydown(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-02-04 14:35:06 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
|
|
|
|
|
|
|
return set_doc_event(This, EVENTID_KEYDOWN, &v);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_onkeydown(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-02-04 14:35:06 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_doc_event(This, EVENTID_KEYDOWN, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_onkeypress(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
|
|
|
|
|
|
|
return set_doc_event(This, EVENTID_KEYPRESS, &v);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_onkeypress(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_doc_event(This, EVENTID_KEYPRESS, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_onmouseup(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2010-01-18 16:27:14 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
|
|
|
|
|
|
|
return set_doc_event(This, EVENTID_MOUSEUP, &v);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_onmouseup(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2010-01-18 16:27:14 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_doc_event(This, EVENTID_MOUSEUP, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_onmousedown(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2010-01-18 16:27:14 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2010-01-18 16:27:14 +00:00
|
|
|
|
|
|
|
return set_doc_event(This, EVENTID_MOUSEDOWN, &v);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_onmousedown(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2010-01-18 16:27:14 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_doc_event(This, EVENTID_MOUSEDOWN, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_onmousemove(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
|
|
|
|
|
|
|
return set_doc_event(This, EVENTID_MOUSEMOVE, &v);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_onmousemove(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_doc_event(This, EVENTID_MOUSEMOVE, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_onmouseout(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2010-01-18 16:27:14 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
|
|
|
|
|
|
|
return set_doc_event(This, EVENTID_MOUSEOUT, &v);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_onmouseout(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2010-01-18 16:27:14 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_doc_event(This, EVENTID_MOUSEOUT, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_onmouseover(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-02-04 14:35:06 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2009-02-04 14:35:06 +00:00
|
|
|
|
|
|
|
return set_doc_event(This, EVENTID_MOUSEOVER, &v);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_onmouseover(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-02-04 14:35:06 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_doc_event(This, EVENTID_MOUSEOVER, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_onreadystatechange(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2010-01-18 16:27:14 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
|
|
|
|
|
|
|
return set_doc_event(This, EVENTID_READYSTATECHANGE, &v);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_onreadystatechange(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2010-01-18 16:27:14 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_doc_event(This, EVENTID_READYSTATECHANGE, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_onafterupdate(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_onafterupdate(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_onrowexit(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_onrowexit(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_onrowenter(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_onrowenter(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_ondragstart(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-02-04 14:35:06 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
|
|
|
|
|
|
|
return set_doc_event(This, EVENTID_DRAGSTART, &v);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_ondragstart(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-02-04 14:35:06 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_doc_event(This, EVENTID_DRAGSTART, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_onselectstart(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-02-04 14:35:06 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s)\n", This, debugstr_variant(&v));
|
|
|
|
|
|
|
|
return set_doc_event(This, EVENTID_SELECTSTART, &v);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_onselectstart(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2009-02-04 14:35:06 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
return get_doc_event(This, EVENTID_SELECTSTART, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
2009-04-29 17:16:20 +00:00
|
|
|
static HRESULT WINAPI HTMLDocument_elementFromPoint(IHTMLDocument2 *iface, LONG x, LONG y,
|
2008-04-11 12:45:31 +00:00
|
|
|
IHTMLElement **elementHit)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
nsIDOMElement *nselem;
|
|
|
|
HTMLDOMNode *node;
|
|
|
|
nsresult nsres;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%d %d %p)\n", This, x, y, elementHit);
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLDocument_ElementFromPoint(This->doc_node->nsdoc, x, y, &nselem);
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("ElementFromPoint failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!nselem) {
|
|
|
|
*elementHit = NULL;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = get_node(This->doc_node, (nsIDOMNode*)nselem, TRUE, &node);
|
|
|
|
nsIDOMElement_Release(nselem);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
hres = IHTMLDOMNode_QueryInterface(&node->IHTMLDOMNode_iface, &IID_IHTMLElement, (void**)elementHit);
|
|
|
|
node_release(node);
|
|
|
|
return hres;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_parentWindow(IHTMLDocument2 *iface, IHTMLWindow2 **p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
*p = &This->window->base.IHTMLWindow2_iface;
|
2008-04-11 12:45:31 +00:00
|
|
|
IHTMLWindow2_AddRef(*p);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_styleSheets(IHTMLDocument2 *iface,
|
|
|
|
IHTMLStyleSheetsCollection **p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-04-11 12:45:31 +00:00
|
|
|
nsIDOMStyleSheetList *nsstylelist;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, p);
|
|
|
|
|
|
|
|
*p = NULL;
|
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
if(!This->doc_node->nsdoc) {
|
2009-02-04 14:35:06 +00:00
|
|
|
WARN("NULL nsdoc\n");
|
|
|
|
return E_UNEXPECTED;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
nsres = nsIDOMHTMLDocument_GetStyleSheets(This->doc_node->nsdoc, &nsstylelist);
|
2009-02-04 14:35:06 +00:00
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
ERR("GetStyleSheets failed: %08x\n", nsres);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
2008-04-11 12:45:31 +00:00
|
|
|
|
|
|
|
*p = HTMLStyleSheetsCollection_Create(nsstylelist);
|
2013-05-19 21:21:20 +00:00
|
|
|
nsIDOMStyleSheetList_Release(nsstylelist);
|
2008-04-11 12:45:31 +00:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_onbeforeupdate(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_onbeforeupdate(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_put_onerrorupdate(IHTMLDocument2 *iface, VARIANT v)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_get_onerrorupdate(IHTMLDocument2 *iface, VARIANT *p)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, p);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_toString(IHTMLDocument2 *iface, BSTR *String)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, String);
|
2008-04-11 12:45:31 +00:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR bstrHref,
|
2009-04-29 17:16:20 +00:00
|
|
|
LONG lIndex, IHTMLStyleSheet **ppnewStyleSheet)
|
2008-04-11 12:45:31 +00:00
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2(iface);
|
|
|
|
nsIDOMHTMLHeadElement *head_elem;
|
|
|
|
IHTMLStyleElement *style_elem;
|
|
|
|
HTMLElement *elem;
|
|
|
|
nsresult nsres;
|
|
|
|
HRESULT hres;
|
2008-04-11 12:45:31 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
static const WCHAR styleW[] = {'s','t','y','l','e',0};
|
2008-04-11 12:45:31 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
TRACE("(%p)->(%s %d %p)\n", This, debugstr_w(bstrHref), lIndex, ppnewStyleSheet);
|
|
|
|
|
|
|
|
if(!This->doc_node->nsdoc) {
|
|
|
|
FIXME("not a real doc object\n");
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(lIndex != -1)
|
|
|
|
FIXME("Unsupported lIndex %d\n", lIndex);
|
|
|
|
|
|
|
|
if(bstrHref) {
|
|
|
|
FIXME("semi-stub for href %s\n", debugstr_w(bstrHref));
|
|
|
|
*ppnewStyleSheet = HTMLStyleSheet_Create(NULL);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = create_element(This->doc_node, styleW, &elem);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLDocument_GetHead(This->doc_node->nsdoc, &head_elem);
|
|
|
|
if(NS_SUCCEEDED(nsres)) {
|
|
|
|
nsIDOMNode *tmp_node;
|
|
|
|
|
|
|
|
nsres = nsIDOMHTMLHeadElement_AppendChild(head_elem, (nsIDOMNode*)elem->nselem, &tmp_node);
|
|
|
|
nsIDOMHTMLHeadElement_Release(head_elem);
|
|
|
|
if(NS_SUCCEEDED(nsres) && tmp_node)
|
|
|
|
nsIDOMNode_Release(tmp_node);
|
|
|
|
}
|
|
|
|
if(NS_FAILED(nsres)) {
|
|
|
|
IHTMLElement_Release(&elem->IHTMLElement_iface);
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = IHTMLElement_QueryInterface(&elem->IHTMLElement_iface, &IID_IHTMLStyleElement, (void**)&style_elem);
|
|
|
|
assert(hres == S_OK);
|
|
|
|
IHTMLElement_Release(&elem->IHTMLElement_iface);
|
|
|
|
|
|
|
|
hres = IHTMLStyleElement_get_styleSheet(style_elem, ppnewStyleSheet);
|
|
|
|
IHTMLStyleElement_Release(style_elem);
|
|
|
|
return hres;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const IHTMLDocument2Vtbl HTMLDocumentVtbl = {
|
|
|
|
HTMLDocument_QueryInterface,
|
|
|
|
HTMLDocument_AddRef,
|
|
|
|
HTMLDocument_Release,
|
|
|
|
HTMLDocument_GetTypeInfoCount,
|
|
|
|
HTMLDocument_GetTypeInfo,
|
|
|
|
HTMLDocument_GetIDsOfNames,
|
|
|
|
HTMLDocument_Invoke,
|
|
|
|
HTMLDocument_get_Script,
|
|
|
|
HTMLDocument_get_all,
|
|
|
|
HTMLDocument_get_body,
|
|
|
|
HTMLDocument_get_activeElement,
|
|
|
|
HTMLDocument_get_images,
|
|
|
|
HTMLDocument_get_applets,
|
|
|
|
HTMLDocument_get_links,
|
|
|
|
HTMLDocument_get_forms,
|
|
|
|
HTMLDocument_get_anchors,
|
|
|
|
HTMLDocument_put_title,
|
|
|
|
HTMLDocument_get_title,
|
|
|
|
HTMLDocument_get_scripts,
|
|
|
|
HTMLDocument_put_designMode,
|
|
|
|
HTMLDocument_get_designMode,
|
|
|
|
HTMLDocument_get_selection,
|
|
|
|
HTMLDocument_get_readyState,
|
|
|
|
HTMLDocument_get_frames,
|
|
|
|
HTMLDocument_get_embeds,
|
|
|
|
HTMLDocument_get_plugins,
|
|
|
|
HTMLDocument_put_alinkColor,
|
|
|
|
HTMLDocument_get_alinkColor,
|
|
|
|
HTMLDocument_put_bgColor,
|
|
|
|
HTMLDocument_get_bgColor,
|
|
|
|
HTMLDocument_put_fgColor,
|
|
|
|
HTMLDocument_get_fgColor,
|
|
|
|
HTMLDocument_put_linkColor,
|
|
|
|
HTMLDocument_get_linkColor,
|
|
|
|
HTMLDocument_put_vlinkColor,
|
|
|
|
HTMLDocument_get_vlinkColor,
|
|
|
|
HTMLDocument_get_referrer,
|
|
|
|
HTMLDocument_get_location,
|
|
|
|
HTMLDocument_get_lastModified,
|
|
|
|
HTMLDocument_put_URL,
|
|
|
|
HTMLDocument_get_URL,
|
|
|
|
HTMLDocument_put_domain,
|
|
|
|
HTMLDocument_get_domain,
|
|
|
|
HTMLDocument_put_cookie,
|
|
|
|
HTMLDocument_get_cookie,
|
|
|
|
HTMLDocument_put_expando,
|
|
|
|
HTMLDocument_get_expando,
|
|
|
|
HTMLDocument_put_charset,
|
|
|
|
HTMLDocument_get_charset,
|
|
|
|
HTMLDocument_put_defaultCharset,
|
|
|
|
HTMLDocument_get_defaultCharset,
|
|
|
|
HTMLDocument_get_mimeType,
|
|
|
|
HTMLDocument_get_fileSize,
|
|
|
|
HTMLDocument_get_fileCreatedDate,
|
|
|
|
HTMLDocument_get_fileModifiedDate,
|
|
|
|
HTMLDocument_get_fileUpdatedDate,
|
|
|
|
HTMLDocument_get_security,
|
|
|
|
HTMLDocument_get_protocol,
|
|
|
|
HTMLDocument_get_nameProp,
|
|
|
|
HTMLDocument_write,
|
|
|
|
HTMLDocument_writeln,
|
|
|
|
HTMLDocument_open,
|
|
|
|
HTMLDocument_close,
|
|
|
|
HTMLDocument_clear,
|
|
|
|
HTMLDocument_queryCommandSupported,
|
|
|
|
HTMLDocument_queryCommandEnabled,
|
|
|
|
HTMLDocument_queryCommandState,
|
|
|
|
HTMLDocument_queryCommandIndeterm,
|
|
|
|
HTMLDocument_queryCommandText,
|
|
|
|
HTMLDocument_queryCommandValue,
|
|
|
|
HTMLDocument_execCommand,
|
|
|
|
HTMLDocument_execCommandShowHelp,
|
|
|
|
HTMLDocument_createElement,
|
|
|
|
HTMLDocument_put_onhelp,
|
|
|
|
HTMLDocument_get_onhelp,
|
|
|
|
HTMLDocument_put_onclick,
|
|
|
|
HTMLDocument_get_onclick,
|
|
|
|
HTMLDocument_put_ondblclick,
|
|
|
|
HTMLDocument_get_ondblclick,
|
|
|
|
HTMLDocument_put_onkeyup,
|
|
|
|
HTMLDocument_get_onkeyup,
|
|
|
|
HTMLDocument_put_onkeydown,
|
|
|
|
HTMLDocument_get_onkeydown,
|
|
|
|
HTMLDocument_put_onkeypress,
|
|
|
|
HTMLDocument_get_onkeypress,
|
|
|
|
HTMLDocument_put_onmouseup,
|
|
|
|
HTMLDocument_get_onmouseup,
|
|
|
|
HTMLDocument_put_onmousedown,
|
|
|
|
HTMLDocument_get_onmousedown,
|
|
|
|
HTMLDocument_put_onmousemove,
|
|
|
|
HTMLDocument_get_onmousemove,
|
|
|
|
HTMLDocument_put_onmouseout,
|
|
|
|
HTMLDocument_get_onmouseout,
|
|
|
|
HTMLDocument_put_onmouseover,
|
|
|
|
HTMLDocument_get_onmouseover,
|
|
|
|
HTMLDocument_put_onreadystatechange,
|
|
|
|
HTMLDocument_get_onreadystatechange,
|
|
|
|
HTMLDocument_put_onafterupdate,
|
|
|
|
HTMLDocument_get_onafterupdate,
|
|
|
|
HTMLDocument_put_onrowexit,
|
|
|
|
HTMLDocument_get_onrowexit,
|
|
|
|
HTMLDocument_put_onrowenter,
|
|
|
|
HTMLDocument_get_onrowenter,
|
|
|
|
HTMLDocument_put_ondragstart,
|
|
|
|
HTMLDocument_get_ondragstart,
|
|
|
|
HTMLDocument_put_onselectstart,
|
|
|
|
HTMLDocument_get_onselectstart,
|
|
|
|
HTMLDocument_elementFromPoint,
|
|
|
|
HTMLDocument_get_parentWindow,
|
|
|
|
HTMLDocument_get_styleSheets,
|
|
|
|
HTMLDocument_put_onbeforeupdate,
|
|
|
|
HTMLDocument_get_onbeforeupdate,
|
|
|
|
HTMLDocument_put_onerrorupdate,
|
|
|
|
HTMLDocument_get_onerrorupdate,
|
|
|
|
HTMLDocument_toString,
|
|
|
|
HTMLDocument_createStyleSheet
|
|
|
|
};
|
|
|
|
|
2010-01-18 16:27:14 +00:00
|
|
|
static void HTMLDocument_on_advise(IUnknown *iface, cp_static_data_t *cp)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IHTMLDocument2((IHTMLDocument2*)iface);
|
2010-01-18 16:27:14 +00:00
|
|
|
|
|
|
|
if(This->window)
|
2013-05-19 21:21:20 +00:00
|
|
|
update_cp_events(This->window->base.inner_window, &This->doc_node->node.event_target, cp, This->doc_node->node.nsnode);
|
2010-01-18 16:27:14 +00:00
|
|
|
}
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
static inline HTMLDocument *impl_from_ISupportErrorInfo(ISupportErrorInfo *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLDocument, ISupportErrorInfo_iface);
|
|
|
|
}
|
2009-02-04 14:35:06 +00:00
|
|
|
|
|
|
|
static HRESULT WINAPI SupportErrorInfo_QueryInterface(ISupportErrorInfo *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_ISupportErrorInfo(iface);
|
|
|
|
return htmldoc_query_interface(This, riid, ppv);
|
2009-02-04 14:35:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI SupportErrorInfo_AddRef(ISupportErrorInfo *iface)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_ISupportErrorInfo(iface);
|
|
|
|
return htmldoc_addref(This);
|
2009-02-04 14:35:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI SupportErrorInfo_Release(ISupportErrorInfo *iface)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_ISupportErrorInfo(iface);
|
|
|
|
return htmldoc_release(This);
|
2009-02-04 14:35:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI SupportErrorInfo_InterfaceSupportsErrorInfo(ISupportErrorInfo *iface, REFIID riid)
|
|
|
|
{
|
|
|
|
FIXME("(%p)->(%s)\n", iface, debugstr_guid(riid));
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const ISupportErrorInfoVtbl SupportErrorInfoVtbl = {
|
|
|
|
SupportErrorInfo_QueryInterface,
|
|
|
|
SupportErrorInfo_AddRef,
|
|
|
|
SupportErrorInfo_Release,
|
|
|
|
SupportErrorInfo_InterfaceSupportsErrorInfo
|
|
|
|
};
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
static inline HTMLDocument *impl_from_IDispatchEx(IDispatchEx *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLDocument, IDispatchEx_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT dispid_from_elem_name(HTMLDocumentNode *This, BSTR name, DISPID *dispid)
|
|
|
|
{
|
|
|
|
nsIDOMNodeList *node_list;
|
|
|
|
nsAString name_str;
|
|
|
|
UINT32 len;
|
|
|
|
unsigned i;
|
|
|
|
nsresult nsres;
|
|
|
|
|
|
|
|
if(!This->nsdoc)
|
|
|
|
return DISP_E_UNKNOWNNAME;
|
|
|
|
|
|
|
|
nsAString_InitDepend(&name_str, name);
|
|
|
|
nsres = nsIDOMHTMLDocument_GetElementsByName(This->nsdoc, &name_str, &node_list);
|
|
|
|
nsAString_Finish(&name_str);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
nsres = nsIDOMNodeList_GetLength(node_list, &len);
|
|
|
|
nsIDOMNodeList_Release(node_list);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
if(!len)
|
|
|
|
return DISP_E_UNKNOWNNAME;
|
|
|
|
|
|
|
|
for(i=0; i < This->elem_vars_cnt; i++) {
|
|
|
|
if(!strcmpW(name, This->elem_vars[i])) {
|
|
|
|
*dispid = MSHTML_DISPID_CUSTOM_MIN+i;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(This->elem_vars_cnt == This->elem_vars_size) {
|
|
|
|
WCHAR **new_vars;
|
|
|
|
|
|
|
|
if(This->elem_vars_size) {
|
|
|
|
new_vars = heap_realloc(This->elem_vars, This->elem_vars_size*2*sizeof(WCHAR*));
|
|
|
|
if(!new_vars)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
This->elem_vars_size *= 2;
|
|
|
|
}else {
|
|
|
|
new_vars = heap_alloc(16*sizeof(WCHAR*));
|
|
|
|
if(!new_vars)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
This->elem_vars_size = 16;
|
|
|
|
}
|
|
|
|
|
|
|
|
This->elem_vars = new_vars;
|
|
|
|
}
|
|
|
|
|
|
|
|
This->elem_vars[This->elem_vars_cnt] = heap_strdupW(name);
|
|
|
|
if(!This->elem_vars[This->elem_vars_cnt])
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
*dispid = MSHTML_DISPID_CUSTOM_MIN+This->elem_vars_cnt++;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2008-07-08 16:39:29 +00:00
|
|
|
|
|
|
|
static HRESULT WINAPI DocDispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IDispatchEx(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
return htmldoc_query_interface(This, riid, ppv);
|
2008-07-08 16:39:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI DocDispatchEx_AddRef(IDispatchEx *iface)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IDispatchEx(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
return htmldoc_addref(This);
|
2008-07-08 16:39:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI DocDispatchEx_Release(IDispatchEx *iface)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IDispatchEx(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
return htmldoc_release(This);
|
2008-07-08 16:39:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocDispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IDispatchEx(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
return IDispatchEx_GetTypeInfoCount(This->dispex, pctinfo);
|
2008-07-08 16:39:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocDispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo,
|
|
|
|
LCID lcid, ITypeInfo **ppTInfo)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IDispatchEx(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
return IDispatchEx_GetTypeInfo(This->dispex, iTInfo, lcid, ppTInfo);
|
2008-07-08 16:39:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocDispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid,
|
|
|
|
LPOLESTR *rgszNames, UINT cNames,
|
|
|
|
LCID lcid, DISPID *rgDispId)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IDispatchEx(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
return IDispatchEx_GetIDsOfNames(This->dispex, riid, rgszNames, cNames, lcid, rgDispId);
|
2008-07-08 16:39:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocDispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember,
|
|
|
|
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
|
|
|
|
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IDispatchEx(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
|
|
|
|
TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
|
|
|
|
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
|
|
|
|
|
|
|
|
switch(dispIdMember) {
|
|
|
|
case DISPID_READYSTATE:
|
|
|
|
TRACE("DISPID_READYSTATE\n");
|
|
|
|
|
|
|
|
if(!(wFlags & DISPATCH_PROPERTYGET))
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
V_VT(pVarResult) = VT_I4;
|
2009-11-15 23:44:20 +00:00
|
|
|
V_I4(pVarResult) = This->window->readystate;
|
2008-07-08 16:39:29 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
return IDispatchEx_Invoke(This->dispex, dispIdMember, riid, lcid, wFlags, pDispParams,
|
2008-07-08 16:39:29 +00:00
|
|
|
pVarResult, pExcepInfo, puArgErr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocDispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IDispatchEx(iface);
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IDispatchEx_GetDispID(This->dispex, bstrName, grfdex, pid);
|
|
|
|
if(hres != DISP_E_UNKNOWNNAME)
|
|
|
|
return hres;
|
2008-07-08 16:39:29 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
return dispid_from_elem_name(This->doc_node, bstrName, pid);
|
2008-07-08 16:39:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocDispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp,
|
|
|
|
VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IDispatchEx(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
|
2010-03-21 15:12:30 +00:00
|
|
|
if(This->window && id == DISPID_IHTMLDOCUMENT2_LOCATION && (wFlags & DISPATCH_PROPERTYPUT))
|
2013-05-19 21:21:20 +00:00
|
|
|
return IDispatchEx_InvokeEx(&This->window->base.IDispatchEx_iface, DISPID_IHTMLWINDOW2_LOCATION,
|
|
|
|
lcid, wFlags, pdp, pvarRes, pei, pspCaller);
|
2010-03-21 15:12:30 +00:00
|
|
|
|
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
return IDispatchEx_InvokeEx(This->dispex, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller);
|
2008-07-08 16:39:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocDispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IDispatchEx(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
return IDispatchEx_DeleteMemberByName(This->dispex, bstrName, grfdex);
|
2008-07-08 16:39:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocDispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IDispatchEx(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
return IDispatchEx_DeleteMemberByDispID(This->dispex, id);
|
2008-07-08 16:39:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocDispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IDispatchEx(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
return IDispatchEx_GetMemberProperties(This->dispex, id, grfdexFetch, pgrfdex);
|
2008-07-08 16:39:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocDispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IDispatchEx(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
return IDispatchEx_GetMemberName(This->dispex, id, pbstrName);
|
2008-07-08 16:39:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocDispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IDispatchEx(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
return IDispatchEx_GetNextDispID(This->dispex, grfdex, id, pid);
|
2008-07-08 16:39:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI DocDispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocument *This = impl_from_IDispatchEx(iface);
|
2008-07-08 16:39:29 +00:00
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
return IDispatchEx_GetNameSpaceParent(This->dispex, ppunk);
|
2008-07-08 16:39:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const IDispatchExVtbl DocDispatchExVtbl = {
|
|
|
|
DocDispatchEx_QueryInterface,
|
|
|
|
DocDispatchEx_AddRef,
|
|
|
|
DocDispatchEx_Release,
|
|
|
|
DocDispatchEx_GetTypeInfoCount,
|
|
|
|
DocDispatchEx_GetTypeInfo,
|
|
|
|
DocDispatchEx_GetIDsOfNames,
|
|
|
|
DocDispatchEx_Invoke,
|
|
|
|
DocDispatchEx_GetDispID,
|
|
|
|
DocDispatchEx_InvokeEx,
|
|
|
|
DocDispatchEx_DeleteMemberByName,
|
|
|
|
DocDispatchEx_DeleteMemberByDispID,
|
|
|
|
DocDispatchEx_GetMemberProperties,
|
|
|
|
DocDispatchEx_GetMemberName,
|
|
|
|
DocDispatchEx_GetNextDispID,
|
|
|
|
DocDispatchEx_GetNameSpaceParent
|
|
|
|
};
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
static inline HTMLDocument *impl_from_IProvideClassInfo(IProvideClassInfo *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLDocument, IProvideClassInfo_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ProvideClassInfo_QueryInterface(IProvideClassInfo *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
HTMLDocument *This = impl_from_IProvideClassInfo(iface);
|
|
|
|
return htmldoc_query_interface(This, riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ProvideClassInfo_AddRef(IProvideClassInfo *iface)
|
|
|
|
{
|
|
|
|
HTMLDocument *This = impl_from_IProvideClassInfo(iface);
|
|
|
|
return htmldoc_addref(This);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ProvideClassInfo_Release(IProvideClassInfo *iface)
|
|
|
|
{
|
|
|
|
HTMLDocument *This = impl_from_IProvideClassInfo(iface);
|
|
|
|
return htmldoc_release(This);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ProvideClassInfo_GetClassInfo(IProvideClassInfo* iface,
|
|
|
|
ITypeInfo **ppTI)
|
|
|
|
{
|
|
|
|
HTMLDocument *This = impl_from_IProvideClassInfo(iface);
|
|
|
|
TRACE("(%p)->(%p)\n", This, ppTI);
|
|
|
|
return get_htmldoc_classinfo(ppTI);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IProvideClassInfoVtbl ProvideClassInfoVtbl = {
|
|
|
|
ProvideClassInfo_QueryInterface,
|
|
|
|
ProvideClassInfo_AddRef,
|
|
|
|
ProvideClassInfo_Release,
|
|
|
|
ProvideClassInfo_GetClassInfo
|
|
|
|
};
|
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv)
|
2009-02-04 14:35:06 +00:00
|
|
|
{
|
2009-10-20 19:28:02 +00:00
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_IUnknown, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IUnknown, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IHTMLDocument2_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IDispatch, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IDispatchEx_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IDispatchEx, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IDispatchEx, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IDispatchEx_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IHTMLDocument, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IHTMLDocument, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IHTMLDocument2_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IHTMLDocument2, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IHTMLDocument2, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IHTMLDocument2_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IHTMLDocument3, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IHTMLDocument3, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IHTMLDocument3_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IHTMLDocument4, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IHTMLDocument4, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IHTMLDocument4_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IHTMLDocument5, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IHTMLDocument5, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IHTMLDocument5_iface;
|
2009-11-15 23:44:20 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IHTMLDocument6, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IHTMLDocument6, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IHTMLDocument6_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IPersist, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IPersist, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IPersistFile_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IPersistMoniker, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IPersistMoniker, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IPersistMoniker_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IPersistFile, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IPersistFile, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IPersistFile_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IMonikerProp, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IMonikerProp, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IMonikerProp_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IOleObject, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IOleObject, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IOleObject_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IOleDocument, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IOleDocument, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IOleDocument_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IOleDocumentView, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IOleDocumentView, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IOleDocumentView_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IOleInPlaceActiveObject, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IOleInPlaceActiveObject_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IViewObject, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IViewObject, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IViewObjectEx_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IViewObject2, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IViewObject2, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IViewObjectEx_iface;
|
2010-01-18 16:27:14 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IViewObjectEx, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IViewObjectEx, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IViewObjectEx_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IOleWindow, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IOleWindow, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IOleInPlaceActiveObject_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IOleInPlaceObject, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IOleInPlaceObject, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IOleInPlaceObjectWindowless_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IOleInPlaceObjectWindowless, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IOleInPlaceObjectWindowless_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IServiceProvider, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IServiceProvider_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IOleCommandTarget, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IOleCommandTarget_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IOleControl, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IOleControl, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IOleControl_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IHlinkTarget, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IHlinkTarget, %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IHlinkTarget_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->cp_container.IConnectionPointContainer_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IPersistStreamInit, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IPersistStreamInit_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&DIID_DispHTMLDocument, riid)) {
|
|
|
|
TRACE("(%p)->(DIID_DispHTMLDocument %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IHTMLDocument2_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_ISupportErrorInfo, riid)) {
|
|
|
|
TRACE("(%p)->(IID_ISupportErrorInfo %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->ISupportErrorInfo_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IPersistHistory, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IPersistHistory %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IPersistHistory_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(IsEqualGUID(&CLSID_CMarkup, riid)) {
|
|
|
|
FIXME("(%p)->(CLSID_CMarkup %p)\n", This, ppv);
|
|
|
|
*ppv = NULL;
|
|
|
|
}else if(IsEqualGUID(&IID_IRunnableObject, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This, ppv);
|
|
|
|
*ppv = NULL;
|
|
|
|
}else if(IsEqualGUID(&IID_IPersistPropertyBag, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This, ppv);
|
|
|
|
*ppv = NULL;
|
|
|
|
}else if(IsEqualGUID(&IID_IMarshal, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IMarshal %p) returning NULL\n", This, ppv);
|
|
|
|
*ppv = NULL;
|
2010-03-02 14:08:15 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IExternalConnection, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IExternalConnection %p) returning NULL\n", This, ppv);
|
|
|
|
*ppv = NULL;
|
2010-03-06 11:42:03 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IStdMarshalInfo, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IStdMarshalInfo %p) returning NULL\n", This, ppv);
|
|
|
|
*ppv = NULL;
|
2010-01-18 16:27:14 +00:00
|
|
|
}else if(IsEqualGUID(&IID_IObjectWithSite, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IObjectWithSite %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IObjectWithSite_iface;
|
|
|
|
}else if(IsEqualGUID(&IID_IOleContainer, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IOleContainer %p)\n", This, ppv);
|
|
|
|
*ppv = &This->IOleContainer_iface;
|
|
|
|
}else if(IsEqualGUID(&IID_IObjectSafety, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IObjectSafety %p)\n", This, ppv);
|
|
|
|
*ppv = &This->IObjectSafety_iface;
|
|
|
|
}else if(IsEqualGUID(&IID_IProvideClassInfo, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IProvideClassInfo, %p)\n", This, ppv);
|
|
|
|
*ppv = &This->IProvideClassInfo_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else {
|
|
|
|
return FALSE;
|
|
|
|
}
|
2009-02-04 14:35:06 +00:00
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
if(*ppv)
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-01-18 16:27:14 +00:00
|
|
|
static cp_static_data_t HTMLDocumentEvents_data = { HTMLDocumentEvents_tid, HTMLDocument_on_advise };
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
static const cpc_entry_t HTMLDocument_cpc[] = {
|
|
|
|
{&IID_IDispatch, &HTMLDocumentEvents_data},
|
|
|
|
{&IID_IPropertyNotifySink},
|
|
|
|
{&DIID_HTMLDocumentEvents, &HTMLDocumentEvents_data},
|
|
|
|
{&DIID_HTMLDocumentEvents2},
|
|
|
|
{NULL}
|
|
|
|
};
|
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
static void init_doc(HTMLDocument *doc, IUnknown *unk_impl, IDispatchEx *dispex)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
doc->IHTMLDocument2_iface.lpVtbl = &HTMLDocumentVtbl;
|
|
|
|
doc->IDispatchEx_iface.lpVtbl = &DocDispatchExVtbl;
|
|
|
|
doc->ISupportErrorInfo_iface.lpVtbl = &SupportErrorInfoVtbl;
|
|
|
|
doc->IProvideClassInfo_iface.lpVtbl = &ProvideClassInfoVtbl;
|
2009-02-04 14:35:06 +00:00
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
doc->unk_impl = unk_impl;
|
|
|
|
doc->dispex = dispex;
|
2009-11-15 23:44:20 +00:00
|
|
|
doc->task_magic = get_task_target_magic();
|
2009-02-04 14:35:06 +00:00
|
|
|
|
|
|
|
HTMLDocument_HTMLDocument3_Init(doc);
|
|
|
|
HTMLDocument_HTMLDocument5_Init(doc);
|
|
|
|
HTMLDocument_Persist_Init(doc);
|
|
|
|
HTMLDocument_OleCmd_Init(doc);
|
|
|
|
HTMLDocument_OleObj_Init(doc);
|
|
|
|
HTMLDocument_View_Init(doc);
|
|
|
|
HTMLDocument_Window_Init(doc);
|
|
|
|
HTMLDocument_Service_Init(doc);
|
|
|
|
HTMLDocument_Hlink_Init(doc);
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
ConnectionPointContainer_Init(&doc->cp_container, (IUnknown*)&doc->IHTMLDocument2_iface, HTMLDocument_cpc);
|
2009-10-20 19:28:02 +00:00
|
|
|
}
|
2009-02-04 14:35:06 +00:00
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
static void destroy_htmldoc(HTMLDocument *This)
|
|
|
|
{
|
2009-11-15 23:44:20 +00:00
|
|
|
remove_target_tasks(This->task_magic);
|
2009-02-04 14:35:06 +00:00
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
ConnectionPointContainer_Destroy(&This->cp_container);
|
|
|
|
}
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
static inline HTMLDocumentNode *impl_from_HTMLDOMNode(HTMLDOMNode *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLDocumentNode, node);
|
|
|
|
}
|
2009-10-20 19:28:02 +00:00
|
|
|
|
|
|
|
static HRESULT HTMLDocumentNode_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
|
2009-10-20 19:28:02 +00:00
|
|
|
|
|
|
|
if(htmldoc_qi(&This->basedoc, riid, ppv))
|
|
|
|
return *ppv ? S_OK : E_NOINTERFACE;
|
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_IInternetHostSecurityManager, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IInternetHostSecurityManager %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->IInternetHostSecurityManager_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else {
|
|
|
|
return HTMLDOMNode_QI(&This->node, riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
2009-02-04 14:35:06 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
static void HTMLDocumentNode_destructor(HTMLDOMNode *iface)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
for(i=0; i < This->elem_vars_cnt; i++)
|
|
|
|
heap_free(This->elem_vars[i]);
|
|
|
|
heap_free(This->elem_vars);
|
2009-10-20 19:28:02 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
detach_events(This);
|
2010-01-18 16:27:14 +00:00
|
|
|
if(This->body_event_target)
|
|
|
|
release_event_target(This->body_event_target);
|
|
|
|
if(This->catmgr)
|
|
|
|
ICatInformation_Release(This->catmgr);
|
2009-10-20 19:28:02 +00:00
|
|
|
|
|
|
|
detach_selection(This);
|
|
|
|
detach_ranges(This);
|
2013-05-19 21:21:20 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
2009-11-15 23:44:20 +00:00
|
|
|
|
|
|
|
if(This->nsdoc) {
|
2013-05-19 21:21:20 +00:00
|
|
|
assert(!This->window);
|
|
|
|
release_document_mutation(This);
|
2009-11-15 23:44:20 +00:00
|
|
|
nsIDOMHTMLDocument_Release(This->nsdoc);
|
2013-05-19 21:21:20 +00:00
|
|
|
}else if(This->window) {
|
|
|
|
/* document fragments own reference to inner window */
|
|
|
|
IHTMLWindow2_Release(&This->window->base.IHTMLWindow2_iface);
|
|
|
|
This->window = NULL;
|
2009-11-15 23:44:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
heap_free(This->event_vector);
|
2009-10-20 19:28:02 +00:00
|
|
|
destroy_htmldoc(&This->basedoc);
|
|
|
|
}
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
static HRESULT HTMLDocumentNode_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
|
|
|
|
{
|
|
|
|
HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
|
|
|
|
FIXME("%p\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void HTMLDocumentNode_traverse(HTMLDOMNode *iface, nsCycleCollectionTraversalCallback *cb)
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
release_document_mutation(This);
|
|
|
|
This->nsdoc = NULL;
|
|
|
|
nsIDOMHTMLDocument_Release(nsdoc);
|
|
|
|
This->window = NULL;
|
|
|
|
}
|
|
|
|
}
|
2009-10-20 19:28:02 +00:00
|
|
|
|
|
|
|
static const NodeImplVtbl HTMLDocumentNodeImplVtbl = {
|
|
|
|
HTMLDocumentNode_QI,
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocumentNode_destructor,
|
|
|
|
HTMLDocument_cpc,
|
|
|
|
HTMLDocumentNode_clone,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
HTMLDocumentNode_traverse,
|
|
|
|
HTMLDocumentNode_unlink
|
|
|
|
};
|
|
|
|
|
|
|
|
static HRESULT HTMLDocumentFragment_clone(HTMLDOMNode *iface, nsIDOMNode *nsnode, HTMLDOMNode **ret)
|
|
|
|
{
|
|
|
|
HTMLDocumentNode *This = impl_from_HTMLDOMNode(iface);
|
|
|
|
HTMLDocumentNode *new_node;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = create_document_fragment(nsnode, This->node.doc, &new_node);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
*ret = &new_node->node;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline HTMLDocumentNode *impl_from_DispatchEx(DispatchEx *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLDocumentNode, node.dispex);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT HTMLDocumentNode_invoke(DispatchEx *dispex, DISPID id, LCID lcid, WORD flags, DISPPARAMS *params,
|
|
|
|
VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
|
|
|
|
{
|
|
|
|
HTMLDocumentNode *This = impl_from_DispatchEx(dispex);
|
|
|
|
nsIDOMNodeList *node_list;
|
|
|
|
nsAString name_str;
|
|
|
|
nsIDOMNode *nsnode;
|
|
|
|
HTMLDOMNode *node;
|
|
|
|
unsigned i;
|
|
|
|
nsresult nsres;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
if(flags != DISPATCH_PROPERTYGET && flags != (DISPATCH_METHOD|DISPATCH_PROPERTYGET)) {
|
|
|
|
FIXME("unsupported flags %x\n", flags);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
i = id - MSHTML_DISPID_CUSTOM_MIN;
|
|
|
|
|
|
|
|
if(!This->nsdoc || i >= This->elem_vars_cnt)
|
|
|
|
return DISP_E_UNKNOWNNAME;
|
|
|
|
|
|
|
|
nsAString_InitDepend(&name_str, This->elem_vars[i]);
|
|
|
|
nsres = nsIDOMHTMLDocument_GetElementsByName(This->nsdoc, &name_str, &node_list);
|
|
|
|
nsAString_Finish(&name_str);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
nsres = nsIDOMNodeList_Item(node_list, 0, &nsnode);
|
|
|
|
nsIDOMNodeList_Release(node_list);
|
|
|
|
if(NS_FAILED(nsres) || !nsnode)
|
|
|
|
return DISP_E_UNKNOWNNAME;
|
|
|
|
|
|
|
|
hres = get_node(This, nsnode, TRUE, &node);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
|
|
|
|
V_VT(res) = VT_DISPATCH;
|
|
|
|
V_DISPATCH(res) = (IDispatch*)&node->IHTMLDOMNode_iface;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static const dispex_static_data_vtbl_t HTMLDocumentNode_dispex_vtbl = {
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
HTMLDocumentNode_invoke,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
static const NodeImplVtbl HTMLDocumentFragmentImplVtbl = {
|
|
|
|
HTMLDocumentNode_QI,
|
|
|
|
HTMLDocumentNode_destructor,
|
|
|
|
HTMLDocument_cpc,
|
|
|
|
HTMLDocumentFragment_clone
|
2009-10-20 19:28:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const tid_t HTMLDocumentNode_iface_tids[] = {
|
|
|
|
IHTMLDOMNode_tid,
|
|
|
|
IHTMLDOMNode2_tid,
|
|
|
|
IHTMLDocument2_tid,
|
|
|
|
IHTMLDocument3_tid,
|
|
|
|
IHTMLDocument4_tid,
|
|
|
|
IHTMLDocument5_tid,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
static dispex_static_data_t HTMLDocumentNode_dispex = {
|
2013-05-19 21:21:20 +00:00
|
|
|
&HTMLDocumentNode_dispex_vtbl,
|
2009-10-20 19:28:02 +00:00
|
|
|
DispHTMLDocument_tid,
|
|
|
|
NULL,
|
|
|
|
HTMLDocumentNode_iface_tids
|
|
|
|
};
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLInnerWindow *window)
|
2008-04-11 12:45:31 +00:00
|
|
|
{
|
2009-10-20 19:28:02 +00:00
|
|
|
HTMLDocumentNode *doc;
|
2008-04-11 12:45:31 +00:00
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
doc = heap_alloc_zero(sizeof(HTMLDocumentNode));
|
|
|
|
if(!doc)
|
2013-05-19 21:21:20 +00:00
|
|
|
return NULL;
|
2009-10-20 19:28:02 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
doc->ref = 1;
|
2009-10-20 19:28:02 +00:00
|
|
|
doc->basedoc.doc_node = doc;
|
|
|
|
doc->basedoc.doc_obj = doc_obj;
|
2013-05-19 21:21:20 +00:00
|
|
|
doc->basedoc.window = window->base.outer_window;
|
|
|
|
doc->window = window;
|
2009-10-20 19:28:02 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
init_dispex(&doc->node.dispex, (IUnknown*)&doc->node.IHTMLDOMNode_iface,
|
|
|
|
&HTMLDocumentNode_dispex);
|
|
|
|
init_doc(&doc->basedoc, (IUnknown*)&doc->node.IHTMLDOMNode_iface,
|
|
|
|
&doc->node.dispex.IDispatchEx_iface);
|
2009-10-20 19:28:02 +00:00
|
|
|
HTMLDocumentNode_SecMgr_Init(doc);
|
2008-04-11 12:45:31 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
list_init(&doc->selection_list);
|
|
|
|
list_init(&doc->range_list);
|
|
|
|
list_init(&doc->plugin_hosts);
|
|
|
|
|
|
|
|
return doc;
|
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
if(!doc_obj->basedoc.window || window->base.outer_window == doc_obj->basedoc.window)
|
2010-01-18 16:27:14 +00:00
|
|
|
doc->basedoc.cp_container.forward_container = &doc_obj->basedoc.cp_container;
|
2008-04-11 12:45:31 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDOMNode_Init(doc, &doc->node, (nsIDOMNode*)nsdoc);
|
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
nsIDOMHTMLDocument_AddRef(nsdoc);
|
|
|
|
doc->nsdoc = nsdoc;
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
nsres = nsIDOMHTMLDocument_QueryInterface(nsdoc, &IID_nsIDOMNodeSelector, (void**)&doc->nsnode_selector);
|
|
|
|
assert(nsres == NS_OK);
|
|
|
|
|
|
|
|
init_document_mutation(doc);
|
|
|
|
doc_init_events(doc);
|
2009-10-20 19:28:02 +00:00
|
|
|
|
|
|
|
doc->node.vtbl = &HTMLDocumentNodeImplVtbl;
|
2010-01-18 16:27:14 +00:00
|
|
|
doc->node.cp_container = &doc->basedoc.cp_container;
|
2009-10-20 19:28:02 +00:00
|
|
|
|
2009-02-04 14:35:06 +00:00
|
|
|
*ret = doc;
|
|
|
|
return S_OK;
|
|
|
|
}
|
2008-04-11 12:45:31 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
HRESULT create_document_fragment(nsIDOMNode *nsnode, HTMLDocumentNode *doc_node, HTMLDocumentNode **ret)
|
|
|
|
{
|
|
|
|
HTMLDocumentNode *doc_frag;
|
|
|
|
|
|
|
|
doc_frag = alloc_doc_node(doc_node->basedoc.doc_obj, doc_node->window);
|
|
|
|
if(!doc_frag)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
IHTMLWindow2_AddRef(&doc_frag->window->base.IHTMLWindow2_iface);
|
|
|
|
|
|
|
|
HTMLDOMNode_Init(doc_node, &doc_frag->node, nsnode);
|
|
|
|
doc_frag->node.vtbl = &HTMLDocumentFragmentImplVtbl;
|
|
|
|
doc_frag->node.cp_container = &doc_frag->basedoc.cp_container;
|
|
|
|
|
|
|
|
*ret = doc_frag;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
/**********************************************************
|
|
|
|
* ICustomDoc implementation
|
|
|
|
*/
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
static inline HTMLDocumentObj *impl_from_ICustomDoc(ICustomDoc *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLDocumentObj, ICustomDoc_iface);
|
|
|
|
}
|
2009-10-20 19:28:02 +00:00
|
|
|
|
|
|
|
static HRESULT WINAPI CustomDoc_QueryInterface(ICustomDoc *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocumentObj *This = impl_from_ICustomDoc(iface);
|
2009-10-20 19:28:02 +00:00
|
|
|
|
|
|
|
if(htmldoc_qi(&This->basedoc, riid, ppv))
|
|
|
|
return *ppv ? S_OK : E_NOINTERFACE;
|
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_ICustomDoc, riid)) {
|
|
|
|
TRACE("(%p)->(IID_ICustomDoc %p)\n", This, ppv);
|
2013-05-19 21:21:20 +00:00
|
|
|
*ppv = &This->ICustomDoc_iface;
|
|
|
|
}else if(IsEqualGUID(&IID_ITargetContainer, riid)) {
|
|
|
|
TRACE("(%p)->(IID_ITargetContainer %p)\n", This, ppv);
|
|
|
|
*ppv = &This->ITargetContainer_iface;
|
2009-10-20 19:28:02 +00:00
|
|
|
}else if(dispex_query_interface(&This->dispex, riid, ppv)) {
|
|
|
|
return *ppv ? S_OK : E_NOINTERFACE;
|
|
|
|
}else {
|
|
|
|
FIXME("Unimplemented interface %s\n", debugstr_guid(riid));
|
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI CustomDoc_AddRef(ICustomDoc *iface)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocumentObj *This = impl_from_ICustomDoc(iface);
|
2009-10-20 19:28:02 +00:00
|
|
|
ULONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p) ref = %u\n", This, ref);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocumentObj *This = impl_from_ICustomDoc(iface);
|
2009-10-20 19:28:02 +00:00
|
|
|
ULONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p) ref = %u\n", This, ref);
|
|
|
|
|
|
|
|
if(!ref) {
|
2013-05-19 21:21:20 +00:00
|
|
|
nsIDOMWindowUtils *window_utils = NULL;
|
|
|
|
|
|
|
|
if(This->basedoc.window && This->basedoc.window->nswindow)
|
|
|
|
get_nsinterface((nsISupports*)This->basedoc.window->nswindow, &IID_nsIDOMWindowUtils, (void**)&window_utils);
|
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
if(This->basedoc.doc_node) {
|
|
|
|
This->basedoc.doc_node->basedoc.doc_obj = NULL;
|
2013-05-19 21:21:20 +00:00
|
|
|
htmldoc_release(&This->basedoc.doc_node->basedoc);
|
2009-10-20 19:28:02 +00:00
|
|
|
}
|
|
|
|
if(This->basedoc.window) {
|
|
|
|
This->basedoc.window->doc_obj = NULL;
|
2013-05-19 21:21:20 +00:00
|
|
|
IHTMLWindow2_Release(&This->basedoc.window->base.IHTMLWindow2_iface);
|
2009-10-20 19:28:02 +00:00
|
|
|
}
|
2010-01-18 16:27:14 +00:00
|
|
|
if(This->basedoc.advise_holder)
|
|
|
|
IOleAdviseHolder_Release(This->basedoc.advise_holder);
|
2009-10-20 19:28:02 +00:00
|
|
|
|
2010-03-02 14:08:15 +00:00
|
|
|
if(This->view_sink)
|
|
|
|
IAdviseSink_Release(This->view_sink);
|
2009-10-20 19:28:02 +00:00
|
|
|
if(This->client)
|
2013-05-19 21:21:20 +00:00
|
|
|
IOleObject_SetClientSite(&This->basedoc.IOleObject_iface, NULL);
|
|
|
|
if(This->hostui)
|
|
|
|
ICustomDoc_SetUIHandler(&This->ICustomDoc_iface, NULL);
|
2009-10-20 19:28:02 +00:00
|
|
|
if(This->in_place_active)
|
2013-05-19 21:21:20 +00:00
|
|
|
IOleInPlaceObjectWindowless_InPlaceDeactivate(&This->basedoc.IOleInPlaceObjectWindowless_iface);
|
2009-10-20 19:28:02 +00:00
|
|
|
if(This->ipsite)
|
2013-05-19 21:21:20 +00:00
|
|
|
IOleDocumentView_SetInPlaceSite(&This->basedoc.IOleDocumentView_iface, NULL);
|
2009-10-20 19:28:02 +00:00
|
|
|
if(This->undomgr)
|
|
|
|
IOleUndoManager_Release(This->undomgr);
|
|
|
|
if(This->tooltips_hwnd)
|
|
|
|
DestroyWindow(This->tooltips_hwnd);
|
|
|
|
|
|
|
|
if(This->hwnd)
|
|
|
|
DestroyWindow(This->hwnd);
|
|
|
|
heap_free(This->mime);
|
|
|
|
|
|
|
|
destroy_htmldoc(&This->basedoc);
|
|
|
|
release_dispex(&This->dispex);
|
|
|
|
|
|
|
|
if(This->nscontainer)
|
|
|
|
NSContainer_Release(This->nscontainer);
|
|
|
|
heap_free(This);
|
2013-05-19 21:21:20 +00:00
|
|
|
|
|
|
|
/* Force cycle collection */
|
|
|
|
if(window_utils) {
|
|
|
|
nsIDOMWindowUtils_CycleCollect(window_utils, NULL, 0);
|
|
|
|
nsIDOMWindowUtils_Release(window_utils);
|
|
|
|
}
|
2009-10-20 19:28:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI CustomDoc_SetUIHandler(ICustomDoc *iface, IDocHostUIHandler *pUIHandler)
|
|
|
|
{
|
2013-05-19 21:21:20 +00:00
|
|
|
HTMLDocumentObj *This = impl_from_ICustomDoc(iface);
|
|
|
|
IOleCommandTarget *cmdtrg;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, pUIHandler);
|
|
|
|
|
|
|
|
if(This->custom_hostui && This->hostui == pUIHandler)
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
This->custom_hostui = TRUE;
|
|
|
|
|
|
|
|
if(This->hostui)
|
|
|
|
IDocHostUIHandler_Release(This->hostui);
|
|
|
|
if(pUIHandler)
|
|
|
|
IDocHostUIHandler_AddRef(pUIHandler);
|
|
|
|
This->hostui = pUIHandler;
|
|
|
|
if(!pUIHandler)
|
|
|
|
return S_OK;
|
|
|
|
|
|
|
|
hres = IDocHostUIHandler_QueryInterface(pUIHandler, &IID_IOleCommandTarget, (void**)&cmdtrg);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
FIXME("custom UI handler supports IOleCommandTarget\n");
|
|
|
|
IOleCommandTarget_Release(cmdtrg);
|
|
|
|
}
|
2009-10-20 19:28:02 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
return S_OK;
|
|
|
|
}
|
2009-10-20 19:28:02 +00:00
|
|
|
|
|
|
|
static const ICustomDocVtbl CustomDocVtbl = {
|
|
|
|
CustomDoc_QueryInterface,
|
|
|
|
CustomDoc_AddRef,
|
|
|
|
CustomDoc_Release,
|
|
|
|
CustomDoc_SetUIHandler
|
|
|
|
};
|
|
|
|
|
|
|
|
static const tid_t HTMLDocumentObj_iface_tids[] = {
|
|
|
|
IHTMLDocument2_tid,
|
|
|
|
IHTMLDocument3_tid,
|
|
|
|
IHTMLDocument4_tid,
|
|
|
|
IHTMLDocument5_tid,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
static dispex_static_data_t HTMLDocumentObj_dispex = {
|
|
|
|
NULL,
|
|
|
|
DispHTMLDocument_tid,
|
|
|
|
NULL,
|
|
|
|
HTMLDocumentObj_iface_tids
|
|
|
|
};
|
|
|
|
|
2009-02-04 14:35:06 +00:00
|
|
|
HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
|
|
|
|
{
|
2009-10-20 19:28:02 +00:00
|
|
|
HTMLDocumentObj *doc;
|
2009-02-04 14:35:06 +00:00
|
|
|
nsIDOMWindow *nswindow = NULL;
|
2009-11-15 23:44:20 +00:00
|
|
|
nsresult nsres;
|
2009-02-04 14:35:06 +00:00
|
|
|
HRESULT hres;
|
2008-04-11 12:45:31 +00:00
|
|
|
|
2009-02-04 14:35:06 +00:00
|
|
|
TRACE("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppvObject);
|
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
doc = heap_alloc_zero(sizeof(HTMLDocumentObj));
|
|
|
|
if(!doc)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
init_dispex(&doc->dispex, (IUnknown*)&doc->ICustomDoc_iface, &HTMLDocumentObj_dispex);
|
|
|
|
init_doc(&doc->basedoc, (IUnknown*)&doc->ICustomDoc_iface, &doc->dispex.IDispatchEx_iface);
|
|
|
|
TargetContainer_Init(doc);
|
2009-10-20 19:28:02 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
doc->ICustomDoc_iface.lpVtbl = &CustomDocVtbl;
|
2009-10-20 19:28:02 +00:00
|
|
|
doc->ref = 1;
|
|
|
|
doc->basedoc.doc_obj = doc;
|
2009-02-04 14:35:06 +00:00
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
doc->usermode = UNKNOWN_USERMODE;
|
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
init_binding_ui(doc);
|
|
|
|
|
|
|
|
hres = create_nscontainer(doc, &doc->nscontainer);
|
|
|
|
if(FAILED(hres)) {
|
2009-11-15 23:44:20 +00:00
|
|
|
ERR("Failed to init Gecko, returning CLASS_E_CLASSNOTAVAILABLE\n");
|
|
|
|
htmldoc_release(&doc->basedoc);
|
2013-05-19 21:21:20 +00:00
|
|
|
return hres;
|
2009-11-15 23:44:20 +00:00
|
|
|
}
|
|
|
|
|
2009-10-20 19:28:02 +00:00
|
|
|
hres = htmldoc_query_interface(&doc->basedoc, riid, ppvObject);
|
|
|
|
htmldoc_release(&doc->basedoc);
|
2009-02-04 14:35:06 +00:00
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
2008-04-11 12:45:31 +00:00
|
|
|
|
2009-11-15 23:44:20 +00:00
|
|
|
nsres = nsIWebBrowser_GetContentDOMWindow(doc->nscontainer->webbrowser, &nswindow);
|
|
|
|
if(NS_FAILED(nsres))
|
|
|
|
ERR("GetContentDOMWindow failed: %08x\n", nsres);
|
2009-02-04 14:35:06 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
hres = HTMLOuterWindow_Create(doc, nswindow, NULL /* FIXME */, &doc->basedoc.window);
|
2009-02-04 14:35:06 +00:00
|
|
|
if(nswindow)
|
|
|
|
nsIDOMWindow_Release(nswindow);
|
|
|
|
if(FAILED(hres)) {
|
2013-05-19 21:21:20 +00:00
|
|
|
htmldoc_release(&doc->basedoc);
|
2009-02-04 14:35:06 +00:00
|
|
|
return hres;
|
|
|
|
}
|
2008-04-11 12:45:31 +00:00
|
|
|
|
2013-05-19 21:21:20 +00:00
|
|
|
if(!doc->basedoc.doc_node && doc->basedoc.window->base.inner_window->doc) {
|
|
|
|
doc->basedoc.doc_node = doc->basedoc.window->base.inner_window->doc;
|
2009-11-15 23:44:20 +00:00
|
|
|
htmldoc_addref(&doc->basedoc.doc_node->basedoc);
|
|
|
|
}
|
|
|
|
|
2008-04-11 12:45:31 +00:00
|
|
|
get_thread_hwnd();
|
|
|
|
|
2009-02-04 14:35:06 +00:00
|
|
|
return S_OK;
|
2008-04-11 12:45:31 +00:00
|
|
|
}
|