mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Combined DOMManipulationTask runnable variants into a single variant
This commit is contained in:
parent
68fb9ebc41
commit
d6f4dc06df
7 changed files with 22 additions and 36 deletions
|
@ -5,7 +5,7 @@
|
|||
use dom::bindings::refcounted::Trusted;
|
||||
use dom::event::{EventBubbles, EventCancelable};
|
||||
use dom::eventtarget::EventTarget;
|
||||
use script_thread::{MainThreadRunnable, MainThreadScriptMsg, Runnable, ScriptThread};
|
||||
use script_thread::{MainThreadScriptMsg, Runnable, ScriptThread};
|
||||
use std::result::Result;
|
||||
use std::sync::mpsc::Sender;
|
||||
use string_cache::Atom;
|
||||
|
@ -39,21 +39,12 @@ impl DOMManipulationTaskSource {
|
|||
}
|
||||
|
||||
pub enum DOMManipulationTask {
|
||||
// https://html.spec.whatwg.org/multipage/#the-end step 7
|
||||
DocumentProgress(Box<Runnable + Send>),
|
||||
// https://dom.spec.whatwg.org/#concept-event-fire
|
||||
FireEvent(Trusted<EventTarget>, Atom, EventBubbles, EventCancelable),
|
||||
// https://html.spec.whatwg.org/multipage/#fire-a-simple-event
|
||||
FireSimpleEvent(Trusted<EventTarget>, Atom),
|
||||
// https://html.spec.whatwg.org/multipage/#details-notification-task-steps
|
||||
FireToggleEvent(Box<Runnable + Send>),
|
||||
// Placeholder until there's a real media element task queue implementation
|
||||
MediaTask(Box<Runnable + Send>),
|
||||
// https://html.spec.whatwg.org/multipage/#planned-navigation
|
||||
PlannedNavigation(Box<Runnable + Send>),
|
||||
// https://html.spec.whatwg.org/multipage/#send-a-storage-notification
|
||||
SendStorageNotification(Box<MainThreadRunnable + Send>),
|
||||
Miscellaneous(Box<Runnable + Send>),
|
||||
|
||||
Runnable(Box<Runnable + Send>),
|
||||
}
|
||||
|
||||
impl DOMManipulationTask {
|
||||
|
@ -61,7 +52,6 @@ impl DOMManipulationTask {
|
|||
use self::DOMManipulationTask::*;
|
||||
|
||||
match self {
|
||||
DocumentProgress(runnable) => runnable.handler(),
|
||||
FireEvent(element, name, bubbles, cancelable) => {
|
||||
let target = element.root();
|
||||
target.fire_event(&*name, bubbles, cancelable);
|
||||
|
@ -70,11 +60,11 @@ impl DOMManipulationTask {
|
|||
let target = element.root();
|
||||
target.fire_simple_event(&*name);
|
||||
}
|
||||
FireToggleEvent(runnable) => runnable.handler(),
|
||||
MediaTask(runnable) => runnable.handler(),
|
||||
PlannedNavigation(runnable) => runnable.handler(),
|
||||
SendStorageNotification(runnable) => runnable.handler(script_thread),
|
||||
Miscellaneous(runnable) => runnable.handler(),
|
||||
Runnable(runnable) => {
|
||||
if !runnable.is_cancelled() {
|
||||
runnable.main_thread_handler(script_thread);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue