mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Rework if/else into early returns
Signed-off-by: Michael Rees <mrees@noeontheend.com>
This commit is contained in:
parent
32721f61d3
commit
3d705c1d20
1 changed files with 49 additions and 48 deletions
|
@ -1521,7 +1521,8 @@ impl HTMLMediaElement {
|
||||||
self.earliest_possible_position(),
|
self.earliest_possible_position(),
|
||||||
/* approximate_for_speed*/ false,
|
/* approximate_for_speed*/ false,
|
||||||
);
|
);
|
||||||
} else {
|
return;
|
||||||
|
}
|
||||||
// Step 2.
|
// Step 2.
|
||||||
// The **ended playback** condition is implemented inside of
|
// The **ended playback** condition is implemented inside of
|
||||||
// the HTMLMediaElementMethods::Ended method
|
// the HTMLMediaElementMethods::Ended method
|
||||||
|
@ -1557,7 +1558,6 @@ impl HTMLMediaElement {
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-media-have_current_data
|
// https://html.spec.whatwg.org/multipage/#dom-media-have_current_data
|
||||||
self.change_ready_state(ReadyState::HaveCurrentData);
|
self.change_ready_state(ReadyState::HaveCurrentData);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn playback_end(&self) {
|
fn playback_end(&self) {
|
||||||
// https://html.spec.whatwg.org/multipage/#media-data-processing-steps-list
|
// https://html.spec.whatwg.org/multipage/#media-data-processing-steps-list
|
||||||
|
@ -1565,7 +1565,9 @@ impl HTMLMediaElement {
|
||||||
// an unsupported format, or can otherwise not be rendered at all"
|
// an unsupported format, or can otherwise not be rendered at all"
|
||||||
if self.ready_state.get() < ReadyState::HaveMetadata {
|
if self.ready_state.get() < ReadyState::HaveMetadata {
|
||||||
self.queue_dedicated_media_source_failure_steps();
|
self.queue_dedicated_media_source_failure_steps();
|
||||||
} else {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#reaches-the-end
|
// https://html.spec.whatwg.org/multipage/#reaches-the-end
|
||||||
match self.direction_of_playback() {
|
match self.direction_of_playback() {
|
||||||
PlaybackDirection::Forwards => self.end_of_playback_in_forwards_direction(),
|
PlaybackDirection::Forwards => self.end_of_playback_in_forwards_direction(),
|
||||||
|
@ -1580,7 +1582,6 @@ impl HTMLMediaElement {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fn playback_error(&self, error: &str, can_gc: CanGc) {
|
fn playback_error(&self, error: &str, can_gc: CanGc) {
|
||||||
error!("Player error: {:?}", error);
|
error!("Player error: {:?}", error);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue