diff options
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r-- | components/script/script_thread.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 118b4b4f653..dd0f798fcec 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -821,6 +821,23 @@ impl ScriptThreadFactory for ScriptThread { } impl ScriptThread { + pub(crate) fn get_any_layout_chan() -> Option<Sender<Msg>> { + SCRIPT_THREAD_ROOT.with(|root| { + let script_thread = match root.get() { + Some(s) => unsafe { &*s }, + None => return None, + }; + script_thread + .documents + .borrow() + .map + .values() + .next() + .map(|d| d.window().layout_chan()) + .cloned() + }) + } + pub fn runtime_handle() -> ParentRuntime { SCRIPT_THREAD_ROOT.with(|root| { let script_thread = unsafe { &*root.get().unwrap() }; |