From 2f8826435173d5e3f66ad06a66f0fae37776bd10 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Fri, 30 Oct 2015 15:45:48 +0100 Subject: Use if let in ScriptTask::notify_devtools. --- components/script/script_task.rs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'components/script/script_task.rs') diff --git a/components/script/script_task.rs b/components/script/script_task.rs index 30bb371667b..02046df717e 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -1656,18 +1656,15 @@ impl ScriptTask { } fn notify_devtools(&self, title: DOMString, url: Url, ids: (PipelineId, Option)) { - 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(); } } -- cgit v1.2.3 From 04dc8ed20122405839e583d9efc23e823d758726 Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Fri, 30 Oct 2015 17:04:48 -0400 Subject: Snap fragment scroll points to pixel boundaries These don't match hardware pixels, but work well enough when the device pixel ratio is a whole number. --- components/script/script_task.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'components/script/script_task.rs') diff --git a/components/script/script_task.rs b/components/script/script_task.rs index 30bb371667b..421077665a8 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -1672,12 +1672,21 @@ impl ScriptTask { } fn scroll_fragment_point(&self, pipeline_id: PipelineId, element: &Element) { - let rect = element.upcast::().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::().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(); } -- cgit v1.2.3 From d8ef3809a6c73922a5affc475f623a0f1152be28 Mon Sep 17 00:00:00 2001 From: nxnfufunezn Date: Sat, 31 Oct 2015 17:41:00 +0530 Subject: Removed JS::root Fixes #8251 --- components/script/script_task.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'components/script/script_task.rs') diff --git a/components/script/script_task.rs b/components/script/script_task.rs index fa427db6ff1..4939a58e086 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -1747,9 +1747,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::().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(); -- cgit v1.2.3 From df7fb8fa326e2b061e2da8c833cc558273db5f37 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Mon, 2 Nov 2015 14:21:11 -0800 Subject: Remove JSTraceable implementation from RefCell. The implementation wasn't really right, and we would rather just use DOMRefCell anyway. --- components/script/script_task.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'components/script/script_task.rs') diff --git a/components/script/script_task.rs b/components/script/script_task.rs index 4939a58e086..cd4a4a09308 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -414,7 +414,7 @@ pub struct ScriptTask { mouse_over_targets: DOMRefCell>>, /// List of pipelines that have been owned and closed by this script task. - closed_pipelines: RefCell>, + closed_pipelines: DOMRefCell>, scheduler_chan: Sender, timer_event_chan: Sender, @@ -643,7 +643,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, -- cgit v1.2.3