Title: [240622] trunk/Tools
Revision
240622
Author
[email protected]
Date
2019-01-28 16:59:12 -0800 (Mon, 28 Jan 2019)

Log Message

[Win][WebKitTestRunner] Error: test and reference images have different sizes. Test image is 784x561, reference image is 800x600
https://bugs.webkit.org/show_bug.cgi?id=193891

Reviewed by Ross Kirsling.

There were three problems in window sizes of WebView and the host window.
1. The sizes of pixel image output were incorrect.
2. The host window is going to appear after window.resize was invoked.
3. window.resize resized only the host window, not WebView.

This change solves them with a following approach.
a. PlatformWebView::PlatformWebView creates the initial host window as zero size.
b. Changes the host window style from WS_OVERLAPPEDWINDOW to WS_POPUP
   as well as DumpRenderTree in order to match the client area and the window area.
c. PlatformWebView::resizeTo simply calls PlatformWebView::setWindowFrame as well as Mac port and GTK port.
d. PlatformWebView::setWindowFrame changes both window sizes.
e. PlatformWebView::setWindowFrame moves the host window to the out side of screen if m_options.shouldShowWebView.

* WebKitTestRunner/win/PlatformWebViewWin.cpp:
(WTR::PlatformWebView::PlatformWebView): Create the host window
and WebView as zero size. Use WS_POPUP instead of WS_OVERLAPPEDWINDOW.
(WTR::PlatformWebView::resizeTo): Calls PlatformWebView::setWindowFrame.
(WTR::PlatformWebView::setWindowFrame): Change both window sizes.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (240621 => 240622)


--- trunk/Tools/ChangeLog	2019-01-29 00:58:13 UTC (rev 240621)
+++ trunk/Tools/ChangeLog	2019-01-29 00:59:12 UTC (rev 240622)
@@ -1,3 +1,29 @@
+2019-01-28  Fujii Hironori  <[email protected]>
+
+        [Win][WebKitTestRunner] Error: test and reference images have different sizes. Test image is 784x561, reference image is 800x600
+        https://bugs.webkit.org/show_bug.cgi?id=193891
+
+        Reviewed by Ross Kirsling.
+
+        There were three problems in window sizes of WebView and the host window.
+        1. The sizes of pixel image output were incorrect.
+        2. The host window is going to appear after window.resize was invoked.
+        3. window.resize resized only the host window, not WebView.
+
+        This change solves them with a following approach.
+        a. PlatformWebView::PlatformWebView creates the initial host window as zero size.
+        b. Changes the host window style from WS_OVERLAPPEDWINDOW to WS_POPUP
+           as well as DumpRenderTree in order to match the client area and the window area.
+        c. PlatformWebView::resizeTo simply calls PlatformWebView::setWindowFrame as well as Mac port and GTK port.
+        d. PlatformWebView::setWindowFrame changes both window sizes.
+        e. PlatformWebView::setWindowFrame moves the host window to the out side of screen if m_options.shouldShowWebView.
+
+        * WebKitTestRunner/win/PlatformWebViewWin.cpp:
+        (WTR::PlatformWebView::PlatformWebView): Create the host window
+        and WebView as zero size. Use WS_POPUP instead of WS_OVERLAPPEDWINDOW.
+        (WTR::PlatformWebView::resizeTo): Calls PlatformWebView::setWindowFrame.
+        (WTR::PlatformWebView::setWindowFrame): Change both window sizes.
+
 2019-01-28  Aakash Jain  <[email protected]>
 
         [ews-app] Add method to save Step data to database

Modified: trunk/Tools/WebKitTestRunner/win/PlatformWebViewWin.cpp (240621 => 240622)


--- trunk/Tools/WebKitTestRunner/win/PlatformWebViewWin.cpp	2019-01-29 00:58:13 UTC (rev 240621)
+++ trunk/Tools/WebKitTestRunner/win/PlatformWebViewWin.cpp	2019-01-29 00:59:12 UTC (rev 240622)
@@ -67,20 +67,20 @@
 {
     registerWindowClass();
 
-    RECT viewRect = {0, 0, 800, 600};
     m_window = ::CreateWindowEx(
         WS_EX_TOOLWINDOW,
         hostWindowClassName,
         testRunnerWindowName,
-        WS_OVERLAPPEDWINDOW,
-        -viewRect.right,
-        -viewRect.bottom,
-        viewRect.right,
-        viewRect.bottom,
+        WS_POPUP,
+        CW_USEDEFAULT,
         0,
         0,
+        0,
+        0,
+        0,
         GetModuleHandle(0),
         0);
+    RECT viewRect = { };
     m_view = WKViewCreate(viewRect, configuration, m_window);
     WKViewSetIsInWindow(m_view, true);
 
@@ -95,14 +95,10 @@
 
 void PlatformWebView::resizeTo(unsigned width, unsigned height, WebViewSizingMode)
 {
-    ::SetWindowPos(
-        WKViewGetWindow(m_view),
-        0,
-        0,
-        0,
-        width,
-        height,
-        SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS);
+    WKRect frame = { };
+    frame.size.width = width;
+    frame.size.height = height;
+    setWindowFrame(frame);
 }
 
 WKPageRef PlatformWebView::page()
@@ -133,13 +129,25 @@
 void PlatformWebView::setWindowFrame(WKRect frame, WebViewSizingMode)
 {
     ::SetWindowPos(
+        WKViewGetWindow(m_view),
+        0,
+        0,
+        0,
+        frame.size.width,
+        frame.size.height,
+        SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS);
+
+    UINT flags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS;
+    if (m_options.shouldShowWebView)
+        flags |= SWP_NOMOVE;
+    ::SetWindowPos(
         m_window,
         0,
-        frame.origin.x,
-        frame.origin.y,
+        -frame.size.width,
+        -frame.size.height,
         frame.size.width,
         frame.size.height,
-        SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS);
+        flags);
 }
 
 void PlatformWebView::didInitializeClients()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to