[webkit-changes] [WebKit/WebKit] 753422: TestWebKitAPI.ScrollViewScrollabilityTests.Scrolla...

Wenson Hsieh noreply at github.com
Tue May 7 17:26:48 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7534227e0513ca35a96d0667791cdc70eb5b4751
      https://github.com/WebKit/WebKit/commit/7534227e0513ca35a96d0667791cdc70eb5b4751
  Author: Wenson Hsieh <wenson_hsieh at apple.com>
  Date:   2024-05-07 (Tue, 07 May 2024)

  Changed paths:
    M Source/WebKit/Scripts/webkit/messages.py
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/WebPageProxy.messages.in
    M Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h

  Log Message:
  -----------
  TestWebKitAPI.ScrollViewScrollabilityTests.ScrollableWithOverflowHiddenWhenZoomed fails on iOS Simulator
https://bugs.webkit.org/show_bug.cgi?id=273738
rdar://127547621

Reviewed by Simon Fraser and Abrar Protyasha.

After the changes in 276962 at main, this iOS API test began failing. This test works by setting the
`WKScrollView`'s `zoomScale` immediately after page load to 1.5, and verifying that the scroll view
is scrollable, on account of the scale being greater than 1.

Since we now schedule a full rendering update when completing a page transition after document load,
this now introduces a race. Consider the following sequence of events:

1. (UI)     Scroll view zoom scale is set to 1.5, which schedules a visible content rect update.

2. (WEB)    Remote layer tree commit (triggered by completing page transition) is sent, as a result
            of scheduling an editor state update. The `pageScaleFactor` in the transaction is 1.0.

3. (WEB)    Visible content rect update arrives, setting the page scale factor to 1.5.

4. (UI)     Remote layer tree commit arrives, updating the scroll view's zoom scale to 1.0. This
            schedules another visible content rect update, with a zoom scale of 1.0.

5. (WEB)    Second visible content rect update arrives, reverting page scale factor to 1.0.

This leaves us in a state where calling `-setZoomScale:animated:` was essentially a no-op. To avoid
this race, we replace the scheduled editor state update (which triggers a layer flush) with a
separate, dedicated IPC message to clear out the `EditorState` during page transition. This also
helps prevent an otherwise-unnecessary layer tree flush immediately after page load.

* Source/WebKit/Scripts/webkit/messages.py:
(types_that_cannot_be_forward_declared):
(headers_for_type):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::clearEditorStateAfterPageTransition):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:

Add a new IPC message to clear the editor state. Note that this only needs to propagate a single
`EditorState` ID, to ensure deterministic ordering in the case where:

1.  A remote layer tree commit containing an `EditorState` is computed (but not yet sent, since that
    happens on a background thread).

2.  Page transition completes, which now sends a message to clear out the `EditorState`.

3.  The commit in (1) is sent.

...in this case, the updated editor state in the UI process should actually be empty (none),
reflecting the chronological order in which the `EditorState` was computed in the web process.

* Source/WebKit/WebProcess/WebCoreSupport/WebLocalFrameLoaderClient.cpp:
(WebKit::WebLocalFrameLoaderClient::transitionToCommittedForNewPage):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::clearEditorStateAfterPageTransition):
* Source/WebKit/WebProcess/WebPage/WebPage.h:

Canonical link: https://commits.webkit.org/278484@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