aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/document.rs30
-rw-r--r--components/script/dom/node.rs1
-rw-r--r--components/script/layout_image.rs5
-rw-r--r--components/script/messaging.rs2
-rw-r--r--components/script/script_thread.rs28
5 files changed, 13 insertions, 53 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 852a12fc7c5..02bdd343d89 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -21,9 +21,7 @@ use base::id::WebViewId;
use canvas_traits::canvas::CanvasId;
use canvas_traits::webgl::{self, WebGLContextId, WebGLMsg};
use chrono::Local;
-use constellation_traits::{
- AnimationTickType, NavigationHistoryBehavior, ScriptToConstellationMessage,
-};
+use constellation_traits::{NavigationHistoryBehavior, ScriptToConstellationMessage};
use content_security_policy::{self as csp, CspList, PolicyDisposition};
use cookie::Cookie;
use cssparser::match_ignore_ascii_case;
@@ -516,10 +514,6 @@ pub(crate) struct Document {
pending_input_events: DomRefCell<Vec<ConstellationInputEvent>>,
/// The index of the last mouse move event in the pending compositor events queue.
mouse_move_event_index: DomRefCell<Option<usize>>,
- /// Pending animation ticks, to be handled at the next rendering opportunity.
- #[no_trace]
- #[ignore_malloc_size_of = "AnimationTickType contains data from an outside crate"]
- pending_animation_ticks: DomRefCell<AnimationTickType>,
/// <https://drafts.csswg.org/resize-observer/#dom-document-resizeobservers-slot>
///
/// Note: we are storing, but never removing, resize observers.
@@ -2397,10 +2391,6 @@ impl Document {
pub(crate) fn run_the_animation_frame_callbacks(&self, can_gc: CanGc) {
let _realm = enter_realm(self);
- self.pending_animation_ticks
- .borrow_mut()
- .remove(AnimationTickType::REQUEST_ANIMATION_FRAME);
-
self.running_animation_callbacks.set(true);
let was_faking_animation_frames = self.is_faking_animation_frames();
let timing = self.global().performance().Now();
@@ -3916,7 +3906,6 @@ impl Document {
image_animation_manager: DomRefCell::new(ImageAnimationManager::new()),
dirty_root: Default::default(),
declarative_refresh: Default::default(),
- pending_animation_ticks: Default::default(),
pending_input_events: Default::default(),
mouse_move_event_index: Default::default(),
resize_observers: Default::default(),
@@ -4689,18 +4678,6 @@ impl Document {
.collect()
}
- /// Note a pending animation tick, to be processed at the next `update_the_rendering` task.
- pub(crate) fn note_pending_animation_tick(&self, tick_type: AnimationTickType) {
- self.pending_animation_ticks.borrow_mut().extend(tick_type);
- }
-
- /// Whether this document has received an animation tick for rafs.
- pub(crate) fn has_received_raf_tick(&self) -> bool {
- self.pending_animation_ticks
- .borrow()
- .contains(AnimationTickType::REQUEST_ANIMATION_FRAME)
- }
-
pub(crate) fn advance_animation_timeline_for_testing(&self, delta: f64) {
self.animation_timeline.borrow_mut().advance_specific(delta);
let current_timeline_value = self.current_animation_timeline_value();
@@ -6437,10 +6414,7 @@ impl FakeRequestAnimationFrameCallback {
pub(crate) fn invoke(self, can_gc: CanGc) {
// TODO: Once there is a more generic mechanism to trigger `update_the_rendering` when
// not driven by the compositor, it should be used here.
- self.document
- .root()
- .note_pending_animation_tick(AnimationTickType::REQUEST_ANIMATION_FRAME);
- with_script_thread(|script_thread| script_thread.update_the_rendering(false, can_gc))
+ with_script_thread(|script_thread| script_thread.update_the_rendering(true, can_gc))
}
}
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 2a01370085a..45a107ae673 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -167,7 +167,6 @@ pub struct Node {
/// Layout data for this node. This is populated during layout and can
/// be used for incremental relayout and script queries.
- #[ignore_malloc_size_of = "trait object"]
#[no_trace]
layout_data: DomRefCell<Option<Box<GenericLayoutData>>>,
}
diff --git a/components/script/layout_image.rs b/components/script/layout_image.rs
index 7fd23804ffd..df542b4b759 100644
--- a/components/script/layout_image.rs
+++ b/components/script/layout_image.rs
@@ -119,7 +119,10 @@ pub(crate) fn fetch_image_for_layout(
)
.origin(document.origin().immutable().clone())
.destination(Destination::Image)
- .pipeline_id(Some(document.global().pipeline_id()));
+ .pipeline_id(Some(document.global().pipeline_id()))
+ .insecure_requests_policy(document.insecure_requests_policy())
+ .has_trustworthy_ancestor_origin(document.has_trustworthy_ancestor_origin())
+ .policy_container(document.policy_container().to_owned());
// Layout image loads do not delay the document load event.
document.fetch_background(request, context);
diff --git a/components/script/messaging.rs b/components/script/messaging.rs
index 808b338e709..7d0b7aabe05 100644
--- a/components/script/messaging.rs
+++ b/components/script/messaging.rs
@@ -73,7 +73,7 @@ impl MixedMessage {
ScriptThreadMessage::RemoveHistoryStates(id, ..) => Some(*id),
ScriptThreadMessage::FocusIFrame(id, ..) => Some(*id),
ScriptThreadMessage::WebDriverScriptCommand(id, ..) => Some(*id),
- ScriptThreadMessage::TickAllAnimations(id, ..) => Some(*id),
+ ScriptThreadMessage::TickAllAnimations(..) => None,
ScriptThreadMessage::WebFontLoaded(id, ..) => Some(*id),
ScriptThreadMessage::DispatchIFrameLoadEvent {
target: _,
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index c9b27bb6c56..07310073949 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -1147,14 +1147,6 @@ impl ScriptThread {
return;
}
- // Run rafs for all pipeline, if a raf tick was received for any.
- // This ensures relative ordering of rafs between parent doc and iframes.
- let should_run_rafs = self
- .documents
- .borrow()
- .iter()
- .any(|(_, doc)| doc.is_fully_active() && doc.has_received_raf_tick());
-
let any_animations_running = self.documents.borrow().iter().any(|(_, document)| {
document.is_fully_active() && document.animations().running_animation_count() != 0
});
@@ -1242,7 +1234,7 @@ impl ScriptThread {
// > 14. For each doc of docs, run the animation frame callbacks for doc, passing
// > in the relative high resolution time given frameTimestamp and doc's
// > relevant global object as the timestamp.
- if should_run_rafs {
+ if requested_by_compositor {
document.run_the_animation_frame_callbacks(can_gc);
}
@@ -1421,18 +1413,9 @@ impl ScriptThread {
self.handle_viewport(id, rect);
}),
MixedMessage::FromConstellation(ScriptThreadMessage::TickAllAnimations(
- pipeline_id,
- tick_type,
+ _webviews,
)) => {
- if let Some(document) = self.documents.borrow().find_document(pipeline_id) {
- document.note_pending_animation_tick(tick_type);
- compositor_requested_update_the_rendering = true;
- } else {
- warn!(
- "Trying to note pending animation tick for closed pipeline {}.",
- pipeline_id
- )
- }
+ compositor_requested_update_the_rendering = true;
},
MixedMessage::FromConstellation(ScriptThreadMessage::SendInputEvent(id, event)) => {
self.handle_input_event(id, event)
@@ -2439,8 +2422,6 @@ impl ScriptThread {
let mut reports = vec![];
perform_memory_report(|ops| {
- let prefix = format!("url({urls})");
- reports.extend(self.get_cx().get_reports(prefix.clone(), ops));
for (_, document) in documents.iter() {
document
.window()
@@ -2448,6 +2429,9 @@ impl ScriptThread {
.collect_reports(&mut reports, ops);
}
+ let prefix = format!("url({urls})");
+ reports.extend(self.get_cx().get_reports(prefix.clone(), ops));
+
reports.push(self.image_cache.memory_report(&prefix, ops));
});