Merge branch 'webview-ie-fixes'
IE-based xwWebView improvements. See https://github.com/wxWidgets/wxWidgets/pull/1987
This commit is contained in:
commit
6787b0548b
@ -73,7 +73,7 @@ public:
|
|||||||
wxDECLARE_NO_COPY_CLASS(wxWebViewIEImpl);
|
wxDECLARE_NO_COPY_CLASS(wxWebViewIEImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
class VirtualProtocol : public wxIInternetProtocol
|
class VirtualProtocol : public wxIInternetProtocol, public wxIInternetProtocolInfo
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
wxIInternetProtocolSink* m_protocolSink;
|
wxIInternetProtocolSink* m_protocolSink;
|
||||||
@ -114,6 +114,27 @@ public:
|
|||||||
ULARGE_INTEGER* WXUNUSED(plibNewPosition)) wxOVERRIDE
|
ULARGE_INTEGER* WXUNUSED(plibNewPosition)) wxOVERRIDE
|
||||||
{ return E_FAIL; }
|
{ return E_FAIL; }
|
||||||
HRESULT STDMETHODCALLTYPE UnlockRequest() wxOVERRIDE { return S_OK; }
|
HRESULT STDMETHODCALLTYPE UnlockRequest() wxOVERRIDE { return S_OK; }
|
||||||
|
|
||||||
|
//IInternetProtocolInfo
|
||||||
|
HRESULT STDMETHODCALLTYPE CombineUrl(
|
||||||
|
LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl,
|
||||||
|
DWORD dwCombineFlags, LPWSTR pwzResult,
|
||||||
|
DWORD cchResult, DWORD *pcchResult,
|
||||||
|
DWORD dwReserved) wxOVERRIDE;
|
||||||
|
HRESULT STDMETHODCALLTYPE ParseUrl(
|
||||||
|
LPCWSTR pwzUrl, wxPARSEACTION ParseAction,
|
||||||
|
DWORD dwParseFlags, LPWSTR pwzResult,
|
||||||
|
DWORD cchResult, DWORD *pcchResult,
|
||||||
|
DWORD dwReserved) wxOVERRIDE;
|
||||||
|
HRESULT STDMETHODCALLTYPE CompareUrl(
|
||||||
|
LPCWSTR pwzUrl1,
|
||||||
|
LPCWSTR pwzUrl2,
|
||||||
|
DWORD dwCompareFlags) wxOVERRIDE;
|
||||||
|
HRESULT STDMETHODCALLTYPE QueryInfo(
|
||||||
|
LPCWSTR pwzUrl, wxQUERYOPTION OueryOption,
|
||||||
|
DWORD dwQueryFlags, LPVOID pBuffer,
|
||||||
|
DWORD cbBuffer, DWORD *pcbBuf,
|
||||||
|
DWORD dwReserved) wxOVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ClassFactory : public IClassFactory
|
class ClassFactory : public IClassFactory
|
||||||
|
@ -27,6 +27,10 @@ struct IHTMLDocument2;
|
|||||||
#define REFRESH_COMPLETELY 3
|
#define REFRESH_COMPLETELY 3
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef INET_E_DEFAULT_ACTION
|
||||||
|
#define INET_E_DEFAULT_ACTION ((HRESULT)0x800C0011L)
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef enum __wxMIDL_IBindStatusCallback_0006
|
typedef enum __wxMIDL_IBindStatusCallback_0006
|
||||||
{
|
{
|
||||||
wxBSCF_FIRSTDATANOTIFICATION = 0x1,
|
wxBSCF_FIRSTDATANOTIFICATION = 0x1,
|
||||||
@ -136,6 +140,53 @@ public:
|
|||||||
DWORD dwReserved) = 0;
|
DWORD dwReserved) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// This interface uses a couple of enums which are not defined in old MinGW
|
||||||
|
// SDK headers, but we don't have any reliable way to test if they're actually
|
||||||
|
// defined, so define our own enums, containing just the values we need: this
|
||||||
|
// compiles everywhere and is ABI-compatible with the real enums.
|
||||||
|
enum wxPARSEACTION
|
||||||
|
{
|
||||||
|
wxPARSE_SECURITY_URL = 3,
|
||||||
|
wxPARSE_SECURITY_DOMAIN = 17
|
||||||
|
};
|
||||||
|
|
||||||
|
enum wxQUERYOPTION
|
||||||
|
{
|
||||||
|
// We don't actually need any values in this one.
|
||||||
|
};
|
||||||
|
|
||||||
|
class wxIInternetProtocolInfo : public IUnknown
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE ParseUrl(LPCWSTR pwzUrl,
|
||||||
|
wxPARSEACTION ParseAction,
|
||||||
|
DWORD dwParseFlags,
|
||||||
|
LPWSTR pwzResult,
|
||||||
|
DWORD cchResult,
|
||||||
|
DWORD *pcchResult,
|
||||||
|
DWORD dwReserved) = 0;
|
||||||
|
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE CombineUrl(LPCWSTR pwzBaseUrl,
|
||||||
|
LPCWSTR pwzRelativeUrl,
|
||||||
|
DWORD dwCombineFlags,
|
||||||
|
LPWSTR pwzResult,
|
||||||
|
DWORD cchResult,
|
||||||
|
DWORD *pcchResult,
|
||||||
|
DWORD dwReserved) = 0;
|
||||||
|
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE CompareUrl(LPCWSTR pwzUrl1,
|
||||||
|
LPCWSTR pwzUrl2,
|
||||||
|
DWORD dwCompareFlags) = 0;
|
||||||
|
|
||||||
|
virtual HRESULT STDMETHODCALLTYPE QueryInfo(LPCWSTR pwzUrl,
|
||||||
|
wxQUERYOPTION OueryOption,
|
||||||
|
DWORD dwQueryFlags,
|
||||||
|
LPVOID pBuffer,
|
||||||
|
DWORD cbBuffer,
|
||||||
|
DWORD *pcbBuf,
|
||||||
|
DWORD dwReserved) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
/* end of urlmon.h */
|
/* end of urlmon.h */
|
||||||
|
|
||||||
/* mshtmhst.h */
|
/* mshtmhst.h */
|
||||||
@ -166,7 +217,8 @@ typedef enum _tagwxDOCHOSTUIFLAG
|
|||||||
DOCHOSTUIFLAG_DISABLE_EDIT_NS_FIXUP = 0x400000,
|
DOCHOSTUIFLAG_DISABLE_EDIT_NS_FIXUP = 0x400000,
|
||||||
DOCHOSTUIFLAG_LOCAL_MACHINE_ACCESS_CHECK = 0x800000,
|
DOCHOSTUIFLAG_LOCAL_MACHINE_ACCESS_CHECK = 0x800000,
|
||||||
DOCHOSTUIFLAG_DISABLE_UNTRUSTEDPROTOCOL = 0x1000000,
|
DOCHOSTUIFLAG_DISABLE_UNTRUSTEDPROTOCOL = 0x1000000,
|
||||||
DOCHOSTUIFLAG_ENABLE_REDIRECT_NOTIFICATION = 0x4000000
|
DOCHOSTUIFLAG_ENABLE_REDIRECT_NOTIFICATION = 0x4000000,
|
||||||
|
DOCHOSTUIFLAG_DPI_AWARE = 0x40000000
|
||||||
} DOCHOSTUIFLAG;
|
} DOCHOSTUIFLAG;
|
||||||
|
|
||||||
typedef struct _tagwxDOCHOSTUIINFO
|
typedef struct _tagwxDOCHOSTUIINFO
|
||||||
|
@ -40,6 +40,7 @@ namespace {
|
|||||||
|
|
||||||
DEFINE_GUID(wxIID_IInternetProtocolRoot,0x79eac9e3,0xbaf9,0x11ce,0x8c,0x82,0,0xaa,0,0x4b,0xa9,0xb);
|
DEFINE_GUID(wxIID_IInternetProtocolRoot,0x79eac9e3,0xbaf9,0x11ce,0x8c,0x82,0,0xaa,0,0x4b,0xa9,0xb);
|
||||||
DEFINE_GUID(wxIID_IInternetProtocol,0x79eac9e4,0xbaf9,0x11ce,0x8c,0x82,0,0xaa,0,0x4b,0xa9,0xb);
|
DEFINE_GUID(wxIID_IInternetProtocol,0x79eac9e4,0xbaf9,0x11ce,0x8c,0x82,0,0xaa,0,0x4b,0xa9,0xb);
|
||||||
|
DEFINE_GUID(wxIID_IInternetProtocolInfo,0x79eac9ec,0xbaf9,0x11ce,0x8c, 0x82,0,0xaa,0,0x4b,0xa9,0x0b);
|
||||||
DEFINE_GUID(wxIID_IDocHostUIHandler, 0xbd3f23c0, 0xd43e, 0x11cf, 0x89, 0x3b, 0x00, 0xaa, 0x00, 0xbd, 0xce, 0x1a);
|
DEFINE_GUID(wxIID_IDocHostUIHandler, 0xbd3f23c0, 0xd43e, 0x11cf, 0x89, 0x3b, 0x00, 0xaa, 0x00, 0xbd, 0xce, 0x1a);
|
||||||
DEFINE_GUID(wxIID_IHTMLElement2,0x3050f434,0x98b5,0x11cf,0xbb,0x82,0,0xaa,0,0xbd,0xce,0x0b);
|
DEFINE_GUID(wxIID_IHTMLElement2,0x3050f434,0x98b5,0x11cf,0xbb,0x82,0,0xaa,0,0xbd,0xce,0x0b);
|
||||||
DEFINE_GUID(wxIID_IMarkupServices,0x3050f4a0,0x98b5,0x11cf,0xbb,0x82,0,0xaa,0,0xbd,0xce,0x0b);
|
DEFINE_GUID(wxIID_IMarkupServices,0x3050f4a0,0x98b5,0x11cf,0xbb,0x82,0,0xaa,0,0xbd,0xce,0x0b);
|
||||||
@ -1621,7 +1622,61 @@ BEGIN_IID_TABLE(VirtualProtocol)
|
|||||||
ADD_RAW_IID(wxIID_IInternetProtocol)
|
ADD_RAW_IID(wxIID_IInternetProtocol)
|
||||||
END_IID_TABLE;
|
END_IID_TABLE;
|
||||||
|
|
||||||
IMPLEMENT_IUNKNOWN_METHODS(VirtualProtocol)
|
STDMETHODIMP VirtualProtocol::QueryInterface(REFIID riid, void **ppv)
|
||||||
|
{
|
||||||
|
wxLogQueryInterface(wxT("VirtualProtocol"), riid);
|
||||||
|
|
||||||
|
if(riid == IID_IUnknown)
|
||||||
|
{
|
||||||
|
wxIInternetProtocolRoot *InternetProtocolRoot = this;
|
||||||
|
IUnknown *Unknown = InternetProtocolRoot;
|
||||||
|
*ppv = Unknown;
|
||||||
|
AddRef();
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
if(riid == wxIID_IInternetProtocolRoot)
|
||||||
|
{
|
||||||
|
wxIInternetProtocolRoot *InternetProtocolRoot = this;
|
||||||
|
*ppv = InternetProtocolRoot;
|
||||||
|
AddRef();
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
if(riid == wxIID_IInternetProtocol)
|
||||||
|
{
|
||||||
|
wxIInternetProtocol *InternetProtocol = this;
|
||||||
|
*ppv = InternetProtocol;
|
||||||
|
AddRef();
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
if(riid == wxIID_IInternetProtocolInfo)
|
||||||
|
{
|
||||||
|
wxIInternetProtocolInfo *InternetProtocolInfo = this;
|
||||||
|
*ppv = InternetProtocolInfo;
|
||||||
|
AddRef();
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
*ppv = NULL;
|
||||||
|
return (HRESULT) E_NOINTERFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP_(ULONG) VirtualProtocol::AddRef()
|
||||||
|
{
|
||||||
|
wxLogAddRef(wxT("VirtualProtocol"), m_cRef);
|
||||||
|
return ++m_cRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP_(ULONG) VirtualProtocol::Release()
|
||||||
|
{
|
||||||
|
wxLogRelease(wxT("VirtualProtocol"), m_cRef);
|
||||||
|
if( --m_cRef == wxAutoULong(0))
|
||||||
|
{
|
||||||
|
delete this;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return m_cRef;
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT STDMETHODCALLTYPE VirtualProtocol::Start(LPCWSTR szUrl, wxIInternetProtocolSink *pOIProtSink,
|
HRESULT STDMETHODCALLTYPE VirtualProtocol::Start(LPCWSTR szUrl, wxIInternetProtocolSink *pOIProtSink,
|
||||||
wxIInternetBindInfo *pOIBindInfo, DWORD grfPI,
|
wxIInternetBindInfo *pOIBindInfo, DWORD grfPI,
|
||||||
@ -1689,6 +1744,84 @@ HRESULT STDMETHODCALLTYPE VirtualProtocol::Read(void *pv, ULONG cb, ULONG *pcbRe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE VirtualProtocol::CombineUrl(
|
||||||
|
LPCWSTR pwzBaseUrl, LPCWSTR pwzRelativeUrl,
|
||||||
|
DWORD dwCombineFlags, LPWSTR pwzResult,
|
||||||
|
DWORD cchResult, DWORD *pcchResult,
|
||||||
|
DWORD dwReserved)
|
||||||
|
{
|
||||||
|
wxUnusedVar(pwzBaseUrl);
|
||||||
|
wxUnusedVar(pwzRelativeUrl);
|
||||||
|
wxUnusedVar(dwCombineFlags);
|
||||||
|
wxUnusedVar(pwzResult);
|
||||||
|
wxUnusedVar(cchResult);
|
||||||
|
wxUnusedVar(pcchResult);
|
||||||
|
wxUnusedVar(dwReserved);
|
||||||
|
|
||||||
|
return INET_E_DEFAULT_ACTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE VirtualProtocol::ParseUrl(
|
||||||
|
LPCWSTR pwzUrl, wxPARSEACTION ParseAction,
|
||||||
|
DWORD dwParseFlags, LPWSTR pwzResult,
|
||||||
|
DWORD cchResult, DWORD *pcchResult,
|
||||||
|
DWORD dwReserved)
|
||||||
|
{
|
||||||
|
wxUnusedVar(pwzUrl);
|
||||||
|
wxUnusedVar(ParseAction);
|
||||||
|
wxUnusedVar(dwParseFlags);
|
||||||
|
wxUnusedVar(pwzResult);
|
||||||
|
wxUnusedVar(cchResult);
|
||||||
|
wxUnusedVar(pcchResult);
|
||||||
|
wxUnusedVar(dwReserved);
|
||||||
|
|
||||||
|
switch (ParseAction)
|
||||||
|
{
|
||||||
|
case wxPARSE_SECURITY_URL:
|
||||||
|
case wxPARSE_SECURITY_DOMAIN:
|
||||||
|
{
|
||||||
|
LPWSTR Result = L"http://localhost";
|
||||||
|
size_t Len = wcslen(Result);
|
||||||
|
if(cchResult <= Len)
|
||||||
|
return S_FALSE;
|
||||||
|
wcscpy(pwzResult, Result);
|
||||||
|
*pcchResult = Len;
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return INET_E_DEFAULT_ACTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE VirtualProtocol::CompareUrl(
|
||||||
|
LPCWSTR pwzUrl1,
|
||||||
|
LPCWSTR pwzUrl2,
|
||||||
|
DWORD dwCompareFlags)
|
||||||
|
{
|
||||||
|
wxUnusedVar(pwzUrl1);
|
||||||
|
wxUnusedVar(pwzUrl2);
|
||||||
|
wxUnusedVar(dwCompareFlags);
|
||||||
|
|
||||||
|
return INET_E_DEFAULT_ACTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
HRESULT STDMETHODCALLTYPE VirtualProtocol::QueryInfo(
|
||||||
|
LPCWSTR pwzUrl, wxQUERYOPTION OueryOption,
|
||||||
|
DWORD dwQueryFlags, LPVOID pBuffer,
|
||||||
|
DWORD cbBuffer, DWORD *pcbBuf,
|
||||||
|
DWORD dwReserved)
|
||||||
|
{
|
||||||
|
wxUnusedVar(pwzUrl);
|
||||||
|
wxUnusedVar(OueryOption);
|
||||||
|
wxUnusedVar(dwQueryFlags);
|
||||||
|
wxUnusedVar(pBuffer);
|
||||||
|
wxUnusedVar(cbBuffer);
|
||||||
|
wxUnusedVar(pcbBuf);
|
||||||
|
wxUnusedVar(dwReserved);
|
||||||
|
|
||||||
|
return INET_E_DEFAULT_ACTION;
|
||||||
|
}
|
||||||
|
|
||||||
BEGIN_IID_TABLE(ClassFactory)
|
BEGIN_IID_TABLE(ClassFactory)
|
||||||
ADD_IID(Unknown)
|
ADD_IID(Unknown)
|
||||||
ADD_IID(ClassFactory)
|
ADD_IID(ClassFactory)
|
||||||
@ -1759,7 +1892,8 @@ HRESULT wxSTDCALL DocHostUIHandler::GetHostInfo(DOCHOSTUIINFO *pInfo)
|
|||||||
// redirected.
|
// redirected.
|
||||||
pInfo->dwFlags |= DOCHOSTUIFLAG_NO3DBORDER |
|
pInfo->dwFlags |= DOCHOSTUIFLAG_NO3DBORDER |
|
||||||
DOCHOSTUIFLAG_THEME |
|
DOCHOSTUIFLAG_THEME |
|
||||||
DOCHOSTUIFLAG_ENABLE_REDIRECT_NOTIFICATION;
|
DOCHOSTUIFLAG_ENABLE_REDIRECT_NOTIFICATION |
|
||||||
|
DOCHOSTUIFLAG_DPI_AWARE;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user