Add wxWebViewIE::MSWSetEmulationLevel()

This extends and replaces MSWSetModernEmulationLevel() by allowing a
more fine-grained choice of the emulation level used by wxWebViewIE.

Closes https://github.com/wxWidgets/wxWidgets/pull/1133
This commit is contained in:
Chilau He
2019-01-11 06:48:22 +08:00
committed by Vadim Zeitlin
parent c8b977314e
commit 3aa6aec620
3 changed files with 111 additions and 25 deletions

View File

@@ -545,15 +545,13 @@ bool wxWebViewIE::IsOfflineMode()
void wxWebViewIE::SetOfflineMode(bool offline)
{
// FIXME: the wxWidgets docs do not really document what the return
// parameter of PutProperty is
#if wxDEBUG_LEVEL
const bool success =
const HRESULT success =
#endif
m_ie.PutProperty("Offline", (offline ?
VARIANT_TRUE :
VARIANT_FALSE));
wxASSERT(success);
wxASSERT(SUCCEEDED(success));
}
bool wxWebViewIE::IsBusy() const
@@ -859,7 +857,7 @@ wxString wxWebViewIE::GetPageText() const
}
}
bool wxWebViewIE::MSWSetModernEmulationLevel(bool modernLevel)
bool wxWebViewIE::MSWSetEmulationLevel(wxWebViewIE_EmulationLevel level)
{
// Registry key where emulation level for programs are set
static const wxChar* IE_EMULATION_KEY =
@@ -874,12 +872,9 @@ bool wxWebViewIE::MSWSetModernEmulationLevel(bool modernLevel)
}
const wxString programName = wxGetFullModuleName().AfterLast('\\');
if ( modernLevel )
if ( level != wxWEBVIEWIE_EMU_DEFAULT )
{
// IE8 (8000) is sufficiently modern for our needs, see
// https://msdn.microsoft.com/library/ee330730.aspx#browser_emulation
// for other values that could be used here.
if ( !key.SetValue(programName, 8000) )
if ( !key.SetValue(programName, level) )
{
wxLogWarning(_("Failed to set web view to modern emulation level"));
return false;