aboutsummaryrefslogtreecommitdiffstats
path: root/ports/servoshell/egl/ohos/simpleservo.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2025-04-16 18:58:52 +0200
committerGitHub <noreply@github.com>2025-04-16 16:58:52 +0000
commitd8a7abda69dc2e03a845cb053c28764babd5b9de (patch)
treebb15a30aa8729eda1feaeec4ea9a9d7294020be7 /ports/servoshell/egl/ohos/simpleservo.rs
parent7a8e75266ff2c138f212a301de9774eafb2b3143 (diff)
downloadservo-d8a7abda69dc2e03a845cb053c28764babd5b9de.tar.gz
servo-d8a7abda69dc2e03a845cb053c28764babd5b9de.zip
libservo: Expose a `ServoBuilder` (#36549)
Expose a `ServoBuilder` for easily creating Servo instances using default values. This change enables removing `EmbedderTraits`. Testing: This is covered by `Servo` unit tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'ports/servoshell/egl/ohos/simpleservo.rs')
-rw-r--r--ports/servoshell/egl/ohos/simpleservo.rs28
1 files changed, 7 insertions, 21 deletions
diff --git a/ports/servoshell/egl/ohos/simpleservo.rs b/ports/servoshell/egl/ohos/simpleservo.rs
index 3bb1191f3f6..9815c0fe4fd 100644
--- a/ports/servoshell/egl/ohos/simpleservo.rs
+++ b/ports/servoshell/egl/ohos/simpleservo.rs
@@ -14,16 +14,10 @@ use raw_window_handle::{
DisplayHandle, OhosDisplayHandle, OhosNdkWindowHandle, RawDisplayHandle, RawWindowHandle,
WindowHandle,
};
-/// The EventLoopWaker::wake function will be called from any thread.
-/// It will be called to notify embedder that some events are available,
-/// and that perform_updates need to be called
-pub use servo::EventLoopWaker;
-use servo::{self, Servo, WindowRenderingContext, resources};
+use servo::{self, EventLoopWaker, ServoBuilder, WindowRenderingContext, resources};
use xcomponent_sys::OH_NativeXComponent;
-use crate::egl::app_state::{
- Coordinates, RunningAppState, ServoEmbedderCallbacks, ServoWindowCallbacks,
-};
+use crate::egl::app_state::{Coordinates, RunningAppState, ServoWindowCallbacks};
use crate::egl::host_trait::HostTrait;
use crate::egl::ohos::InitOpts;
use crate::egl::ohos::resources::ResourceReaderInstance;
@@ -128,19 +122,11 @@ pub fn init(
RefCell::new(coordinates),
));
- let embedder_callbacks = Box::new(ServoEmbedderCallbacks::new(
- waker,
- #[cfg(feature = "webxr")]
- None,
- ));
-
- let servo = Servo::new(
- opts,
- preferences,
- rendering_context.clone(),
- embedder_callbacks,
- Default::default(),
- );
+ let servo = ServoBuilder::new(rendering_context.clone())
+ .opts(opts)
+ .preferences(preferences)
+ .event_loop_waker(waker)
+ .build();
let app_state = RunningAppState::new(
Some(options.url),