Diff
Modified: trunk/Source/WebKit/ChangeLog (252457 => 252458)
--- trunk/Source/WebKit/ChangeLog 2019-11-14 15:28:17 UTC (rev 252457)
+++ trunk/Source/WebKit/ChangeLog 2019-11-14 18:07:21 UTC (rev 252458)
@@ -1,3 +1,14 @@
+2019-11-14 Brady Eidson <[email protected]>
+
+ pageZoom/setPageZoom: should not be in a Mac-only part of WKWebView.mm
+ https://bugs.webkit.org/show_bug.cgi?id=204128
+
+ Reviewed by Alex Christensen.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView setPageZoom:]):
+ (-[WKWebView pageZoom]):
+
2019-11-13 Per Arne Vollan <[email protected]>
REGRESSION: WKWebView navigation fails when navigating from about:blank
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (252457 => 252458)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2019-11-14 15:28:17 UTC (rev 252457)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2019-11-14 18:07:21 UTC (rev 252458)
@@ -4441,16 +4441,6 @@
}
#endif
-- (void)setPageZoom:(CGFloat)pageZoom
-{
- _page->setPageZoomFactor(pageZoom);
-}
-
-- (CGFloat)pageZoom
-{
- return _page->pageZoomFactor();
-}
-
- (BOOL)_usePlatformFindUI
{
return _usePlatformFindUI;
@@ -5700,6 +5690,16 @@
_page->setTextZoomFactor(zoomFactor);
}
+- (void)setPageZoom:(CGFloat)pageZoom
+{
+ _page->setPageZoomFactor(pageZoom);
+}
+
+- (CGFloat)pageZoom
+{
+ return _page->pageZoomFactor();
+}
+
- (double)_pageZoomFactor
{
return [self pageZoom];
Modified: trunk/Tools/ChangeLog (252457 => 252458)
--- trunk/Tools/ChangeLog 2019-11-14 15:28:17 UTC (rev 252457)
+++ trunk/Tools/ChangeLog 2019-11-14 18:07:21 UTC (rev 252458)
@@ -1,3 +1,17 @@
+2019-11-14 Brady Eidson <[email protected]>
+
+ pageZoom/setPageZoom: should not be in a Mac-only part of WKWebView.mm
+ https://bugs.webkit.org/show_bug.cgi?id=204128
+
+ Reviewed by Alex Christensen.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKitCocoa/PageZoom.mm: Added.
+ (TestWebKitAPI::getClientWidth):
+ * TestWebKitAPI/cocoa/TestWKWebView.h:
+ * TestWebKitAPI/cocoa/TestWKWebView.mm:
+ (-[WKWebView waitUntilClientWidthIs:]):
+
2019-11-14 Jonathan Bedard <[email protected]>
webkitpy: Clarify webkitpy/style/optparser_unittest.py by removing parse variables
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (252457 => 252458)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2019-11-14 15:28:17 UTC (rev 252457)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2019-11-14 18:07:21 UTC (rev 252458)
@@ -260,6 +260,7 @@
5120C83D1E6751290025B250 /* WebsiteDataStoreCustomPaths.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5120C83C1E6750790025B250 /* WebsiteDataStoreCustomPaths.mm */; };
5120C83E1E67678F0025B250 /* WebsiteDataStoreCustomPaths.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5120C83B1E674E350025B250 /* WebsiteDataStoreCustomPaths.html */; };
51242CD52374E62500EED9C1 /* FindInPageAPI.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51242CD42374E61E00EED9C1 /* FindInPageAPI.mm */; };
+ 51242CDB237B7ACB00EED9C1 /* PageZoom.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51242CDA237B791E00EED9C1 /* PageZoom.mm */; };
512C4C9E20EAA40D004945EA /* ResponsivenessTimerCrash.mm in Sources */ = {isa = PBXBuildFile; fileRef = 512C4C9D20EAA405004945EA /* ResponsivenessTimerCrash.mm */; };
51393E221523952D005F39C5 /* DOMWindowExtensionBasic_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51393E1D1523944A005F39C5 /* DOMWindowExtensionBasic_Bundle.cpp */; };
51396E1A222E516000A42FCE /* LoadFileURL.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51396E19222E4E8600A42FCE /* LoadFileURL.mm */; };
@@ -1796,6 +1797,7 @@
5120C83B1E674E350025B250 /* WebsiteDataStoreCustomPaths.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = WebsiteDataStoreCustomPaths.html; sourceTree = "<group>"; };
5120C83C1E6750790025B250 /* WebsiteDataStoreCustomPaths.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebsiteDataStoreCustomPaths.mm; sourceTree = "<group>"; };
51242CD42374E61E00EED9C1 /* FindInPageAPI.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FindInPageAPI.mm; sourceTree = "<group>"; };
+ 51242CDA237B791E00EED9C1 /* PageZoom.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageZoom.mm; sourceTree = "<group>"; };
512C4C9D20EAA405004945EA /* ResponsivenessTimerCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResponsivenessTimerCrash.mm; sourceTree = "<group>"; };
51393E1D1523944A005F39C5 /* DOMWindowExtensionBasic_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowExtensionBasic_Bundle.cpp; sourceTree = "<group>"; };
51393E1E1523944A005F39C5 /* DOMWindowExtensionBasic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowExtensionBasic.cpp; sourceTree = "<group>"; };
@@ -2922,6 +2924,7 @@
CEBCA12E1E3A660100C73293 /* OverrideContentSecurityPolicy.mm */,
2DA2586E225C67DC00B45C1C /* OverrideViewportArguments.mm */,
2D3CA3A4221DF2390088E803 /* PageOverlayPlugin.mm */,
+ 51242CDA237B791E00EED9C1 /* PageZoom.mm */,
F44C79FB20F9E50C0014478C /* ParserYieldTokenPlugIn.mm */,
F44C79FD20F9E8710014478C /* ParserYieldTokenTests.h */,
F44C79FE20F9E8710014478C /* ParserYieldTokenTests.mm */,
@@ -4757,6 +4760,7 @@
7CCE7F081A411AE600447C4C /* PageLoadDidChangeLocationWithinPageForFrame.cpp in Sources */,
272A691022F012DA000FDABB /* PageLoadState.cpp in Sources */,
7CCE7EC71A411A7E00447C4C /* PageVisibilityStateWithWindowChanges.mm in Sources */,
+ 51242CDB237B7ACB00EED9C1 /* PageZoom.mm in Sources */,
7CCE7F091A411AE600447C4C /* ParentFrame.cpp in Sources */,
7C83E0511D0A641800FEBCF3 /* ParsedContentRange.cpp in Sources */,
AA96CAB621C7DB5000FD2F97 /* ParsedContentType.cpp in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PageZoom.mm (0 => 252458)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PageZoom.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PageZoom.mm 2019-11-14 18:07:21 UTC (rev 252458)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * 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"
+
+#import "PlatformUtilities.h"
+#import "TestNavigationDelegate.h"
+#import "TestWKWebView.h"
+#import <wtf/RetainPtr.h>
+
+namespace TestWebKitAPI {
+
+TEST(WKWebView, PageZoom)
+{
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 400, 400)]);
+ [webView synchronouslyLoadHTMLString:@"<body>TEST</body>" baseURL:nil];
+
+ // On macOS this will be 400, per the size of the WKWebView.
+ // On iOS devices it will be a native device width, and we need to fetch that here.
+ unsigned beforeClientWidth = [webView waitUntilClientWidthIs:400];
+
+ webView.get().pageZoom = 2.0;
+
+ unsigned afterClientWidth = [webView waitUntilClientWidthIs:beforeClientWidth / 2];
+ EXPECT_EQ(beforeClientWidth / 2, afterClientWidth);
+}
+
+} // namespace TestWebKitAPI
Modified: trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h (252457 => 252458)
--- trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h 2019-11-14 15:28:17 UTC (rev 252457)
+++ trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h 2019-11-14 18:07:21 UTC (rev 252458)
@@ -63,6 +63,7 @@
- (NSString *)stringByEvaluatingJavaScript:(NSString *)script;
- (id)objectByEvaluatingJavaScriptWithUserGesture:(NSString *)script;
- (id)objectByEvaluatingJavaScript:(NSString *)script;
+- (unsigned)waitUntilClientWidthIs:(unsigned)expectedClientWidth;
@end
@interface TestMessageHandler : NSObject <WKScriptMessageHandler>
Modified: trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm (252457 => 252458)
--- trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm 2019-11-14 15:28:17 UTC (rev 252457)
+++ trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm 2019-11-14 18:07:21 UTC (rev 252458)
@@ -183,6 +183,23 @@
return [NSString stringWithFormat:@"%@", [self objectByEvaluatingJavaScript:script]];
}
+- (unsigned)waitUntilClientWidthIs:(unsigned)expectedClientWidth
+{
+ int timeout = 10;
+ unsigned clientWidth = 0;
+ do {
+ if (timeout != 10)
+ TestWebKitAPI::Util::sleep(0.1);
+
+ id result = [self objectByEvaluatingJavaScript:@"function ___forceLayoutAndGetClientWidth___() { document.body.offsetTop; return document.body.clientWidth; }; ___forceLayoutAndGetClientWidth___();"];
+ clientWidth = [result integerValue];
+
+ --timeout;
+ } while (clientWidth != expectedClientWidth && timeout >= 0);
+
+ return clientWidth;
+}
+
@end
@implementation TestMessageHandler {