ENH: update WebView2 to 1.0.1418.22

Change-Id: I76d4747f8e135368e9dae6ee9f3e980bf4ec6f81
This commit is contained in:
chunmao.guo 2022-12-09 17:34:28 +08:00 committed by Lane.Wei
parent 4b63bf453c
commit a953442c9e
9 changed files with 16169 additions and 18 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,149 @@
// Copyright (C) Microsoft Corporation. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef __core_webview2_environment_options_h__
#define __core_webview2_environment_options_h__
#include <objbase.h>
#include <wrl/implements.h>
#include "webview2.h"
#define CORE_WEBVIEW_TARGET_PRODUCT_VERSION L"107.0.1418.22"
#define COREWEBVIEW2ENVIRONMENTOPTIONS_STRING_PROPERTY(p) \
public: \
HRESULT STDMETHODCALLTYPE get_##p(LPWSTR* value) override { \
if (!value) \
return E_POINTER; \
*value = m_##p.Copy(); \
if ((*value == nullptr) && (m_##p.Get() != nullptr)) \
return HRESULT_FROM_WIN32(GetLastError()); \
return S_OK; \
} \
HRESULT STDMETHODCALLTYPE put_##p(LPCWSTR value) override { \
LPCWSTR result = m_##p.Set(value); \
if ((result == nullptr) && (value != nullptr)) \
return HRESULT_FROM_WIN32(GetLastError()); \
return S_OK; \
} \
\
protected: \
AutoCoMemString m_##p;
#define COREWEBVIEW2ENVIRONMENTOPTIONS_BOOL_PROPERTY(p) \
public: \
HRESULT STDMETHODCALLTYPE get_##p(BOOL* value) override { \
if (!value) \
return E_POINTER; \
*value = m_##p; \
return S_OK; \
} \
HRESULT STDMETHODCALLTYPE put_##p(BOOL value) override { \
m_##p = value; \
return S_OK; \
} \
\
protected: \
BOOL m_##p = FALSE;
// This is a base COM class that implements ICoreWebView2EnvironmentOptions.
template <typename allocate_fn_t,
allocate_fn_t allocate_fn,
typename deallocate_fn_t,
deallocate_fn_t deallocate_fn>
class CoreWebView2EnvironmentOptionsBase
: public Microsoft::WRL::Implements<
Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>,
ICoreWebView2EnvironmentOptions,
ICoreWebView2EnvironmentOptions2> {
public:
CoreWebView2EnvironmentOptionsBase() {
// Initialize the target compatible browser version value to the version of
// the browser binaries corresponding to this version of the SDK.
m_TargetCompatibleBrowserVersion.Set(CORE_WEBVIEW_TARGET_PRODUCT_VERSION);
}
protected:
~CoreWebView2EnvironmentOptionsBase() {}
class AutoCoMemString {
public:
AutoCoMemString() {}
~AutoCoMemString() { Release(); }
void Release() {
if (m_string) {
deallocate_fn(m_string);
m_string = nullptr;
}
}
LPCWSTR Set(LPCWSTR str) {
Release();
if (str) {
m_string = MakeCoMemString(str);
}
return m_string;
}
LPCWSTR Get() { return m_string; }
LPWSTR Copy() {
if (m_string)
return MakeCoMemString(m_string);
return nullptr;
}
protected:
LPWSTR MakeCoMemString(LPCWSTR source) {
const size_t length = wcslen(source);
const size_t bytes = (length + 1) * sizeof(*source);
// Ensure we didn't overflow during our size calculation.
if (bytes <= length) {
return nullptr;
}
wchar_t* result = reinterpret_cast<wchar_t*>(allocate_fn(bytes));
if (result)
memcpy(result, source, bytes);
return result;
}
LPWSTR m_string = nullptr;
};
// ICoreWebView2EnvironmentOptions
COREWEBVIEW2ENVIRONMENTOPTIONS_STRING_PROPERTY(AdditionalBrowserArguments)
COREWEBVIEW2ENVIRONMENTOPTIONS_STRING_PROPERTY(Language)
COREWEBVIEW2ENVIRONMENTOPTIONS_STRING_PROPERTY(TargetCompatibleBrowserVersion)
COREWEBVIEW2ENVIRONMENTOPTIONS_BOOL_PROPERTY(
AllowSingleSignOnUsingOSPrimaryAccount)
// ICoreWebView2EnvironmentOptions2
COREWEBVIEW2ENVIRONMENTOPTIONS_BOOL_PROPERTY(ExclusiveUserDataFolderAccess)
};
template <typename allocate_fn_t,
allocate_fn_t allocate_fn,
typename deallocate_fn_t,
deallocate_fn_t deallocate_fn>
class CoreWebView2EnvironmentOptionsBaseClass
: public Microsoft::WRL::RuntimeClass<
Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>,
CoreWebView2EnvironmentOptionsBase<allocate_fn_t,
allocate_fn,
deallocate_fn_t,
deallocate_fn>> {
public:
CoreWebView2EnvironmentOptionsBaseClass() {}
protected:
~CoreWebView2EnvironmentOptionsBaseClass() override {}
};
typedef CoreWebView2EnvironmentOptionsBaseClass<decltype(&::CoTaskMemAlloc),
::CoTaskMemAlloc,
decltype(&::CoTaskMemFree),
::CoTaskMemFree>
CoreWebView2EnvironmentOptions;
#endif // __core_webview2_environment_options_h__

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -14,6 +14,19 @@ index 0bc4f934b9..479431a69c 100644
find_package(WAYLANDEGL) find_package(WAYLANDEGL)
if(WAYLANDEGL_FOUND AND wxHAVE_GDK_WAYLAND) if(WAYLANDEGL_FOUND AND wxHAVE_GDK_WAYLAND)
list(APPEND OPENGL_LIBRARIES ${WAYLANDEGL_LIBRARIES}) list(APPEND OPENGL_LIBRARIES ${WAYLANDEGL_LIBRARIES})
diff --git a/build/cmake/lib/webview/CMakeLists.txt b/build/cmake/lib/webview/CMakeLists.txt
index cc3298ff33..8adbeaea4f 100644
--- a/build/cmake/lib/webview/CMakeLists.txt
+++ b/build/cmake/lib/webview/CMakeLists.txt
@@ -56,7 +56,7 @@ if(APPLE)
elseif(WXMSW)
if(wxUSE_WEBVIEW_EDGE)
# Update the following variables if updating WebView2 SDK
- set(WEBVIEW2_VERSION "1.0.705.50")
+ set(WEBVIEW2_VERSION "1.0.1418.22")
set(WEBVIEW2_URL "https://www.nuget.org/api/v2/package/Microsoft.Web.WebView2/${WEBVIEW2_VERSION}")
set(WEBVIEW2_SHA256 "6a34bb553e18cfac7297b4031f3eac2558e439f8d16a45945c22945ac404105d")
diff --git a/include/wx/fontutil.h b/include/wx/fontutil.h diff --git a/include/wx/fontutil.h b/include/wx/fontutil.h
index 09ad8c8ef3..3c0c2d8f7e 100644 index 09ad8c8ef3..3c0c2d8f7e 100644
--- a/include/wx/fontutil.h --- a/include/wx/fontutil.h

View file

@ -440,6 +440,10 @@ endif ()
add_library(libslic3r_gui STATIC ${SLIC3R_GUI_SOURCES}) add_library(libslic3r_gui STATIC ${SLIC3R_GUI_SOURCES})
target_include_directories(libslic3r_gui PRIVATE Utils) target_include_directories(libslic3r_gui PRIVATE Utils)
if (WIN32)
target_include_directories(libslic3r_gui PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../deps/WebView2/include)
endif()
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SLIC3R_GUI_SOURCES}) source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SLIC3R_GUI_SOURCES})
encoding_check(libslic3r_gui) encoding_check(libslic3r_gui)

View file

@ -13,7 +13,7 @@
#endif #endif
#ifdef __WIN32__ #ifdef __WIN32__
#include "../WebView2.h" #include <WebView2.h>
#elif defined __linux__ #elif defined __linux__
#include <gtk/gtk.h> #include <gtk/gtk.h>
#define WEBKIT_API #define WEBKIT_API