Commit 8d28f09d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Wine Gecko 0.9.0 release.

parent 03a83c49
......@@ -45,6 +45,7 @@ C_SRCS = \
install.c \
loadopts.c \
main.c \
mutation.c \
navigate.c \
nsembed.c \
nsevents.c \
......
......@@ -548,18 +548,18 @@ static HRESULT WINAPI HTMLElement2_removeFilter(IHTMLElement2 *iface, IUnknown *
static HRESULT WINAPI HTMLElement2_get_clientHeight(IHTMLElement2 *iface, long *p)
{
HTMLElement *This = HTMLELEM2_THIS(iface);
nsIDOMNSHTMLElement *nselem;
nsIDOMNSElement *nselem;
PRInt32 height=0;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
if(NS_SUCCEEDED(nsres)) {
nsIDOMNSHTMLElement_GetClientHeight(nselem, &height);
nsIDOMNSHTMLElement_Release(nselem);
nsIDOMNSElement_GetClientHeight(nselem, &height);
nsIDOMNSElement_Release(nselem);
}else {
ERR("Could not get nsIDOMHTMLNSElement: %08x\n", nsres);
ERR("Could not get nsIDOMNSElement: %08x\n", nsres);
}
*p = height;
......@@ -569,18 +569,18 @@ static HRESULT WINAPI HTMLElement2_get_clientHeight(IHTMLElement2 *iface, long *
static HRESULT WINAPI HTMLElement2_get_clientWidth(IHTMLElement2 *iface, long *p)
{
HTMLElement *This = HTMLELEM2_THIS(iface);
nsIDOMNSHTMLElement *nselem;
nsIDOMNSElement *nselem;
PRInt32 width=0;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
if(NS_SUCCEEDED(nsres)) {
nsIDOMNSHTMLElement_GetClientWidth(nselem, &width);
nsIDOMNSHTMLElement_Release(nselem);
nsIDOMNSElement_GetClientWidth(nselem, &width);
nsIDOMNSElement_Release(nselem);
}else {
ERR("Could not get nsIDOMHTMLNSElement: %08x\n", nsres);
ERR("Could not get nsIDOMNSElement: %08x\n", nsres);
}
*p = width;
......@@ -727,7 +727,7 @@ static HRESULT WINAPI HTMLElement2_createControlRange(IHTMLElement2 *iface, IDis
static HRESULT WINAPI HTMLElement2_get_scrollHeight(IHTMLElement2 *iface, long *p)
{
HTMLElement *This = HTMLELEM2_THIS(iface);
nsIDOMNSHTMLElement *nselem;
nsIDOMNSElement *nselem;
PRInt32 height = 0;
nsresult nsres;
......@@ -735,15 +735,15 @@ static HRESULT WINAPI HTMLElement2_get_scrollHeight(IHTMLElement2 *iface, long *
nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
if(NS_SUCCEEDED(nsres)) {
nsres = nsIDOMNSHTMLElement_GetScrollHeight(nselem, &height);
nsIDOMNSHTMLElement_Release(nselem);
nsres = nsIDOMNSElement_GetScrollHeight(nselem, &height);
nsIDOMNSElement_Release(nselem);
if(NS_FAILED(nsres))
ERR("GetScrollHeight failed: %08x\n", nsres);
}else {
ERR("Could not get nsIDOMNSHTMLElement interface: %08x\n", nsres);
ERR("Could not get nsIDOMNSElement interface: %08x\n", nsres);
}
*p = height;
*p = height == -1 ? 0 : height;
TRACE("*p = %ld\n", *p);
return S_OK;
......@@ -752,20 +752,20 @@ static HRESULT WINAPI HTMLElement2_get_scrollHeight(IHTMLElement2 *iface, long *
static HRESULT WINAPI HTMLElement2_get_scrollWidth(IHTMLElement2 *iface, long *p)
{
HTMLElement *This = HTMLELEM2_THIS(iface);
nsIDOMNSHTMLElement *nselem;
nsIDOMNSElement *nselem;
PRInt32 width = 0;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
if(NS_SUCCEEDED(nsres)) {
nsres = nsIDOMNSHTMLElement_GetScrollWidth(nselem, &width);
nsIDOMNSHTMLElement_Release(nselem);
nsres = nsIDOMNSElement_GetScrollWidth(nselem, &width);
nsIDOMNSElement_Release(nselem);
if(NS_FAILED(nsres))
ERR("GetScrollWidth failed: %08x\n", nsres);
}else {
ERR("Could not get nsIDOMNSHTMLElement interface: %08x\n", nsres);
ERR("Could not get nsIDOMNSElement interface: %08x\n", nsres);
}
*p = width;
......@@ -777,7 +777,7 @@ static HRESULT WINAPI HTMLElement2_get_scrollWidth(IHTMLElement2 *iface, long *p
static HRESULT WINAPI HTMLElement2_put_scrollTop(IHTMLElement2 *iface, long v)
{
HTMLElement *This = HTMLELEM2_THIS(iface);
nsIDOMNSHTMLElement *nselem;
nsIDOMNSElement *nselem;
nsresult nsres;
TRACE("(%p)->(%ld)\n", This, v);
......@@ -787,12 +787,12 @@ static HRESULT WINAPI HTMLElement2_put_scrollTop(IHTMLElement2 *iface, long v)
return E_NOTIMPL;
}
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
if(NS_SUCCEEDED(nsres)) {
nsIDOMNSHTMLElement_SetScrollTop(nselem, v);
nsIDOMNSHTMLElement_Release(nselem);
nsIDOMNSElement_SetScrollTop(nselem, v);
nsIDOMNSElement_Release(nselem);
}else {
ERR("Could not get nsIDOMNSHTMLElement interface: %08x\n", nsres);
ERR("Could not get nsIDOMNSElement interface: %08x\n", nsres);
}
return S_OK;
......@@ -801,20 +801,20 @@ static HRESULT WINAPI HTMLElement2_put_scrollTop(IHTMLElement2 *iface, long v)
static HRESULT WINAPI HTMLElement2_get_scrollTop(IHTMLElement2 *iface, long *p)
{
HTMLElement *This = HTMLELEM2_THIS(iface);
nsIDOMNSHTMLElement *nselem;
nsIDOMNSElement *nselem;
PRInt32 top = 0;
nsresult nsres;
TRACE("(%p)->(%p)\n", This, p);
nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
if(NS_SUCCEEDED(nsres)) {
nsres = nsIDOMNSHTMLElement_GetScrollTop(nselem, &top);
nsIDOMNSHTMLElement_Release(nselem);
nsres = nsIDOMNSElement_GetScrollTop(nselem, &top);
nsIDOMNSElement_Release(nselem);
if(NS_FAILED(nsres))
ERR("GetScrollTop failed: %08x\n", nsres);
}else {
ERR("Could not get nsIDOMNSHTMLElement interface: %08x\n", nsres);
ERR("Could not get nsIDOMNSElement interface: %08x\n", nsres);
}
*p = top;
......@@ -826,7 +826,7 @@ static HRESULT WINAPI HTMLElement2_get_scrollTop(IHTMLElement2 *iface, long *p)
static HRESULT WINAPI HTMLElement2_put_scrollLeft(IHTMLElement2 *iface, long v)
{
HTMLElement *This = HTMLELEM2_THIS(iface);
nsIDOMNSHTMLElement *nselem;
nsIDOMNSElement *nselem;
nsresult nsres;
TRACE("(%p)->(%ld)\n", This, v);
......@@ -836,12 +836,12 @@ static HRESULT WINAPI HTMLElement2_put_scrollLeft(IHTMLElement2 *iface, long v)
return E_NOTIMPL;
}
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
nsres = nsIDOMElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
if(NS_SUCCEEDED(nsres)) {
nsIDOMNSHTMLElement_SetScrollLeft(nselem, v);
nsIDOMNSHTMLElement_Release(nselem);
nsIDOMNSElement_SetScrollLeft(nselem, v);
nsIDOMNSElement_Release(nselem);
}else {
ERR("Could not get nsIDOMNSHTMLElement interface: %08x\n", nsres);
ERR("Could not get nsIDOMNSElement interface: %08x\n", nsres);
}
return S_OK;
......@@ -850,7 +850,7 @@ static HRESULT WINAPI HTMLElement2_put_scrollLeft(IHTMLElement2 *iface, long v)
static HRESULT WINAPI HTMLElement2_get_scrollLeft(IHTMLElement2 *iface, long *p)
{
HTMLElement *This = HTMLELEM2_THIS(iface);
nsIDOMNSHTMLElement *nselem;
nsIDOMNSElement *nselem;
PRInt32 left = 0;
nsresult nsres;
......@@ -865,11 +865,11 @@ static HRESULT WINAPI HTMLElement2_get_scrollLeft(IHTMLElement2 *iface, long *p)
return E_NOTIMPL;
}
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
nsres = nsIDOMHTMLElement_QueryInterface(This->nselem, &IID_nsIDOMNSElement, (void**)&nselem);
if(NS_SUCCEEDED(nsres))
{
nsres = nsIDOMNSHTMLElement_GetScrollLeft(nselem, &left);
nsIDOMNSHTMLElement_Release(nselem);
nsres = nsIDOMNSElement_GetScrollLeft(nselem, &left);
nsIDOMNSElement_Release(nselem);
if(NS_FAILED(nsres))
left = 0;
}
......
......@@ -296,6 +296,13 @@ typedef struct {
NSContainer *This;
} nsEventListener;
typedef struct _mutation_queue_t {
DWORD type;
nsISupports *nsiface;
struct _mutation_queue_t *next;
} mutation_queue_t;
struct NSContainer {
const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
......@@ -306,6 +313,10 @@ struct NSContainer {
const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
const nsIDocumentObserverVtbl *lpDocumentObserverVtbl;
const nsIRunnableVtbl *lpRunnableVtbl;
nsEventListener blur_listener;
nsEventListener focus_listener;
nsEventListener keypress_listener;
......@@ -330,6 +341,9 @@ struct NSContainer {
HWND hwnd;
mutation_queue_t *mutation_queue;
mutation_queue_t *mutation_queue_tail;
nsChannelBSC *bscallback; /* hack */
HWND reset_focus; /* hack */
......@@ -434,6 +448,10 @@ typedef struct {
#define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
#define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
#define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpDocumentObserverVtbl)
#define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpRunnableVtbl)
#define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
#define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
#define NSUPCHANNEL(x) ((nsIUploadChannel*) &(x)->lpUploadChannelVtbl)
......@@ -487,6 +505,10 @@ void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
NSContainer *NSContainer_Create(HTMLDocument*,NSContainer*);
void NSContainer_Release(NSContainer*);
void init_mutation(NSContainer*);
void set_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
BOOL handle_insert_comment(HTMLDocument *doc, const PRUnichar *comment);
void HTMLDocument_LockContainer(HTMLDocument*,BOOL);
void show_context_menu(HTMLDocument*,DWORD,POINT*,IDispatch*);
void notif_focus(HTMLDocument*);
......
......@@ -661,7 +661,7 @@ static void nsnode_to_nsstring_rec(nsIContentSerializer *serializer, nsIDOMNode
case ELEMENT_NODE: {
nsIDOMElement *nselem;
nsIDOMNode_QueryInterface(nsnode, &IID_nsIDOMElement, (void**)&nselem);
nsIContentSerializer_AppendElementStart(serializer, nselem, has_children, str);
nsIContentSerializer_AppendElementStart(serializer, nselem, nselem, str);
nsIDOMElement_Release(nselem);
break;
}
......@@ -733,7 +733,7 @@ void nsnode_to_nsstring(nsIDOMNode *nsdoc, nsAString *str)
return;
}
nsres = nsIContentSerializer_Init(serializer, 0, 100, NULL, FALSE);
nsres = nsIContentSerializer_Init(serializer, 0, 100, NULL, FALSE, FALSE /* FIXME */);
if(NS_FAILED(nsres))
ERR("Init failed: %08x\n", nsres);
......@@ -816,7 +816,8 @@ void set_ns_editmode(NSContainer *This)
return;
}
nsres = nsIEditingSession_MakeWindowEditable(editing_session, dom_window, NULL, FALSE);
nsres = nsIEditingSession_MakeWindowEditable(editing_session, dom_window,
NULL, FALSE, TRUE, TRUE);
nsIEditingSession_Release(editing_session);
nsIDOMWindow_Release(dom_window);
if(NS_FAILED(nsres)) {
......@@ -865,6 +866,9 @@ void update_nsdocument(HTMLDocument *doc)
nsIDOMHTMLDocument_Release(doc->nsdoc);
doc->nsdoc = nsdoc;
if(nsdoc)
set_mutation_observer(doc->nscontainer, nsdoc);
}
void close_gecko(void)
......@@ -1668,6 +1672,7 @@ NSContainer *NSContainer_Create(HTMLDocument *doc, NSContainer *parent)
ret->doc = doc;
ret->ref = 1;
init_mutation(ret);
nsres = nsIComponentManager_CreateInstanceByContractID(pCompMgr, NS_WEBBROWSER_CONTRACTID,
NULL, &IID_nsIWebBrowser, (void**)&ret->webbrowser);
......
......@@ -178,7 +178,7 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
#define IE_MAJOR_VERSION 7
#define IE_MINOR_VERSION 0
static BOOL handle_insert_comment(HTMLDocument *doc, const PRUnichar *comment)
BOOL handle_insert_comment(HTMLDocument *doc, const PRUnichar *comment)
{
DWORD len;
int majorv = 0, minorv = 0;
......@@ -484,8 +484,6 @@ void init_nsevents(NSContainer *This)
static const PRUnichar wsz_focus[] = {'f','o','c','u','s',0};
static const PRUnichar wsz_keypress[] = {'k','e','y','p','r','e','s','s',0};
static const PRUnichar wsz_load[] = {'l','o','a','d',0};
static const PRUnichar DOMNodeInsertedW[] =
{'D','O','M','N','o','d','e','I','n','s','e','r','t','e','d',0};
init_listener(&This->blur_listener, This, &blur_vtbl);
init_listener(&This->focus_listener, This, &focus_vtbl);
......@@ -511,7 +509,6 @@ void init_nsevents(NSContainer *This)
init_event(target, wsz_focus, NSEVENTLIST(&This->focus_listener), TRUE);
init_event(target, wsz_keypress, NSEVENTLIST(&This->keypress_listener), FALSE);
init_event(target, wsz_load, NSEVENTLIST(&This->load_listener), TRUE);
init_event(target, DOMNodeInsertedW,NSEVENTLIST(&This->node_insert_listener),TRUE);
nsIDOMEventTarget_Release(target);
}
......@@ -2276,11 +2276,76 @@ static nsresult NSAPI nsNetUtil_ParseContentType(nsINetUtil *iface, const nsACSt
return nsINetUtil_ParseContentType(net_util, aTypeHeader, aCharset, aHadCharset, aContentType);
}
static nsresult NSAPI nsNetUtil_ProtocolHasFlags(nsINetUtil *iface, nsIURI *aURI, PRUint32 aFlags, PRBool *_retval)
{
TRACE("()\n");
return nsINetUtil_ProtocolHasFlags(net_util, aURI, aFlags, _retval);
}
static nsresult NSAPI nsNetUtil_URIChainHasFlags(nsINetUtil *iface, nsIURI *aURI, PRUint32 aFlags, PRBool *_retval)
{
TRACE("(%p %08x %p)\n", aURI, aFlags, _retval);
if(aFlags == (1<<11)) {
*_retval = FALSE;
return NS_OK;
}
return nsINetUtil_URIChainHasFlags(net_util, aURI, aFlags, _retval);
}
static nsresult NSAPI nsNetUtil_ToImmutableURI(nsINetUtil *iface, nsIURI *aURI, nsIURI **_retval)
{
TRACE("(%p %p)\n", aURI, _retval);
return nsINetUtil_ToImmutableURI(net_util, aURI, _retval);
}
static nsresult NSAPI nsNetUtil_EscapeString(nsINetUtil *iface, const nsACString *aString,
PRUint32 aEscapeType, nsACString *_retval)
{
TRACE("(%p %x %p)\n", aString, aEscapeType, _retval);
return nsINetUtil_EscapeString(net_util, aString, aEscapeType, _retval);
}
static nsresult NSAPI nsNetUtil_EscapeURL(nsINetUtil *iface, const nsACString *aStr, PRUint32 aFlags,
nsACString *_retval)
{
TRACE("(%p %08x %p)\n", aStr, aFlags, _retval);
return nsINetUtil_EscapeURL(net_util, aStr, aFlags, _retval);
}
static nsresult NSAPI nsNetUtil_UnescapeString(nsINetUtil *iface, const nsACString *aStr,
PRUint32 aFlags, nsACString *_retval)
{
TRACE("(%p %08x %p)\n", aStr, aFlags, _retval);
return nsINetUtil_UnescapeString(net_util, aStr, aFlags, _retval);
}
static nsresult NSAPI nsNetUtil_ExtractCharsetFromContentType(nsINetUtil *iface, const nsACString *aTypeHeader,
nsACString *aCharset, PRInt32 *aCharsetStart, PRInt32 *aCharsetEnd, PRBool *_retval)
{
TRACE("(%p %p %p %p %p)\n", aTypeHeader, aCharset, aCharsetStart, aCharsetEnd, _retval);
return nsINetUtil_ExtractCharsetFromContentType(net_util, aTypeHeader, aCharset, aCharsetStart, aCharsetEnd, _retval);
}
static const nsINetUtilVtbl nsNetUtilVtbl = {
nsNetUtil_QueryInterface,
nsNetUtil_AddRef,
nsNetUtil_Release,
nsNetUtil_ParseContentType
nsNetUtil_ParseContentType,
nsNetUtil_ProtocolHasFlags,
nsNetUtil_URIChainHasFlags,
nsNetUtil_ToImmutableURI,
nsNetUtil_EscapeString,
nsNetUtil_EscapeURL,
nsNetUtil_UnescapeString,
nsNetUtil_ExtractCharsetFromContentType
};
static nsINetUtil nsNetUtil = { &nsNetUtilVtbl };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment