libservo: Add a WebView::take_screenshot() API and use it for reftests

Co-authored-by: Delan Azabani <dazabani@igalia.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-09-26 09:24:24 +02:00
parent 92dd54b1ec
commit ebb12cb298
25 changed files with 481 additions and 414 deletions

View file

@ -12,6 +12,7 @@ use crossbeam_channel::Sender;
use embedder_traits::{AnimationState, EventLoopWaker, TouchEventResult};
use log::warn;
use malloc_size_of_derive::MallocSizeOf;
use rustc_hash::FxHashMap;
use smallvec::SmallVec;
use strum_macros::IntoStaticStr;
use webrender_api::{DocumentId, FontVariation};
@ -87,8 +88,6 @@ pub enum CompositorMsg {
RemoveWebView(WebViewId),
/// Script has handled a touch event, and either prevented or allowed default actions.
TouchEventProcessed(WebViewId, TouchEventResult),
/// A reply to the compositor asking if the output image is stable.
IsReadyToSaveImageReply(bool),
/// Set whether to use less resources by stopping animations.
SetThrottled(WebViewId, PipelineId, bool),
/// WebRender has produced a new frame. This message informs the compositor that
@ -100,8 +99,6 @@ pub enum CompositorMsg {
/// they have fully shut it down, to avoid recreating it due to any subsequent
/// messages.
PipelineExited(WebViewId, PipelineId, PipelineExitSource),
/// The load of a page has completed
LoadComplete(WebViewId),
/// Inform WebRender of the existence of this pipeline.
SendInitialTransaction(WebRenderPipelineId),
/// Perform a scroll operation.
@ -163,6 +160,9 @@ pub enum CompositorMsg {
CollectMemoryReport(ReportsChan),
/// A top-level frame has parsed a viewport metatag and is sending the new constraints.
Viewport(WebViewId, ViewportDescription),
/// Let the compositor know that the given WebView is ready to have a screenshot taken
/// after the given pipeline's epochs have been rendered.
ScreenshotReadinessReponse(WebViewId, FxHashMap<PipelineId, Epoch>),
}
impl Debug for CompositorMsg {