[Win] UIScriptController::zoomToScale not implemented
authorHironori.Fujii@sony.com <Hironori.Fujii@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Nov 2019 08:26:33 +0000 (08:26 +0000)
committerHironori.Fujii@sony.com <Hironori.Fujii@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Nov 2019 08:26:33 +0000 (08:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=180424

Reviewed by Alex Christensen.

Tools:

* DumpRenderTree/PlatformWin.cmake:
* DumpRenderTree/win/UIScriptControllerWin.cpp: Added.
(WTR::UIScriptController::create):
(WTR::UIScriptControllerWin::doAsyncTask):
(WTR::UIScriptControllerWin::zoomToScale):
(WTR::UIScriptControllerWin::zoomScale const):
* DumpRenderTree/win/UIScriptControllerWin.h: Added.
(WTR::UIScriptControllerWin::UIScriptControllerWin):
* TestRunnerShared/UIScriptContext/UIScriptController.cpp:
* WebKitTestRunner/PlatformWin.cmake:
* WebKitTestRunner/win/UIScriptControllerWin.cpp: Added.
(WTR::UIScriptController::create):
(WTR::UIScriptControllerWin::doAsyncTask):
(WTR::UIScriptControllerWin::zoomToScale):
(WTR::UIScriptControllerWin::zoomScale const):
* WebKitTestRunner/win/UIScriptControllerWin.h: Added.
(WTR::UIScriptControllerWin::UIScriptControllerWin):

LayoutTests:

* platform/win/TestExpectations:
* platform/wincairo/TestExpectations:
Unmarked skipped tests for webkit.org/b/180424.
Marked fast/visual-viewport/client-coordinates-relative-to-layout-viewport.html,
fast/visual-viewport/client-rects-relative-to-layout-viewport.html
and fast/visual-viewport/zoomed-fixed-scroll-down-then-up.html as
Failure.

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

LayoutTests/ChangeLog
LayoutTests/platform/win/TestExpectations
LayoutTests/platform/wincairo/TestExpectations
Tools/ChangeLog
Tools/DumpRenderTree/PlatformWin.cmake
Tools/DumpRenderTree/win/UIScriptControllerWin.cpp [new file with mode: 0644]
Tools/DumpRenderTree/win/UIScriptControllerWin.h [new file with mode: 0644]
Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp
Tools/WebKitTestRunner/PlatformWin.cmake
Tools/WebKitTestRunner/win/UIScriptControllerWin.cpp [new file with mode: 0644]
Tools/WebKitTestRunner/win/UIScriptControllerWin.h [new file with mode: 0644]

index 77f2119..e9acc02 100644 (file)
@@ -1,3 +1,18 @@
+2019-11-12  Fujii Hironori  <Hironori.Fujii@sony.com>
+
+        [Win] UIScriptController::zoomToScale not implemented
+        https://bugs.webkit.org/show_bug.cgi?id=180424
+
+        Reviewed by Alex Christensen.
+
+        * platform/win/TestExpectations:
+        * platform/wincairo/TestExpectations:
+        Unmarked skipped tests for webkit.org/b/180424.
+        Marked fast/visual-viewport/client-coordinates-relative-to-layout-viewport.html,
+        fast/visual-viewport/client-rects-relative-to-layout-viewport.html
+        and fast/visual-viewport/zoomed-fixed-scroll-down-then-up.html as
+        Failure.
+
 2019-11-11  Ryosuke Niwa  <rniwa@webkit.org>
 
         iOS: fast/scrolling/ios/scrollTo-at-page-load.html is flaky
index 0a65ffe..b587ff3 100644 (file)
@@ -224,10 +224,6 @@ webkit.org/b/29287 http/tests/local/formdata/ [ Skip ]
 fast/events/autoscroll-with-software-keyboard.html [ Skip ]
 fast/events/autoscroll-when-input-is-offscreen.html [ Skip ]
 
-# UIScriptController::zoomToScale is not supported.
-fast/visual-viewport/client-coordinates-relative-to-layout-viewport.html [ Skip ]
-fast/visual-viewport/client-rects-relative-to-layout-viewport.html [ Skip ]
-
 # UIScriptController::removeViewFromWindow/addViewToWindow is not supported.
 pageoverlay/overlay-remove-reinsert-view.html [ Skip ]
 
@@ -691,21 +687,8 @@ http/wpt/credential-management/ [ Skip ]
 http/wpt/webauthn/ [ Skip ]
 imported/w3c/web-platform-tests/credential-management/ [ Skip ]
 
-# UIScriptController::zoomToScale is not implemented on Windows.
-webkit.org/b/180424 fast/visual-viewport/resize-event-fired.html [ Skip ]
-webkit.org/b/180424 fast/visual-viewport/rtl-zoomed-rects.html [ Skip ]
-webkit.org/b/180424 fast/visual-viewport/scroll-event-fired.html [ Skip ]
-webkit.org/b/180424 fast/visual-viewport/viewport-dimensions-exclude-custom-scrollbars.html [ Skip ]
-webkit.org/b/180424 fast/visual-viewport/viewport-dimensions-exclude-scrollbars.html [ Skip ]
-webkit.org/b/180424 fast/visual-viewport/viewport-dimensions-iframe.html [ Skip ]
-webkit.org/b/180424 fast/visual-viewport/viewport-dimensions-under-page-zoom.html [ Skip ]
-webkit.org/b/180424 fast/visual-viewport/viewport-dimensions.html [ Skip ]
-webkit.org/b/180424 fast/visual-viewport/zoomed-fixed-header-and-footer.html [ Skip ]
-webkit.org/b/180424 fast/visual-viewport/zoomed-fixed-scroll-down-then-up.html [ Skip ]
-webkit.org/b/180424 fast/visual-viewport/zoomed-fixed.html [ Skip ]
-webkit.org/b/180424 fast/visual-viewport/zoomed-rects.html [ Skip ]
-webkit.org/b/180424 fast/zooming/client-rect-in-fixed-zoomed.html [ Skip ]
-webkit.org/b/180424 fast/zooming/uiscript-zooming.html [ Skip ]
+fast/visual-viewport/client-coordinates-relative-to-layout-viewport.html [ Failure ]
+fast/visual-viewport/zoomed-fixed-scroll-down-then-up.html [ Failure ]
 
 ################################################################################
 ###########    End Missing Functionality Prevents Testing         ##############
index e1b7ee1..e798965 100644 (file)
@@ -530,21 +530,8 @@ streams/reference-implementation/writable-stream-abort.html [ Failure ]
 streams/reference-implementation/writable-stream.html [ Failure ]
 streams/shadowing-Promise.html [ Failure ]
 
-# UIScriptController::zoomToScale() is not implemented.
-webkit.org/b/180424 fast/visual-viewport/resize-event-fired.html [ Skip ]
-webkit.org/b/180424 fast/visual-viewport/rtl-zoomed-rects.html [ Skip ]
-webkit.org/b/180424 fast/visual-viewport/scroll-event-fired.html [ Skip ]
-webkit.org/b/180424 fast/visual-viewport/viewport-dimensions-exclude-custom-scrollbars.html [ Skip ]
-webkit.org/b/180424 fast/visual-viewport/viewport-dimensions-exclude-scrollbars.html [ Skip ]
-webkit.org/b/180424 fast/visual-viewport/viewport-dimensions-iframe.html [ Skip ]
-webkit.org/b/180424 fast/visual-viewport/viewport-dimensions-under-page-zoom.html [ Skip ]
-webkit.org/b/180424 fast/visual-viewport/viewport-dimensions.html [ Skip ]
-webkit.org/b/180424 fast/visual-viewport/zoomed-fixed-header-and-footer.html [ Skip ]
-webkit.org/b/180424 fast/visual-viewport/zoomed-fixed-scroll-down-then-up.html [ Skip ]
-webkit.org/b/180424 fast/visual-viewport/zoomed-fixed.html [ Skip ]
-webkit.org/b/180424 fast/visual-viewport/zoomed-rects.html [ Skip ]
-webkit.org/b/180424 fast/zooming/client-rect-in-fixed-zoomed.html [ Skip ]
-webkit.org/b/180424 fast/zooming/uiscript-zooming.html [ Skip ]
+fast/visual-viewport/client-rects-relative-to-layout-viewport.html [ Failure ]
+fast/visual-viewport/zoomed-fixed-scroll-down-then-up.html [ Failure ]
 
 # eventSender.scheduleAsynchronousClick is not a function.
 fast/events/popup-blocking-click-in-iframe.html [ Skip ]
@@ -1554,7 +1541,6 @@ fast/table [ Skip ]
 fast/text [ Skip ]
 fast/tokenizer [ Skip ]
 fast/transforms [ Skip ]
-fast/visual-viewport [ Skip ]
 fast/workers/worker-exception-during-navigation.html [ Pass Failure ]
 fast/writing-mode [ Skip ]
 fast/xmlhttprequest [ Skip ]
index c770bf9..f579afa 100644 (file)
@@ -1,3 +1,28 @@
+2019-11-12  Fujii Hironori  <Hironori.Fujii@sony.com>
+
+        [Win] UIScriptController::zoomToScale not implemented
+        https://bugs.webkit.org/show_bug.cgi?id=180424
+
+        Reviewed by Alex Christensen.
+
+        * DumpRenderTree/PlatformWin.cmake:
+        * DumpRenderTree/win/UIScriptControllerWin.cpp: Added.
+        (WTR::UIScriptController::create):
+        (WTR::UIScriptControllerWin::doAsyncTask):
+        (WTR::UIScriptControllerWin::zoomToScale):
+        (WTR::UIScriptControllerWin::zoomScale const):
+        * DumpRenderTree/win/UIScriptControllerWin.h: Added.
+        (WTR::UIScriptControllerWin::UIScriptControllerWin):
+        * TestRunnerShared/UIScriptContext/UIScriptController.cpp:
+        * WebKitTestRunner/PlatformWin.cmake:
+        * WebKitTestRunner/win/UIScriptControllerWin.cpp: Added.
+        (WTR::UIScriptController::create):
+        (WTR::UIScriptControllerWin::doAsyncTask):
+        (WTR::UIScriptControllerWin::zoomToScale):
+        (WTR::UIScriptControllerWin::zoomScale const):
+        * WebKitTestRunner/win/UIScriptControllerWin.h: Added.
+        (WTR::UIScriptControllerWin::UIScriptControllerWin):
+
 2019-11-12  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] WebDriver: implement new window command
index 0c7730b..cc6548b 100644 (file)
@@ -21,6 +21,7 @@ set(DumpRenderTreeLib_SOURCES
     win/TextInputController.cpp
     win/TextInputControllerWin.cpp
     win/UIDelegate.cpp
+    win/UIScriptControllerWin.cpp
     win/WorkQueueItemWin.cpp
 )
 
diff --git a/Tools/DumpRenderTree/win/UIScriptControllerWin.cpp b/Tools/DumpRenderTree/win/UIScriptControllerWin.cpp
new file mode 100644 (file)
index 0000000..8f7e9a8
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2019 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. AND ITS CONTRIBUTORS ``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 ITS 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 "config.h"
+#include "UIScriptControllerWin.h"
+
+#include "DumpRenderTreeWin.h"
+#include "UIScriptContext.h"
+#include <WebCore/COMPtr.h>
+#include <WebKitLegacy/WebKit.h>
+
+namespace WTR {
+
+Ref<UIScriptController> UIScriptController::create(UIScriptContext& context)
+{
+    return adoptRef(*new UIScriptControllerWin(context));
+}
+
+void UIScriptControllerWin::doAsyncTask(JSValueRef callback)
+{
+    unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
+
+    callOnMainThread([this, protectedThis = makeRef(*this), callbackID ] {
+        if (!m_context)
+            return;
+        m_context->asyncTaskComplete(callbackID);
+    });
+}
+
+void UIScriptControllerWin::zoomToScale(double scale, JSValueRef callback)
+{
+    doAsyncTask(callback);
+
+    COMPtr<IWebView> webView;
+    if (FAILED(frame->webView(&webView)))
+        return;
+
+    COMPtr<IWebViewPrivate2> webView2(Query, webView);
+    if (!webView2)
+        return;
+
+    webView2->scaleWebView(scale, { 0, 0 });
+}
+
+double UIScriptControllerWin::zoomScale() const
+{
+    // No API to get the page scale factor
+    return 1;
+}
+
+}
diff --git a/Tools/DumpRenderTree/win/UIScriptControllerWin.h b/Tools/DumpRenderTree/win/UIScriptControllerWin.h
new file mode 100644 (file)
index 0000000..f5e248f
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2019 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. AND ITS CONTRIBUTORS ``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 ITS 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 "UIScriptController.h"
+
+namespace WTR {
+
+class UIScriptControllerWin : public UIScriptController {
+public:
+    explicit UIScriptControllerWin(UIScriptContext& context)
+        : UIScriptController(context)
+    {
+    }
+
+    void doAsyncTask(JSValueRef) override;
+    void zoomToScale(double, JSValueRef) override;
+    double zoomScale() const override;
+};
+
+}
index 96b6809..7522d58 100644 (file)
@@ -58,7 +58,7 @@ DeviceOrientation* toDeviceOrientation(JSContextRef context, JSValueRef value)
     return nullptr;
 }
 
-#if !PLATFORM(GTK) && !PLATFORM(COCOA)
+#if !PLATFORM(GTK) && !PLATFORM(COCOA) && !PLATFORM(WIN)
 Ref<UIScriptController> UIScriptController::create(UIScriptContext& context)
 {
     return adoptRef(*new UIScriptController(context));
index 14a8721..cdac662 100644 (file)
@@ -4,6 +4,7 @@ set(WebKitTestRunnerLib_SOURCES
     win/EventSenderProxyWin.cpp
     win/PlatformWebViewWin.cpp
     win/TestControllerWin.cpp
+    win/UIScriptControllerWin.cpp
     win/main.cpp
 )
 
diff --git a/Tools/WebKitTestRunner/win/UIScriptControllerWin.cpp b/Tools/WebKitTestRunner/win/UIScriptControllerWin.cpp
new file mode 100644 (file)
index 0000000..cbfa5e2
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2019 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. AND ITS CONTRIBUTORS ``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 ITS 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 "config.h"
+#include "UIScriptControllerWin.h"
+
+#include "PlatformWebView.h"
+#include "TestController.h"
+#include "UIScriptContext.h"
+
+namespace WTR {
+
+Ref<UIScriptController> UIScriptController::create(UIScriptContext& context)
+{
+    return adoptRef(*new UIScriptControllerWin(context));
+}
+
+void UIScriptControllerWin::doAsyncTask(JSValueRef callback)
+{
+    unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
+
+    callOnMainThread([this, protectedThis = makeRef(*this), callbackID ] {
+        if (!m_context)
+            return;
+        m_context->asyncTaskComplete(callbackID);
+    });
+}
+
+void UIScriptControllerWin::zoomToScale(double scale, JSValueRef callback)
+{
+    auto page = TestController::singleton().mainWebView()->page();
+    WKPageSetScaleFactor(page, scale, WKPointMake(0, 0));
+    doAsyncTask(callback);
+}
+
+double UIScriptControllerWin::zoomScale() const
+{
+    auto page = TestController::singleton().mainWebView()->page();
+    return WKPageGetScaleFactor(page);
+}
+
+} // namespace WTR
diff --git a/Tools/WebKitTestRunner/win/UIScriptControllerWin.h b/Tools/WebKitTestRunner/win/UIScriptControllerWin.h
new file mode 100644 (file)
index 0000000..be3fded
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2019 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. AND ITS CONTRIBUTORS ``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 ITS 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 "PlatformWebView.h"
+#include "TestController.h"
+#include "UIScriptController.h"
+
+namespace WTR {
+
+class UIScriptControllerWin : public UIScriptController {
+public:
+    explicit UIScriptControllerWin(UIScriptContext& context)
+        : UIScriptController(context)
+    {
+    }
+
+    void doAsyncTask(JSValueRef) override;
+    void zoomToScale(double, JSValueRef) override;
+    double zoomScale() const override;
+};
+
+} // namespace WTR