mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
add methods to ensure frame state stays consistent
This commit is contained in:
parent
f010fb58fd
commit
eedff27ea9
2 changed files with 18 additions and 4 deletions
|
@ -76,6 +76,13 @@ impl Frame {
|
|||
pub fn remove_forward_entries(&mut self) -> Vec<FrameState> {
|
||||
replace(&mut self.next, vec!())
|
||||
}
|
||||
|
||||
/// Update the current entry of the Frame from an entry that has been traversed to.
|
||||
pub fn update_current(&mut self, pipeline_id: PipelineId, entry: &FrameState) {
|
||||
self.pipeline_id = pipeline_id;
|
||||
self.instant = entry.instant;
|
||||
self.url = entry.url.clone();
|
||||
}
|
||||
}
|
||||
|
||||
/// An entry in a frame's session history.
|
||||
|
@ -99,6 +106,15 @@ pub struct FrameState {
|
|||
pub frame_id: FrameId,
|
||||
}
|
||||
|
||||
impl FrameState {
|
||||
/// Updates the entry's pipeline and url. This is used when navigating with replacement
|
||||
/// enabled.
|
||||
pub fn replace_pipeline(&mut self, pipeline_id: PipelineId, url: ServoUrl) {
|
||||
self.pipeline_id = Some(pipeline_id);
|
||||
self.url = url;
|
||||
}
|
||||
}
|
||||
|
||||
/// Represents a pending change in the frame tree, that will be applied
|
||||
/// once the new pipeline has loaded and completed initial layout / paint.
|
||||
pub struct FrameChange {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue