WebKit Bugzilla
Attachment 342411 Details for
Bug 186478
: [Win][MiniBrowser] Add WebKitBrowserWindow class for modern WebKit API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186478-20180611151703.patch (text/plain), 21.42 KB, created by
Fujii Hironori
on 2018-06-10 23:17:04 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Fujii Hironori
Created:
2018-06-10 23:17:04 PDT
Size:
21.42 KB
patch
obsolete
>Subversion Revision: 232669 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index bd019400a16341da61d3714bcd74b9689869f7f4..787094cd2d64139bc3cb0fd6959608c9d8ded153 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,56 @@ >+2018-06-10 Fujii Hironori <Hironori.Fujii@sony.com> >+ >+ [Win][MiniBrowser] Add WebKitBrowserWindow class for modern WebKit API >+ https://bugs.webkit.org/show_bug.cgi?id=186478 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added "New WebKit Window" and "New WebKitLegacy Window" menu >+ items. Disabled the menu item "New WebKit Window" if >+ !ENABLE(WEBKIT). >+ >+ * MiniBrowser/win/CMakeLists.txt: Added WebKitBrowserWindow.cpp >+ source file and ENABLE_WEBKIT macro if ENABLE_WEBKIT. >+ * MiniBrowser/win/MainWindow.cpp: >+ (MainWindow::MainWindow): >+ (MainWindow::create): >+ (MainWindow::init): >+ (MainWindow::WndProc): >+ * MiniBrowser/win/MainWindow.h: >+ * MiniBrowser/win/MiniBrowserLib.rc: >+ * MiniBrowser/win/MiniBrowserLibResource.h: >+ * MiniBrowser/win/PrintWebUIDelegate.cpp: >+ (PrintWebUIDelegate::createWebViewWithRequest): >+ * MiniBrowser/win/WebKitBrowserWindow.cpp: Added. >+ (createString): >+ (toUtf8): >+ (createWKString): >+ (createWKURL): >+ (WebKitBrowserWindow::create): >+ (WebKitBrowserWindow::WebKitBrowserWindow): >+ (WebKitBrowserWindow::init): >+ (WebKitBrowserWindow::hwnd): >+ (WebKitBrowserWindow::loadURL): >+ (WebKitBrowserWindow::loadHTMLString): >+ (WebKitBrowserWindow::navigateForwardOrBackward): >+ (WebKitBrowserWindow::navigateToHistory): >+ (WebKitBrowserWindow::setPreference): >+ (WebKitBrowserWindow::print): >+ (WebKitBrowserWindow::launchInspector): >+ (WebKitBrowserWindow::setUserAgent): >+ (WebKitBrowserWindow::userAgent): >+ (WebKitBrowserWindow::showLayerTree): >+ (WebKitBrowserWindow::updateStatistics): >+ (WebKitBrowserWindow::resetZoom): >+ (WebKitBrowserWindow::zoomIn): >+ (WebKitBrowserWindow::zoomOut): >+ (toWebKitBrowserWindow): >+ (WebKitBrowserWindow::didReceiveTitleForFrame): >+ (WebKitBrowserWindow::didCommitLoadForFrame): >+ * MiniBrowser/win/WebKitBrowserWindow.h: >+ * MiniBrowser/win/WinMain.cpp: >+ (wWinMain): >+ > 2018-06-10 Fujii Hironori <Hironori.Fujii@sony.com> > > [Win][MiniBrowser] MiniBrowser class should be renamed to WebKitLegacyBrowserWindow >diff --git a/Tools/MiniBrowser/win/CMakeLists.txt b/Tools/MiniBrowser/win/CMakeLists.txt >index 6a83763da31c8a8e2d210f2ceecee7092ce2bc60..61561a36f740c30b28c45de6ed18f5bba61c592d 100644 >--- a/Tools/MiniBrowser/win/CMakeLists.txt >+++ b/Tools/MiniBrowser/win/CMakeLists.txt >@@ -38,6 +38,14 @@ if (USE_CF) > ) > endif () > >+if (ENABLE_WEBKIT) >+ add_definitions(-DENABLE_WEBKIT) >+ list(APPEND MiniBrowser_SOURCES >+ WebKitBrowserWindow.cpp >+ ) >+ list(APPEND MiniBrowser_LIBRARIES WebKit) >+endif () >+ > set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${MSVC_RUNTIME_LINKER_FLAGS}") > set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wWinMainCRTStartup") > >diff --git a/Tools/MiniBrowser/win/MainWindow.cpp b/Tools/MiniBrowser/win/MainWindow.cpp >index f99da5e967a3ddca5e5e2b427c295d98d06ac549..7e36a82af2ca8159c69e0f7ea79d16d526643c40 100644 >--- a/Tools/MiniBrowser/win/MainWindow.cpp >+++ b/Tools/MiniBrowser/win/MainWindow.cpp >@@ -28,6 +28,11 @@ > > #include "Common.h" > #include "MiniBrowserLibResource.h" >+#include "WebKitLegacyBrowserWindow.h" >+ >+#if ENABLE(WEBKIT) >+#include "WebKitBrowserWindow.h" >+#endif > > namespace WebCore { > float deviceScaleFactorForWindow(HWND); >@@ -78,7 +83,8 @@ void MainWindow::registerClass(HINSTANCE hInstance) > RegisterClassEx(&wcex); > } > >-MainWindow::MainWindow() >+MainWindow::MainWindow(BrowserWindowType type) >+ : m_browserWindowType(type) > { > s_numInstances++; > } >@@ -88,9 +94,9 @@ MainWindow::~MainWindow() > s_numInstances--; > } > >-Ref<MainWindow> MainWindow::create() >+Ref<MainWindow> MainWindow::create(BrowserWindowType type) > { >- return adoptRef(*new MainWindow()); >+ return adoptRef(*new MainWindow(type)); > } > > bool MainWindow::init(HINSTANCE hInstance, bool usesLayeredWebView, bool pageLoadTesting) >@@ -105,6 +111,10 @@ bool MainWindow::init(HINSTANCE hInstance, bool usesLayeredWebView, bool pageLoa > if (!m_hMainWnd) > return false; > >+#if !ENABLE(WEBKIT) >+ EnableMenuItem(GetMenu(m_hMainWnd), IDM_NEW_WEBKIT_WINDOW, MF_GRAYED); >+#endif >+ > float scaleFactor = WebCore::deviceScaleFactorForWindow(nullptr); > m_hBackButtonWnd = CreateWindow(L"BUTTON", L"<", WS_CHILD | WS_VISIBLE | BS_TEXT, 0, 0, 0, 0, m_hMainWnd, reinterpret_cast<HMENU>(IDM_HISTORY_BACKWARD), hInstance, 0); > m_hForwardButtonWnd = CreateWindow(L"BUTTON", L">", WS_CHILD | WS_VISIBLE | BS_TEXT, scaleFactor * controlButtonWidth, 0, 0, 0, m_hMainWnd, reinterpret_cast<HMENU>(IDM_HISTORY_FORWARD), hInstance, 0); >@@ -113,7 +123,12 @@ bool MainWindow::init(HINSTANCE hInstance, bool usesLayeredWebView, bool pageLoa > DefEditProc = reinterpret_cast<WNDPROC>(GetWindowLongPtr(m_hURLBarWnd, GWLP_WNDPROC)); > SetWindowLongPtr(m_hURLBarWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(EditProc)); > >- m_browserWindow = WebKitLegacyBrowserWindow::create(m_hMainWnd, m_hURLBarWnd, usesLayeredWebView, pageLoadTesting); >+ auto factory = WebKitLegacyBrowserWindow::create; >+#if ENABLE(WEBKIT) >+ if (m_browserWindowType == BrowserWindowType::WebKit) >+ factory = WebKitBrowserWindow::create; >+#endif >+ m_browserWindow = factory(m_hMainWnd, m_hURLBarWnd, usesLayeredWebView, pageLoadTesting); > if (!m_browserWindow) > return false; > HRESULT hr = m_browserWindow->init(); >@@ -171,6 +186,18 @@ LRESULT CALLBACK MainWindow::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPA > case IDC_URL_BAR: > thisWindow->onURLBarEnter(); > break; >+ case IDM_NEW_WEBKIT_WINDOW: { >+ auto& newWindow = MainWindow::create(BrowserWindowType::WebKit).leakRef(); >+ newWindow.init(hInst); >+ ShowWindow(newWindow.hwnd(), SW_SHOW); >+ break; >+ } >+ case IDM_NEW_WEBKITLEGACY_WINDOW: { >+ auto& newWindow = MainWindow::create(BrowserWindowType::WebKitLegacy).leakRef(); >+ newWindow.init(hInst); >+ ShowWindow(newWindow.hwnd(), SW_SHOW); >+ break; >+ } > case IDM_ABOUT: > DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); > break; >diff --git a/Tools/MiniBrowser/win/MainWindow.h b/Tools/MiniBrowser/win/MainWindow.h >index a2d39bf303d4043b12b0daa135ccd5f7a20f5d9f..97021b6df84a413855692282b8f3cc4e04c55231 100644 >--- a/Tools/MiniBrowser/win/MainWindow.h >+++ b/Tools/MiniBrowser/win/MainWindow.h >@@ -25,14 +25,18 @@ > > #pragma once > >-#include "WebKitLegacyBrowserWindow.h" >+#include "BrowserWindow.h" > #include <memory> > #include <string> > #include <wtf/RefPtr.h> > > class MainWindow : public RefCounted<MainWindow> { > public: >- static Ref<MainWindow> create(); >+ enum class BrowserWindowType { >+ WebKit, >+ WebKitLegacy >+ }; >+ static Ref<MainWindow> create(BrowserWindowType); > > ~MainWindow(); > bool init(HINSTANCE hInstance, bool usesLayeredWebView = false, bool pageLoadTesting = false); >@@ -51,7 +55,7 @@ private: > static std::wstring s_windowClass; > static size_t s_numInstances; > >- MainWindow(); >+ MainWindow(BrowserWindowType); > bool toggleMenuItem(UINT menuID); > void onURLBarEnter(); > void updateDeviceScaleFactor(); >@@ -62,5 +66,6 @@ private: > HWND m_hForwardButtonWnd { nullptr }; > HWND m_hCacheWnd { nullptr }; > HGDIOBJ m_hURLBarFont { nullptr }; >+ BrowserWindowType m_browserWindowType; > RefPtr<BrowserWindow> m_browserWindow; > }; >diff --git a/Tools/MiniBrowser/win/MiniBrowserLib.rc b/Tools/MiniBrowser/win/MiniBrowserLib.rc >old mode 100644 >new mode 100755 >index 9af7bde32faaedfaf65c3f7989ac743ce34026cc..5c82f0067828077f8263ecd20c48612b1760a8e3 >--- a/Tools/MiniBrowser/win/MiniBrowserLib.rc >+++ b/Tools/MiniBrowser/win/MiniBrowserLib.rc >@@ -44,6 +44,8 @@ BEGIN > BEGIN > MENUITEM "&Print\tCtrl-P", IDM_PRINT > MENUITEM "E&xit", IDM_EXIT >+ MENUITEM "New WebKit Window", IDM_NEW_WEBKIT_WINDOW >+ MENUITEM "New WebKitLegacy Window", IDM_NEW_WEBKITLEGACY_WINDOW > END > POPUP "&View" > BEGIN >diff --git a/Tools/MiniBrowser/win/MiniBrowserLibResource.h b/Tools/MiniBrowser/win/MiniBrowserLibResource.h >old mode 100644 >new mode 100755 >index 0bda06ae549b1730080dc61b02564354770dc90b..30375d72b32024a43ee03e77d66ae6dea8e80553 >--- a/Tools/MiniBrowser/win/MiniBrowserLibResource.h >+++ b/Tools/MiniBrowser/win/MiniBrowserLibResource.h >@@ -110,6 +110,8 @@ > #define IDC_AUTH_USER 1053 > #define IDC_AUTH_PASSWORD 1054 > #define IDC_URL_BAR 1055 >+#define IDM_NEW_WEBKIT_WINDOW 32776 >+#define IDM_NEW_WEBKITLEGACY_WINDOW 32777 > #define IDC_STATIC -1 > > // Next default values for new objects >@@ -118,7 +120,7 @@ > #ifndef APSTUDIO_READONLY_SYMBOLS > #define _APS_NO_MFC 1 > #define _APS_NEXT_RESOURCE_VALUE 175 >-#define _APS_NEXT_COMMAND_VALUE 32776 >+#define _APS_NEXT_COMMAND_VALUE 32778 > #define _APS_NEXT_CONTROL_VALUE 1055 > #define _APS_NEXT_SYMED_VALUE 110 > #endif >diff --git a/Tools/MiniBrowser/win/PrintWebUIDelegate.cpp b/Tools/MiniBrowser/win/PrintWebUIDelegate.cpp >index 344d35d24bc0e1c143b4502c0a9f4d2c6a5c2ff0..c4292750edaa130629513271ab56c6e6f583696f 100644 >--- a/Tools/MiniBrowser/win/PrintWebUIDelegate.cpp >+++ b/Tools/MiniBrowser/win/PrintWebUIDelegate.cpp >@@ -65,7 +65,7 @@ HRESULT PrintWebUIDelegate::createWebViewWithRequest(_In_opt_ IWebView*, _In_opt > if (!request) > return E_POINTER; > >- auto& newWindow = MainWindow::create().leakRef(); >+ auto& newWindow = MainWindow::create(MainWindow::BrowserWindowType::WebKitLegacy).leakRef(); > bool ok = newWindow.init(hInst); > if (!ok) > return E_FAIL; >diff --git a/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp b/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..a6dd082b4b4f10c182f2364232b5b8a66c0544fb >--- /dev/null >+++ b/Tools/MiniBrowser/win/WebKitBrowserWindow.cpp >@@ -0,0 +1,240 @@ >+/* >+ * Copyright (C) 2018 Sony Interactive Entertainment Inc. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+#include "stdafx.h" >+#include "WebKitBrowserWindow.h" >+ >+#include "MiniBrowserLibResource.h" >+#include <WebKit/WKInspector.h> >+ >+std::wstring >+createString(WKStringRef wkString) >+{ >+ size_t maxSize = WKStringGetMaximumUTF8CStringSize(wkString); >+ char* utf8Buffer = new char[maxSize]; >+ size_t utf8Length = WKStringGetUTF8CString(wkString, utf8Buffer, maxSize); >+ >+ int wcharLength = MultiByteToWideChar(CP_UTF8, 0, utf8Buffer, utf8Length, 0, 0); >+ wchar_t* wcharBuffer = new wchar_t[wcharLength + 1]; >+ MultiByteToWideChar(CP_UTF8, 0, utf8Buffer, utf8Length, wcharBuffer, wcharLength); >+ wcharBuffer[wcharLength] = L'\0'; >+ std::wstring dest(wcharBuffer); >+ return dest; >+} >+ >+std::wstring createString(WKURLRef wkURL) >+{ >+ WKRetainPtr<WKStringRef> url = adoptWK(WKURLCopyString(wkURL)); >+ return createString(url.get()); >+} >+ >+std::string toUtf8(const wchar_t* src, size_t srcLength) >+{ >+ int utf8Length = WideCharToMultiByte(CP_UTF8, 0, src, srcLength, 0, 0, nullptr, nullptr); >+ char* utf8Buffer = new char[utf8Length]; >+ WideCharToMultiByte(CP_UTF8, 0, src, srcLength, >+ utf8Buffer, utf8Length, nullptr, nullptr); >+ utf8Buffer[utf8Length] = '\0'; >+ std::string dest(utf8Buffer); >+ delete[] utf8Buffer; >+ return dest; >+} >+ >+WKRetainPtr<WKStringRef> >+createWKString(_bstr_t str) >+{ >+ auto utf8 = toUtf8(str, str.length()); >+ return adoptWK(WKStringCreateWithUTF8CString(utf8.c_str())); >+} >+ >+WKRetainPtr<WKURLRef> >+createWKURL(_bstr_t str) >+{ >+ auto utf8 = toUtf8(str, str.length()); >+ return adoptWK(WKURLCreateWithUTF8CString(utf8.c_str())); >+} >+ >+Ref<BrowserWindow> WebKitBrowserWindow::create(HWND mainWnd, HWND urlBarWnd, bool, bool) >+{ >+ return adoptRef(*new WebKitBrowserWindow(mainWnd, urlBarWnd)); >+} >+ >+WebKitBrowserWindow::WebKitBrowserWindow(HWND mainWnd, HWND urlBarWnd) >+ : m_hMainWnd(mainWnd) >+ , m_urlBarWnd(urlBarWnd) >+{ >+ RECT rect = { }; >+ auto conf = adoptWK(WKPageConfigurationCreate()); >+ auto context = adoptWK(WKContextCreate()); >+ WKPageConfigurationSetContext(conf.get(), context.get()); >+ >+ m_view = adoptWK(WKViewCreate(rect, conf.get(), mainWnd)); >+ auto page = WKViewGetPage(m_view.get()); >+ >+ WKPageLoaderClientV0 loadClient = {{ 0, this }}; >+ loadClient.didReceiveTitleForFrame = didReceiveTitleForFrame; >+ loadClient.didCommitLoadForFrame = didCommitLoadForFrame; >+ WKPageSetPageLoaderClient(page, &loadClient.base); >+} >+ >+HRESULT WebKitBrowserWindow::init() >+{ >+ return S_OK; >+} >+ >+HWND WebKitBrowserWindow::hwnd() >+{ >+ return WKViewGetWindow(m_view.get()); >+} >+ >+HRESULT WebKitBrowserWindow::loadURL(const BSTR& url) >+{ >+ auto page = WKViewGetPage(m_view.get()); >+ WKPageLoadURL(page, createWKURL(url).get()); >+ return true; >+} >+ >+HRESULT WebKitBrowserWindow::loadHTMLString(const BSTR& str) >+{ >+ auto page = WKViewGetPage(m_view.get()); >+ auto url = createWKURL(L"about:"); >+ WKPageLoadHTMLString(page, createWKString(_bstr_t(str)).get(), url.get()); >+ return true; >+} >+ >+void WebKitBrowserWindow::navigateForwardOrBackward(UINT menuID) >+{ >+ auto page = WKViewGetPage(m_view.get()); >+ if (menuID == IDM_HISTORY_FORWARD) >+ WKPageGoForward(page); >+ else >+ WKPageGoBack(page); >+} >+ >+void WebKitBrowserWindow::navigateToHistory(UINT menuID) >+{ >+ // Not implemented >+} >+ >+void WebKitBrowserWindow::setPreference(UINT menuID, bool enable) >+{ >+ auto page = WKViewGetPage(m_view.get()); >+ auto pgroup = WKPageGetPageGroup(page); >+ auto pref = WKPageGroupGetPreferences(pgroup); >+ switch (menuID) { >+ case IDM_DISABLE_IMAGES: >+ WKPreferencesSetLoadsImagesAutomatically(pref, !enable); >+ break; >+ case IDM_DISABLE_JAVASCRIPT: >+ WKPreferencesSetJavaScriptEnabled(pref, !enable); >+ break; >+ } >+} >+ >+void WebKitBrowserWindow::print() >+{ >+ // Not implemented >+} >+ >+void WebKitBrowserWindow::launchInspector() >+{ >+ auto page = WKViewGetPage(m_view.get()); >+ auto inspector = WKPageGetInspector(page); >+ WKInspectorShow(inspector); >+} >+ >+void WebKitBrowserWindow::setUserAgent(UINT menuID) >+{ >+ // This method should be removed. >+} >+ >+void WebKitBrowserWindow::setUserAgent(_bstr_t& customUAString) >+{ >+ auto page = WKViewGetPage(m_view.get()); >+ auto ua = createWKString(customUAString); >+ WKPageSetCustomUserAgent(page, ua.get()); >+} >+ >+_bstr_t WebKitBrowserWindow::userAgent() >+{ >+ auto page = WKViewGetPage(m_view.get()); >+ auto ua = adoptWK(WKPageCopyUserAgent(page)); >+ return createString(ua.get()).c_str(); >+} >+ >+void WebKitBrowserWindow::showLayerTree() >+{ >+ // Not implemented >+} >+ >+void WebKitBrowserWindow::updateStatistics(HWND hDlg) >+{ >+ // Not implemented >+} >+ >+ >+void WebKitBrowserWindow::resetZoom() >+{ >+ auto page = WKViewGetPage(m_view.get()); >+ WKPageSetPageZoomFactor(page, 1); >+} >+ >+void WebKitBrowserWindow::zoomIn() >+{ >+ auto page = WKViewGetPage(m_view.get()); >+ double s = WKPageGetPageZoomFactor(page); >+ WKPageSetPageZoomFactor(page, s * 1.25); >+} >+ >+void WebKitBrowserWindow::zoomOut() >+{ >+ auto page = WKViewGetPage(m_view.get()); >+ double s = WKPageGetPageZoomFactor(page); >+ WKPageSetPageZoomFactor(page, s * 0.8); >+} >+ >+static WebKitBrowserWindow& toWebKitBrowserWindow(const void *clientInfo) >+{ >+ return *const_cast<WebKitBrowserWindow*>(static_cast<const WebKitBrowserWindow*>(clientInfo)); >+} >+ >+void WebKitBrowserWindow::didReceiveTitleForFrame(WKPageRef page, WKStringRef title, WKFrameRef frame, WKTypeRef userData, const void *clientInfo) >+{ >+ if (!WKFrameIsMainFrame(frame)) >+ return; >+ std::wstring titleString = createString(title) + L" [WebKit]"; >+ auto& thisWindow = toWebKitBrowserWindow(clientInfo); >+ SetWindowText(thisWindow.m_hMainWnd, titleString.c_str()); >+} >+ >+void WebKitBrowserWindow::didCommitLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo) >+{ >+ if (!WKFrameIsMainFrame(frame)) >+ return; >+ auto& thisWindow = toWebKitBrowserWindow(clientInfo); >+ >+ WKRetainPtr<WKURLRef> wkurl = adoptWK(WKFrameCopyURL(frame)); >+ std::wstring urlString = createString(wkurl.get()); >+ SetWindowText(thisWindow.m_urlBarWnd, urlString.c_str()); >+} >diff --git a/Tools/MiniBrowser/win/WebKitBrowserWindow.h b/Tools/MiniBrowser/win/WebKitBrowserWindow.h >new file mode 100644 >index 0000000000000000000000000000000000000000..0502a8a07d4871a20590a0cb0fb42bca77b1bb21 >--- /dev/null >+++ b/Tools/MiniBrowser/win/WebKitBrowserWindow.h >@@ -0,0 +1,67 @@ >+/* >+ * Copyright (C) 2018 Sony Interactive Entertainment Inc. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+#pragma once >+ >+#include "BrowserWindow.h" >+#include <WebKit/WKRetainPtr.h> >+#include <WebKit/WebKit2_C.h> >+ >+class WebKitBrowserWindow : public BrowserWindow { >+public: >+ static Ref<BrowserWindow> create(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView = false, bool pageLoadTesting = false); >+ >+private: >+ WebKitBrowserWindow(HWND mainWnd, HWND urlBarWnd); >+ >+ HRESULT init() override; >+ HWND hwnd() override; >+ >+ HRESULT loadHTMLString(const BSTR&) override; >+ HRESULT loadURL(const BSTR& url) override; >+ void navigateForwardOrBackward(UINT menuID) override; >+ void navigateToHistory(UINT menuID) override; >+ void setPreference(UINT menuID, bool enable) override; >+ >+ void print() override; >+ void launchInspector() override; >+ >+ _bstr_t userAgent() override; >+ void setUserAgent(UINT menuID) override; >+ void setUserAgent(_bstr_t&) override; >+ >+ void showLayerTree() override; >+ void updateStatistics(HWND dialog) override; >+ >+ void resetZoom() override; >+ void zoomIn() override; >+ void zoomOut() override; >+ >+ static void didReceiveTitleForFrame(WKPageRef, WKStringRef, WKFrameRef, WKTypeRef, const void *); >+ static void didCommitLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void *); >+ >+ WKRetainPtr<WKViewRef> m_view; >+ HWND m_hMainWnd { nullptr }; >+ HWND m_urlBarWnd { nullptr }; >+}; >diff --git a/Tools/MiniBrowser/win/WinMain.cpp b/Tools/MiniBrowser/win/WinMain.cpp >index 1bc09c35645b94cb8f8894745a7896979fc91818..c96a677c74f124c300dabaf5eed521f934ed60af 100644 >--- a/Tools/MiniBrowser/win/WinMain.cpp >+++ b/Tools/MiniBrowser/win/WinMain.cpp >@@ -65,7 +65,7 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, > > ::SetProcessDPIAware(); > >- auto& mainWindow = MainWindow::create().leakRef(); >+ auto& mainWindow = MainWindow::create(MainWindow::BrowserWindowType::WebKitLegacy).leakRef(); > HRESULT hr = mainWindow.init(hInst, usesLayeredWebView, pageLoadTesting); > if (FAILED(hr)) > goto exit;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186478
: 342411