Changeset 277775 in webkit
- Timestamp:
- May 19, 2021 10:05:40 PM (14 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/scrolling/page-y-offset-should-not-be-changed-after-zoom-expected.txt (added)
-
LayoutTests/fast/scrolling/page-y-offset-should-not-be-changed-after-zoom.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/page/Frame.cpp (modified) (2 diffs)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/API/C/WKPage.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r277772 r277775 1 2021-05-19 Tomoki Imai <Tomoki.Imai@sony.com> 2 3 Scrolling must be done after the layout when doing full page zoom 4 https://bugs.webkit.org/show_bug.cgi?id=225730 5 6 Reviewed by Simon Fraser. 7 8 Added a testcase to ensure that scroll position is not changed after zoom. 9 10 * fast/scrolling/page-y-offset-should-not-be-changed-after-zoom-expected.txt: Added. 11 * fast/scrolling/page-y-offset-should-not-be-changed-after-zoom.html: Added. 12 1 13 2021-05-19 Devin Rousso <drousso@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r277772 r277775 1 2021-05-19 Tomoki Imai <Tomoki.Imai@sony.com> 2 3 Scrolling must be done after the layout when doing full page zoom 4 https://bugs.webkit.org/show_bug.cgi?id=225730 5 6 Reviewed by Simon Fraser. 7 8 Previously, the actual scroll was executed before the layout with the zoomed position. 9 It sometimes makes the scroll position exceed the page height, and cannot retain pageYOffset. 10 In the user experience perspective, the user may miss what they are looking at after zoom. 11 12 This patch makes the scroll happen after the layout, with the zoomed position. 13 14 Test: LayoutTests\fast\scrolling\page-y-offset-should-not-be-changed-after-zoom.html 15 16 * page/Frame.cpp: 17 (WebCore::Frame::setPageAndTextZoomFactors): Makes the scroll happen after the layout. 18 1 19 2021-05-19 Devin Rousso <drousso@apple.com> 2 20 -
trunk/Source/WebCore/page/Frame.cpp
r277295 r277775 962 962 return; 963 963 964 Optional<ScrollPosition> scrollPositionAfterZoomed; 964 965 if (m_pageZoomFactor != pageZoomFactor) { 966 // Compute the scroll position with scale after zooming to stay the same position in the content. 965 967 if (FrameView* view = this->view()) { 966 // Update the scroll position when doing a full page zoom, so the content stays in relatively the same position. 967 LayoutPoint scrollPosition = view->scrollPosition(); 968 float percentDifference = (pageZoomFactor / m_pageZoomFactor); 969 view->setScrollPosition(IntPoint(scrollPosition.x() * percentDifference, scrollPosition.y() * percentDifference)); 968 scrollPositionAfterZoomed = view->scrollPosition(); 969 scrollPositionAfterZoomed->scale(pageZoomFactor / m_pageZoomFactor); 970 970 } 971 971 } 972 973 972 m_pageZoomFactor = pageZoomFactor; 974 973 m_textZoomFactor = textZoomFactor; … … 982 981 if (document->renderView() && document->renderView()->needsLayout() && view->didFirstLayout()) 983 982 view->layoutContext().layout(); 983 984 // Scrolling to the calculated position must be done after the layout. 985 if (scrollPositionAfterZoomed) 986 view->setScrollPosition(scrollPositionAfterZoomed.value()); 984 987 } 985 988 } -
trunk/Source/WebKit/ChangeLog
r277774 r277775 1 2021-05-19 Tomoki Imai <Tomoki.Imai@sony.com> 2 3 Scrolling must be done after the layout when doing full page zoom 4 https://bugs.webkit.org/show_bug.cgi?id=225730 5 6 Reviewed by Simon Fraser. 7 8 Add check to disallow negative or zero zoom value. 9 10 * UIProcess/API/C/WKPage.cpp: 11 (WKPageSetPageZoomFactor): 12 1 13 2021-05-19 Chris Dumez <cdumez@apple.com> 2 14 -
trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp
r277740 r277775 606 606 { 607 607 CRASH_IF_SUSPENDED; 608 if (zoomFactor <= 0) 609 return; 608 610 toImpl(pageRef)->setPageZoomFactor(zoomFactor); 609 611 }
Note: See TracChangeset
for help on using the changeset viewer.