mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
dom: Unindent Document::set_activity.
This commit is contained in:
parent
47e39af0f3
commit
aa7a52c05e
1 changed files with 62 additions and 55 deletions
|
@ -506,23 +506,36 @@ impl Document {
|
||||||
pub fn set_activity(&self, activity: DocumentActivity) {
|
pub fn set_activity(&self, activity: DocumentActivity) {
|
||||||
// This function should only be called on documents with a browsing context
|
// This function should only be called on documents with a browsing context
|
||||||
assert!(self.has_browsing_context);
|
assert!(self.has_browsing_context);
|
||||||
|
if activity == self.activity.get() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Set the document's activity level, reflow if necessary, and suspend or resume timers.
|
// Set the document's activity level, reflow if necessary, and suspend or resume timers.
|
||||||
if activity != self.activity.get() {
|
|
||||||
self.activity.set(activity);
|
self.activity.set(activity);
|
||||||
let media = ServoMedia::get().unwrap();
|
let media = ServoMedia::get().unwrap();
|
||||||
let pipeline_id = self.window().pipeline_id().expect("doc with no pipeline");
|
let pipeline_id = self.window().pipeline_id().expect("doc with no pipeline");
|
||||||
let client_context_id =
|
let client_context_id =
|
||||||
ClientContextId::build(pipeline_id.namespace_id.0, pipeline_id.index.0.get());
|
ClientContextId::build(pipeline_id.namespace_id.0, pipeline_id.index.0.get());
|
||||||
if activity == DocumentActivity::FullyActive {
|
|
||||||
|
if activity != DocumentActivity::FullyActive {
|
||||||
|
self.window().suspend();
|
||||||
|
media.suspend(&client_context_id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
self.title_changed();
|
self.title_changed();
|
||||||
self.dirty_all_nodes();
|
self.dirty_all_nodes();
|
||||||
self.window()
|
self.window()
|
||||||
.reflow(ReflowGoal::Full, ReflowReason::CachedPageNeededReflow);
|
.reflow(ReflowGoal::Full, ReflowReason::CachedPageNeededReflow);
|
||||||
self.window().resume();
|
self.window().resume();
|
||||||
media.resume(&client_context_id);
|
media.resume(&client_context_id);
|
||||||
|
|
||||||
|
if self.ready_state.get() != DocumentReadyState::Complete {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// html.spec.whatwg.org/multipage/#history-traversal
|
// html.spec.whatwg.org/multipage/#history-traversal
|
||||||
// Step 4.6
|
// Step 4.6
|
||||||
if self.ready_state.get() == DocumentReadyState::Complete {
|
|
||||||
let document = Trusted::new(self);
|
let document = Trusted::new(self);
|
||||||
self.window
|
self.window
|
||||||
.task_manager()
|
.task_manager()
|
||||||
|
@ -557,12 +570,6 @@ impl Document {
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
self.window().suspend();
|
|
||||||
media.suspend(&client_context_id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn origin(&self) -> &MutableOrigin {
|
pub fn origin(&self) -> &MutableOrigin {
|
||||||
&self.origin
|
&self.origin
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue