Changeset 232723 in webkit
- Timestamp:
- Jun 11, 2018 11:59:21 AM (6 years ago)
- Location:
- trunk/Tools
- Files:
-
- 1 added
- 8 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r232721 r232723 1 2018-06-11 Fujii Hironori <Hironori.Fujii@sony.com> 2 3 [Win][MiniBrowser] Add WebKitBrowserWindow class for modern WebKit API 4 https://bugs.webkit.org/show_bug.cgi?id=186478 5 6 Reviewed by Alex Christensen. 7 8 Added "New WebKit Window" and "New WebKitLegacy Window" menu 9 items. Disabled the menu item "New WebKit Window" if 10 !ENABLE(WEBKIT). 11 12 * MiniBrowser/win/CMakeLists.txt: Added WebKitBrowserWindow.cpp 13 source file and ENABLE_WEBKIT macro if ENABLE_WEBKIT. 14 * MiniBrowser/win/MainWindow.cpp: 15 (MainWindow::MainWindow): 16 (MainWindow::create): 17 (MainWindow::init): 18 (MainWindow::WndProc): 19 * MiniBrowser/win/MainWindow.h: 20 * MiniBrowser/win/MiniBrowserLib.rc: 21 * MiniBrowser/win/MiniBrowserLibResource.h: 22 * MiniBrowser/win/PrintWebUIDelegate.cpp: 23 (PrintWebUIDelegate::createWebViewWithRequest): 24 * MiniBrowser/win/WebKitBrowserWindow.cpp: Added. 25 (createString): 26 (toUtf8): 27 (createWKString): 28 (createWKURL): 29 (WebKitBrowserWindow::create): 30 (WebKitBrowserWindow::WebKitBrowserWindow): 31 (WebKitBrowserWindow::init): 32 (WebKitBrowserWindow::hwnd): 33 (WebKitBrowserWindow::loadURL): 34 (WebKitBrowserWindow::loadHTMLString): 35 (WebKitBrowserWindow::navigateForwardOrBackward): 36 (WebKitBrowserWindow::navigateToHistory): 37 (WebKitBrowserWindow::setPreference): 38 (WebKitBrowserWindow::print): 39 (WebKitBrowserWindow::launchInspector): 40 (WebKitBrowserWindow::setUserAgent): 41 (WebKitBrowserWindow::userAgent): 42 (WebKitBrowserWindow::showLayerTree): 43 (WebKitBrowserWindow::updateStatistics): 44 (WebKitBrowserWindow::resetZoom): 45 (WebKitBrowserWindow::zoomIn): 46 (WebKitBrowserWindow::zoomOut): 47 (toWebKitBrowserWindow): 48 (WebKitBrowserWindow::didReceiveTitleForFrame): 49 (WebKitBrowserWindow::didCommitLoadForFrame): 50 * MiniBrowser/win/WebKitBrowserWindow.h: 51 * MiniBrowser/win/WinMain.cpp: 52 (wWinMain): 53 1 54 2018-06-11 Keith Miller <keith_miller@apple.com> 2 55 -
trunk/Tools/MiniBrowser/win/CMakeLists.txt
r232669 r232723 39 39 endif () 40 40 41 if (ENABLE_WEBKIT) 42 add_definitions(-DENABLE_WEBKIT) 43 list(APPEND MiniBrowser_SOURCES 44 WebKitBrowserWindow.cpp 45 ) 46 list(APPEND MiniBrowser_LIBRARIES WebKit) 47 endif () 48 41 49 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${MSVC_RUNTIME_LINKER_FLAGS}") 42 50 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:wWinMainCRTStartup") -
trunk/Tools/MiniBrowser/win/MainWindow.cpp
r232669 r232723 29 29 #include "Common.h" 30 30 #include "MiniBrowserLibResource.h" 31 #include "WebKitLegacyBrowserWindow.h" 32 33 #if ENABLE(WEBKIT) 34 #include "WebKitBrowserWindow.h" 35 #endif 31 36 32 37 namespace WebCore { … … 79 84 } 80 85 81 MainWindow::MainWindow() 86 MainWindow::MainWindow(BrowserWindowType type) 87 : m_browserWindowType(type) 82 88 { 83 89 s_numInstances++; … … 89 95 } 90 96 91 Ref<MainWindow> MainWindow::create( )92 { 93 return adoptRef(*new MainWindow( ));97 Ref<MainWindow> MainWindow::create(BrowserWindowType type) 98 { 99 return adoptRef(*new MainWindow(type)); 94 100 } 95 101 … … 105 111 if (!m_hMainWnd) 106 112 return false; 113 114 #if !ENABLE(WEBKIT) 115 EnableMenuItem(GetMenu(m_hMainWnd), IDM_NEW_WEBKIT_WINDOW, MF_GRAYED); 116 #endif 107 117 108 118 float scaleFactor = WebCore::deviceScaleFactorForWindow(nullptr); … … 114 124 SetWindowLongPtr(m_hURLBarWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(EditProc)); 115 125 116 m_browserWindow = WebKitLegacyBrowserWindow::create(m_hMainWnd, m_hURLBarWnd, usesLayeredWebView, pageLoadTesting); 126 auto factory = WebKitLegacyBrowserWindow::create; 127 #if ENABLE(WEBKIT) 128 if (m_browserWindowType == BrowserWindowType::WebKit) 129 factory = WebKitBrowserWindow::create; 130 #endif 131 m_browserWindow = factory(m_hMainWnd, m_hURLBarWnd, usesLayeredWebView, pageLoadTesting); 117 132 if (!m_browserWindow) 118 133 return false; … … 172 187 thisWindow->onURLBarEnter(); 173 188 break; 189 case IDM_NEW_WEBKIT_WINDOW: { 190 auto& newWindow = MainWindow::create(BrowserWindowType::WebKit).leakRef(); 191 newWindow.init(hInst); 192 ShowWindow(newWindow.hwnd(), SW_SHOW); 193 break; 194 } 195 case IDM_NEW_WEBKITLEGACY_WINDOW: { 196 auto& newWindow = MainWindow::create(BrowserWindowType::WebKitLegacy).leakRef(); 197 newWindow.init(hInst); 198 ShowWindow(newWindow.hwnd(), SW_SHOW); 199 break; 200 } 174 201 case IDM_ABOUT: 175 202 DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); -
trunk/Tools/MiniBrowser/win/MainWindow.h
r232669 r232723 26 26 #pragma once 27 27 28 #include " WebKitLegacyBrowserWindow.h"28 #include "BrowserWindow.h" 29 29 #include <memory> 30 30 #include <string> … … 33 33 class MainWindow : public RefCounted<MainWindow> { 34 34 public: 35 static Ref<MainWindow> create(); 35 enum class BrowserWindowType { 36 WebKit, 37 WebKitLegacy 38 }; 39 static Ref<MainWindow> create(BrowserWindowType); 36 40 37 41 ~MainWindow(); … … 52 56 static size_t s_numInstances; 53 57 54 MainWindow( );58 MainWindow(BrowserWindowType); 55 59 bool toggleMenuItem(UINT menuID); 56 60 void onURLBarEnter(); … … 63 67 HWND m_hCacheWnd { nullptr }; 64 68 HGDIOBJ m_hURLBarFont { nullptr }; 69 BrowserWindowType m_browserWindowType; 65 70 RefPtr<BrowserWindow> m_browserWindow; 66 71 }; -
trunk/Tools/MiniBrowser/win/MiniBrowserLib.rc
-
Property
svn:executable
set to
*
r219830 r232723 45 45 MENUITEM "&Print\tCtrl-P", IDM_PRINT 46 46 MENUITEM "E&xit", IDM_EXIT 47 MENUITEM "New WebKit Window", IDM_NEW_WEBKIT_WINDOW 48 MENUITEM "New WebKitLegacy Window", IDM_NEW_WEBKITLEGACY_WINDOW 47 49 END 48 50 POPUP "&View" -
Property
svn:executable
set to
-
trunk/Tools/MiniBrowser/win/MiniBrowserLibResource.h
-
Property
svn:executable
set to
*
r232458 r232723 111 111 #define IDC_AUTH_PASSWORD 1054 112 112 #define IDC_URL_BAR 1055 113 #define IDM_NEW_WEBKIT_WINDOW 32776 114 #define IDM_NEW_WEBKITLEGACY_WINDOW 32777 113 115 #define IDC_STATIC -1 114 116 … … 119 121 #define _APS_NO_MFC 1 120 122 #define _APS_NEXT_RESOURCE_VALUE 175 121 #define _APS_NEXT_COMMAND_VALUE 3277 6123 #define _APS_NEXT_COMMAND_VALUE 32778 122 124 #define _APS_NEXT_CONTROL_VALUE 1055 123 125 #define _APS_NEXT_SYMED_VALUE 110 -
Property
svn:executable
set to
-
trunk/Tools/MiniBrowser/win/PrintWebUIDelegate.cpp
r232669 r232723 66 66 return E_POINTER; 67 67 68 auto& newWindow = MainWindow::create( ).leakRef();68 auto& newWindow = MainWindow::create(MainWindow::BrowserWindowType::WebKitLegacy).leakRef(); 69 69 bool ok = newWindow.init(hInst); 70 70 if (!ok) -
trunk/Tools/MiniBrowser/win/WebKitBrowserWindow.h
r232722 r232723 23 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 24 */ 25 26 25 #pragma once 27 26 28 #include "WebKitLegacyBrowserWindow.h" 29 #include <memory> 30 #include <string> 31 #include <wtf/RefPtr.h> 27 #include "BrowserWindow.h" 28 #include <WebKit/WKRetainPtr.h> 29 #include <WebKit/WebKit2_C.h> 32 30 33 class MainWindow : public RefCounted<MainWindow>{31 class WebKitBrowserWindow : public BrowserWindow { 34 32 public: 35 static Ref< MainWindow> create();33 static Ref<BrowserWindow> create(HWND mainWnd, HWND urlBarWnd, bool useLayeredWebView = false, bool pageLoadTesting = false); 36 34 37 ~MainWindow(); 38 bool init(HINSTANCE hInstance, bool usesLayeredWebView = false, bool pageLoadTesting = false);35 private: 36 WebKitBrowserWindow(HWND mainWnd, HWND urlBarWnd); 39 37 40 void resizeSubViews(); 41 HWND hwnd() const { return m_hMainWnd; } 42 BrowserWindow* browserWindow() const { return m_browserWindow.get(); } 38 HRESULT init() override; 39 HWND hwnd() override; 43 40 44 void loadURL(BSTR url); 45 46 private: 47 static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); 48 static INT_PTR CALLBACK customUserAgentDialogProc(HWND, UINT, WPARAM, LPARAM); 49 static INT_PTR CALLBACK cachesDialogProc(HWND, UINT, WPARAM, LPARAM); 50 static void registerClass(HINSTANCE hInstance); 51 static std::wstring s_windowClass; 52 static size_t s_numInstances; 41 HRESULT loadHTMLString(const BSTR&) override; 42 HRESULT loadURL(const BSTR& url) override; 43 void navigateForwardOrBackward(UINT menuID) override; 44 void navigateToHistory(UINT menuID) override; 45 void setPreference(UINT menuID, bool enable) override; 53 46 54 MainWindow(); 55 bool toggleMenuItem(UINT menuID); 56 void onURLBarEnter(); 57 void updateDeviceScaleFactor(); 47 void print() override; 48 void launchInspector() override; 58 49 50 _bstr_t userAgent() override; 51 void setUserAgent(UINT menuID) override; 52 void setUserAgent(_bstr_t&) override; 53 54 void showLayerTree() override; 55 void updateStatistics(HWND dialog) override; 56 57 void resetZoom() override; 58 void zoomIn() override; 59 void zoomOut() override; 60 61 static void didReceiveTitleForFrame(WKPageRef, WKStringRef, WKFrameRef, WKTypeRef, const void *); 62 static void didCommitLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void *); 63 64 WKRetainPtr<WKViewRef> m_view; 59 65 HWND m_hMainWnd { nullptr }; 60 HWND m_hURLBarWnd { nullptr }; 61 HWND m_hBackButtonWnd { nullptr }; 62 HWND m_hForwardButtonWnd { nullptr }; 63 HWND m_hCacheWnd { nullptr }; 64 HGDIOBJ m_hURLBarFont { nullptr }; 65 RefPtr<BrowserWindow> m_browserWindow; 66 HWND m_urlBarWnd { nullptr }; 66 67 }; -
trunk/Tools/MiniBrowser/win/WinMain.cpp
r232577 r232723 66 66 ::SetProcessDPIAware(); 67 67 68 auto& mainWindow = MainWindow::create( ).leakRef();68 auto& mainWindow = MainWindow::create(MainWindow::BrowserWindowType::WebKitLegacy).leakRef(); 69 69 HRESULT hr = mainWindow.init(hInst, usesLayeredWebView, pageLoadTesting); 70 70 if (FAILED(hr))
Note: See TracChangeset
for help on using the changeset viewer.