mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
script: Expose NodeTraits::owner_global
/ Window::as_global_scope
(#34843)
Expose two new helpers and start using them as much as possible. - `NodeTraits::owner_global`: which gets the `GlobalScope` that currenty owns a `Node`. This may be different than `.global()` in the case that the `Node` was adopted by a different `Document`. - `Window::as_global_scope`: A helper to avoid having to cast so much when treating a `Window` like a `GlobalScope`. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
17e2ca3f01
commit
e42b4b793d
33 changed files with 262 additions and 258 deletions
|
@ -286,7 +286,7 @@ impl HTMLInputElement {
|
|||
) -> HTMLInputElement {
|
||||
let chan = document
|
||||
.window()
|
||||
.upcast::<GlobalScope>()
|
||||
.as_global_scope()
|
||||
.script_to_constellation_chan()
|
||||
.clone();
|
||||
HTMLInputElement {
|
||||
|
@ -1843,7 +1843,7 @@ impl HTMLInputElement {
|
|||
fn select_files(&self, opt_test_paths: Option<Vec<DOMString>>, can_gc: CanGc) {
|
||||
let window = self.owner_window();
|
||||
let origin = get_blob_origin(&window.get_url());
|
||||
let resource_threads = window.upcast::<GlobalScope>().resource_threads();
|
||||
let resource_threads = window.as_global_scope().resource_threads();
|
||||
|
||||
let mut files: Vec<DomRoot<File>> = vec![];
|
||||
let mut error = None;
|
||||
|
@ -2576,7 +2576,7 @@ impl VirtualMethods for HTMLInputElement {
|
|||
self.input_type().is_textual_or_password()
|
||||
{
|
||||
if event.IsTrusted() {
|
||||
self.owner_window()
|
||||
self.owner_global()
|
||||
.task_manager()
|
||||
.user_interaction_task_source()
|
||||
.queue_event(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue