libservo: Add a WebView::take_screenshot() API and use it for reftests#39583
libservo: Add a WebView::take_screenshot() API and use it for reftests#39583mrobinson merged 1 commit intoservo:mainfrom
WebView::take_screenshot() API and use it for reftests#39583Conversation
|
🔨 Triggering try run (#18121131681) for Linux (WPT) |
| self.set_needs_repaint(RepaintReason::ReadyForScreenshot); | ||
| } | ||
| CompositorMsg::NewWebRenderFrameReady(..) => { | ||
| unreachable!("New WebRender frames should be handled in the caller."); |
There was a problem hiding this comment.
can we add a comment in handle_messages() explaining why we set these messages aside, and maybe s/the caller/handle_messages()/ here?
| let img = self | ||
| .compositor | ||
| .borrow_mut() | ||
| .render_to_shared_memory(webview_id, page_rect); |
There was a problem hiding this comment.
I wonder if we can do something similar here and completely remove render_to_shared_memory. This is also taking webview screenshot if page_rect == None.
If provided, it takes the screenshot of the rectangle.
There was a problem hiding this comment.
Yep! That's will be the next change in the series.
There was a problem hiding this comment.
Nice! render_to_shared_memory is used as for WebDriver screenshot test, and should provide test coverage for the change.
|
Test results for linux-wpt from try job (#18121131681): Flaky unexpected result (29)
Stable unexpected results that are known to be intermittent (33)
|
|
✨ Try run (#18121131681) succeeded. |
c1b2f31 to
a6d1f8a
Compare
a6d1f8a to
134a7d5
Compare
134a7d5 to
f072b4e
Compare
|
🔨 Triggering try run (#18126654002) for Android |
|
🔨 Triggering try run (#18126655985) for OpenHarmony |
|
|
|
|
This change adds a new API to the `WebView` for capturing screenshots. This makes it: - Possible to use the reftest waiting infrastructure via the API easily. - Possible to take more than a single screenshot in one Servo run. In addition, the previous infrastructure, the `wait_for_stable_image` option is removed completely. Co-authored-by: Delan Azabani <[email protected]> Signed-off-by: Martin Robinson <[email protected]>
f072b4e to
fd12589
Compare
|
🔨 Triggering try run (#18127549061) for Android, OpenHarmony |
|
✨ Try run (#18127549061) succeeded. |
…sts (#39583) (bencher) {"fail_fast": false, "matrix": [{"name": "Linux (Bencher)", "workflow": "linux", "wpt": false, "profile": "release", "unit_tests": false, "build_libservo": false, "bencher": true, "build_args": "", "wpt_args": "", "number_of_wpt_chunks": 20}, {"name": "MacOS (Bencher)", "workflow": "macos", "wpt": false, "profile": "release", "unit_tests": false, "build_libservo": false, "bencher": true, "build_args": "", "wpt_args": "", "number_of_wpt_chunks": 20}, {"name": "Windows (Bencher)", "workflow": "windows", "wpt": false, "profile": "release", "unit_tests": false, "build_libservo": false, "bencher": true, "build_args": "", "wpt_args": "", "number_of_wpt_chunks": 20}, {"name": "Android (Bencher)", "workflow": "android", "wpt": false, "profile": "release", "unit_tests": false, "build_libservo": false, "bencher": true, "build_args": "", "wpt_args": "", "number_of_wpt_chunks": 20}, {"name": "OpenHarmony (Bencher)", "workflow": "ohos", "wpt": false, "profile": "release", "unit_tests": false, "build_libservo": false, "bencher": true, "build_args": "", "wpt_args": "", "number_of_wpt_chunks": 20}]}
When processing new WebRender frames after handling messages in the compositor, only do that when we actually receive `NewWebRenderFrameReady` messages. This isn't an issue unless there are active animations. When there are, every spin of the event loop was triggering a repaint. Signed-off-by: Martin Robinson <[email protected]> Co-authored-by: Delan Azabani <[email protected]>
When processing new WebRender frames after handling messages in the compositor, only do that when we actually receive `NewWebRenderFrameReady` messages. This isn't an issue unless there are active animations. When there are, every spin of the event loop was triggering a repaint. Testing: This should fix the performance regression on the Speedometer Bencher benchmarks. Fixes: #39641 Signed-off-by: Martin Robinson <[email protected]> Co-authored-by: Delan Azabani <[email protected]>
…ts.ready` This fixes a regression (likely from servo#39583) that made the result of many font loading tests intermittent. The issues here is that the count of fonts loading is decremented synchronously in the `FontContext`, but the notification to the `ScriptThread` happens asynchronously. In between the time the decrement happens and the `ScriptThread` is notified, a rendering update could happen which could mark a screenshot as ready to take too soon. The solution here is to wait until the `fonts.ready` promise is resolved, which is guaranteed to fire after all fonts have loaded. In addition, a rendering update is queued after this happens. This means that the screenshot will wait until that final rendering update to be ready. This should remove the flakiness of font load tests. Signed-off-by: Martin Robinson <[email protected]>
…ts.ready` This fixes a regression (likely from servo#39583) that made the result of many font loading tests intermittent. The issues here is that the count of fonts loading is decremented synchronously in the `FontContext`, but the notification to the `ScriptThread` happens asynchronously. In between the time the decrement happens and the `ScriptThread` is notified, a rendering update could happen which could mark a screenshot as ready to take too soon. The solution here is to wait until the `fonts.ready` promise is resolved, which is guaranteed to fire after all fonts have loaded. In addition, a rendering update is queued after this happens. This means that the screenshot will wait until that final rendering update to be ready. This should remove the flakiness of font load tests. Signed-off-by: Martin Robinson <[email protected]>
…ts.ready` (#39963) This fixes a regression (likely from #39583) that made the result of many font loading tests intermittent. The issues here is that the count of fonts loading is decremented synchronously in the `FontContext`, but the notification to the `ScriptThread` happens asynchronously. In between the time the decrement happens and the `ScriptThread` is notified, a rendering update could happen which could mark a screenshot as ready to take too soon. The solution here is to wait until the `fonts.ready` promise is resolved, which is guaranteed to fire after all fonts have loaded. In addition, a rendering update is queued after this happens. This means that the screenshot will wait until that final rendering update to be ready. This should remove the flakiness of font load tests. Testing: This should fix many flaky tests. Fixes: #39953. Fixes: #39951. Fixes #38956. Fixes #39408. Fixes #39429. Fixes #39592. Fixes #39636. Fixes #39650. Fixes #39666. Fixes #39667. Fixes #39706. Fixes #39750. Fixes #39801. Fixes #39853. Fixes #39881. Fixes #39950. Signed-off-by: Martin Robinson <[email protected]>
This change adds a new API to the
WebViewfor capturing screenshots.This makes it possible to:
easily.
WebViewnormally priorto the moment that the screenshot is ready, instead of preventing
all non-screenshot-ready paints while taking a screenshot.
In addition, the previous infrastructure, the
wait_for_stable_imageoption is removed completely.
Testing: This change is tested by the passing of the WPT tests,
as they commonly use the screenshot feature.