mshtml: Added generic get_nsinterface function and use it in get_ns_command_state.
This commit is contained in:
parent
124f0290e4
commit
fa58e6ce5d
|
@ -114,19 +114,9 @@ static void do_ns_editor_command(NSContainer *This, const char *cmd)
|
||||||
static nsresult get_ns_command_state(NSContainer *This, const char *cmd, nsICommandParams *nsparam)
|
static nsresult get_ns_command_state(NSContainer *This, const char *cmd, nsICommandParams *nsparam)
|
||||||
{
|
{
|
||||||
nsICommandManager *cmdmgr;
|
nsICommandManager *cmdmgr;
|
||||||
nsIInterfaceRequestor *iface_req;
|
|
||||||
nsresult nsres;
|
nsresult nsres;
|
||||||
|
|
||||||
nsres = nsIWebBrowser_QueryInterface(This->webbrowser,
|
nsres = get_nsinterface((nsISupports*)This->webbrowser, &IID_nsICommandManager, (void**)&cmdmgr);
|
||||||
&IID_nsIInterfaceRequestor, (void**)&iface_req);
|
|
||||||
if(NS_FAILED(nsres)) {
|
|
||||||
ERR("Could not get nsIInterfaceRequestor: %08x\n", nsres);
|
|
||||||
return nsres;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsres = nsIInterfaceRequestor_GetInterface(iface_req, &IID_nsICommandManager,
|
|
||||||
(void**)&cmdmgr);
|
|
||||||
nsIInterfaceRequestor_Release(iface_req);
|
|
||||||
if(NS_FAILED(nsres)) {
|
if(NS_FAILED(nsres)) {
|
||||||
ERR("Could not get nsICommandManager: %08x\n", nsres);
|
ERR("Could not get nsICommandManager: %08x\n", nsres);
|
||||||
return nsres;
|
return nsres;
|
||||||
|
|
|
@ -398,6 +398,7 @@ nsIWritableVariant *create_nsvariant(void);
|
||||||
void nsnode_to_nsstring(nsIDOMNode*,nsAString*);
|
void nsnode_to_nsstring(nsIDOMNode*,nsAString*);
|
||||||
void get_editor_controller(NSContainer*);
|
void get_editor_controller(NSContainer*);
|
||||||
void init_nsevents(NSContainer*);
|
void init_nsevents(NSContainer*);
|
||||||
|
nsresult get_nsinterface(nsISupports*,REFIID,void**);
|
||||||
|
|
||||||
BSCallback *create_bscallback(IMoniker*);
|
BSCallback *create_bscallback(IMoniker*);
|
||||||
HRESULT start_binding(BSCallback*);
|
HRESULT start_binding(BSCallback*);
|
||||||
|
|
|
@ -523,6 +523,21 @@ nsICommandParams *create_nscommand_params(void)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult get_nsinterface(nsISupports *iface, REFIID riid, void **ppv)
|
||||||
|
{
|
||||||
|
nsIInterfaceRequestor *iface_req;
|
||||||
|
nsresult nsres;
|
||||||
|
|
||||||
|
nsres = nsISupports_QueryInterface(iface, &IID_nsIInterfaceRequestor, (void**)&iface_req);
|
||||||
|
if(NS_FAILED(nsres))
|
||||||
|
return nsres;
|
||||||
|
|
||||||
|
nsres = nsIInterfaceRequestor_GetInterface(iface_req, riid, ppv);
|
||||||
|
nsIInterfaceRequestor_Release(iface_req);
|
||||||
|
|
||||||
|
return nsres;
|
||||||
|
}
|
||||||
|
|
||||||
static void nsnode_to_nsstring_rec(nsIContentSerializer *serializer, nsIDOMNode *nsnode, nsAString *str)
|
static void nsnode_to_nsstring_rec(nsIContentSerializer *serializer, nsIDOMNode *nsnode, nsAString *str)
|
||||||
{
|
{
|
||||||
nsIDOMNodeList *node_list = NULL;
|
nsIDOMNodeList *node_list = NULL;
|
||||||
|
|
Loading…
Reference in New Issue