diff --git a/components/servo/lib.rs b/components/servo/lib.rs index 896de307e13..293cd23acd1 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -208,8 +208,6 @@ pub struct Servo { /// and deinitialization of the JS Engine. Multiprocess Servo instances have their /// own instance that exists in the content process instead. _js_engine_setup: Option, - /// Whether or not any WebView in this instance is animating or WebXR is enabled. - animating: Cell, } impl Servo { @@ -324,7 +322,6 @@ impl Servo { webviews: Default::default(), servo_errors: ServoErrorChannel::default(), _js_engine_setup: js_engine_setup, - animating: Cell::new(false), } } @@ -336,15 +333,6 @@ impl Servo { *self.delegate.borrow_mut() = delegate; } - /// Whether or not any [`WebView`] of this Servo instance has animating content, such as a CSS - /// animation or transition or is running `requestAnimationFrame` callbacks. In addition, this - /// returns true if WebXR content is running. This indicates that the embedding application - /// should be spinning the Servo event loop on regular intervals in order to trigger animation - /// updates. - pub fn animating(&self) -> bool { - self.animating.get() - } - /// **EXPERIMENTAL:** Intialize GL accelerated media playback. This currently only works on a limited number /// of platforms. This should be run *before* calling [`Servo::new`] and creating the first [`WebView`]. pub fn initialize_gl_accelerated_media(display: NativeDisplay, api: GlApi, context: GlContext) { @@ -394,7 +382,6 @@ impl Servo { self.compositor.borrow_mut().perform_updates(); self.send_new_frame_ready_messages(); - self.send_animating_changed_messages(); self.handle_delegate_errors(); self.clean_up_destroyed_webview_handles(); @@ -416,19 +403,6 @@ impl Servo { } } - fn send_animating_changed_messages(&self) { - let animating = self.compositor.borrow().webxr_running() || - self.webviews - .borrow() - .values() - .filter_map(WebView::from_weak_handle) - .any(|webview| webview.animating()); - if animating != self.animating.get() { - self.animating.set(animating); - self.delegate().notify_animating_changed(animating); - } - } - fn handle_delegate_errors(&self) { while let Some(error) = self.servo_errors.try_recv() { self.delegate().notify_error(self, error); diff --git a/components/servo/tests/servo.rs b/components/servo/tests/servo.rs index 23a85e03908..e071442e470 100644 --- a/components/servo/tests/servo.rs +++ b/components/servo/tests/servo.rs @@ -15,7 +15,8 @@ mod common; use common::ServoTest; #[test] -fn test_simple_servo_is_not_animating_by_default() { +fn test_simple_start_and_stop_servo() { let servo_test = ServoTest::new(); - assert!(!servo_test.servo().animating()); + servo_test.servo().start_shutting_down(); + while servo_test.servo().spin_event_loop() {} } diff --git a/ports/servoshell/desktop/app.rs b/ports/servoshell/desktop/app.rs index cbc1607e1c3..297b9d40551 100644 --- a/ports/servoshell/desktop/app.rs +++ b/ports/servoshell/desktop/app.rs @@ -175,14 +175,6 @@ impl App { self.state = AppState::Running(running_state); } - pub(crate) fn animating(&self) -> bool { - match self.state { - AppState::Initializing => false, - AppState::Running(ref running_app_state) => running_app_state.servo().animating(), - AppState::ShuttingDown => false, - } - } - /// Handle all servo events with headless mode. Return true if the application should /// continue. pub fn handle_events_with_headless(&mut self) -> bool { diff --git a/ports/servoshell/desktop/events_loop.rs b/ports/servoshell/desktop/events_loop.rs index 1e35d8b7112..e03d95083cb 100644 --- a/ports/servoshell/desktop/events_loop.rs +++ b/ports/servoshell/desktop/events_loop.rs @@ -102,9 +102,7 @@ impl EventsLoop { if !app.handle_events_with_headless() { break; } - if !app.animating() { - *flag.lock().unwrap() = false; - } + *flag.lock().unwrap() = false; } }, } diff --git a/ports/servoshell/egl/android.rs b/ports/servoshell/egl/android.rs index d75f19c47d1..10f7f5a8ee1 100644 --- a/ports/servoshell/egl/android.rs +++ b/ports/servoshell/egl/android.rs @@ -679,19 +679,6 @@ impl HostTrait for HostCallbacks { .unwrap(); } - fn on_animating_changed(&self, animating: bool) { - debug!("on_animating_changed"); - let mut env = self.jvm.get_env().unwrap(); - let animating = JValue::Bool(animating as jboolean); - env.call_method( - self.callbacks.as_obj(), - "onAnimatingChanged", - "(Z)V", - &[animating], - ) - .unwrap(); - } - fn on_ime_show(&self, _: InputMethodControl) { let mut env = self.jvm.get_env().unwrap(); env.call_method(self.callbacks.as_obj(), "onImeShow", "()V", &[]) diff --git a/ports/servoshell/egl/app_state.rs b/ports/servoshell/egl/app_state.rs index cb60626ba04..a66704f37a5 100644 --- a/ports/servoshell/egl/app_state.rs +++ b/ports/servoshell/egl/app_state.rs @@ -443,12 +443,6 @@ impl RunningAppState { if !should_continue { self.callbacks.host_callbacks.on_shutdown_complete(); } - if self.inner().animating_state_changed.get() { - self.inner().animating_state_changed.set(false); - self.callbacks - .host_callbacks - .on_animating_changed(self.servo().animating()); - } } /// Load an URL. diff --git a/ports/servoshell/egl/host_trait.rs b/ports/servoshell/egl/host_trait.rs index d78af1229a7..192dc0ab34f 100644 --- a/ports/servoshell/egl/host_trait.rs +++ b/ports/servoshell/egl/host_trait.rs @@ -37,22 +37,6 @@ pub trait HostTrait { /// Back/forward state has changed. /// Back/forward buttons need to be disabled/enabled. fn on_history_changed(&self, can_go_back: bool, can_go_forward: bool); - /// Page animation state has changed. If animating, it's recommended - /// that the embedder doesn't wait for the wake function to be called - /// to call perform_updates. Usually, it means doing: - /// ```rust - /// while true { - /// servo.perform_updates(); - /// servo.present_if_needed(); - /// } - /// ``` - /// . This will end up calling flush - /// which will call swap_buffer which will be blocking long enough to limit - /// drawing at 60 FPS. - /// If not animating, call perform_updates only when needed (when the embedder - /// has events for Servo, or Servo has woken up the embedder event loop via - /// EventLoopWaker). - fn on_animating_changed(&self, animating: bool); /// Servo finished shutting down. fn on_shutdown_complete(&self); /// A text input is focused. diff --git a/ports/servoshell/egl/ohos.rs b/ports/servoshell/egl/ohos.rs index 0cc23e82576..61f2d7444aa 100644 --- a/ports/servoshell/egl/ohos.rs +++ b/ports/servoshell/egl/ohos.rs @@ -980,10 +980,6 @@ impl HostTrait for HostCallbacks { fn on_history_changed(&self, can_go_back: bool, can_go_forward: bool) {} - fn on_animating_changed(&self, animating: bool) { - // todo: should we tell the vsync thread that it should perform updates? - } - fn on_shutdown_complete(&self) { if let Some(terminate_fn) = TERMINATE_CALLBACK.get() { terminate_fn.call((), ThreadsafeFunctionCallMode::Blocking); diff --git a/support/android/apk/servoview/src/main/java/org/servo/servoview/JNIServo.java b/support/android/apk/servoview/src/main/java/org/servo/servoview/JNIServo.java index c5459ef1abf..a2500d380bc 100644 --- a/support/android/apk/servoview/src/main/java/org/servo/servoview/JNIServo.java +++ b/support/android/apk/servoview/src/main/java/org/servo/servoview/JNIServo.java @@ -100,8 +100,6 @@ public class JNIServo { void onAlert(String message); - void onAnimatingChanged(boolean animating); - void onLoadStarted(); void onLoadEnded(); diff --git a/support/android/apk/servoview/src/main/java/org/servo/servoview/Servo.java b/support/android/apk/servoview/src/main/java/org/servo/servoview/Servo.java index 2d75342f641..aa444f1c2c3 100644 --- a/support/android/apk/servoview/src/main/java/org/servo/servoview/Servo.java +++ b/support/android/apk/servoview/src/main/java/org/servo/servoview/Servo.java @@ -211,8 +211,6 @@ public class Servo { public interface GfxCallbacks { void flushGLBuffers(); - void animationStateChanged(boolean animating); - void makeCurrent(); } @@ -262,10 +260,6 @@ public class Servo { mRunCallback.inUIThread(() -> mClient.onImeHide()); } - public void onAnimatingChanged(boolean animating) { - mRunCallback.inGLThread(() -> mGfxCb.animationStateChanged(animating)); - } - public boolean onAllowNavigation(String url) { return mClient.onAllowNavigation(url); } diff --git a/support/android/apk/servoview/src/main/java/org/servo/servoview/ServoView.java b/support/android/apk/servoview/src/main/java/org/servo/servoview/ServoView.java index a680330185b..f7846696c04 100644 --- a/support/android/apk/servoview/src/main/java/org/servo/servoview/ServoView.java +++ b/support/android/apk/servoview/src/main/java/org/servo/servoview/ServoView.java @@ -105,10 +105,6 @@ public class ServoView extends SurfaceView } - @Override - public void animationStateChanged(boolean animating) { - } - @Override public void makeCurrent() { }