[UnifiedPDF][iOS] Relative scroll position is not preserved when resizing web view#46211
Conversation
|
EWS run on previous version of this PR (hash e5e8338) Details |
Neither does Mac! I think this is just an invented feature :P |
There was a problem hiding this comment.
should the oldContentSize.height > 0 just be oldContentSize.height because of the style rule not to compare to 0?
There was a problem hiding this comment.
The "compare to 0" style rule applies to equality checks
There was a problem hiding this comment.
Technically it would be fine since content size shouldn't be negative, but I also don't see a strong reason to change it, so keeping as-is.
|
EWS run on current version of this PR (hash 44f36cb) Details |
…zing 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
44f36cb to
4312171
Compare
|
Committed 295715@main (4312171): https://commits.webkit.org/295715@main Reviewed commits have been landed. Closing PR #46211 and removing active labels. |
4312171
44f36cb
🧪 ios-wk2-wpt