Title: [252872] trunk/Tools
Revision
252872
Author
[email protected]
Date
2019-11-25 18:56:33 -0800 (Mon, 25 Nov 2019)

Log Message

[Win] Ensure MiniBrowser can be built with !ENABLE(WEBKIT_LEGACY)
https://bugs.webkit.org/show_bug.cgi?id=204592

Reviewed by Don Olmstead.

* MiniBrowser/win/CMakeLists.txt:
* MiniBrowser/win/Common.cpp:
(parseCommandLine):
* MiniBrowser/win/Common.h:
* MiniBrowser/win/MainWindow.cpp:
(MainWindow::init):
(MainWindow::WndProc):
* MiniBrowser/win/WinMain.cpp:
(wWinMain):
* PlatformWin.cmake:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (252871 => 252872)


--- trunk/Tools/ChangeLog	2019-11-26 02:12:01 UTC (rev 252871)
+++ trunk/Tools/ChangeLog	2019-11-26 02:56:33 UTC (rev 252872)
@@ -1,3 +1,21 @@
+2019-11-25  Ross Kirsling  <[email protected]>
+
+        [Win] Ensure MiniBrowser can be built with !ENABLE(WEBKIT_LEGACY)
+        https://bugs.webkit.org/show_bug.cgi?id=204592
+
+        Reviewed by Don Olmstead.
+
+        * MiniBrowser/win/CMakeLists.txt:
+        * MiniBrowser/win/Common.cpp:
+        (parseCommandLine):
+        * MiniBrowser/win/Common.h:
+        * MiniBrowser/win/MainWindow.cpp:
+        (MainWindow::init):
+        (MainWindow::WndProc):
+        * MiniBrowser/win/WinMain.cpp:
+        (wWinMain):
+        * PlatformWin.cmake:
+
 2019-11-25  Fujii Hironori  <[email protected]>
 
         Add DefaultHash<OptionSet<T>> and HashTrait<OptionSet<T>> specializations

Modified: trunk/Tools/MiniBrowser/win/CMakeLists.txt (252871 => 252872)


--- trunk/Tools/MiniBrowser/win/CMakeLists.txt	2019-11-26 02:12:01 UTC (rev 252871)
+++ trunk/Tools/MiniBrowser/win/CMakeLists.txt	2019-11-26 02:56:33 UTC (rev 252872)
@@ -1,22 +1,13 @@
 set(MiniBrowser_INCLUDE_DIRECTORIES
     ${PAL_FRAMEWORK_HEADERS_DIR}
     ${WebCore_PRIVATE_FRAMEWORK_HEADERS_DIR}
-    ${WebKitLegacy_FRAMEWORK_HEADERS_DIR}
-    ${WebKit_FRAMEWORK_HEADERS_DIR}
-    ${WebKit_PRIVATE_FRAMEWORK_HEADERS_DIR}
 )
 
 set(MiniBrowser_SOURCES
-    AccessibilityDelegate.cpp
     BrowserWindow.cpp
     Common.cpp
     MainWindow.cpp
-    PrintWebUIDelegate.cpp
-    ResourceLoadDelegate.cpp
-    WebDownloadDelegate.cpp
     MiniBrowserLib.rc
-    MiniBrowserWebHost.cpp
-    WebKitLegacyBrowserWindow.cpp
     WinMain.cpp
     stdafx.cpp
 )
@@ -24,8 +15,6 @@
 set(MiniBrowser_LIBRARIES
     DbgHelp
     WebKit::WTF
-    WebKitLegacy
-    WebKitLegacyGUID
     comctl32
     comsupp
     comsuppw
@@ -38,12 +27,37 @@
     )
 endif ()
 
+if (ENABLE_WEBKIT_LEGACY)
+    add_definitions(-DENABLE_WEBKIT_LEGACY)
+    list(APPEND MiniBrowser_INCLUDE_DIRECTORIES
+        ${WebKitLegacy_FRAMEWORK_HEADERS_DIR}
+    )
+    list(APPEND MiniBrowser_SOURCES
+        AccessibilityDelegate.cpp
+        MiniBrowserWebHost.cpp
+        PrintWebUIDelegate.cpp
+        ResourceLoadDelegate.cpp
+        WebDownloadDelegate.cpp
+        WebKitLegacyBrowserWindow.cpp
+    )
+    list(APPEND MiniBrowser_LIBRARIES
+        WebKitLegacy
+        WebKitLegacyGUID
+    )
+endif ()
+
 if (ENABLE_WEBKIT)
     add_definitions(-DENABLE_WEBKIT)
+    list(APPEND MiniBrowser_INCLUDE_DIRECTORIES
+        ${WebKit_FRAMEWORK_HEADERS_DIR}
+        ${WebKit_PRIVATE_FRAMEWORK_HEADERS_DIR}
+    )
     list(APPEND MiniBrowser_SOURCES
         WebKitBrowserWindow.cpp
     )
-    list(APPEND MiniBrowser_LIBRARIES WebKit)
+    list(APPEND MiniBrowser_LIBRARIES
+        WebKit
+    )
 endif ()
 
 set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${MSVC_RUNTIME_LINKER_FLAGS}")

Modified: trunk/Tools/MiniBrowser/win/Common.cpp (252871 => 252872)


--- trunk/Tools/MiniBrowser/win/Common.cpp	2019-11-26 02:12:01 UTC (rev 252871)
+++ trunk/Tools/MiniBrowser/win/Common.cpp	2019-11-26 02:56:33 UTC (rev 252872)
@@ -271,8 +271,10 @@
             options.usesLayeredWebView = true;
         else if (!wcsicmp(argv[i], L"--desktop"))
             options.useFullDesktop = true;
+#if ENABLE(WEBKIT_LEGACY)
         else if (!wcsicmp(argv[i], L"--wk1") || !wcsicmp(argv[i], L"--legacy"))
             options.windowType = BrowserWindowType::WebKitLegacy;
+#endif
 #if ENABLE(WEBKIT)
         else if (!wcsicmp(argv[i], L"--wk2") || !wcsicmp(argv[i], L"--webkit"))
             options.windowType = BrowserWindowType::WebKit;

Modified: trunk/Tools/MiniBrowser/win/Common.h (252871 => 252872)


--- trunk/Tools/MiniBrowser/win/Common.h	2019-11-26 02:12:01 UTC (rev 252871)
+++ trunk/Tools/MiniBrowser/win/Common.h	2019-11-26 02:56:33 UTC (rev 252872)
@@ -27,7 +27,6 @@
 
 #include "stdafx.h"
 #include "MainWindow.h"
-#include "WebKitLegacyBrowserWindow.h"
 
 enum class BrowserWindowType {
     WebKit,

Modified: trunk/Tools/MiniBrowser/win/MainWindow.cpp (252871 => 252872)


--- trunk/Tools/MiniBrowser/win/MainWindow.cpp	2019-11-26 02:12:01 UTC (rev 252871)
+++ trunk/Tools/MiniBrowser/win/MainWindow.cpp	2019-11-26 02:56:33 UTC (rev 252872)
@@ -28,14 +28,20 @@
 
 #include "Common.h"
 #include "MiniBrowserLibResource.h"
-#include "WebKitLegacyBrowserWindow.h"
-#include <CoreFoundation/CoreFoundation.h>
 #include <sstream>
 
+#if USE(CF)
+#include <CoreFoundation/CoreFoundation.h>
+#endif
+
 #if ENABLE(WEBKIT)
 #include "WebKitBrowserWindow.h"
 #endif
 
+#if ENABLE(WEBKIT_LEGACY)
+#include "WebKitLegacyBrowserWindow.h"
+#endif
+
 namespace WebCore {
 float deviceScaleFactorForWindow(HWND);
 }
@@ -115,6 +121,9 @@
 #if !ENABLE(WEBKIT)
     EnableMenuItem(GetMenu(m_hMainWnd), IDM_NEW_WEBKIT_WINDOW, MF_GRAYED);
 #endif
+#if !ENABLE(WEBKIT_LEGACY)
+    EnableMenuItem(GetMenu(m_hMainWnd), IDM_NEW_WEBKITLEGACY_WINDOW, MF_GRAYED);
+#endif
 
     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, 0, 0, 0, 0, m_hMainWnd, reinterpret_cast<HMENU>(IDM_HISTORY_FORWARD), hInstance, 0);
@@ -193,6 +202,7 @@
             break;
         }
 #endif
+#if ENABLE(WEBKIT_LEGACY)
         case IDM_NEW_WEBKITLEGACY_WINDOW: {
             auto& newWindow = MainWindow::create().leakRef();
             newWindow.init(WebKitLegacyBrowserWindow::create, hInst);
@@ -199,6 +209,7 @@
             ShowWindow(newWindow.hwnd(), SW_SHOW);
             break;
         }
+#endif
         case IDM_CLOSE_WINDOW:
             PostMessage(hWnd, WM_CLOSE, 0, 0);
             break;

Modified: trunk/Tools/MiniBrowser/win/WinMain.cpp (252871 => 252872)


--- trunk/Tools/MiniBrowser/win/WinMain.cpp	2019-11-26 02:12:01 UTC (rev 252871)
+++ trunk/Tools/MiniBrowser/win/WinMain.cpp	2019-11-26 02:56:33 UTC (rev 252872)
@@ -32,14 +32,21 @@
 #include "Common.h"
 #include "MiniBrowserLibResource.h"
 #include "MiniBrowserReplace.h"
-#include "WebKitLegacyBrowserWindow.h"
-#include <WebKitLegacy/WebKitCOMAPI.h>
 #include <wtf/win/SoftLinking.h>
 
+#if USE(CF)
+#include <CoreFoundation/CoreFoundation.h>
+#endif
+
 #if ENABLE(WEBKIT)
 #include "WebKitBrowserWindow.h"
 #endif
 
+#if ENABLE(WEBKIT_LEGACY)
+#include "WebKitLegacyBrowserWindow.h"
+#include <WebKitLegacy/WebKitCOMAPI.h>
+#endif
+
 SOFT_LINK_LIBRARY(user32);
 SOFT_LINK_OPTIONAL(user32, SetProcessDpiAwarenessContext, BOOL, STDAPICALLTYPE, (DPI_AWARENESS_CONTEXT));
 
@@ -72,10 +79,12 @@
     else
         ::SetProcessDPIAware();
 
+#if !ENABLE(WEBKIT_LEGACY)
+    auto factory = WebKitBrowserWindow::create;
+#elif !ENABLE(WEBKIT)
     auto factory = WebKitLegacyBrowserWindow::create;
-#if ENABLE(WEBKIT)
-    if (options.windowType == BrowserWindowType::WebKit)
-        factory = WebKitBrowserWindow::create;
+#else
+    auto factory = options.windowType == BrowserWindowType::WebKit ? WebKitBrowserWindow::create : WebKitLegacyBrowserWindow::create;
 #endif
     auto& mainWindow = MainWindow::create().leakRef();
     HRESULT hr = mainWindow.init(factory, hInst, options.usesLayeredWebView);
@@ -95,6 +104,17 @@
 
     // Main message loop:
     __try {
+#if ENABLE(WEBKIT)
+        while (GetMessage(&msg, nullptr, 0, 0)) {
+#if USE(CF)
+            CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, true);
+#endif
+            if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) {
+                TranslateMessage(&msg);
+                DispatchMessage(&msg);
+            }
+        }
+#else
         IWebKitMessageLoopPtr messageLoop;
 
         hr = WebKitCreateInstance(CLSID_WebKitMessageLoop, 0, IID_IWebKitMessageLoop, reinterpret_cast<void**>(&messageLoop.GetInterfacePtr()));
@@ -102,11 +122,13 @@
             goto exit;
 
         messageLoop->run(hAccelTable);
-
+#endif
     } __except(createCrashReport(GetExceptionInformation()), EXCEPTION_EXECUTE_HANDLER) { }
 
 exit:
+#if !ENABLE(WEBKIT)
     shutDownWebKit();
+#endif
 #ifdef _CRTDBG_MAP_ALLOC
     _CrtDumpMemoryLeaks();
 #endif

Modified: trunk/Tools/PlatformWin.cmake (252871 => 252872)


--- trunk/Tools/PlatformWin.cmake	2019-11-26 02:12:01 UTC (rev 252871)
+++ trunk/Tools/PlatformWin.cmake	2019-11-26 02:56:33 UTC (rev 252872)
@@ -1,8 +1,11 @@
 add_subdirectory(ImageDiff)
 
+if (ENABLE_WEBKIT OR ENABLE_WEBKIT_LEGACY)
+    add_subdirectory(MiniBrowser/win)
+endif ()
+
 if (ENABLE_WEBKIT_LEGACY)
     add_subdirectory(DumpRenderTree)
-    add_subdirectory(MiniBrowser/win)
 endif ()
 
 if (ENABLE_WEBKIT)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to