aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/window.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r--components/script/dom/window.rs23
1 files changed, 14 insertions, 9 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 993749b00c2..4317d2890b7 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -76,7 +76,7 @@ use script_layout_interface::rpc::{MarginStyleResponse, NodeScrollRootIdResponse
use script_layout_interface::rpc::{ResolvedStyleResponse, TextIndexResponse};
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, ScriptThreadEventCategory};
use script_thread::{MainThreadScriptChan, MainThreadScriptMsg, Runnable, RunnableWrapper};
-use script_thread::{SendableMainThreadScriptChan, ImageCacheMsg};
+use script_thread::{SendableMainThreadScriptChan, ImageCacheMsg, ScriptThread};
use script_traits::{ConstellationControlMsg, LoadData, MozBrowserEvent, UntrustedNodeAddress};
use script_traits::{DocumentState, TimerEvent, TimerEventId};
use script_traits::{ScriptMsg as ConstellationMsg, TimerSchedulerMsg, WindowSizeData, WindowSizeType};
@@ -1150,6 +1150,7 @@ impl Window {
/// off-main-thread layout.
///
/// Returns true if layout actually happened, false otherwise.
+ #[allow(unsafe_code)]
pub fn force_reflow(&self,
goal: ReflowGoal,
query_type: ReflowQueryType,
@@ -1213,16 +1214,16 @@ impl Window {
debug!("script: layout forked");
- match join_port.try_recv() {
+ let complete = match join_port.try_recv() {
Err(Empty) => {
info!("script: waiting on layout");
- join_port.recv().unwrap();
+ join_port.recv().unwrap()
}
- Ok(_) => {}
+ Ok(reflow_complete) => reflow_complete,
Err(Disconnected) => {
panic!("Layout thread failed while script was waiting for a result.");
}
- }
+ };
debug!("script: layout joined");
@@ -1236,12 +1237,11 @@ impl Window {
self.emit_timeline_marker(marker.end());
}
- let pending_images = self.layout_rpc.pending_images();
- for image in pending_images {
+ for image in complete.pending_images {
let id = image.id;
let js_runtime = self.js_runtime.borrow();
let js_runtime = js_runtime.as_ref().unwrap();
- let node = from_untrusted_node_address(js_runtime.rt(), image.node);
+ let node = unsafe { from_untrusted_node_address(js_runtime.rt(), image.node) };
if let PendingImageState::Unrequested(ref url) = image.state {
fetch_image_for_layout(url.clone(), &*node, id, self.image_cache.clone());
@@ -1261,6 +1261,10 @@ impl Window {
}
}
+ unsafe {
+ ScriptThread::note_newly_transitioning_nodes(complete.newly_transitioning_nodes);
+ }
+
true
}
@@ -1455,6 +1459,7 @@ impl Window {
DOMString::from(resolved)
}
+ #[allow(unsafe_code)]
pub fn offset_parent_query(&self, node: TrustedNodeAddress) -> (Option<Root<Element>>, Rect<Au>) {
if !self.reflow(ReflowGoal::ForScriptQuery,
ReflowQueryType::OffsetParentQuery(node),
@@ -1466,7 +1471,7 @@ impl Window {
let js_runtime = self.js_runtime.borrow();
let js_runtime = js_runtime.as_ref().unwrap();
let element = response.node_address.and_then(|parent_node_address| {
- let node = from_untrusted_node_address(js_runtime.rt(), parent_node_address);
+ let node = unsafe { from_untrusted_node_address(js_runtime.rt(), parent_node_address) };
Root::downcast(node)
});
(element, response.rect)