Diff
Modified: trunk/LayoutTests/ChangeLog (208206 => 208207)
--- trunk/LayoutTests/ChangeLog 2016-11-01 01:36:00 UTC (rev 208206)
+++ trunk/LayoutTests/ChangeLog 2016-11-01 02:43:47 UTC (rev 208207)
@@ -1,3 +1,14 @@
+2016-10-31 Simon Fraser <simon.fra...@apple.com>
+
+ Make UIScriptController::zoomToScale() work on Mac WK1 and WK2
+ https://bugs.webkit.org/show_bug.cgi?id=164238
+
+ Reviewed by Dean Jackson.
+
+ * fast/zooming/uiscript-zooming-expected.txt: Added.
+ * fast/zooming/uiscript-zooming.html: Added.
+ * platform/ios-simulator-wk1/TestExpectations:
+
2016-10-31 Joseph Pecoraro <pecor...@apple.com>
Remove test workaround now that original issue is fixed
Added: trunk/LayoutTests/fast/zooming/uiscript-zooming-expected.txt (0 => 208207)
--- trunk/LayoutTests/fast/zooming/uiscript-zooming-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/zooming/uiscript-zooming-expected.txt 2016-11-01 02:43:47 UTC (rev 208207)
@@ -0,0 +1,10 @@
+Test that uiController.zoomToScale() works.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS internals.pageScaleFactor() is 2
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/zooming/uiscript-zooming.html (0 => 208207)
--- trunk/LayoutTests/fast/zooming/uiscript-zooming.html (rev 0)
+++ trunk/LayoutTests/fast/zooming/uiscript-zooming.html 2016-11-01 02:43:47 UTC (rev 208207)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ body {
+ height: 2000px;
+ width: 2000px;
+ }
+ </style>
+ <script src=""
+ <script>
+ description("Test that uiController.zoomToScale() works.");
+
+ window.jsTestIsAsync = true;
+
+ function doAfterZooming()
+ {
+ shouldBe('internals.pageScaleFactor()', '2');
+ finishJSTest();
+ }
+
+ function getUIScript()
+ {
+ return `(function() {
+ uiController.zoomToScale(2, function() {
+ uiController.uiScriptComplete(uiController.zoomScale);
+ });
+ })();`;
+ }
+
+ function doTest()
+ {
+ if (window.testRunner)
+ testRunner.runUIScript(getUIScript(), function(zoomScale) {
+ doAfterZooming();
+ })
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+ <script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/platform/ios-simulator-wk1/TestExpectations (208206 => 208207)
--- trunk/LayoutTests/platform/ios-simulator-wk1/TestExpectations 2016-11-01 01:36:00 UTC (rev 208206)
+++ trunk/LayoutTests/platform/ios-simulator-wk1/TestExpectations 2016-11-01 02:43:47 UTC (rev 208207)
@@ -100,6 +100,9 @@
editing/unsupported-content/table-type-after.html
editing/unsupported-content/table-type-before.html
+# Zooming works differently in iOS DRT
+fast/zooming/uiscript-zooming.html [ Failure ]
+
# FIXME: Tests that fail due to lack of textInputController <rdar://problem/5106287>
editing/inserting/insert-composition-whitespace.html [ Failure ]
Modified: trunk/Source/WebCore/ChangeLog (208206 => 208207)
--- trunk/Source/WebCore/ChangeLog 2016-11-01 01:36:00 UTC (rev 208206)
+++ trunk/Source/WebCore/ChangeLog 2016-11-01 02:43:47 UTC (rev 208207)
@@ -1,3 +1,19 @@
+2016-10-31 Simon Fraser <simon.fra...@apple.com>
+
+ Make UIScriptController::zoomToScale() work on Mac WK1 and WK2
+ https://bugs.webkit.org/show_bug.cgi?id=164238
+
+ Reviewed by Dean Jackson.
+
+ Test: fast/zooming/uiscript-zooming.html
+
+ Expose pageScaleFactor() for tests.
+
+ * testing/Internals.cpp:
+ (WebCore::Internals::pageScaleFactor):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
2016-10-31 Myles C. Maxfield <mmaxfi...@apple.com>
Migrate CanvasRenderingContext's internal canvas pointer to a reference
Modified: trunk/Source/WebCore/testing/Internals.cpp (208206 => 208207)
--- trunk/Source/WebCore/testing/Internals.cpp 2016-11-01 01:36:00 UTC (rev 208206)
+++ trunk/Source/WebCore/testing/Internals.cpp 2016-11-01 02:43:47 UTC (rev 208207)
@@ -2017,6 +2017,15 @@
return PrintContext::pageSizeAndMarginsInPixels(frame(), pageNumber, width, height, marginTop, marginRight, marginBottom, marginLeft);
}
+ExceptionOr<float> Internals::pageScaleFactor() const
+{
+ Document* document = contextDocument();
+ if (!document || !document->page())
+ return Exception { INVALID_ACCESS_ERR };
+
+ return document->page()->pageScaleFactor();
+}
+
ExceptionOr<void> Internals::setPageScaleFactor(float scaleFactor, int x, int y)
{
Document* document = contextDocument();
Modified: trunk/Source/WebCore/testing/Internals.h (208206 => 208207)
--- trunk/Source/WebCore/testing/Internals.h 2016-11-01 01:36:00 UTC (rev 208206)
+++ trunk/Source/WebCore/testing/Internals.h 2016-11-01 02:43:47 UTC (rev 208207)
@@ -284,6 +284,8 @@
ExceptionOr<String> pageProperty(const String& propertyName, int pageNumber) const;
ExceptionOr<String> pageSizeAndMarginsInPixels(int pageNumber, int width, int height, int marginTop, int marginRight, int marginBottom, int marginLeft) const;
+ ExceptionOr<float> pageScaleFactor() const;
+
ExceptionOr<void> setPageScaleFactor(float scaleFactor, int x, int y);
ExceptionOr<void> setPageZoomFactor(float);
ExceptionOr<void> setTextZoomFactor(float);
Modified: trunk/Source/WebCore/testing/Internals.idl (208206 => 208207)
--- trunk/Source/WebCore/testing/Internals.idl 2016-11-01 01:36:00 UTC (rev 208206)
+++ trunk/Source/WebCore/testing/Internals.idl 2016-11-01 02:43:47 UTC (rev 208207)
@@ -278,6 +278,8 @@
[MayThrowException] DOMString pageSizeAndMarginsInPixels(long pageIndex, long width, long height, long marginTop, long marginRight, long marginBottom, long marginLeft);
[MayThrowException] void setPageScaleFactor(unrestricted float scaleFactor, long x, long y);
+ [MayThrowException] float pageScaleFactor();
+
[MayThrowException] void setPageZoomFactor(unrestricted float zoomFactor);
[MayThrowException] void setTextZoomFactor(unrestricted float zoomFactor);
Modified: trunk/Tools/ChangeLog (208206 => 208207)
--- trunk/Tools/ChangeLog 2016-11-01 01:36:00 UTC (rev 208206)
+++ trunk/Tools/ChangeLog 2016-11-01 02:43:47 UTC (rev 208207)
@@ -1,3 +1,18 @@
+2016-10-31 Simon Fraser <simon.fra...@apple.com>
+
+ Make UIScriptController::zoomToScale() work on Mac WK1 and WK2
+ https://bugs.webkit.org/show_bug.cgi?id=164238
+
+ Reviewed by Dean Jackson.
+
+ Implement UIScriptController::zoomToScale() for WTR and DRT on Mac.
+
+ * DumpRenderTree/mac/UIScriptControllerMac.mm:
+ (WTR::UIScriptController::zoomToScale):
+ * TestRunnerShared/UIScriptContext/UIScriptController.cpp:
+ * WebKitTestRunner/mac/UIScriptControllerMac.mm:
+ (WTR::UIScriptController::zoomToScale):
+
2016-10-31 Dewei Zhu <dewei_...@apple.com>
Update twisted version in webkitpy.thirdparty.autoinstalled module.
Modified: trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm (208206 => 208207)
--- trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm 2016-11-01 01:36:00 UTC (rev 208206)
+++ trunk/Tools/DumpRenderTree/mac/UIScriptControllerMac.mm 2016-11-01 02:43:47 UTC (rev 208207)
@@ -26,7 +26,10 @@
#import "config.h"
#import "UIScriptController.h"
+#import "DumpRenderTree.h"
#import "UIScriptContext.h"
+#import <WebKit/WebKit.h>
+#import <WebKit/WebViewPrivate.h>
#if PLATFORM(MAC)
@@ -47,6 +50,20 @@
{
}
+void UIScriptController::zoomToScale(double scale, JSValueRef callback)
+{
+ unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
+
+ WebView *webView = [mainFrame webView];
+ [webView _scaleWebView:scale atOrigin:NSZeroPoint];
+
+ dispatch_async(dispatch_get_main_queue(), ^ {
+ if (!m_context)
+ return;
+ m_context->asyncTaskComplete(callbackID);
+ });
}
+}
+
#endif // PLATFORM(MAC)
Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp (208206 => 208207)
--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp 2016-11-01 01:36:00 UTC (rev 208206)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp 2016-11-01 02:43:47 UTC (rev 208207)
@@ -157,11 +157,13 @@
return m_context->callbackWithID(CallbackTypeDidHideKeyboard);
}
-#if !PLATFORM(IOS)
+#if !PLATFORM(COCOA)
void UIScriptController::zoomToScale(double, JSValueRef)
{
}
+#endif
+#if !PLATFORM(IOS)
void UIScriptController::touchDownAtPoint(long x, long y, long touchCount, JSValueRef)
{
}
Modified: trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm (208206 => 208207)
--- trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm 2016-11-01 01:36:00 UTC (rev 208206)
+++ trunk/Tools/WebKitTestRunner/mac/UIScriptControllerMac.mm 2016-11-01 02:43:47 UTC (rev 208207)
@@ -66,4 +66,23 @@
#endif
}
+void UIScriptController::zoomToScale(double scale, JSValueRef callback)
+{
+#if WK_API_ENABLED
+ unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
+
+ auto* webView = TestController::singleton().mainWebView()->platformView();
+ [webView _setPageScale:scale withOrigin:CGPointZero];
+
+ [webView _doAfterNextPresentationUpdate: ^ {
+ if (!m_context)
+ return;
+ m_context->asyncTaskComplete(callbackID);
+ }];
+#else
+ UNUSED_PARAM(scale);
+ UNUSED_PARAM(callback);
+#endif
}
+
+} // namespace WTR