aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_task.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r--components/script/script_task.rs26
1 files changed, 18 insertions, 8 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index 5e776d4db0f..b7fc3198511 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -70,7 +70,6 @@ use net_traits::LoadData as NetLoadData;
use net_traits::image_cache_task::{ImageCacheChan, ImageCacheTask, ImageCacheResult};
use net_traits::storage_task::StorageTask;
use string_cache::Atom;
-use util::geometry::to_frac_px;
use util::str::DOMString;
use util::task::{spawn_named, spawn_named_with_send_on_failure};
use util::task_state;
@@ -85,7 +84,6 @@ use js::rust::{Runtime, RtUtils};
use url::Url;
use libc;
-use num::ToPrimitive;
use std::any::Any;
use std::borrow::ToOwned;
use std::cell::{Cell, RefCell};
@@ -726,9 +724,10 @@ impl ScriptTask {
self.handle_update_subpage_id(containing_pipeline_id, old_subpage_id, new_subpage_id),
ConstellationControlMsg::FocusIFrame(containing_pipeline_id, subpage_id) =>
self.handle_focus_iframe_msg(containing_pipeline_id, subpage_id),
- ConstellationControlMsg::WebDriverCommand(pipeline_id, msg) => {
- self.handle_webdriver_msg(pipeline_id, msg);
- }
+ ConstellationControlMsg::WebDriverCommand(pipeline_id, msg) =>
+ self.handle_webdriver_msg(pipeline_id, msg),
+ ConstellationControlMsg::TickAllAnimations(pipeline_id) =>
+ self.handle_tick_all_animations(pipeline_id),
}
}
@@ -778,6 +777,8 @@ impl ScriptTask {
devtools::handle_set_timeline_markers(&page, self, marker_types, reply),
DevtoolScriptControlMsg::DropTimelineMarkers(_pipeline_id, marker_types) =>
devtools::handle_drop_timeline_markers(&page, self, marker_types),
+ DevtoolScriptControlMsg::RequestAnimationFrame(pipeline_id, callback) =>
+ devtools::handle_request_animation_frame(&page, pipeline_id, callback),
}
}
@@ -789,7 +790,9 @@ impl ScriptTask {
let page = self.root_page();
match msg {
WebDriverScriptCommand::EvaluateJS(script, reply) =>
- webdriver_handlers::handle_evaluate_js(&page, pipeline_id, script, reply)
+ webdriver_handlers::handle_evaluate_js(&page, pipeline_id, script, reply),
+ WebDriverScriptCommand::GetTitle(reply) =>
+ webdriver_handlers::handle_get_title(&page, pipeline_id, reply)
}
}
@@ -1018,6 +1021,13 @@ impl ScriptTask {
return false;
}
+ /// Handles when layout task finishes all animation in one tick
+ fn handle_tick_all_animations(&self, id: PipelineId) {
+ let page = get_page(&self.root_page(), id);
+ let document = page.document().root();
+ document.r().invoke_animation_callbacks();
+ }
+
/// The entry point to document loading. Defines bindings, sets up the window and document
/// objects, parses HTML and CSS, and kicks off initial layout.
fn load(&self, response: LoadResponse, incomplete: InProgressLoad) {
@@ -1182,8 +1192,7 @@ impl ScriptTask {
fn scroll_fragment_point(&self, pipeline_id: PipelineId, node: JSRef<Element>) {
let node: JSRef<Node> = NodeCast::from_ref(node);
let rect = node.get_bounding_content_box();
- let point = Point2D(to_frac_px(rect.origin.x).to_f32().unwrap(),
- to_frac_px(rect.origin.y).to_f32().unwrap());
+ let point = Point2D(rect.origin.x.to_f32_px(), rect.origin.y.to_f32_px());
// FIXME(#2003, pcwalton): This is pretty bogus when multiple layers are involved.
// Really what needs to happen is that this needs to go through layout to ask which
// layer the element belongs to, and have it send the scroll message to the
@@ -1358,6 +1367,7 @@ impl ScriptTask {
preserved_headers: load_data.headers,
data: load_data.data,
cors: None,
+ pipeline_id: Some(id),
}, LoadConsumer::Channel(input_chan))).unwrap();
let load_response = input_port.recv().unwrap();