[webkit-changes] [WebKit/WebKit] 7eac12: usatoday.com: Rotating from landscape to portrait ...
Jessica Cheung
noreply at github.com
Fri Jan 24 00:29:36 PST 2025
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 7eac12ec2ff9679924ce2d6adc86c943cacdccf4
https://github.com/WebKit/WebKit/commit/7eac12ec2ff9679924ce2d6adc86c943cacdccf4
Author: Jessica Cheung <jcheung23 at apple.com>
Date: 2025-01-24 (Fri, 24 Jan 2025)
Changed paths:
M Source/WebCore/page/VisualViewport.cpp
M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
A Tools/TestWebKitAPI/Tests/ios/VisualViewport.mm
Log Message:
-----------
usatoday.com: Rotating from landscape to portrait causes flickering
https://bugs.webkit.org/show_bug.cgi?id=286367
rdar://93767145
Reviewed by Wenson Hsieh.
usatoday.com has a visual viewport flickering issue when rotating from landscape to portrait.
This issue happens when rotating from portrait to landscape as well, but does not flicker due
to the width cutoffs set in javascript for the website.
Additionally, this issue actually happens when we change the viewport width in the meta tag.
In this scenario, the new width is calculated based on the current visual viewport scale and width.
In our code, the issue was as follows:
1. Document::processViewport is called whenever the viewport meta tag changes
2. The scale is set
- Layout change happens before VisibleContentRectUpdates
3. VisualViewport::update calls setNeedsVisualViewportResize()
4. A resize is dispatched
- This is the extra/premature resize
5. (UI) WebpageProxy::updateVisibleContentRects is called which in turn calls
(WEB) WebPage::updateVisibleContentRects
6. A resize is dispatched
- This is the correct resize that we anticipate with updated width
The scale is updated in the UI process but the width is updated in the Web process.
Thus, the scale is updated ahead of the width and hits this section of code in VisualViewport.cpp:
if (m_width != width || m_height != height || m_scale != scale) {
if (document)
document->setNeedsVisualViewportResize();
We hit m_scale != scale and call document->setNeedsVisualViewportResize(); prematurely,
when we should be waiting until either the width or height changes as well.
Thus, the issue of the extra resize(s) is fixed by removing the condition to check
for scale changes when determining when to call resize. This is safe because visual viewport
scales should never update independently from width/height.
An API test was also added for this change.
* Source/WebCore/page/VisualViewport.cpp:
(WebCore::VisualViewport::update):
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/ios/VisualViewport.mm: Added.
(TestWebKitAPI::TEST(VisualViewport, RotationResize)):
Canonical link: https://commits.webkit.org/289334@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list