mshtml: Moved nsIDocumentObserver implementation to HTMLDocumentNode object.
This commit is contained in:
parent
f9eff68891
commit
5894e3be75
|
@ -1811,6 +1811,7 @@ HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_ob
|
||||||
doc->basedoc.doc_node = doc;
|
doc->basedoc.doc_node = doc;
|
||||||
doc->basedoc.doc_obj = doc_obj;
|
doc->basedoc.doc_obj = doc_obj;
|
||||||
|
|
||||||
|
init_mutation(doc);
|
||||||
init_dispex(&doc->node.dispex, (IUnknown*)HTMLDOMNODE(&doc->node), &HTMLDocumentNode_dispex);
|
init_dispex(&doc->node.dispex, (IUnknown*)HTMLDOMNODE(&doc->node), &HTMLDocumentNode_dispex);
|
||||||
init_doc(&doc->basedoc, (IUnknown*)HTMLDOMNODE(&doc->node), DISPATCHEX(&doc->node.dispex));
|
init_doc(&doc->basedoc, (IUnknown*)HTMLDOMNODE(&doc->node), DISPATCHEX(&doc->node.dispex));
|
||||||
HTMLDocumentNode_SecMgr_Init(doc);
|
HTMLDocumentNode_SecMgr_Init(doc);
|
||||||
|
@ -1887,7 +1888,7 @@ static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface)
|
||||||
set_current_mon(&This->basedoc, NULL);
|
set_current_mon(&This->basedoc, NULL);
|
||||||
if(This->basedoc.doc_node) {
|
if(This->basedoc.doc_node) {
|
||||||
if(This->basedoc.doc_node->nsdoc)
|
if(This->basedoc.doc_node->nsdoc)
|
||||||
remove_mutation_observer(This->nscontainer, This->basedoc.doc_node->nsdoc);
|
remove_mutation_observer(This->basedoc.doc_node);
|
||||||
This->basedoc.doc_node->basedoc.doc_obj = NULL;
|
This->basedoc.doc_node->basedoc.doc_obj = NULL;
|
||||||
IHTMLDocument2_Release(HTMLDOC(&This->basedoc.doc_node->basedoc));
|
IHTMLDocument2_Release(HTMLDOC(&This->basedoc.doc_node->basedoc));
|
||||||
}
|
}
|
||||||
|
|
|
@ -360,13 +360,6 @@ typedef struct {
|
||||||
NSContainer *This;
|
NSContainer *This;
|
||||||
} nsEventListener;
|
} nsEventListener;
|
||||||
|
|
||||||
typedef struct _mutation_queue_t {
|
|
||||||
DWORD type;
|
|
||||||
nsISupports *nsiface;
|
|
||||||
|
|
||||||
struct _mutation_queue_t *next;
|
|
||||||
} mutation_queue_t;
|
|
||||||
|
|
||||||
struct NSContainer {
|
struct NSContainer {
|
||||||
const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
|
const nsIWebBrowserChromeVtbl *lpWebBrowserChromeVtbl;
|
||||||
const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
|
const nsIContextMenuListenerVtbl *lpContextMenuListenerVtbl;
|
||||||
|
@ -377,10 +370,6 @@ struct NSContainer {
|
||||||
const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
|
const nsIWeakReferenceVtbl *lpWeakReferenceVtbl;
|
||||||
const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
|
const nsISupportsWeakReferenceVtbl *lpSupportsWeakReferenceVtbl;
|
||||||
|
|
||||||
const nsIDocumentObserverVtbl *lpDocumentObserverVtbl;
|
|
||||||
|
|
||||||
const nsIRunnableVtbl *lpRunnableVtbl;
|
|
||||||
|
|
||||||
nsEventListener blur_listener;
|
nsEventListener blur_listener;
|
||||||
nsEventListener focus_listener;
|
nsEventListener focus_listener;
|
||||||
nsEventListener keypress_listener;
|
nsEventListener keypress_listener;
|
||||||
|
@ -404,9 +393,6 @@ struct NSContainer {
|
||||||
|
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
|
|
||||||
mutation_queue_t *mutation_queue;
|
|
||||||
mutation_queue_t *mutation_queue_tail;
|
|
||||||
|
|
||||||
nsChannelBSC *bscallback; /* hack */
|
nsChannelBSC *bscallback; /* hack */
|
||||||
HWND reset_focus; /* hack */
|
HWND reset_focus; /* hack */
|
||||||
};
|
};
|
||||||
|
@ -476,12 +462,22 @@ typedef struct {
|
||||||
ConnectionPoint cp;
|
ConnectionPoint cp;
|
||||||
} HTMLTextContainer;
|
} HTMLTextContainer;
|
||||||
|
|
||||||
|
typedef struct _mutation_queue_t {
|
||||||
|
DWORD type;
|
||||||
|
nsISupports *nsiface;
|
||||||
|
|
||||||
|
struct _mutation_queue_t *next;
|
||||||
|
} mutation_queue_t;
|
||||||
|
|
||||||
struct HTMLDocumentNode {
|
struct HTMLDocumentNode {
|
||||||
HTMLDOMNode node;
|
HTMLDOMNode node;
|
||||||
HTMLDocument basedoc;
|
HTMLDocument basedoc;
|
||||||
|
|
||||||
const IInternetHostSecurityManagerVtbl *lpIInternetHostSecurityManagerVtbl;
|
const IInternetHostSecurityManagerVtbl *lpIInternetHostSecurityManagerVtbl;
|
||||||
|
|
||||||
|
const nsIDocumentObserverVtbl *lpIDocumentObserverVtbl;
|
||||||
|
const nsIRunnableVtbl *lpIRunnableVtbl;
|
||||||
|
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
nsIDOMHTMLDocument *nsdoc;
|
nsIDOMHTMLDocument *nsdoc;
|
||||||
|
@ -490,6 +486,9 @@ struct HTMLDocumentNode {
|
||||||
|
|
||||||
IInternetSecurityManager *secmgr;
|
IInternetSecurityManager *secmgr;
|
||||||
|
|
||||||
|
mutation_queue_t *mutation_queue;
|
||||||
|
mutation_queue_t *mutation_queue_tail;
|
||||||
|
|
||||||
struct list selection_list;
|
struct list selection_list;
|
||||||
struct list range_list;
|
struct list range_list;
|
||||||
};
|
};
|
||||||
|
@ -534,9 +533,9 @@ struct HTMLDocumentNode {
|
||||||
#define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
|
#define NSWEAKREF(x) ((nsIWeakReference*) &(x)->lpWeakReferenceVtbl)
|
||||||
#define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
|
#define NSSUPWEAKREF(x) ((nsISupportsWeakReference*) &(x)->lpSupportsWeakReferenceVtbl)
|
||||||
|
|
||||||
#define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpDocumentObserverVtbl)
|
#define NSDOCOBS(x) ((nsIDocumentObserver*) &(x)->lpIDocumentObserverVtbl)
|
||||||
|
|
||||||
#define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpRunnableVtbl)
|
#define NSRUNNABLE(x) ((nsIRunnable*) &(x)->lpIRunnableVtbl)
|
||||||
|
|
||||||
#define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
|
#define NSCHANNEL(x) ((nsIChannel*) &(x)->lpHttpChannelVtbl)
|
||||||
#define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
|
#define NSHTTPCHANNEL(x) ((nsIHttpChannel*) &(x)->lpHttpChannelVtbl)
|
||||||
|
@ -601,9 +600,9 @@ void ConnectionPointContainer_Destroy(ConnectionPointContainer*);
|
||||||
NSContainer *NSContainer_Create(HTMLDocumentObj*,NSContainer*);
|
NSContainer *NSContainer_Create(HTMLDocumentObj*,NSContainer*);
|
||||||
void NSContainer_Release(NSContainer*);
|
void NSContainer_Release(NSContainer*);
|
||||||
|
|
||||||
void init_mutation(NSContainer*);
|
void init_mutation(HTMLDocumentNode*);
|
||||||
void set_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
|
void set_mutation_observer(HTMLDocumentNode*);
|
||||||
void remove_mutation_observer(NSContainer*,nsIDOMHTMLDocument*);
|
void remove_mutation_observer(HTMLDocumentNode*);
|
||||||
|
|
||||||
void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL);
|
void HTMLDocument_LockContainer(HTMLDocumentObj*,BOOL);
|
||||||
void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*);
|
void show_context_menu(HTMLDocumentObj*,DWORD,POINT*,IDispatch*);
|
||||||
|
|
|
@ -40,33 +40,33 @@ enum {
|
||||||
MUTATION_SCRIPT
|
MUTATION_SCRIPT
|
||||||
};
|
};
|
||||||
|
|
||||||
void set_mutation_observer(NSContainer *nscontainer, nsIDOMHTMLDocument *nshtmldoc)
|
void set_mutation_observer(HTMLDocumentNode *doc)
|
||||||
{
|
{
|
||||||
nsIDOMNSDocument *nsdoc;
|
nsIDOMNSDocument *nsdoc;
|
||||||
nsresult nsres;
|
nsresult nsres;
|
||||||
|
|
||||||
nsres = nsIDOMHTMLDocument_QueryInterface(nshtmldoc, &IID_nsIDOMNSDocument, (void**)&nsdoc);
|
nsres = nsIDOMHTMLDocument_QueryInterface(doc->nsdoc, &IID_nsIDOMNSDocument, (void**)&nsdoc);
|
||||||
if(NS_FAILED(nsres)) {
|
if(NS_FAILED(nsres)) {
|
||||||
ERR("Could not get nsIDOMNSDocument: %08x\n", nsres);
|
ERR("Could not get nsIDOMNSDocument: %08x\n", nsres);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIDOMNSDocument_WineAddObserver(nsdoc, NSDOCOBS(nscontainer));
|
nsIDOMNSDocument_WineAddObserver(nsdoc, NSDOCOBS(doc));
|
||||||
nsIDOMNSDocument_Release(nsdoc);
|
nsIDOMNSDocument_Release(nsdoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void remove_mutation_observer(NSContainer *nscontainer, nsIDOMHTMLDocument *nshtmldoc)
|
void remove_mutation_observer(HTMLDocumentNode *doc)
|
||||||
{
|
{
|
||||||
nsIDOMNSDocument *nsdoc;
|
nsIDOMNSDocument *nsdoc;
|
||||||
nsresult nsres;
|
nsresult nsres;
|
||||||
|
|
||||||
nsres = nsIDOMHTMLDocument_QueryInterface(nshtmldoc, &IID_nsIDOMNSDocument, (void**)&nsdoc);
|
nsres = nsIDOMHTMLDocument_QueryInterface(doc->nsdoc, &IID_nsIDOMNSDocument, (void**)&nsdoc);
|
||||||
if(NS_FAILED(nsres)) {
|
if(NS_FAILED(nsres)) {
|
||||||
ERR("Could not get nsIDOMNSDocument: %08x\n", nsres);
|
ERR("Could not get nsIDOMNSDocument: %08x\n", nsres);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIDOMNSDocument_WineRemoveObserver(nsdoc, NSDOCOBS(nscontainer));
|
nsIDOMNSDocument_WineRemoveObserver(nsdoc, NSDOCOBS(doc));
|
||||||
nsIDOMNSDocument_Release(nsdoc);
|
nsIDOMNSDocument_Release(nsdoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,12 +209,12 @@ static BOOL handle_insert_comment(HTMLDocumentNode *doc, const PRUnichar *commen
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_script_runner(NSContainer *This)
|
static void add_script_runner(HTMLDocumentNode *This)
|
||||||
{
|
{
|
||||||
nsIDOMNSDocument *nsdoc;
|
nsIDOMNSDocument *nsdoc;
|
||||||
nsresult nsres;
|
nsresult nsres;
|
||||||
|
|
||||||
nsres = nsIDOMHTMLDocument_QueryInterface(This->doc->basedoc.doc_node->nsdoc, &IID_nsIDOMNSDocument, (void**)&nsdoc);
|
nsres = nsIDOMHTMLDocument_QueryInterface(This->nsdoc, &IID_nsIDOMNSDocument, (void**)&nsdoc);
|
||||||
if(NS_FAILED(nsres)) {
|
if(NS_FAILED(nsres)) {
|
||||||
ERR("Could not get nsIDOMNSDocument: %08x\n", nsres);
|
ERR("Could not get nsIDOMNSDocument: %08x\n", nsres);
|
||||||
return;
|
return;
|
||||||
|
@ -224,12 +224,12 @@ static void add_script_runner(NSContainer *This)
|
||||||
nsIDOMNSDocument_Release(nsdoc);
|
nsIDOMNSDocument_Release(nsdoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NSRUNNABLE_THIS(iface) DEFINE_THIS(NSContainer, Runnable, iface)
|
#define NSRUNNABLE_THIS(iface) DEFINE_THIS(HTMLDocumentNode, IRunnable, iface)
|
||||||
|
|
||||||
static nsresult NSAPI nsRunnable_QueryInterface(nsIRunnable *iface,
|
static nsresult NSAPI nsRunnable_QueryInterface(nsIRunnable *iface,
|
||||||
nsIIDRef riid, nsQIResult result)
|
nsIIDRef riid, nsQIResult result)
|
||||||
{
|
{
|
||||||
NSContainer *This = NSRUNNABLE_THIS(iface);
|
HTMLDocumentNode *This = NSRUNNABLE_THIS(iface);
|
||||||
|
|
||||||
if(IsEqualGUID(riid, &IID_nsISupports)) {
|
if(IsEqualGUID(riid, &IID_nsISupports)) {
|
||||||
TRACE("(%p)->(IID_nsISupports %p)\n", This, result);
|
TRACE("(%p)->(IID_nsISupports %p)\n", This, result);
|
||||||
|
@ -249,26 +249,26 @@ static nsresult NSAPI nsRunnable_QueryInterface(nsIRunnable *iface,
|
||||||
|
|
||||||
static nsrefcnt NSAPI nsRunnable_AddRef(nsIRunnable *iface)
|
static nsrefcnt NSAPI nsRunnable_AddRef(nsIRunnable *iface)
|
||||||
{
|
{
|
||||||
NSContainer *This = NSRUNNABLE_THIS(iface);
|
HTMLDocumentNode *This = NSRUNNABLE_THIS(iface);
|
||||||
return nsIWebBrowserChrome_AddRef(NSWBCHROME(This));
|
return htmldoc_addref(&This->basedoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static nsrefcnt NSAPI nsRunnable_Release(nsIRunnable *iface)
|
static nsrefcnt NSAPI nsRunnable_Release(nsIRunnable *iface)
|
||||||
{
|
{
|
||||||
NSContainer *This = NSRUNNABLE_THIS(iface);
|
HTMLDocumentNode *This = NSRUNNABLE_THIS(iface);
|
||||||
return nsIWebBrowserChrome_Release(NSWBCHROME(This));
|
return htmldoc_release(&This->basedoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pop_mutation_queue(NSContainer *nscontainer)
|
static void pop_mutation_queue(HTMLDocumentNode *doc)
|
||||||
{
|
{
|
||||||
mutation_queue_t *tmp = nscontainer->mutation_queue;
|
mutation_queue_t *tmp = doc->mutation_queue;
|
||||||
|
|
||||||
if(!tmp)
|
if(!tmp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nscontainer->mutation_queue = tmp->next;
|
doc->mutation_queue = tmp->next;
|
||||||
if(!tmp->next)
|
if(!tmp->next)
|
||||||
nscontainer->mutation_queue_tail = NULL;
|
doc->mutation_queue_tail = NULL;
|
||||||
|
|
||||||
nsISupports_Release(tmp->nsiface);
|
nsISupports_Release(tmp->nsiface);
|
||||||
heap_free(tmp);
|
heap_free(tmp);
|
||||||
|
@ -276,7 +276,7 @@ static void pop_mutation_queue(NSContainer *nscontainer)
|
||||||
|
|
||||||
static nsresult NSAPI nsRunnable_Run(nsIRunnable *iface)
|
static nsresult NSAPI nsRunnable_Run(nsIRunnable *iface)
|
||||||
{
|
{
|
||||||
NSContainer *This = NSRUNNABLE_THIS(iface);
|
HTMLDocumentNode *This = NSRUNNABLE_THIS(iface);
|
||||||
nsresult nsres;
|
nsresult nsres;
|
||||||
|
|
||||||
TRACE("(%p)\n", This);
|
TRACE("(%p)\n", This);
|
||||||
|
@ -300,7 +300,7 @@ static nsresult NSAPI nsRunnable_Run(nsIRunnable *iface)
|
||||||
const PRUnichar *comment;
|
const PRUnichar *comment;
|
||||||
|
|
||||||
nsAString_GetData(&comment_str, &comment);
|
nsAString_GetData(&comment_str, &comment);
|
||||||
remove_comment = handle_insert_comment(This->doc->basedoc.doc_node, comment);
|
remove_comment = handle_insert_comment(This, comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAString_Finish(&comment_str);
|
nsAString_Finish(&comment_str);
|
||||||
|
@ -340,7 +340,7 @@ static nsresult NSAPI nsRunnable_Run(nsIRunnable *iface)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
doc_insert_script(This->doc->basedoc.window, nsscript);
|
doc_insert_script(This->basedoc.window, nsscript);
|
||||||
nsIDOMHTMLScriptElement_Release(nsscript);
|
nsIDOMHTMLScriptElement_Release(nsscript);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -364,12 +364,12 @@ static const nsIRunnableVtbl nsRunnableVtbl = {
|
||||||
nsRunnable_Run
|
nsRunnable_Run
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NSDOCOBS_THIS(iface) DEFINE_THIS(NSContainer, DocumentObserver, iface)
|
#define NSDOCOBS_THIS(iface) DEFINE_THIS(HTMLDocumentNode, IDocumentObserver, iface)
|
||||||
|
|
||||||
static nsresult NSAPI nsDocumentObserver_QueryInterface(nsIDocumentObserver *iface,
|
static nsresult NSAPI nsDocumentObserver_QueryInterface(nsIDocumentObserver *iface,
|
||||||
nsIIDRef riid, nsQIResult result)
|
nsIIDRef riid, nsQIResult result)
|
||||||
{
|
{
|
||||||
NSContainer *This = NSDOCOBS_THIS(iface);
|
HTMLDocumentNode *This = NSDOCOBS_THIS(iface);
|
||||||
|
|
||||||
if(IsEqualGUID(&IID_nsISupports, riid)) {
|
if(IsEqualGUID(&IID_nsISupports, riid)) {
|
||||||
TRACE("(%p)->(IID_nsISupports, %p)\n", This, result);
|
TRACE("(%p)->(IID_nsISupports, %p)\n", This, result);
|
||||||
|
@ -386,20 +386,20 @@ static nsresult NSAPI nsDocumentObserver_QueryInterface(nsIDocumentObserver *ifa
|
||||||
return NS_NOINTERFACE;
|
return NS_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIWebBrowserChrome_AddRef(NSWBCHROME(This));
|
htmldoc_addref(&This->basedoc);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static nsrefcnt NSAPI nsDocumentObserver_AddRef(nsIDocumentObserver *iface)
|
static nsrefcnt NSAPI nsDocumentObserver_AddRef(nsIDocumentObserver *iface)
|
||||||
{
|
{
|
||||||
NSContainer *This = NSDOCOBS_THIS(iface);
|
HTMLDocumentNode *This = NSDOCOBS_THIS(iface);
|
||||||
return nsIWebBrowserChrome_AddRef(NSWBCHROME(This));
|
return htmldoc_addref(&This->basedoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static nsrefcnt NSAPI nsDocumentObserver_Release(nsIDocumentObserver *iface)
|
static nsrefcnt NSAPI nsDocumentObserver_Release(nsIDocumentObserver *iface)
|
||||||
{
|
{
|
||||||
NSContainer *This = NSDOCOBS_THIS(iface);
|
HTMLDocumentNode *This = NSDOCOBS_THIS(iface);
|
||||||
return nsIWebBrowserChrome_Release(NSWBCHROME(This));
|
return htmldoc_release(&This->basedoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void NSAPI nsDocumentObserver_CharacterDataWillChange(nsIDocumentObserver *iface,
|
static void NSAPI nsDocumentObserver_CharacterDataWillChange(nsIDocumentObserver *iface,
|
||||||
|
@ -461,24 +461,26 @@ static void NSAPI nsDocumentObserver_BeginLoad(nsIDocumentObserver *iface, nsIDo
|
||||||
|
|
||||||
static void NSAPI nsDocumentObserver_EndLoad(nsIDocumentObserver *iface, nsIDocument *aDocument)
|
static void NSAPI nsDocumentObserver_EndLoad(nsIDocumentObserver *iface, nsIDocument *aDocument)
|
||||||
{
|
{
|
||||||
NSContainer *This = NSDOCOBS_THIS(iface);
|
HTMLDocumentNode *This = NSDOCOBS_THIS(iface);
|
||||||
task_t *task;
|
|
||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
||||||
This->doc->basedoc.doc_node->content_ready = TRUE;
|
This->content_ready = TRUE;
|
||||||
|
|
||||||
task = heap_alloc(sizeof(task_t));
|
if(This == This->basedoc.doc_obj->basedoc.doc_node) {
|
||||||
|
task_t *task;
|
||||||
|
task = heap_alloc(sizeof(task_t));
|
||||||
|
|
||||||
task->doc = &This->doc->basedoc;
|
task->doc = &This->basedoc.doc_obj->basedoc;
|
||||||
task->task_id = TASK_PARSECOMPLETE;
|
task->task_id = TASK_PARSECOMPLETE;
|
||||||
task->next = NULL;
|
task->next = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This should be done in the worker thread that parses HTML,
|
* This should be done in the worker thread that parses HTML,
|
||||||
* but we don't have such thread (Gecko parses HTML for us).
|
* but we don't have such thread (Gecko parses HTML for us).
|
||||||
*/
|
*/
|
||||||
push_task(task);
|
push_task(task);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void NSAPI nsDocumentObserver_ContentStatesChanged(nsIDocumentObserver *iface, nsIDocument *aDocument,
|
static void NSAPI nsDocumentObserver_ContentStatesChanged(nsIDocumentObserver *iface, nsIDocument *aDocument,
|
||||||
|
@ -516,7 +518,7 @@ static void NSAPI nsDocumentObserver_StyleRuleRemoved(nsIDocumentObserver *iface
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static void push_mutation_queue(NSContainer *nscontainer, DWORD type, nsISupports *nsiface)
|
static void push_mutation_queue(HTMLDocumentNode *doc, DWORD type, nsISupports *nsiface)
|
||||||
{
|
{
|
||||||
mutation_queue_t *elem;
|
mutation_queue_t *elem;
|
||||||
|
|
||||||
|
@ -529,16 +531,16 @@ static void push_mutation_queue(NSContainer *nscontainer, DWORD type, nsISupport
|
||||||
elem->nsiface = nsiface;
|
elem->nsiface = nsiface;
|
||||||
nsISupports_AddRef(nsiface);
|
nsISupports_AddRef(nsiface);
|
||||||
|
|
||||||
if(nscontainer->mutation_queue_tail)
|
if(doc->mutation_queue_tail)
|
||||||
nscontainer->mutation_queue_tail = nscontainer->mutation_queue_tail->next = elem;
|
doc->mutation_queue_tail = doc->mutation_queue_tail->next = elem;
|
||||||
else
|
else
|
||||||
nscontainer->mutation_queue = nscontainer->mutation_queue_tail = elem;
|
doc->mutation_queue = doc->mutation_queue_tail = elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void NSAPI nsDocumentObserver_BindToDocument(nsIDocumentObserver *iface, nsIDocument *aDocument,
|
static void NSAPI nsDocumentObserver_BindToDocument(nsIDocumentObserver *iface, nsIDocument *aDocument,
|
||||||
nsIContent *aContent)
|
nsIContent *aContent)
|
||||||
{
|
{
|
||||||
NSContainer *This = NSDOCOBS_THIS(iface);
|
HTMLDocumentNode *This = NSDOCOBS_THIS(iface);
|
||||||
nsIDOMComment *nscomment;
|
nsIDOMComment *nscomment;
|
||||||
nsIDOMElement *nselem;
|
nsIDOMElement *nselem;
|
||||||
nsresult nsres;
|
nsresult nsres;
|
||||||
|
@ -547,7 +549,7 @@ static void NSAPI nsDocumentObserver_BindToDocument(nsIDocumentObserver *iface,
|
||||||
|
|
||||||
nsres = nsISupports_QueryInterface(aContent, &IID_nsIDOMElement, (void**)&nselem);
|
nsres = nsISupports_QueryInterface(aContent, &IID_nsIDOMElement, (void**)&nselem);
|
||||||
if(NS_SUCCEEDED(nsres)) {
|
if(NS_SUCCEEDED(nsres)) {
|
||||||
check_event_attr(This->doc->basedoc.doc_node, nselem);
|
check_event_attr(This, nselem);
|
||||||
nsIDOMElement_Release(nselem);
|
nsIDOMElement_Release(nselem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,7 +566,7 @@ static void NSAPI nsDocumentObserver_BindToDocument(nsIDocumentObserver *iface,
|
||||||
static void NSAPI nsDocumentObserver_DoneAddingChildren(nsIDocumentObserver *iface, nsIContent *aContent,
|
static void NSAPI nsDocumentObserver_DoneAddingChildren(nsIDocumentObserver *iface, nsIContent *aContent,
|
||||||
PRBool aHaveNotified)
|
PRBool aHaveNotified)
|
||||||
{
|
{
|
||||||
NSContainer *This = NSDOCOBS_THIS(iface);
|
HTMLDocumentNode *This = NSDOCOBS_THIS(iface);
|
||||||
nsIDOMHTMLScriptElement *nsscript;
|
nsIDOMHTMLScriptElement *nsscript;
|
||||||
nsresult nsres;
|
nsresult nsres;
|
||||||
|
|
||||||
|
@ -608,8 +610,8 @@ static const nsIDocumentObserverVtbl nsDocumentObserverVtbl = {
|
||||||
nsDocumentObserver_DoneAddingChildren
|
nsDocumentObserver_DoneAddingChildren
|
||||||
};
|
};
|
||||||
|
|
||||||
void init_mutation(NSContainer *nscontainer)
|
void init_mutation(HTMLDocumentNode *doc)
|
||||||
{
|
{
|
||||||
nscontainer->lpDocumentObserverVtbl = &nsDocumentObserverVtbl;
|
doc->lpIDocumentObserverVtbl = &nsDocumentObserverVtbl;
|
||||||
nscontainer->lpRunnableVtbl = &nsRunnableVtbl;
|
doc->lpIRunnableVtbl = &nsRunnableVtbl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -837,9 +837,8 @@ void update_nsdocument(HTMLDocumentObj *doc)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doc->basedoc.doc_node && doc->basedoc.doc_node->nsdoc) {
|
if(doc->basedoc.doc_node && doc->basedoc.doc_node->nsdoc) {
|
||||||
remove_mutation_observer(doc->nscontainer, doc->basedoc.doc_node->nsdoc);
|
|
||||||
|
|
||||||
doc_node = doc->basedoc.doc_node;
|
doc_node = doc->basedoc.doc_node;
|
||||||
|
remove_mutation_observer(doc_node);
|
||||||
doc_node->basedoc.doc_obj = NULL;
|
doc_node->basedoc.doc_obj = NULL;
|
||||||
IHTMLDocument2_Release(HTMLDOC(&doc_node->basedoc));
|
IHTMLDocument2_Release(HTMLDOC(&doc_node->basedoc));
|
||||||
doc->basedoc.doc_node = NULL;
|
doc->basedoc.doc_node = NULL;
|
||||||
|
@ -851,14 +850,13 @@ void update_nsdocument(HTMLDocumentObj *doc)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_mutation_observer(doc->nscontainer, nsdoc);
|
|
||||||
|
|
||||||
hres = create_doc_from_nsdoc(nsdoc, doc, doc->basedoc.window, &doc_node);
|
hres = create_doc_from_nsdoc(nsdoc, doc, doc->basedoc.window, &doc_node);
|
||||||
if(FAILED(hres)) {
|
if(FAILED(hres)) {
|
||||||
ERR("Could not create document: %08x\n", hres);
|
ERR("Could not create document: %08x\n", hres);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_mutation_observer(doc_node);
|
||||||
doc->basedoc.doc_node = doc_node;
|
doc->basedoc.doc_node = doc_node;
|
||||||
window_set_docnode(doc->basedoc.window, doc_node);
|
window_set_docnode(doc->basedoc.window, doc_node);
|
||||||
}
|
}
|
||||||
|
@ -1693,7 +1691,6 @@ NSContainer *NSContainer_Create(HTMLDocumentObj *doc, NSContainer *parent)
|
||||||
|
|
||||||
ret->doc = doc;
|
ret->doc = doc;
|
||||||
ret->ref = 1;
|
ret->ref = 1;
|
||||||
init_mutation(ret);
|
|
||||||
|
|
||||||
nsres = nsIComponentManager_CreateInstanceByContractID(pCompMgr, NS_WEBBROWSER_CONTRACTID,
|
nsres = nsIComponentManager_CreateInstanceByContractID(pCompMgr, NS_WEBBROWSER_CONTRACTID,
|
||||||
NULL, &IID_nsIWebBrowser, (void**)&ret->webbrowser);
|
NULL, &IID_nsIWebBrowser, (void**)&ret->webbrowser);
|
||||||
|
|
Loading…
Reference in New Issue