mshtml: Make HTMLBodyElement child object of HTMLTextContainer.

This commit is contained in:
Jacek Caban 2007-09-15 16:07:52 +02:00 committed by Alexandre Julliard
parent 99d061a041
commit ea52235f8f
3 changed files with 23 additions and 25 deletions

View File

@ -36,7 +36,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml); WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
typedef struct { typedef struct {
HTMLElement element; HTMLTextContainer textcont;
const IHTMLBodyElementVtbl *lpHTMLBodyElementVtbl; const IHTMLBodyElementVtbl *lpHTMLBodyElementVtbl;
@ -83,7 +83,7 @@ static HRESULT WINAPI HTMLBodyElement_QueryInterface(IHTMLBodyElement *iface,
return S_OK; return S_OK;
} }
hres = HTMLElement_QI(&This->element, riid, ppv); hres = HTMLElement_QI(&This->textcont.element, riid, ppv);
if(FAILED(hres)) if(FAILED(hres))
WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
@ -96,7 +96,7 @@ static ULONG WINAPI HTMLBodyElement_AddRef(IHTMLBodyElement *iface)
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
return IHTMLDocument2_AddRef(HTMLDOC(This->element.node.doc)); return IHTMLDocument2_AddRef(HTMLDOC(This->textcont.element.node.doc));
} }
static ULONG WINAPI HTMLBodyElement_Release(IHTMLBodyElement *iface) static ULONG WINAPI HTMLBodyElement_Release(IHTMLBodyElement *iface)
@ -105,7 +105,7 @@ static ULONG WINAPI HTMLBodyElement_Release(IHTMLBodyElement *iface)
TRACE("(%p)\n", This); TRACE("(%p)\n", This);
return IHTMLDocument2_Release(HTMLDOC(This->element.node.doc)); return IHTMLDocument2_Release(HTMLDOC(This->textcont.element.node.doc));
} }
static HRESULT WINAPI HTMLBodyElement_GetTypeInfoCount(IHTMLBodyElement *iface, UINT *pctinfo) static HRESULT WINAPI HTMLBodyElement_GetTypeInfoCount(IHTMLBodyElement *iface, UINT *pctinfo)
@ -407,18 +407,18 @@ static HRESULT WINAPI HTMLBodyElement_createTextRange(IHTMLBodyElement *iface, I
TRACE("(%p)->(%p)\n", This, range); TRACE("(%p)->(%p)\n", This, range);
if(This->element.node.doc->nscontainer) { if(This->textcont.element.node.doc->nscontainer) {
nsIDOMDocument *nsdoc; nsIDOMDocument *nsdoc;
nsIDOMDocumentRange *nsdocrange; nsIDOMDocumentRange *nsdocrange;
nsresult nsres; nsresult nsres;
nsIWebNavigation_GetDocument(This->element.node.doc->nscontainer->navigation, &nsdoc); nsIWebNavigation_GetDocument(This->textcont.element.node.doc->nscontainer->navigation, &nsdoc);
nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMDocumentRange, (void**)&nsdocrange); nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMDocumentRange, (void**)&nsdocrange);
nsIDOMDocument_Release(nsdoc); nsIDOMDocument_Release(nsdoc);
nsres = nsIDOMDocumentRange_CreateRange(nsdocrange, &nsrange); nsres = nsIDOMDocumentRange_CreateRange(nsdocrange, &nsrange);
if(NS_SUCCEEDED(nsres)) { if(NS_SUCCEEDED(nsres)) {
nsres = nsIDOMRange_SelectNodeContents(nsrange, This->element.node.nsnode); nsres = nsIDOMRange_SelectNodeContents(nsrange, This->textcont.element.node.nsnode);
if(NS_FAILED(nsres)) if(NS_FAILED(nsres))
ERR("SelectNodeContents failed: %08x\n", nsres); ERR("SelectNodeContents failed: %08x\n", nsres);
}else { }else {
@ -428,7 +428,7 @@ static HRESULT WINAPI HTMLBodyElement_createTextRange(IHTMLBodyElement *iface, I
nsIDOMDocumentRange_Release(nsdocrange); nsIDOMDocumentRange_Release(nsdocrange);
} }
*range = HTMLTxtRange_Create(This->element.node.doc, nsrange); *range = HTMLTxtRange_Create(This->textcont.element.node.doc, nsrange);
return S_OK; return S_OK;
} }
@ -493,7 +493,7 @@ HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement *nselem)
ret->lpHTMLBodyElementVtbl = &HTMLBodyElementVtbl; ret->lpHTMLBodyElementVtbl = &HTMLBodyElementVtbl;
HTMLTextContainer_Init(&ret->text_container, &ret->element); HTMLTextContainer_Init(&ret->text_container);
ConnectionPoint_Init(&ret->cp_propnotif, CONPTCONT(&ret->cp_container), ConnectionPoint_Init(&ret->cp_propnotif, CONPTCONT(&ret->cp_container),
&IID_IPropertyNotifySink, NULL); &IID_IPropertyNotifySink, NULL);
@ -506,8 +506,8 @@ HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement *nselem)
if(NS_FAILED(nsres)) if(NS_FAILED(nsres))
ERR("Could not get nsDOMHTMLBodyElement: %08x\n", nsres); ERR("Could not get nsDOMHTMLBodyElement: %08x\n", nsres);
ret->element.impl = (IUnknown*)HTMLBODY(ret); ret->textcont.element.impl = (IUnknown*)HTMLBODY(ret);
ret->element.destructor = HTMLBodyElement_destructor; ret->textcont.element.destructor = HTMLBodyElement_destructor;
return &ret->element; return &ret->textcont.element;
} }

View File

@ -40,19 +40,19 @@ static HRESULT WINAPI HTMLTextContainer_QueryInterface(IHTMLTextContainer *iface
REFIID riid, void **ppv) REFIID riid, void **ppv)
{ {
HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface); HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
return IHTMLElement_QueryInterface(HTMLELEM(This->element), riid, ppv); return IHTMLElement_QueryInterface(HTMLELEM(&This->element), riid, ppv);
} }
static ULONG WINAPI HTMLTextContainer_AddRef(IHTMLTextContainer *iface) static ULONG WINAPI HTMLTextContainer_AddRef(IHTMLTextContainer *iface)
{ {
HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface); HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
return IHTMLElement_AddRef(HTMLELEM(This->element)); return IHTMLElement_AddRef(HTMLELEM(&This->element));
} }
static ULONG WINAPI HTMLTextContainer_Release(IHTMLTextContainer *iface) static ULONG WINAPI HTMLTextContainer_Release(IHTMLTextContainer *iface)
{ {
HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface); HTMLTextContainer *This = HTMLTEXTCONT_THIS(iface);
return IHTMLElement_Release(HTMLELEM(This->element)); return IHTMLElement_Release(HTMLELEM(&This->element));
} }
static HRESULT WINAPI HTMLTextContainer_GetTypeInfoCount(IHTMLTextContainer *iface, UINT *pctinfo) static HRESULT WINAPI HTMLTextContainer_GetTypeInfoCount(IHTMLTextContainer *iface, UINT *pctinfo)
@ -107,7 +107,7 @@ static HRESULT WINAPI HTMLTextContainer_get_scrollHeight(IHTMLTextContainer *ifa
TRACE("(%p)->(%p)\n", This, p); TRACE("(%p)->(%p)\n", This, p);
nsres = nsIDOMElement_QueryInterface(This->element->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem); nsres = nsIDOMElement_QueryInterface(This->element.nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
if(NS_SUCCEEDED(nsres)) { if(NS_SUCCEEDED(nsres)) {
nsIDOMNSHTMLElement_GetScrollHeight(nselem, &height); nsIDOMNSHTMLElement_GetScrollHeight(nselem, &height);
nsIDOMNSHTMLElement_Release(nselem); nsIDOMNSHTMLElement_Release(nselem);
@ -130,7 +130,7 @@ static HRESULT WINAPI HTMLTextContainer_get_scrollWidth(IHTMLTextContainer *ifac
TRACE("(%p)->(%p)\n", This, p); TRACE("(%p)->(%p)\n", This, p);
nsres = nsIDOMElement_QueryInterface(This->element->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem); nsres = nsIDOMElement_QueryInterface(This->element.nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
if(NS_SUCCEEDED(nsres)) { if(NS_SUCCEEDED(nsres)) {
nsIDOMNSHTMLElement_GetScrollWidth(nselem, &width); nsIDOMNSHTMLElement_GetScrollWidth(nselem, &width);
nsIDOMNSHTMLElement_Release(nselem); nsIDOMNSHTMLElement_Release(nselem);
@ -152,7 +152,7 @@ static HRESULT WINAPI HTMLTextContainer_put_scrollTop(IHTMLTextContainer *iface,
TRACE("(%p)->(%ld)\n", This, v); TRACE("(%p)->(%ld)\n", This, v);
nsres = nsIDOMHTMLElement_QueryInterface(This->element->nselem, &IID_nsIDOMNSHTMLElement, nsres = nsIDOMHTMLElement_QueryInterface(This->element.nselem, &IID_nsIDOMNSHTMLElement,
(void**)&nselem); (void**)&nselem);
if(NS_SUCCEEDED(nsres)) { if(NS_SUCCEEDED(nsres)) {
nsIDOMNSHTMLElement_SetScrollTop(nselem, v); nsIDOMNSHTMLElement_SetScrollTop(nselem, v);
@ -179,7 +179,7 @@ static HRESULT WINAPI HTMLTextContainer_put_scrollLeft(IHTMLTextContainer *iface
TRACE("(%p)->(%ld)\n", This, v); TRACE("(%p)->(%ld)\n", This, v);
nsres = nsIDOMHTMLElement_QueryInterface(This->element->nselem, &IID_nsIDOMNSHTMLElement, nsres = nsIDOMHTMLElement_QueryInterface(This->element.nselem, &IID_nsIDOMNSHTMLElement,
(void**)&nselem); (void**)&nselem);
if(NS_SUCCEEDED(nsres)) { if(NS_SUCCEEDED(nsres)) {
nsIDOMNSHTMLElement_SetScrollLeft(nselem, v); nsIDOMNSHTMLElement_SetScrollLeft(nselem, v);
@ -233,8 +233,7 @@ static const IHTMLTextContainerVtbl HTMLTextContainerVtbl = {
HTMLTextContainer_get_onscroll HTMLTextContainer_get_onscroll
}; };
void HTMLTextContainer_Init(HTMLTextContainer *This, HTMLElement *elem) void HTMLTextContainer_Init(HTMLTextContainer *This)
{ {
This->lpHTMLTextContainerVtbl = &HTMLTextContainerVtbl; This->lpHTMLTextContainerVtbl = &HTMLTextContainerVtbl;
This->element = elem;
} }

View File

@ -284,9 +284,9 @@ typedef struct {
} HTMLElement; } HTMLElement;
typedef struct { typedef struct {
const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl; HTMLElement element;
HTMLElement *element; const IHTMLTextContainerVtbl *lpHTMLTextContainerVtbl;
} HTMLTextContainer; } HTMLTextContainer;
#define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl) #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl)
@ -423,8 +423,7 @@ HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement*);
HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*); HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*);
void HTMLElement2_Init(HTMLElement*); void HTMLElement2_Init(HTMLElement*);
void HTMLTextContainer_Init(HTMLTextContainer*);
void HTMLTextContainer_Init(HTMLTextContainer*,HTMLElement*);
HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**); HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**);
HRESULT HTMLElement_QI(HTMLElement*,REFIID,void**); HRESULT HTMLElement_QI(HTMLElement*,REFIID,void**);