static nsresult run_bind_to_tree(HTMLDocumentNode *doc, nsISupports *nsiface, nsISupports *arg2) { nsIDOMNode *nsnode; HTMLDOMNode *node; nsresult nsres; HRESULT hres; TRACE("(%p)->(%p)\n", doc, nsiface); nsres = nsISupports_QueryInterface(nsiface, &IID_nsIDOMNode, (void**)&nsnode); if(NS_FAILED(nsres)) return nsres; hres = get_node(doc, nsnode, TRUE, &node); nsIDOMNode_Release(nsnode); if(FAILED(hres)) { ERR("Could not get node\n"); return nsres; } if(node->vtbl->bind_to_tree) node->vtbl->bind_to_tree(node); node_release(node); return nsres; }
static nsresult NSAPI nsServiceFactory_CreateInstance(nsIFactory *iface, nsISupports *aOuter, const nsIID *iid, void **result) { nsServiceFactory *This = impl_from_nsIFactory(iface); TRACE("(%p)->(%p %s %p)\n", This, aOuter, debugstr_guid(iid), result); return nsISupports_QueryInterface(This->service, iid, result); }
static void load_settings(HTMLDocumentObj *doc) { nsIMarkupDocumentViewer *markup_document_viewer; nsIContentViewer *content_viewer; nsIDocShell *doc_shell; HKEY settings_key; DWORD val, size; LONG res; nsresult nsres; static const WCHAR ie_keyW[] = { 'S','O','F','T','W','A','R','E','\\', 'M','i','c','r','o','s','o','f','t','\\', 'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r',0}; static const WCHAR zoomW[] = {'Z','o','o','m',0}; static const WCHAR zoom_factorW[] = {'Z','o','o','m','F','a','c','t','o','r',0}; res = RegOpenKeyW(HKEY_CURRENT_USER, ie_keyW, &settings_key); if(res != ERROR_SUCCESS) return; size = sizeof(val); res = RegGetValueW(settings_key, zoomW, zoom_factorW, RRF_RT_REG_DWORD, NULL, &val, &size); RegCloseKey(settings_key); if(res != ERROR_SUCCESS) return; TRACE("Setting ZoomFactor to %u\n", val); nsres = get_nsinterface((nsISupports*)doc->nscontainer->navigation, &IID_nsIDocShell, (void**)&doc_shell); assert(nsres == NS_OK); nsres = nsIDocShell_GetContentViewer(doc_shell, &content_viewer); assert(nsres == NS_OK && content_viewer); nsres = nsISupports_QueryInterface(content_viewer, &IID_nsIMarkupDocumentViewer, (void**)&markup_document_viewer); nsISupports_Release(content_viewer); assert(nsres == NS_OK); nsres = nsIMarkupDocumentViewer_SetFullZoom(markup_document_viewer, (float)val/100000); if(NS_FAILED(nsres)) ERR("SetFullZoom failed: %08x\n", nsres); nsIDocShell_Release(doc_shell); }
static nsresult run_insert_comment(HTMLDocumentNode *doc, nsISupports *comment_iface, nsISupports *arg2) { const PRUnichar *comment; nsIDOMComment *nscomment; PRUnichar *replace_html; nsAString comment_str; nsresult nsres; nsres = nsISupports_QueryInterface(comment_iface, &IID_nsIDOMComment, (void**)&nscomment); if(NS_FAILED(nsres)) { ERR("Could not get nsIDOMComment iface:%08x\n", nsres); return nsres; } nsAString_Init(&comment_str, NULL); nsres = nsIDOMComment_GetData(nscomment, &comment_str); if(NS_FAILED(nsres)) return nsres; nsAString_GetData(&comment_str, &comment); replace_html = handle_insert_comment(doc, comment); nsAString_Finish(&comment_str); if(replace_html) { HRESULT hres; hres = replace_node_by_html(doc->nsdoc, (nsIDOMNode*)nscomment, replace_html); heap_free(replace_html); if(FAILED(hres)) nsres = NS_ERROR_FAILURE; } nsIDOMComment_Release(nscomment); return nsres; }
static nsresult run_insert_script(HTMLDocumentNode *doc, nsISupports *script_iface, nsISupports *parser_iface) { nsIDOMHTMLScriptElement *nsscript; HTMLScriptElement *script_elem; nsIParser *nsparser = NULL; script_queue_entry_t *iter; HTMLInnerWindow *window; nsresult nsres; HRESULT hres; TRACE("(%p)->(%p)\n", doc, script_iface); window = doc->window; if(!window) return NS_OK; nsres = nsISupports_QueryInterface(script_iface, &IID_nsIDOMHTMLScriptElement, (void**)&nsscript); if(NS_FAILED(nsres)) { ERR("Could not get nsIDOMHTMLScriptElement: %08x\n", nsres); return nsres; } if(parser_iface) { nsres = nsISupports_QueryInterface(parser_iface, &IID_nsIParser, (void**)&nsparser); if(NS_FAILED(nsres)) { ERR("Could not get nsIParser iface: %08x\n", nsres); nsparser = NULL; } } hres = script_elem_from_nsscript(doc, nsscript, &script_elem); nsIDOMHTMLScriptElement_Release(nsscript); if(FAILED(hres)) return NS_ERROR_FAILURE; if(nsparser) { nsIParser_BeginEvaluatingParserInsertedScript(nsparser); window->parser_callback_cnt++; } IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface); doc_insert_script(window, script_elem); while(!list_empty(&window->script_queue)) { iter = LIST_ENTRY(list_head(&window->script_queue), script_queue_entry_t, entry); list_remove(&iter->entry); if(!iter->script->parsed) doc_insert_script(window, iter->script); IHTMLScriptElement_Release(&iter->script->IHTMLScriptElement_iface); heap_free(iter); } IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); if(nsparser) { window->parser_callback_cnt--; nsIParser_EndEvaluatingParserInsertedScript(nsparser); nsIParser_Release(nsparser); } IHTMLScriptElement_Release(&script_elem->IHTMLScriptElement_iface); return NS_OK; }