Ensure layout/script always have a correct viewport size when a new pipeline is created.

This commit is contained in:
Josh Matthews 2019-11-06 16:13:43 -05:00
parent 2aa5ddf922
commit 91dfa354b1
10 changed files with 41 additions and 56 deletions

View file

@ -2216,6 +2216,7 @@ where
new_pipeline_id: new_pipeline_id,
replace: None,
new_browsing_context_info: None,
window_size,
});
}
@ -2360,6 +2361,7 @@ where
is_private: is_private,
is_visible: is_visible,
}),
window_size,
});
}
@ -2531,6 +2533,10 @@ where
// https://github.com/rust-lang/rust/issues/59159
let browsing_context_size = browsing_context.size;
let browsing_context_is_visible = browsing_context.is_visible;
debug_assert_eq!(
browsing_context_size,
load_info.window_size.initial_viewport
);
// Create the new pipeline, attached to the parent and push to pending changes
self.new_pipeline(
@ -2552,6 +2558,7 @@ where
replace: replace,
// Browsing context for iframe already exists.
new_browsing_context_info: None,
window_size: load_info.window_size.initial_viewport,
});
}
@ -2610,6 +2617,7 @@ where
is_private: is_private,
is_visible: is_parent_visible,
}),
window_size: load_info.window_size.initial_viewport,
});
}
@ -2698,6 +2706,7 @@ where
is_private: is_opener_private,
is_visible: is_opener_visible,
}),
window_size: self.window_size.initial_viewport,
});
}
@ -2901,6 +2910,7 @@ where
replace,
// `load_url` is always invoked on an existing browsing context.
new_browsing_context_info: None,
window_size,
});
Some(new_pipeline_id)
},
@ -3220,6 +3230,7 @@ where
replace: Some(NeedsToReload::Yes(pipeline_id, load_data)),
// Browsing context must exist at this point.
new_browsing_context_info: None,
window_size,
});
return;
},
@ -3977,7 +3988,7 @@ where
change.top_level_browsing_context_id,
change.new_pipeline_id,
new_context_info.parent_pipeline_id,
self.window_size.initial_viewport, //XXXjdm is this valid?
change.window_size,
new_context_info.is_private,
new_context_info.is_visible,
);

View file

@ -3,6 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use crate::browsingcontext::NewBrowsingContextInfo;
use euclid::Size2D;
use msg::constellation_msg::{
BrowsingContextId, HistoryStateId, PipelineId, TopLevelBrowsingContextId,
};
@ -10,6 +11,7 @@ use script_traits::LoadData;
use servo_url::ServoUrl;
use std::cmp::PartialEq;
use std::{fmt, mem};
use style_traits::CSSPixel;
/// Represents the joint session history
/// https://html.spec.whatwg.org/multipage/#joint-session-history
@ -122,6 +124,9 @@ pub struct SessionHistoryChange {
/// Holds data for not-yet constructed browsing contexts that are not
/// easily available when they need to be constructed.
pub new_browsing_context_info: Option<NewBrowsingContextInfo>,
/// The size of the viewport for the browsing context.
pub window_size: Size2D<f32, CSSPixel>,
}
/// Represents a pipeline or discarded pipeline in a history entry.