aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_task.rs
diff options
context:
space:
mode:
authorrohan.prinja <rohan.prinja@samsung.com>2015-11-03 19:01:23 +0900
committerrohan.prinja <rohan.prinja@samsung.com>2015-11-03 19:01:23 +0900
commit6e774ea6eb6d719b98f924ab5bd0629d92fb27d0 (patch)
treefa48b89bb313a2e9514124b556bbcff5ed526a0f /components/script/script_task.rs
parent7032a5d1dee9bb2ba0bee45f1fda984dadfa0609 (diff)
parent4f51710ed387baa1ad0a6e4cdb0fc5eee44093d5 (diff)
downloadservo-6e774ea6eb6d719b98f924ab5bd0629d92fb27d0.tar.gz
servo-6e774ea6eb6d719b98f924ab5bd0629d92fb27d0.zip
merge from master
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r--components/script/script_task.rs43
1 files changed, 24 insertions, 19 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index 7efed232426..7a3ddd43837 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -415,7 +415,7 @@ pub struct ScriptTask {
mouse_over_targets: DOMRefCell<Vec<JS<Element>>>,
/// List of pipelines that have been owned and closed by this script task.
- closed_pipelines: RefCell<HashSet<PipelineId>>,
+ closed_pipelines: DOMRefCell<HashSet<PipelineId>>,
scheduler_chan: Sender<TimerEventRequest>,
timer_event_chan: Sender<TimerEvent>,
@@ -644,7 +644,7 @@ impl ScriptTask {
js_runtime: Rc::new(runtime),
mouse_over_targets: DOMRefCell::new(vec!()),
- closed_pipelines: RefCell::new(HashSet::new()),
+ closed_pipelines: DOMRefCell::new(HashSet::new()),
scheduler_chan: state.scheduler_chan,
timer_event_chan: timer_event_chan,
@@ -1657,28 +1657,34 @@ impl ScriptTask {
}
fn notify_devtools(&self, title: DOMString, url: Url, ids: (PipelineId, Option<WorkerId>)) {
- match self.devtools_chan {
- None => {}
- Some(ref chan) => {
- let page_info = DevtoolsPageInfo {
- title: title,
- url: url,
- };
- chan.send(ScriptToDevtoolsControlMsg::NewGlobal(
- ids,
- self.devtools_sender.clone(),
- page_info)).unwrap();
- }
+ if let Some(ref chan) = self.devtools_chan {
+ let page_info = DevtoolsPageInfo {
+ title: title,
+ url: url,
+ };
+ chan.send(ScriptToDevtoolsControlMsg::NewGlobal(
+ ids,
+ self.devtools_sender.clone(),
+ page_info)).unwrap();
}
}
fn scroll_fragment_point(&self, pipeline_id: PipelineId, element: &Element) {
- let rect = element.upcast::<Node>().get_bounding_content_box();
- let point = Point2D::new(rect.origin.x.to_f32_px(), rect.origin.y.to_f32_px());
- // FIXME(#2003, pcwalton): This is pretty bogus when multiple layers are involved.
+ // FIXME(#8275, 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
// compositor.
+ let rect = element.upcast::<Node>().get_bounding_content_box();
+
+ // In order to align with element edges, we snap to unscaled pixel boundaries, since the
+ // paint task currently does the same for drawing elements. This is important for pages
+ // that require pixel perfect scroll positioning for proper display (like Acid2). Since we
+ // don't have the device pixel ratio here, this might not be accurate, but should work as
+ // long as the ratio is a whole number. Once #8275 is fixed this should actually take into
+ // account the real device pixel ratio.
+ let point = Point2D::new(rect.origin.x.to_nearest_px() as f32,
+ rect.origin.y.to_nearest_px() as f32);
+
self.compositor.borrow_mut().send(ScriptToCompositorMsg::ScrollFragmentPoint(
pipeline_id, LayerId::null(), point, false)).unwrap();
}
@@ -1742,9 +1748,8 @@ impl ScriptTask {
// Notify Constellation about the topmost anchor mouse over target.
for target in &*mouse_over_targets {
- let target = target.root();
if target.upcast::<Node>().is_anchor_element() {
- let status = target.r().get_attribute(&ns!(""), &atom!("href"))
+ let status = target.get_attribute(&ns!(""), &atom!("href"))
.and_then(|href| {
let value = href.value();
let url = document.r().url();