[Win] Extend WinLauncher with support for Page Zoom
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Jan 2015 23:40:04 +0000 (23:40 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Jan 2015 23:40:04 +0000 (23:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=140152

Reviewed by Anders Carlsson.

* WinLauncher/Common.cpp:
(WndProc):
* WinLauncher/WinLauncher.cpp:
(WinLauncher::resetZoom):
(WinLauncher::zoomIn):
(WinLauncher::zoomOut):
* WinLauncher/WinLauncher.h:
* WinLauncher/WinLauncher.vcxproj/WinLauncherLib.rc:
* WinLauncher/WinLauncher.vcxproj/WinLauncherLibResource.h:
* win/DLLLauncher/DLLLauncherMain.cpp:
(wWinMain):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@178001 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/WinLauncher/Common.cpp
Tools/WinLauncher/WinLauncher.cpp
Tools/WinLauncher/WinLauncher.h
Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLib.rc
Tools/WinLauncher/WinLauncher.vcxproj/WinLauncherLibResource.h
Tools/win/DLLLauncher/DLLLauncherMain.cpp

index de82c8c..baa3f6f 100644 (file)
@@ -1,3 +1,22 @@
+2015-01-06  Brent Fulgham  <bfulgham@apple.com>
+
+        [Win] Extend WinLauncher with support for Page Zoom
+        https://bugs.webkit.org/show_bug.cgi?id=140152
+
+        Reviewed by Anders Carlsson.
+
+        * WinLauncher/Common.cpp:
+        (WndProc):
+        * WinLauncher/WinLauncher.cpp:
+        (WinLauncher::resetZoom):
+        (WinLauncher::zoomIn):
+        (WinLauncher::zoomOut):
+        * WinLauncher/WinLauncher.h:
+        * WinLauncher/WinLauncher.vcxproj/WinLauncherLib.rc:
+        * WinLauncher/WinLauncher.vcxproj/WinLauncherLibResource.h:
+        * win/DLLLauncher/DLLLauncherMain.cpp:
+        (wWinMain):
+
 2015-01-06  Anders Carlsson  <andersca@apple.com>
 
         Fix API tests that are broken under HiDPI
index 30ab65f..199a968 100644 (file)
@@ -480,6 +480,18 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
             else
                 DialogBox(hInst, MAKEINTRESOURCE(IDD_USER_AGENT), hWnd, CustomUserAgent);
             break;
+        case IDM_ACTUAL_SIZE:
+            if (gWinLauncher)
+                gWinLauncher->resetZoom();
+            break;
+        case IDM_ZOOM_IN:
+            if (gWinLauncher)
+                gWinLauncher->zoomIn();
+            break;
+        case IDM_ZOOM_OUT:
+            if (gWinLauncher)
+                gWinLauncher->zoomOut();
+            break;
         default:
             return CallWindowProc(parentProc, hWnd, message, wParam, lParam);
         }
index 8273f02..847385d 100644 (file)
@@ -444,3 +444,32 @@ _bstr_t WinLauncher::userAgent()
 
     return userAgent;
 }
+
+typedef _com_ptr_t<_com_IIID<IWebIBActions, &__uuidof(IWebIBActions)>> IWebIBActionsPtr;
+
+void WinLauncher::resetZoom()
+{
+    IWebIBActionsPtr webActions;
+    if (FAILED(m_webView->QueryInterface(IID_IWebIBActions, reinterpret_cast<void**>(&webActions.GetInterfacePtr()))))
+        return;
+
+    webActions->resetPageZoom(nullptr);
+}
+
+void WinLauncher::zoomIn()
+{
+    IWebIBActionsPtr webActions;
+    if (FAILED(m_webView->QueryInterface(IID_IWebIBActions, reinterpret_cast<void**>(&webActions.GetInterfacePtr()))))
+        return;
+
+    webActions->zoomPageIn(nullptr);
+}
+
+void WinLauncher::zoomOut()
+{
+    IWebIBActionsPtr webActions;
+    if (FAILED(m_webView->QueryInterface(IID_IWebIBActions, reinterpret_cast<void**>(&webActions.GetInterfacePtr()))))
+        return;
+
+    webActions->zoomPageOut(nullptr);
+}
index 5d1d34f..1bac282 100644 (file)
@@ -84,6 +84,10 @@ public:
 
     PageLoadTestClient& pageLoadTestClient() { return *m_pageLoadTestClient; }
 
+    void resetZoom();
+    void zoomIn();
+    void zoomOut();
+
 private:
     std::vector<IWebHistoryItemPtr> m_historyItems;
 
index c3f9f54..5eaae6e 100644 (file)
@@ -43,6 +43,12 @@ BEGIN
         MENUITEM "&Print\tCtrl-P",              IDM_PRINT\r
         MENUITEM "E&xit",                       IDM_EXIT\r
     END\r
+    POPUP "&View"\r
+    BEGIN\r
+        MENUITEM "Actual Size",                 IDM_ACTUAL_SIZE\r
+        MENUITEM "Zoom In\tCtrl++",             IDM_ZOOM_IN\r
+        MENUITEM "Zoom Out\tCtrl+-",            IDM_ZOOM_OUT\r
+    END\r
     POPUP "&History"\r
     BEGIN\r
         MENUITEM "Back",                        IDM_HISTORY_BACKWARD\r
@@ -111,8 +117,10 @@ END
 \r
 IDC_WINLAUNCHER ACCELERATORS\r
 BEGIN\r
-    "?",            IDM_ABOUT,              ASCII,  ALT\r
-    "/",            IDM_ABOUT,              ASCII,  ALT\r
+    "/",            IDM_ABOUT,              ASCII,  ALT, NOINVERT\r
+    "?",            IDM_ABOUT,              ASCII,  ALT, NOINVERT\r
+    VK_ADD,         IDM_ZOOM_IN,            VIRTKEY, CONTROL, NOINVERT\r
+    VK_SUBTRACT,    IDM_ZOOM_OUT,           VIRTKEY, CONTROL, NOINVERT\r
 END\r
 \r
 \r
index 1b696af..fc4f9a5 100644 (file)
@@ -48,6 +48,9 @@
 #define IDM_UA_FIREFOX_MAC              168
 #define IDM_UA_FIREFOX_WIN              169
 #define IDM_UA_OTHER                    170
+#define IDM_ACTUAL_SIZE                 171
+#define IDM_ZOOM_IN                     172
+#define IDM_ZOOM_OUT                    173
 #define IDC_EMPTY_URL_CACHE             1000
 #define IDC_RETURN_FREE_MEMORY          1001
 #define IDC_EMPTY_WEBCORE_CACHE         1002
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NO_MFC                     1
-#define _APS_NEXT_RESOURCE_VALUE        171
-#define _APS_NEXT_COMMAND_VALUE         32771
+#define _APS_NEXT_RESOURCE_VALUE        174
+#define _APS_NEXT_COMMAND_VALUE         32776
 #define _APS_NEXT_CONTROL_VALUE         1053
 #define _APS_NEXT_SYMED_VALUE           110
 #endif
index 72fa62e..375536f 100644 (file)
@@ -187,6 +187,8 @@ int main(int argc, const char* argv[])
 int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpstrCmdLine, int nCmdShow)
 #endif
 {
+    _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF);
+
     enableTerminationOnHeapCorruption();
 
     // Get the path of our executable.