Title: [284322] trunk
- Revision
- 284322
- Author
- simon.fra...@apple.com
- Date
- 2021-10-16 13:32:52 -0700 (Sat, 16 Oct 2021)
Log Message
Page zoom is messed up after navigating back from a PDF
https://bugs.webkit.org/show_bug.cgi?id=231841
<rdar://72666365>
Reviewed by Tim Horton.
Source/WebKit:
A navigation back from a PDF is a FrameLoadType::Back, so resetting
m_mainFramePluginHandlesPageScaleGesture only for FrameLoadType::Standard is wrong.
For all navigations, the plugins seem to call
pluginScaleFactorDidChange/pluginZoomFactorDidChange/
mainFramePluginHandlesPageScaleGestureDidChange so it's safe to reset them for all
navigation types.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didCommitLoadForFrame):
Tools:
* TestWebKitAPI/Tests/WebKitCocoa/PageZoom.mm:
(TestWebKitAPI::TEST):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (284321 => 284322)
--- trunk/Source/WebKit/ChangeLog 2021-10-16 20:16:56 UTC (rev 284321)
+++ trunk/Source/WebKit/ChangeLog 2021-10-16 20:32:52 UTC (rev 284322)
@@ -1,3 +1,22 @@
+2021-10-16 Simon Fraser <simon.fra...@apple.com>
+
+ Page zoom is messed up after navigating back from a PDF
+ https://bugs.webkit.org/show_bug.cgi?id=231841
+ <rdar://72666365>
+
+ Reviewed by Tim Horton.
+
+ A navigation back from a PDF is a FrameLoadType::Back, so resetting
+ m_mainFramePluginHandlesPageScaleGesture only for FrameLoadType::Standard is wrong.
+
+ For all navigations, the plugins seem to call
+ pluginScaleFactorDidChange/pluginZoomFactorDidChange/
+ mainFramePluginHandlesPageScaleGestureDidChange so it's safe to reset them for all
+ navigation types.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::didCommitLoadForFrame):
+
2021-10-16 Commit Queue <commit-qu...@webkit.org>
Unreviewed, reverting r284300.
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (284321 => 284322)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-10-16 20:16:56 UTC (rev 284321)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2021-10-16 20:32:52 UTC (rev 284322)
@@ -4933,11 +4933,9 @@
// plugin is handling page scaling itself) so we should reset it to the default
// for standard main frame loads.
if (frame->isMainFrame()) {
- if (frameLoadType == FrameLoadType::Standard) {
- m_pageScaleFactor = 1;
- m_pluginScaleFactor = 1;
- m_mainFramePluginHandlesPageScaleGesture = false;
- }
+ m_pageScaleFactor = 1;
+ m_pluginScaleFactor = 1;
+ m_mainFramePluginHandlesPageScaleGesture = false;
#if ENABLE(POINTER_LOCK)
requestPointerUnlock();
#endif
Modified: trunk/Tools/ChangeLog (284321 => 284322)
--- trunk/Tools/ChangeLog 2021-10-16 20:16:56 UTC (rev 284321)
+++ trunk/Tools/ChangeLog 2021-10-16 20:32:52 UTC (rev 284322)
@@ -1,3 +1,14 @@
+2021-10-16 Simon Fraser <simon.fra...@apple.com>
+
+ Page zoom is messed up after navigating back from a PDF
+ https://bugs.webkit.org/show_bug.cgi?id=231841
+ <rdar://72666365>
+
+ Reviewed by Tim Horton.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/PageZoom.mm:
+ (TestWebKitAPI::TEST):
+
2021-10-15 Basuke Suzuki <basuke.suz...@sony.com>
Add flag to turn off Iso heap
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PageZoom.mm (284321 => 284322)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PageZoom.mm 2021-10-16 20:16:56 UTC (rev 284321)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/PageZoom.mm 2021-10-16 20:32:52 UTC (rev 284322)
@@ -47,4 +47,25 @@
EXPECT_EQ(beforeClientWidth / 2, afterClientWidth);
}
+TEST(WKWebView, PageZoomAfterPDF)
+{
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 400, 400)]);
+
+ NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+ [webView loadRequest:request];
+ [webView _test_waitForDidFinishNavigation];
+ webView.get().pageZoom = 2.0;
+ auto beforePageZoom = webView.get().pageZoom;
+
+ NSURLRequest *pdfRequest = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"test" withExtension:@"pdf" subdirectory:@"TestWebKitAPI.resources"]];
+ [webView loadRequest:pdfRequest];
+ [webView _test_waitForDidFinishNavigation];
+
+ [webView goBack];
+ [webView _test_waitForDidFinishNavigation];
+
+ auto afterPageZoom = webView.get().pageZoom;
+ EXPECT_EQ(beforePageZoom, afterPageZoom);
+}
+
} // namespace TestWebKitAPI
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes