Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d732d3bb86897cc43697d418eb589d29081ed549
      
https://github.com/WebKit/WebKit/commit/d732d3bb86897cc43697d418eb589d29081ed549
  Author: Abrar Rahman Protyasha <[email protected]>
  Date:   2026-09-02 (Wed, 02 Sep 2026)

  Changed paths:
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm
    M Source/WebKit/UIProcess/DrawingAreaProxy.h
    M 
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeDrawingAreaProxyMac.h
    M 
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeDrawingAreaProxyMac.mm
    M Source/WebKit/UIProcess/ViewGestureController.cpp
    M Source/WebKit/UIProcess/ViewGestureController.h
    M Tools/TestWebKitAPI/Configurations/Base.xcconfig
    M Tools/TestWebKitAPI/PlatformCocoa.cmake
    M Tools/TestWebKitAPI/SourcesMac.txt
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    A Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/WKWebViewMagnification.mm

  Log Message:
  -----------
  WKWebView.magnification reports the pre-gesture scale while a committed 
transient zoom animates
https://bugs.webkit.org/show_bug.cgi?id=323127
rdar://185381317

Reviewed by Richard Robinson.

WKWebView.magnification reports the live scale during an ongoing gesture
and otherwise falls back to the page scale factor. However, at the end
of a gesture, we clear the active gesture type synchronously, while the
committed transient zoom is not written to the page scale factor until
sendCommitTransientZoom() runs (asynchronously) after the gesture
animation is complete (and CATransaction.completionBlock runs). In this
period, we report the scale from before the gesture started, which is
wrong.

We account for the committed-but-not-reflected phase by plumbing a
committedTransientZoomScale value, set in commitTransientZoom(), which
we promptly unset in sendCommitTransientZoom() when the page scale
factor is actually written.

Test: TestWebKitAPI.WKWebViewMagnification

* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivateForTesting.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewTesting.mm:
(-[WKWebView _minMagnification]):
(-[WKWebView _maxMagnification]):
* Source/WebKit/UIProcess/DrawingAreaProxy.h:
(WebKit::DrawingAreaProxy::committedTransientZoomScale const):
* 
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeDrawingAreaProxyMac.h:
* 
Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeDrawingAreaProxyMac.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::commitTransientZoom):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::sendCommitTransientZoom):
* Source/WebKit/UIProcess/ViewGestureController.cpp:
(WebKit::ViewGestureController::prepareMagnificationGesture):
(WebKit::ViewGestureController::magnification const):
* Tools/TestWebKitAPI/Configurations/Base.xcconfig:
* Tools/TestWebKitAPI/PlatformCocoa.cmake:
* Tools/TestWebKitAPI/SourcesMac.txt:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/WKWebViewMagnification.mm: 
Added.
(TestWebKitAPI::magnify):
(TestWebKitAPI::magnifyPastMaximum):
(TestWebKitAPI::lowestMagnificationReportedAfterGesture):
(TestWebKitAPI::webViewWithMagnificationAllowed):
(TestWebKitAPI::runAccurateAtGestureEndTest):
(TestWebKitAPI::TEST(WKWebViewMagnification, AccurateAtGestureEnd)):
(TestWebKitAPI::TEST(WKWebViewMagnification, AccurateAtGestureEndPDF)):
  Separate PDF case since the plugin handles its own scale, and also
  has separate magnification limits from regular web content.

Canonical link: https://commits.webkit.org/320341@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to