Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4312171edbbfbbfc2aa88a125eea2aeef57acbe2
      
https://github.com/WebKit/WebKit/commit/4312171edbbfbbfc2aa88a125eea2aeef57acbe2
  Author: Aditya Keerthi <[email protected]>
  Date:   2025-06-02 (Mon, 02 Jun 2025)

  Changed paths:
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/UnifiedPDFTests.mm

  Log Message:
  -----------
  [UnifiedPDF][iOS] Relative scroll position is not preserved when resizing web 
view
https://bugs.webkit.org/show_bug.cgi?id=293906
rdar://152160616

Reviewed by Richard Robinson, Wenson Hsieh, and Tim Horton.

When the web view is resized, the fitting scale of the PDF changes, resulting
in an individual page becoming taller or shorter, and an overall change to the
content size. However, the scroll view's content offset remains unchanged,
resulting in a "jump" to another page when the web view is resized.

Fix by computing a new content offset when the fitting scale changes. Since the
fitting scale is not actually exposed to the UI process, simply take the ratio
of new content height to the old content height.

* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _updateScrollViewForTransaction:]):

Repurpose logic that pins the scroll position for traditional web content to
also support pinning the PDF scroll position.

Note that the added logic is only correct for PDFs that display vertically.
This is fine since WebKit does not support horizontal PDF display.

* Tools/TestWebKitAPI/Tests/WebKitCocoa/UnifiedPDFTests.mm:
(TestWebKitAPI::UNIFIED_PDF_TEST(KeepRelativeScrollPositionAfterAnimatedResize)):
(TestWebKitAPI::UNIFIED_PDF_TEST(ScrollOffsetResetWhenChangingPDF)):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to