ReactOS  0.4.15-dev-341-g17c5fb8
mutation.c File Reference
#include "mshtml_private.h"
Include dependency graph for mutation.c:

Go to the source code of this file.

Classes

struct  nsRunnable
 

Macros

#define IE_MAJOR_VERSION   7
 
#define IE_MINOR_VERSION   0
 

Typedefs

typedef struct nsRunnable nsRunnable
 
typedef nsresult(* runnable_proc_t) (HTMLDocumentNode *, nsISupports *, nsISupports *)
 

Functions

static PRUnicharhandle_insert_comment (HTMLDocumentNode *doc, const PRUnichar *comment)
 
static nsresult run_insert_comment (HTMLDocumentNode *doc, nsISupports *comment_iface, nsISupports *arg2)
 
static nsresult run_bind_to_tree (HTMLDocumentNode *doc, nsISupports *nsiface, nsISupports *arg2)
 
static void call_explorer_69 (HTMLDocumentObj *doc)
 
static void parse_complete (HTMLDocumentObj *doc)
 
static nsresult run_end_load (HTMLDocumentNode *This, nsISupports *arg1, nsISupports *arg2)
 
static nsresult run_insert_script (HTMLDocumentNode *doc, nsISupports *script_iface, nsISupports *parser_iface)
 
static nsRunnableimpl_from_nsIRunnable (nsIRunnable *iface)
 
static nsresult NSAPI nsRunnable_QueryInterface (nsIRunnable *iface, nsIIDRef riid, void **result)
 
static nsrefcnt NSAPI nsRunnable_AddRef (nsIRunnable *iface)
 
static nsrefcnt NSAPI nsRunnable_Release (nsIRunnable *iface)
 
static nsresult NSAPI nsRunnable_Run (nsIRunnable *iface)
 
static void add_script_runner (HTMLDocumentNode *This, runnable_proc_t proc, nsISupports *arg1, nsISupports *arg2)
 
static HTMLDocumentNodeimpl_from_nsIDocumentObserver (nsIDocumentObserver *iface)
 
static nsresult NSAPI nsDocumentObserver_QueryInterface (nsIDocumentObserver *iface, nsIIDRef riid, void **result)
 
static nsrefcnt NSAPI nsDocumentObserver_AddRef (nsIDocumentObserver *iface)
 
static nsrefcnt NSAPI nsDocumentObserver_Release (nsIDocumentObserver *iface)
 
static void NSAPI nsDocumentObserver_CharacterDataWillChange (nsIDocumentObserver *iface, nsIDocument *aDocument, nsIContent *aContent, void *aInfo)
 
static void NSAPI nsDocumentObserver_CharacterDataChanged (nsIDocumentObserver *iface, nsIDocument *aDocument, nsIContent *aContent, void *aInfo)
 
static void NSAPI nsDocumentObserver_AttributeWillChange (nsIDocumentObserver *iface, nsIDocument *aDocument, nsIContent *aContent, LONG aNameSpaceID, nsIAtom *aAttribute, LONG aModType)
 
static void NSAPI nsDocumentObserver_AttributeChanged (nsIDocumentObserver *iface, nsIDocument *aDocument, nsIContent *aContent, LONG aNameSpaceID, nsIAtom *aAttribute, LONG aModType)
 
static void NSAPI nsDocumentObserver_AttributeSetToCurrentValue (nsIDocumentObserver *iface, nsIDocument *aDocument, void *aElement, LONG aNameSpaceID, nsIAtom *aAttribute)
 
static void NSAPI nsDocumentObserver_ContentAppended (nsIDocumentObserver *iface, nsIDocument *aDocument, nsIContent *aContainer, nsIContent *aFirstNewContent, LONG aNewIndexInContainer)
 
static void NSAPI nsDocumentObserver_ContentInserted (nsIDocumentObserver *iface, nsIDocument *aDocument, nsIContent *aContainer, nsIContent *aChild, LONG aIndexInContainer)
 
static void NSAPI nsDocumentObserver_ContentRemoved (nsIDocumentObserver *iface, nsIDocument *aDocument, nsIContent *aContainer, nsIContent *aChild, LONG aIndexInContainer, nsIContent *aProviousSibling)
 
static void NSAPI nsDocumentObserver_NodeWillBeDestroyed (nsIDocumentObserver *iface, const nsINode *aNode)
 
static void NSAPI nsDocumentObserver_ParentChainChanged (nsIDocumentObserver *iface, nsIContent *aContent)
 
static void NSAPI nsDocumentObserver_BeginUpdate (nsIDocumentObserver *iface, nsIDocument *aDocument, nsUpdateType aUpdateType)
 
static void NSAPI nsDocumentObserver_EndUpdate (nsIDocumentObserver *iface, nsIDocument *aDocument, nsUpdateType aUpdateType)
 
static void NSAPI nsDocumentObserver_BeginLoad (nsIDocumentObserver *iface, nsIDocument *aDocument)
 
static void NSAPI nsDocumentObserver_EndLoad (nsIDocumentObserver *iface, nsIDocument *aDocument)
 
static void NSAPI nsDocumentObserver_ContentStatesChanged (nsIDocumentObserver *iface, nsIDocument *aDocument, nsIContent *aContent, EventStates aStateMask)
 
static void NSAPI nsDocumentObserver_DocumentStatesChanged (nsIDocumentObserver *iface, nsIDocument *aDocument, EventStates aStateMask)
 
static void NSAPI nsDocumentObserver_StyleSheetAdded (nsIDocumentObserver *iface, nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, cpp_bool aDocumentSheet)
 
static void NSAPI nsDocumentObserver_StyleSheetRemoved (nsIDocumentObserver *iface, nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, cpp_bool aDocumentSheet)
 
static void NSAPI nsDocumentObserver_StyleSheetApplicableStateChanged (nsIDocumentObserver *iface, nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, cpp_bool aApplicable)
 
static void NSAPI nsDocumentObserver_StyleRuleChanged (nsIDocumentObserver *iface, nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, nsIStyleRule *aOldStyleRule, nsIStyleSheet *aNewStyleRule)
 
static void NSAPI nsDocumentObserver_StyleRuleAdded (nsIDocumentObserver *iface, nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, nsIStyleRule *aStyleRule)
 
static void NSAPI nsDocumentObserver_StyleRuleRemoved (nsIDocumentObserver *iface, nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, nsIStyleRule *aStyleRule)
 
static void NSAPI nsDocumentObserver_BindToDocument (nsIDocumentObserver *iface, nsIDocument *aDocument, nsIContent *aContent)
 
static void NSAPI nsDocumentObserver_AttemptToExecuteScript (nsIDocumentObserver *iface, nsIContent *aContent, nsIParser *aParser, cpp_bool *aBlock)
 
void init_document_mutation (HTMLDocumentNode *doc)
 
void release_document_mutation (HTMLDocumentNode *doc)
 
JSContextget_context_from_document (nsIDOMHTMLDocument *nsdoc)
 
void init_mutation (nsIComponentManager *component_manager)
 

Variables

static const IID NS_ICONTENTUTILS_CID
 
static nsIContentUtilscontent_utils
 
static const nsIRunnableVtbl nsRunnableVtbl
 
static const nsIDocumentObserverVtbl nsDocumentObserverVtbl
 

Macro Definition Documentation

◆ IE_MAJOR_VERSION

#define IE_MAJOR_VERSION   7

Definition at line 21 of file mutation.c.

◆ IE_MINOR_VERSION

#define IE_MINOR_VERSION   0

Definition at line 22 of file mutation.c.

Typedef Documentation

◆ nsRunnable

Definition at line 343 of file mutation.c.

◆ runnable_proc_t

typedef nsresult(* runnable_proc_t) (HTMLDocumentNode *, nsISupports *, nsISupports *)

Definition at line 345 of file mutation.c.

Function Documentation

◆ add_script_runner()

static void add_script_runner ( HTMLDocumentNode This,
runnable_proc_t  proc,
nsISupports arg1,
nsISupports arg2 
)
static

Definition at line 428 of file mutation.c.

429 {
431 
432  runnable = heap_alloc_zero(sizeof(*runnable));
433  if(!runnable)
434  return;
435 
436  runnable->nsIRunnable_iface.lpVtbl = &nsRunnableVtbl;
437  runnable->ref = 1;
438 
439  htmldoc_addref(&This->basedoc);
440  runnable->doc = This;
441  runnable->proc = proc;
442 
443  if(arg1)
444  nsISupports_AddRef(arg1);
445  runnable->arg1 = arg1;
446 
447  if(arg2)
448  nsISupports_AddRef(arg2);
449  runnable->arg2 = arg2;
450 
451  nsIContentUtils_AddScriptRunner(content_utils, &runnable->nsIRunnable_iface);
452 
453  nsIRunnable_Release(&runnable->nsIRunnable_iface);
454 }
static HANDLE proc()
Definition: pdb.c:32
static nsIContentUtils * content_utils
Definition: mutation.c:27
static IRunnableObject * runnable
Definition: ole2.c:76
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
Definition: glext.h:9514
GLuint GLuint GLuint GLuint arg1
Definition: glext.h:9513
static const nsIRunnableVtbl nsRunnableVtbl
Definition: mutation.c:421
static ULONG htmldoc_addref(HTMLDocument *This)

Referenced by nsDocumentObserver_AttemptToExecuteScript(), nsDocumentObserver_BindToDocument(), and nsDocumentObserver_EndLoad().

◆ call_explorer_69()

static void call_explorer_69 ( HTMLDocumentObj doc)
static

Definition at line 218 of file mutation.c.

219 {
220  IOleCommandTarget *olecmd;
221  VARIANT var;
222  HRESULT hres;
223 
224  if(!doc->client)
225  return;
226 
227  hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
228  if(FAILED(hres))
229  return;
230 
231  VariantInit(&var);
232  hres = IOleCommandTarget_Exec(olecmd, &CGID_Explorer, 69, 0, NULL, &var);
233  IOleCommandTarget_Release(olecmd);
234  if(SUCCEEDED(hres) && V_VT(&var) != VT_NULL)
235  FIXME("handle result\n");
236 }
const char * var
Definition: shader.c:5666
IOleClientSite * client
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:568
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
#define V_VT(A)
Definition: oleauto.h:211
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by parse_complete().

◆ get_context_from_document()

JSContext* get_context_from_document ( nsIDOMHTMLDocument nsdoc)

Definition at line 758 of file mutation.c.

759 {
760  nsIDocument *doc;
761  JSContext *ctx;
762  nsresult nsres;
763 
764  nsres = nsIDOMHTMLDocument_QueryInterface(nsdoc, &IID_nsIDocument, (void**)&doc);
765  assert(nsres == NS_OK);
766 
767  ctx = nsIContentUtils_GetContextFromDocument(content_utils, doc);
768  nsIDocument_Release(doc);
769 
770  TRACE("ret %p\n", ctx);
771  return ctx;
772 }
#define assert(x)
Definition: debug.h:53
static nsIContentUtils * content_utils
Definition: mutation.c:27
#define NS_OK
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT nsresult
Definition: nsiface.idl:39

Referenced by document_write(), and HTMLDocument_open().

◆ handle_insert_comment()

static PRUnichar* handle_insert_comment ( HTMLDocumentNode doc,
const PRUnichar comment 
)
static

Definition at line 29 of file mutation.c.

30 {
31  int majorv = 0, minorv = 0;
32  const PRUnichar *ptr, *end;
33  PRUnichar *buf;
34  DWORD len;
35 
36  enum {
37  CMP_EQ,
38  CMP_LT,
39  CMP_LTE,
40  CMP_GT,
41  CMP_GTE
42  } cmpt = CMP_EQ;
43 
44  static const PRUnichar endifW[] = {'<','!','[','e','n','d','i','f',']'};
45 
46  if(comment[0] != '[' || comment[1] != 'i' || comment[2] != 'f')
47  return NULL;
48 
49  ptr = comment+3;
50  while(isspaceW(*ptr))
51  ptr++;
52 
53  if(ptr[0] == 'l' && ptr[1] == 't') {
54  ptr += 2;
55  if(*ptr == 'e') {
56  cmpt = CMP_LTE;
57  ptr++;
58  }else {
59  cmpt = CMP_LT;
60  }
61  }else if(ptr[0] == 'g' && ptr[1] == 't') {
62  ptr += 2;
63  if(*ptr == 'e') {
64  cmpt = CMP_GTE;
65  ptr++;
66  }else {
67  cmpt = CMP_GT;
68  }
69  }
70 
71  if(!isspaceW(*ptr++))
72  return NULL;
73  while(isspaceW(*ptr))
74  ptr++;
75 
76  if(ptr[0] != 'I' || ptr[1] != 'E')
77  return NULL;
78 
79  ptr +=2;
80  if(!isspaceW(*ptr++))
81  return NULL;
82  while(isspaceW(*ptr))
83  ptr++;
84 
85  if(!isdigitW(*ptr))
86  return NULL;
87  while(isdigitW(*ptr))
88  majorv = majorv*10 + (*ptr++ - '0');
89 
90  if(*ptr == '.') {
91  ptr++;
92  if(!isdigitW(*ptr))
93  return NULL;
94  while(isdigitW(*ptr))
95  minorv = minorv*10 + (*ptr++ - '0');
96  }
97 
98  while(isspaceW(*ptr))
99  ptr++;
100  if(ptr[0] != ']' || ptr[1] != '>')
101  return NULL;
102  ptr += 2;
103 
104  len = strlenW(ptr);
105  if(len < sizeof(endifW)/sizeof(WCHAR))
106  return NULL;
107 
108  end = ptr + len-sizeof(endifW)/sizeof(WCHAR);
109  if(memcmp(end, endifW, sizeof(endifW)))
110  return NULL;
111 
112  switch(cmpt) {
113  case CMP_EQ:
114  if(majorv == IE_MAJOR_VERSION && minorv == IE_MINOR_VERSION)
115  break;
116  return NULL;
117  case CMP_LT:
118  if(majorv > IE_MAJOR_VERSION)
119  break;
120  if(majorv == IE_MAJOR_VERSION && minorv > IE_MINOR_VERSION)
121  break;
122  return NULL;
123  case CMP_LTE:
124  if(majorv > IE_MAJOR_VERSION)
125  break;
126  if(majorv == IE_MAJOR_VERSION && minorv >= IE_MINOR_VERSION)
127  break;
128  return NULL;
129  case CMP_GT:
130  if(majorv < IE_MAJOR_VERSION)
131  break;
132  if(majorv == IE_MAJOR_VERSION && minorv < IE_MINOR_VERSION)
133  break;
134  return NULL;
135  case CMP_GTE:
136  if(majorv < IE_MAJOR_VERSION)
137  break;
138  if(majorv == IE_MAJOR_VERSION && minorv <= IE_MINOR_VERSION)
139  break;
140  return NULL;
141  }
142 
143  buf = heap_alloc((end-ptr+1)*sizeof(WCHAR));
144  if(!buf)
145  return NULL;
146 
147  memcpy(buf, ptr, (end-ptr)*sizeof(WCHAR));
148  buf[end-ptr] = 0;
149 
150  return buf;
151 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
WINE_UNICODE_INLINE int isspaceW(WCHAR wc)
Definition: unicode.h:165
GLuint GLuint end
Definition: gl.h:1545
#define comment(fmt, arg1)
Definition: rebar.c:820
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IE_MINOR_VERSION
Definition: mutation.c:22
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define IE_MAJOR_VERSION
Definition: mutation.c:21
WINE_UNICODE_INLINE int isdigitW(WCHAR wc)
Definition: unicode.h:170
WCHAR PRUnichar
Definition: nsiface.idl:48

Referenced by run_insert_comment().

◆ impl_from_nsIDocumentObserver()

static HTMLDocumentNode* impl_from_nsIDocumentObserver ( nsIDocumentObserver iface)
inlinestatic

Definition at line 456 of file mutation.c.

457 {
458  return CONTAINING_RECORD(iface, HTMLDocumentNode, nsIDocumentObserver_iface);
459 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by nsDocumentObserver_AddRef(), nsDocumentObserver_AttemptToExecuteScript(), nsDocumentObserver_BindToDocument(), nsDocumentObserver_EndLoad(), nsDocumentObserver_QueryInterface(), and nsDocumentObserver_Release().

◆ impl_from_nsIRunnable()

static nsRunnable* impl_from_nsIRunnable ( nsIRunnable iface)
inlinestatic

Definition at line 359 of file mutation.c.

360 {
361  return CONTAINING_RECORD(iface, nsRunnable, nsIRunnable_iface);
362 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by nsRunnable_AddRef(), nsRunnable_QueryInterface(), nsRunnable_Release(), and nsRunnable_Run().

◆ init_document_mutation()

void init_document_mutation ( HTMLDocumentNode doc)

Definition at line 726 of file mutation.c.

727 {
728  nsIDocument *nsdoc;
729  nsresult nsres;
730 
732 
733  nsres = nsIDOMHTMLDocument_QueryInterface(doc->nsdoc, &IID_nsIDocument, (void**)&nsdoc);
734  if(NS_FAILED(nsres)) {
735  ERR("Could not get nsIDocument: %08x\n", nsres);
736  return;
737  }
738 
739  nsIContentUtils_AddDocumentObserver(content_utils, nsdoc, &doc->nsIDocumentObserver_iface);
740  nsIDocument_Release(nsdoc);
741 }
nsIDOMHTMLDocument * nsdoc
nsIDocumentObserver nsIDocumentObserver_iface
static nsIContentUtils * content_utils
Definition: mutation.c:27
#define NS_FAILED(res)
#define ERR(fmt,...)
Definition: debug.h:110
static const nsIDocumentObserverVtbl nsDocumentObserverVtbl
Definition: mutation.c:696
HRESULT nsresult
Definition: nsiface.idl:39

Referenced by create_doc_from_nsdoc().

◆ init_mutation()

void init_mutation ( nsIComponentManager component_manager)

Definition at line 774 of file mutation.c.

775 {
777  nsresult nsres;
778 
779  if(!component_manager) {
780  if(content_utils) {
781  nsIContentUtils_Release(content_utils);
783  }
784  return;
785  }
786 
787  nsres = nsIComponentManager_GetClassObject(component_manager, &NS_ICONTENTUTILS_CID,
788  &IID_nsIFactory, (void**)&factory);
789  if(NS_FAILED(nsres)) {
790  ERR("Could not create nsIContentUtils service: %08x\n", nsres);
791  return;
792  }
793 
794  nsres = nsIFactory_CreateInstance(factory, NULL, &IID_nsIContentUtils, (void**)&content_utils);
795  nsIFactory_Release(factory);
796  if(NS_FAILED(nsres))
797  ERR("Could not create nsIContentUtils instance: %08x\n", nsres);
798 }
static const IID NS_ICONTENTUTILS_CID
Definition: mutation.c:24
static nsIContentUtils * content_utils
Definition: mutation.c:27
Definition: main.c:438
smooth NULL
Definition: ftsmooth.c:416
#define NS_FAILED(res)
#define ERR(fmt,...)
Definition: debug.h:110
HRESULT nsresult
Definition: nsiface.idl:39
static ClassFactoryImpl factory
Definition: ole_server.c:234

Referenced by close_gecko(), and init_xpcom().

◆ nsDocumentObserver_AddRef()

static nsrefcnt NSAPI nsDocumentObserver_AddRef ( nsIDocumentObserver iface)
static

Definition at line 485 of file mutation.c.

486 {
488  return htmldoc_addref(&This->basedoc);
489 }
static HTMLDocumentNode * impl_from_nsIDocumentObserver(nsIDocumentObserver *iface)
Definition: mutation.c:456
static ULONG htmldoc_addref(HTMLDocument *This)

◆ nsDocumentObserver_AttemptToExecuteScript()

static void NSAPI nsDocumentObserver_AttemptToExecuteScript ( nsIDocumentObserver iface,
nsIContent aContent,
nsIParser aParser,
cpp_bool aBlock 
)
static

Definition at line 678 of file mutation.c.

680 {
682  nsIDOMHTMLScriptElement *nsscript;
683  nsresult nsres;
684 
685  TRACE("(%p)->(%p %p %p)\n", This, aContent, aParser, aBlock);
686 
687  nsres = nsIContent_QueryInterface(aContent, &IID_nsIDOMHTMLScriptElement, (void**)&nsscript);
688  if(NS_SUCCEEDED(nsres)) {
689  TRACE("script node\n");
690 
692  nsIDOMHTMLScriptElement_Release(nsscript);
693  }
694 }
static HTMLDocumentNode * impl_from_nsIDocumentObserver(nsIDocumentObserver *iface)
Definition: mutation.c:456
static nsresult run_insert_script(HTMLDocumentNode *doc, nsISupports *script_iface, nsISupports *parser_iface)
Definition: mutation.c:277
#define TRACE(s)
Definition: solgame.cpp:4
#define NS_SUCCEEDED(res)
HRESULT nsresult
Definition: nsiface.idl:39
static void add_script_runner(HTMLDocumentNode *This, runnable_proc_t proc, nsISupports *arg1, nsISupports *arg2)
Definition: mutation.c:428

◆ nsDocumentObserver_AttributeChanged()

static void NSAPI nsDocumentObserver_AttributeChanged ( nsIDocumentObserver iface,
nsIDocument aDocument,
nsIContent aContent,
LONG  aNameSpaceID,
nsIAtom aAttribute,
LONG  aModType 
)
static

Definition at line 512 of file mutation.c.

514 {
515 }

◆ nsDocumentObserver_AttributeSetToCurrentValue()

static void NSAPI nsDocumentObserver_AttributeSetToCurrentValue ( nsIDocumentObserver iface,
nsIDocument aDocument,
void aElement,
LONG  aNameSpaceID,
nsIAtom aAttribute 
)
static

Definition at line 517 of file mutation.c.

519 {
520 }

◆ nsDocumentObserver_AttributeWillChange()

static void NSAPI nsDocumentObserver_AttributeWillChange ( nsIDocumentObserver iface,
nsIDocument aDocument,
nsIContent aContent,
LONG  aNameSpaceID,
nsIAtom aAttribute,
LONG  aModType 
)
static

Definition at line 507 of file mutation.c.

509 {
510 }

◆ nsDocumentObserver_BeginLoad()

static void NSAPI nsDocumentObserver_BeginLoad ( nsIDocumentObserver iface,
nsIDocument aDocument 
)
static

Definition at line 556 of file mutation.c.

557 {
558 }

◆ nsDocumentObserver_BeginUpdate()

static void NSAPI nsDocumentObserver_BeginUpdate ( nsIDocumentObserver iface,
nsIDocument aDocument,
nsUpdateType  aUpdateType 
)
static

Definition at line 546 of file mutation.c.

548 {
549 }

◆ nsDocumentObserver_BindToDocument()

static void NSAPI nsDocumentObserver_BindToDocument ( nsIDocumentObserver iface,
nsIDocument aDocument,
nsIContent aContent 
)
static

Definition at line 613 of file mutation.c.

615 {
617  nsIDOMHTMLIFrameElement *nsiframe;
618  nsIDOMHTMLFrameElement *nsframe;
619  nsIDOMHTMLScriptElement *nsscript;
620  nsIDOMHTMLElement *nselem;
621  nsIDOMComment *nscomment;
622  nsresult nsres;
623 
624  TRACE("(%p)->(%p %p)\n", This, aDocument, aContent);
625 
626  nsres = nsIContent_QueryInterface(aContent, &IID_nsIDOMHTMLElement, (void**)&nselem);
627  if(NS_SUCCEEDED(nsres)) {
628  check_event_attr(This, nselem);
629  nsIDOMHTMLElement_Release(nselem);
630  }
631 
632  nsres = nsIContent_QueryInterface(aContent, &IID_nsIDOMComment, (void**)&nscomment);
633  if(NS_SUCCEEDED(nsres)) {
634  TRACE("comment node\n");
635 
637  nsIDOMComment_Release(nscomment);
638  return;
639  }
640 
641  nsres = nsIContent_QueryInterface(aContent, &IID_nsIDOMHTMLIFrameElement, (void**)&nsiframe);
642  if(NS_SUCCEEDED(nsres)) {
643  TRACE("iframe node\n");
644 
646  nsIDOMHTMLIFrameElement_Release(nsiframe);
647  return;
648  }
649 
650  nsres = nsIContent_QueryInterface(aContent, &IID_nsIDOMHTMLFrameElement, (void**)&nsframe);
651  if(NS_SUCCEEDED(nsres)) {
652  TRACE("frame node\n");
653 
655  nsIDOMHTMLFrameElement_Release(nsframe);
656  return;
657  }
658 
659  nsres = nsIContent_QueryInterface(aContent, &IID_nsIDOMHTMLScriptElement, (void**)&nsscript);
660  if(NS_SUCCEEDED(nsres)) {
661  HTMLScriptElement *script_elem;
662  HRESULT hres;
663 
664  TRACE("script element\n");
665 
666  hres = script_elem_from_nsscript(This, nsscript, &script_elem);
667  nsIDOMHTMLScriptElement_Release(nsscript);
668  if(FAILED(hres))
669  return;
670 
671  if(script_elem->parse_on_bind)
673 
674  IHTMLScriptElement_Release(&script_elem->IHTMLScriptElement_iface);
675  }
676 }
static nsresult run_bind_to_tree(HTMLDocumentNode *doc, nsISupports *nsiface, nsISupports *arg2)
Definition: mutation.c:190
IHTMLScriptElement IHTMLScriptElement_iface
Definition: htmlscript.h:24
HRESULT script_elem_from_nsscript(HTMLDocumentNode *doc, nsIDOMHTMLScriptElement *nsscript, HTMLScriptElement **ret)
Definition: htmlscript.c:425
static nsresult run_insert_comment(HTMLDocumentNode *doc, nsISupports *comment_iface, nsISupports *arg2)
Definition: mutation.c:153
static HTMLDocumentNode * impl_from_nsIDocumentObserver(nsIDocumentObserver *iface)
Definition: mutation.c:456
static nsresult run_insert_script(HTMLDocumentNode *doc, nsISupports *script_iface, nsISupports *parser_iface)
Definition: mutation.c:277
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
#define NS_SUCCEEDED(res)
HRESULT nsresult
Definition: nsiface.idl:39
void check_event_attr(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem)
Definition: htmlevent.c:1559
static void add_script_runner(HTMLDocumentNode *This, runnable_proc_t proc, nsISupports *arg1, nsISupports *arg2)
Definition: mutation.c:428

◆ nsDocumentObserver_CharacterDataChanged()

static void NSAPI nsDocumentObserver_CharacterDataChanged ( nsIDocumentObserver iface,
nsIDocument aDocument,
nsIContent aContent,
void aInfo 
)
static

Definition at line 502 of file mutation.c.

504 {
505 }

◆ nsDocumentObserver_CharacterDataWillChange()

static void NSAPI nsDocumentObserver_CharacterDataWillChange ( nsIDocumentObserver iface,
nsIDocument aDocument,
nsIContent aContent,
void aInfo 
)
static

Definition at line 497 of file mutation.c.

499 {
500 }

◆ nsDocumentObserver_ContentAppended()

static void NSAPI nsDocumentObserver_ContentAppended ( nsIDocumentObserver iface,
nsIDocument aDocument,
nsIContent aContainer,
nsIContent aFirstNewContent,
LONG  aNewIndexInContainer 
)
static

Definition at line 522 of file mutation.c.

524 {
525 }

◆ nsDocumentObserver_ContentInserted()

static void NSAPI nsDocumentObserver_ContentInserted ( nsIDocumentObserver iface,
nsIDocument aDocument,
nsIContent aContainer,
nsIContent aChild,
LONG  aIndexInContainer 
)
static

Definition at line 527 of file mutation.c.

529 {
530 }

◆ nsDocumentObserver_ContentRemoved()

static void NSAPI nsDocumentObserver_ContentRemoved ( nsIDocumentObserver iface,
nsIDocument aDocument,
nsIContent aContainer,
nsIContent aChild,
LONG  aIndexInContainer,
nsIContent aProviousSibling 
)
static

Definition at line 532 of file mutation.c.

535 {
536 }

◆ nsDocumentObserver_ContentStatesChanged()

static void NSAPI nsDocumentObserver_ContentStatesChanged ( nsIDocumentObserver iface,
nsIDocument aDocument,
nsIContent aContent,
EventStates  aStateMask 
)
static

Definition at line 573 of file mutation.c.

575 {
576 }

◆ nsDocumentObserver_DocumentStatesChanged()

static void NSAPI nsDocumentObserver_DocumentStatesChanged ( nsIDocumentObserver iface,
nsIDocument aDocument,
EventStates  aStateMask 
)
static

Definition at line 578 of file mutation.c.

580 {
581 }

◆ nsDocumentObserver_EndLoad()

static void NSAPI nsDocumentObserver_EndLoad ( nsIDocumentObserver iface,
nsIDocument aDocument 
)
static

Definition at line 560 of file mutation.c.

561 {
563 
564  TRACE("(%p)\n", This);
565 
566  if(This->skip_mutation_notif)
567  return;
568 
569  This->content_ready = TRUE;
571 }
#define TRUE
Definition: types.h:120
static nsresult run_end_load(HTMLDocumentNode *This, nsISupports *arg1, nsISupports *arg2)
Definition: mutation.c:257
static HTMLDocumentNode * impl_from_nsIDocumentObserver(nsIDocumentObserver *iface)
Definition: mutation.c:456
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static void add_script_runner(HTMLDocumentNode *This, runnable_proc_t proc, nsISupports *arg1, nsISupports *arg2)
Definition: mutation.c:428

◆ nsDocumentObserver_EndUpdate()

static void NSAPI nsDocumentObserver_EndUpdate ( nsIDocumentObserver iface,
nsIDocument aDocument,
nsUpdateType  aUpdateType 
)
static

Definition at line 551 of file mutation.c.

553 {
554 }

◆ nsDocumentObserver_NodeWillBeDestroyed()

static void NSAPI nsDocumentObserver_NodeWillBeDestroyed ( nsIDocumentObserver iface,
const nsINode aNode 
)
static

Definition at line 538 of file mutation.c.

539 {
540 }

◆ nsDocumentObserver_ParentChainChanged()

static void NSAPI nsDocumentObserver_ParentChainChanged ( nsIDocumentObserver iface,
nsIContent aContent 
)
static

Definition at line 542 of file mutation.c.

543 {
544 }

◆ nsDocumentObserver_QueryInterface()

static nsresult NSAPI nsDocumentObserver_QueryInterface ( nsIDocumentObserver iface,
nsIIDRef  riid,
void **  result 
)
static

Definition at line 461 of file mutation.c.

463 {
465 
466  if(IsEqualGUID(&IID_nsISupports, riid)) {
467  TRACE("(%p)->(IID_nsISupports, %p)\n", This, result);
468  *result = &This->nsIDocumentObserver_iface;
469  }else if(IsEqualGUID(&IID_nsIMutationObserver, riid)) {
470  TRACE("(%p)->(IID_nsIMutationObserver %p)\n", This, result);
471  *result = &This->nsIDocumentObserver_iface;
472  }else if(IsEqualGUID(&IID_nsIDocumentObserver, riid)) {
473  TRACE("(%p)->(IID_nsIDocumentObserver %p)\n", This, result);
474  *result = &This->nsIDocumentObserver_iface;
475  }else {
476  *result = NULL;
477  TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), result);
478  return NS_NOINTERFACE;
479  }
480 
481  htmldoc_addref(&This->basedoc);
482  return NS_OK;
483 }
REFIID riid
Definition: precomp.h:44
static HTMLDocumentNode * impl_from_nsIDocumentObserver(nsIDocumentObserver *iface)
Definition: mutation.c:456
#define NS_OK
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
#define NS_NOINTERFACE
static ULONG htmldoc_addref(HTMLDocument *This)
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
GLuint64EXT * result
Definition: glext.h:11304

◆ nsDocumentObserver_Release()

static nsrefcnt NSAPI nsDocumentObserver_Release ( nsIDocumentObserver iface)
static

Definition at line 491 of file mutation.c.

492 {
494  return htmldoc_release(&This->basedoc);
495 }
static HTMLDocumentNode * impl_from_nsIDocumentObserver(nsIDocumentObserver *iface)
Definition: mutation.c:456
static ULONG htmldoc_release(HTMLDocument *This)

◆ nsDocumentObserver_StyleRuleAdded()

static void NSAPI nsDocumentObserver_StyleRuleAdded ( nsIDocumentObserver iface,
nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
nsIStyleRule aStyleRule 
)
static

Definition at line 603 of file mutation.c.

605 {
606 }

◆ nsDocumentObserver_StyleRuleChanged()

static void NSAPI nsDocumentObserver_StyleRuleChanged ( nsIDocumentObserver iface,
nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
nsIStyleRule aOldStyleRule,
nsIStyleSheet aNewStyleRule 
)
static

Definition at line 598 of file mutation.c.

600 {
601 }

◆ nsDocumentObserver_StyleRuleRemoved()

static void NSAPI nsDocumentObserver_StyleRuleRemoved ( nsIDocumentObserver iface,
nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
nsIStyleRule aStyleRule 
)
static

Definition at line 608 of file mutation.c.

610 {
611 }

◆ nsDocumentObserver_StyleSheetAdded()

static void NSAPI nsDocumentObserver_StyleSheetAdded ( nsIDocumentObserver iface,
nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
cpp_bool  aDocumentSheet 
)
static

Definition at line 583 of file mutation.c.

585 {
586 }

◆ nsDocumentObserver_StyleSheetApplicableStateChanged()

static void NSAPI nsDocumentObserver_StyleSheetApplicableStateChanged ( nsIDocumentObserver iface,
nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
cpp_bool  aApplicable 
)
static

Definition at line 593 of file mutation.c.

595 {
596 }

◆ nsDocumentObserver_StyleSheetRemoved()

static void NSAPI nsDocumentObserver_StyleSheetRemoved ( nsIDocumentObserver iface,
nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
cpp_bool  aDocumentSheet 
)
static

Definition at line 588 of file mutation.c.

590 {
591 }

◆ nsRunnable_AddRef()

static nsrefcnt NSAPI nsRunnable_AddRef ( nsIRunnable iface)
static

Definition at line 385 of file mutation.c.

386 {
389 
390  TRACE("(%p) ref=%d\n", This, ref);
391 
392  return ref;
393 }
Definition: send.c:48
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
static nsRunnable * impl_from_nsIRunnable(nsIRunnable *iface)
Definition: mutation.c:359

◆ nsRunnable_QueryInterface()

static nsresult NSAPI nsRunnable_QueryInterface ( nsIRunnable iface,
nsIIDRef  riid,
void **  result 
)
static

Definition at line 364 of file mutation.c.

366 {
368 
369  if(IsEqualGUID(riid, &IID_nsISupports)) {
370  TRACE("(%p)->(IID_nsISupports %p)\n", This, result);
371  *result = &This->nsIRunnable_iface;
372  }else if(IsEqualGUID(riid, &IID_nsIRunnable)) {
373  TRACE("(%p)->(IID_nsIRunnable %p)\n", This, result);
374  *result = &This->nsIRunnable_iface;
375  }else {
376  *result = NULL;
377  WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), result);
378  return NS_NOINTERFACE;
379  }
380 
381  nsISupports_AddRef((nsISupports*)*result);
382  return NS_OK;
383 }
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:112
#define NS_OK
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
static nsRunnable * impl_from_nsIRunnable(nsIRunnable *iface)
Definition: mutation.c:359
#define NS_NOINTERFACE
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
GLuint64EXT * result
Definition: glext.h:11304

◆ nsRunnable_Release()

static nsrefcnt NSAPI nsRunnable_Release ( nsIRunnable iface)
static

Definition at line 395 of file mutation.c.

396 {
399 
400  TRACE("(%p) ref=%d\n", This, ref);
401 
402  if(!ref) {
403  htmldoc_release(&This->doc->basedoc);
404  if(This->arg1)
405  nsISupports_Release(This->arg1);
406  if(This->arg2)
407  nsISupports_Release(This->arg2);
408  heap_free(This);
409  }
410 
411  return ref;
412 }
Definition: send.c:48
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
static ULONG htmldoc_release(HTMLDocument *This)
static nsRunnable * impl_from_nsIRunnable(nsIRunnable *iface)
Definition: mutation.c:359
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ nsRunnable_Run()

static nsresult NSAPI nsRunnable_Run ( nsIRunnable iface)
static

Definition at line 414 of file mutation.c.

415 {
417 
418  return This->proc(This->doc, This->arg1, This->arg2);
419 }
static nsRunnable * impl_from_nsIRunnable(nsIRunnable *iface)
Definition: mutation.c:359

◆ parse_complete()

static void parse_complete ( HTMLDocumentObj doc)
static

Definition at line 238 of file mutation.c.

239 {
240  TRACE("(%p)\n", doc);
241 
242  if(doc->usermode == EDITMODE)
243  init_editor(&doc->basedoc);
244 
245  call_explorer_69(doc);
246  if(doc->view_sink)
247  IAdviseSink_OnViewChange(doc->view_sink, DVASPECT_CONTENT, -1);
249  call_explorer_69(doc);
250 
251  if(doc->webbrowser && doc->usermode != EDITMODE && !(doc->basedoc.window->load_flags & BINDING_REFRESH))
252  IDocObjectService_FireNavigateComplete2(doc->doc_object_service, &doc->basedoc.window->base.IHTMLWindow2_iface, 0);
253 
254  /* FIXME: IE7 calls EnableModelless(TRUE), EnableModelless(FALSE) and sets interactive state here */
255 }
static void call_explorer_69(HTMLDocumentObj *doc)
Definition: mutation.c:218
HTMLOuterWindow * window
void call_property_onchanged(ConnectionPointContainer *container, DISPID dispid)
Definition: conpoint.c:342
IUnknown * webbrowser
#define TRACE(s)
Definition: solgame.cpp:4
HTMLDocument basedoc
ConnectionPointContainer cp_container
#define BINDING_REFRESH
Definition: binding.h:130
IAdviseSink * view_sink
IDocObjectService * doc_object_service
IHTMLWindow2 IHTMLWindow2_iface
void init_editor(HTMLDocument *This)
Definition: editor.c:1202

Referenced by run_end_load().

◆ release_document_mutation()

void release_document_mutation ( HTMLDocumentNode doc)

Definition at line 743 of file mutation.c.

744 {
745  nsIDocument *nsdoc;
746  nsresult nsres;
747 
748  nsres = nsIDOMHTMLDocument_QueryInterface(doc->nsdoc, &IID_nsIDocument, (void**)&nsdoc);
749  if(NS_FAILED(nsres)) {
750  ERR("Could not get nsIDocument: %08x\n", nsres);
751  return;
752  }
753 
754  nsIContentUtils_RemoveDocumentObserver(content_utils, nsdoc, &doc->nsIDocumentObserver_iface);
755  nsIDocument_Release(nsdoc);
756 }
nsIDOMHTMLDocument * nsdoc
nsIDocumentObserver nsIDocumentObserver_iface
static nsIContentUtils * content_utils
Definition: mutation.c:27
#define NS_FAILED(res)
#define ERR(fmt,...)
Definition: debug.h:110
HRESULT nsresult
Definition: nsiface.idl:39

Referenced by HTMLDocumentNode_unlink().

◆ run_bind_to_tree()

static nsresult run_bind_to_tree ( HTMLDocumentNode doc,
nsISupports nsiface,
nsISupports arg2 
)
static

Definition at line 190 of file mutation.c.

191 {
192  nsIDOMNode *nsnode;
193  HTMLDOMNode *node;
194  nsresult nsres;
195  HRESULT hres;
196 
197  TRACE("(%p)->(%p)\n", doc, nsiface);
198 
199  nsres = nsISupports_QueryInterface(nsiface, &IID_nsIDOMNode, (void**)&nsnode);
200  if(NS_FAILED(nsres))
201  return nsres;
202 
203  hres = get_node(doc, nsnode, TRUE, &node);
204  nsIDOMNode_Release(nsnode);
205  if(FAILED(hres)) {
206  ERR("Could not get node\n");
207  return nsres;
208  }
209 
210  if(node->vtbl->bind_to_tree)
211  node->vtbl->bind_to_tree(node);
212 
214  return nsres;
215 }
#define TRUE
Definition: types.h:120
struct node node
static void node_release(HTMLDOMNode *node)
#define NS_FAILED(res)
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
#define ERR(fmt,...)
Definition: debug.h:110
HRESULT get_node(HTMLDocumentNode *This, nsIDOMNode *nsnode, BOOL create, HTMLDOMNode **ret)
Definition: htmlnode.c:1339
HRESULT nsresult
Definition: nsiface.idl:39
Definition: dlist.c:348

Referenced by nsDocumentObserver_BindToDocument().

◆ run_end_load()

static nsresult run_end_load ( HTMLDocumentNode This,
nsISupports arg1,
nsISupports arg2 
)
static

Definition at line 257 of file mutation.c.

258 {
259  TRACE("(%p)\n", This);
260 
261  if(!This->basedoc.doc_obj)
262  return NS_OK;
263 
264  if(This == This->basedoc.doc_obj->basedoc.doc_node) {
265  /*
266  * This should be done in the worker thread that parses HTML,
267  * but we don't have such thread (Gecko parses HTML for us).
268  */
269  parse_complete(This->basedoc.doc_obj);
270  }
271 
273  set_ready_state(This->basedoc.window, READYSTATE_INTERACTIVE);
274  return NS_OK;
275 }
static void parse_complete(HTMLDocumentObj *doc)
Definition: mutation.c:238
#define NS_OK
#define TRACE(s)
Definition: solgame.cpp:4
void set_ready_state(HTMLOuterWindow *, READYSTATE) DECLSPEC_HIDDEN
Definition: persist.c:450
void bind_event_scripts(HTMLDocumentNode *) DECLSPEC_HIDDEN
Definition: script.c:1423

Referenced by nsDocumentObserver_EndLoad().

◆ run_insert_comment()

static nsresult run_insert_comment ( HTMLDocumentNode doc,
nsISupports comment_iface,
nsISupports arg2 
)
static

Definition at line 153 of file mutation.c.

154 {
155  const PRUnichar *comment;
156  nsIDOMComment *nscomment;
157  PRUnichar *replace_html;
158  nsAString comment_str;
159  nsresult nsres;
160 
161  nsres = nsISupports_QueryInterface(comment_iface, &IID_nsIDOMComment, (void**)&nscomment);
162  if(NS_FAILED(nsres)) {
163  ERR("Could not get nsIDOMComment iface:%08x\n", nsres);
164  return nsres;
165  }
166 
167  nsAString_Init(&comment_str, NULL);
168  nsres = nsIDOMComment_GetData(nscomment, &comment_str);
169  if(NS_FAILED(nsres))
170  return nsres;
171 
172  nsAString_GetData(&comment_str, &comment);
173  replace_html = handle_insert_comment(doc, comment);
174  nsAString_Finish(&comment_str);
175 
176  if(replace_html) {
177  HRESULT hres;
178 
179  hres = replace_node_by_html(doc->nsdoc, (nsIDOMNode*)nscomment, replace_html);
180  heap_free(replace_html);
181  if(FAILED(hres))
182  nsres = NS_ERROR_FAILURE;
183  }
184 
185 
186  nsIDOMComment_Release(nscomment);
187  return nsres;
188 }
nsIDOMHTMLDocument * nsdoc
static PRUnichar * handle_insert_comment(HTMLDocumentNode *doc, const PRUnichar *comment)
Definition: mutation.c:29
#define comment(fmt, arg1)
Definition: rebar.c:820
smooth NULL
Definition: ftsmooth.c:416
#define NS_FAILED(res)
#define NS_ERROR_FAILURE
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
UINT32 nsAString_GetData(const nsAString *, const PRUnichar **) DECLSPEC_HIDDEN
Definition: nsembed.c:831
#define ERR(fmt,...)
Definition: debug.h:110
HRESULT replace_node_by_html(nsIDOMHTMLDocument *nsdoc, nsIDOMNode *nsnode, const WCHAR *html)
Definition: htmlelem.c:98
BOOL nsAString_Init(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:817
void nsAString_Finish(nsAString *) DECLSPEC_HIDDEN
Definition: nsembed.c:836
HRESULT nsresult
Definition: nsiface.idl:39
WCHAR PRUnichar
Definition: nsiface.idl:48
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by nsDocumentObserver_BindToDocument().

◆ run_insert_script()

static nsresult run_insert_script ( HTMLDocumentNode doc,
nsISupports script_iface,
nsISupports parser_iface 
)
static

Definition at line 277 of file mutation.c.

278 {
279  nsIDOMHTMLScriptElement *nsscript;
280  HTMLScriptElement *script_elem;
281  nsIParser *nsparser = NULL;
282  script_queue_entry_t *iter;
284  nsresult nsres;
285  HRESULT hres;
286 
287  TRACE("(%p)->(%p)\n", doc, script_iface);
288 
289  window = doc->window;
290  if(!window)
291  return NS_OK;
292 
293  nsres = nsISupports_QueryInterface(script_iface, &IID_nsIDOMHTMLScriptElement, (void**)&nsscript);
294  if(NS_FAILED(nsres)) {
295  ERR("Could not get nsIDOMHTMLScriptElement: %08x\n", nsres);
296  return nsres;
297  }
298 
299  if(parser_iface) {
300  nsres = nsISupports_QueryInterface(parser_iface, &IID_nsIParser, (void**)&nsparser);
301  if(NS_FAILED(nsres)) {
302  ERR("Could not get nsIParser iface: %08x\n", nsres);
303  nsparser = NULL;
304  }
305  }
306 
307  hres = script_elem_from_nsscript(doc, nsscript, &script_elem);
308  nsIDOMHTMLScriptElement_Release(nsscript);
309  if(FAILED(hres))
310  return NS_ERROR_FAILURE;
311 
312  if(nsparser) {
313  nsIParser_BeginEvaluatingParserInsertedScript(nsparser);
314  window->parser_callback_cnt++;
315  }
316 
317  IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface);
318 
319  doc_insert_script(window, script_elem);
320 
321  while(!list_empty(&window->script_queue)) {
322  iter = LIST_ENTRY(list_head(&window->script_queue), script_queue_entry_t, entry);
323  list_remove(&iter->entry);
324  if(!iter->script->parsed)
326  IHTMLScriptElement_Release(&iter->script->IHTMLScriptElement_iface);
327  heap_free(iter);
328  }
329 
330  IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface);
331 
332  if(nsparser) {
333  window->parser_callback_cnt--;
334  nsIParser_EndEvaluatingParserInsertedScript(nsparser);
335  nsIParser_Release(nsparser);
336  }
337 
338  IHTMLScriptElement_Release(&script_elem->IHTMLScriptElement_iface);
339 
340  return NS_OK;
341 }
IHTMLScriptElement IHTMLScriptElement_iface
Definition: htmlscript.h:24
HRESULT script_elem_from_nsscript(HTMLDocumentNode *doc, nsIDOMHTMLScriptElement *nsscript, HTMLScriptElement **ret)
Definition: htmlscript.c:425
HTMLInnerWindow * window
Definition: htmlscript.h:33
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
#define NS_OK
struct list entry
Definition: htmlscript.h:34
HTMLScriptElement * script
Definition: htmlscript.h:35
smooth NULL
Definition: ftsmooth.c:416
#define NS_FAILED(res)
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define NS_ERROR_FAILURE
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:78
uint32_t entry
Definition: isohybrid.c:63
static IHTMLWindow2 * window
Definition: events.c:77
#define ERR(fmt,...)
Definition: debug.h:110
__WINE_SERVER_LIST_INLINE int list_empty(const struct list *list)
Definition: list.h:143
void doc_insert_script(HTMLInnerWindow *, HTMLScriptElement *) DECLSPEC_HIDDEN
Definition: script.c:1172
HRESULT nsresult
Definition: nsiface.idl:39
#define LIST_ENTRY(type)
Definition: queue.h:175
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by nsDocumentObserver_AttemptToExecuteScript(), and nsDocumentObserver_BindToDocument().

Variable Documentation

◆ content_utils

◆ NS_ICONTENTUTILS_CID

const IID NS_ICONTENTUTILS_CID
static
Initial value:
=
{0x762C4AE7,0xB923,0x422F,{0xB9,0x7E,0xB9,0xBF,0xC1,0xEF,0x7B,0xF0}}

Definition at line 24 of file mutation.c.

Referenced by init_mutation().

◆ nsDocumentObserverVtbl

const nsIDocumentObserverVtbl nsDocumentObserverVtbl
static
Initial value:
= {
}
static nsrefcnt NSAPI nsDocumentObserver_Release(nsIDocumentObserver *iface)
Definition: mutation.c:491
static void NSAPI nsDocumentObserver_ContentAppended(nsIDocumentObserver *iface, nsIDocument *aDocument, nsIContent *aContainer, nsIContent *aFirstNewContent, LONG aNewIndexInContainer)
Definition: mutation.c:522
static void NSAPI nsDocumentObserver_StyleRuleChanged(nsIDocumentObserver *iface, nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, nsIStyleRule *aOldStyleRule, nsIStyleSheet *aNewStyleRule)
Definition: mutation.c:598
static void NSAPI nsDocumentObserver_ParentChainChanged(nsIDocumentObserver *iface, nsIContent *aContent)
Definition: mutation.c:542
static void NSAPI nsDocumentObserver_AttributeWillChange(nsIDocumentObserver *iface, nsIDocument *aDocument, nsIContent *aContent, LONG aNameSpaceID, nsIAtom *aAttribute, LONG aModType)
Definition: mutation.c:507
static void NSAPI nsDocumentObserver_BeginLoad(nsIDocumentObserver *iface, nsIDocument *aDocument)
Definition: mutation.c:556
static void NSAPI nsDocumentObserver_ContentInserted(nsIDocumentObserver *iface, nsIDocument *aDocument, nsIContent *aContainer, nsIContent *aChild, LONG aIndexInContainer)
Definition: mutation.c:527
static void NSAPI nsDocumentObserver_ContentRemoved(nsIDocumentObserver *iface, nsIDocument *aDocument, nsIContent *aContainer, nsIContent *aChild, LONG aIndexInContainer, nsIContent *aProviousSibling)
Definition: mutation.c:532
static void NSAPI nsDocumentObserver_BeginUpdate(nsIDocumentObserver *iface, nsIDocument *aDocument, nsUpdateType aUpdateType)
Definition: mutation.c:546
static nsresult NSAPI nsDocumentObserver_QueryInterface(nsIDocumentObserver *iface, nsIIDRef riid, void **result)
Definition: mutation.c:461
static void NSAPI nsDocumentObserver_EndUpdate(nsIDocumentObserver *iface, nsIDocument *aDocument, nsUpdateType aUpdateType)
Definition: mutation.c:551
static void NSAPI nsDocumentObserver_StyleRuleRemoved(nsIDocumentObserver *iface, nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, nsIStyleRule *aStyleRule)
Definition: mutation.c:608
static void NSAPI nsDocumentObserver_CharacterDataWillChange(nsIDocumentObserver *iface, nsIDocument *aDocument, nsIContent *aContent, void *aInfo)
Definition: mutation.c:497
static nsrefcnt NSAPI nsDocumentObserver_AddRef(nsIDocumentObserver *iface)
Definition: mutation.c:485
static void NSAPI nsDocumentObserver_StyleSheetApplicableStateChanged(nsIDocumentObserver *iface, nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, cpp_bool aApplicable)
Definition: mutation.c:593
static void NSAPI nsDocumentObserver_CharacterDataChanged(nsIDocumentObserver *iface, nsIDocument *aDocument, nsIContent *aContent, void *aInfo)
Definition: mutation.c:502
static void NSAPI nsDocumentObserver_StyleSheetAdded(nsIDocumentObserver *iface, nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, cpp_bool aDocumentSheet)
Definition: mutation.c:583
static void NSAPI nsDocumentObserver_BindToDocument(nsIDocumentObserver *iface, nsIDocument *aDocument, nsIContent *aContent)
Definition: mutation.c:613
static void NSAPI nsDocumentObserver_AttributeSetToCurrentValue(nsIDocumentObserver *iface, nsIDocument *aDocument, void *aElement, LONG aNameSpaceID, nsIAtom *aAttribute)
Definition: mutation.c:517
static void NSAPI nsDocumentObserver_StyleSheetRemoved(nsIDocumentObserver *iface, nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, cpp_bool aDocumentSheet)
Definition: mutation.c:588
static void NSAPI nsDocumentObserver_StyleRuleAdded(nsIDocumentObserver *iface, nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, nsIStyleRule *aStyleRule)
Definition: mutation.c:603
static void NSAPI nsDocumentObserver_DocumentStatesChanged(nsIDocumentObserver *iface, nsIDocument *aDocument, EventStates aStateMask)
Definition: mutation.c:578
static void NSAPI nsDocumentObserver_AttributeChanged(nsIDocumentObserver *iface, nsIDocument *aDocument, nsIContent *aContent, LONG aNameSpaceID, nsIAtom *aAttribute, LONG aModType)
Definition: mutation.c:512
static void NSAPI nsDocumentObserver_ContentStatesChanged(nsIDocumentObserver *iface, nsIDocument *aDocument, nsIContent *aContent, EventStates aStateMask)
Definition: mutation.c:573
static void NSAPI nsDocumentObserver_AttemptToExecuteScript(nsIDocumentObserver *iface, nsIContent *aContent, nsIParser *aParser, cpp_bool *aBlock)
Definition: mutation.c:678
static void NSAPI nsDocumentObserver_EndLoad(nsIDocumentObserver *iface, nsIDocument *aDocument)
Definition: mutation.c:560
static void NSAPI nsDocumentObserver_NodeWillBeDestroyed(nsIDocumentObserver *iface, const nsINode *aNode)
Definition: mutation.c:538

Definition at line 696 of file mutation.c.

Referenced by init_document_mutation().

◆ nsRunnableVtbl

const nsIRunnableVtbl nsRunnableVtbl
static
Initial value:
= {
}
static nsrefcnt NSAPI nsRunnable_Release(nsIRunnable *iface)
Definition: mutation.c:395
static nsresult NSAPI nsRunnable_QueryInterface(nsIRunnable *iface, nsIIDRef riid, void **result)
Definition: mutation.c:364
static nsrefcnt NSAPI nsRunnable_AddRef(nsIRunnable *iface)
Definition: mutation.c:385
static nsresult NSAPI nsRunnable_Run(nsIRunnable *iface)
Definition: mutation.c:414

Definition at line 421 of file mutation.c.

Referenced by add_script_runner().