mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
script: No longer do explicit reflows for display (#34599)
These all happen now in *update the rendering*, typically after the message that triggered this code is processed, though in two cases reflow needs to be triggered explicitly. This makes `ReflowReason` redundant though perhaps `ReflowCondition` can be expanded later to give more insight into why the page is dirty. - Handling of the "reflow timer" concept has been explained a bit more via data structures and rustdoc comments. - Theme changes are cleaned up a little to simplify what happens during reflow and to avoid unecessary reflows when the theme doesn't change. Notably, layout queries and scrolling still trigger normal reflows and don't update the rendering. This needs more investigation as it's unclear to me currently whether or not they should update the rendering and simply delay event dispatch or only reflow. In general, this is a simplfication of the code. Fixes #31871. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
682eba9f74
commit
471d3572b7
9 changed files with 179 additions and 191 deletions
|
@ -328,11 +328,19 @@ pub enum QueryMsg {
|
|||
InnerWindowDimensionsQuery,
|
||||
}
|
||||
|
||||
/// Any query to perform with this reflow.
|
||||
/// The goal of a reflow request.
|
||||
///
|
||||
/// Please do not add any other types of reflows. In general, all reflow should
|
||||
/// go through the *update the rendering* step of the HTML specification. Exceptions
|
||||
/// should have careful review.
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum ReflowGoal {
|
||||
Full,
|
||||
TickAnimations,
|
||||
/// A reflow has been requesting by the *update the rendering* step of the HTML
|
||||
/// event loop. This nominally driven by the display's VSync.
|
||||
UpdateTheRendering,
|
||||
|
||||
/// Script has done a layout query and this reflow ensurs that layout is up-to-date
|
||||
/// with the latest changes to the DOM.
|
||||
LayoutQuery(QueryMsg),
|
||||
|
||||
/// Tells layout about a single new scrolling offset from the script. The rest will
|
||||
|
@ -345,7 +353,7 @@ impl ReflowGoal {
|
|||
/// be present or false if it only needs stacking-relative positions.
|
||||
pub fn needs_display_list(&self) -> bool {
|
||||
match *self {
|
||||
ReflowGoal::Full | ReflowGoal::TickAnimations | ReflowGoal::UpdateScrollNode(_) => true,
|
||||
ReflowGoal::UpdateTheRendering | ReflowGoal::UpdateScrollNode(_) => true,
|
||||
ReflowGoal::LayoutQuery(ref querymsg) => match *querymsg {
|
||||
QueryMsg::ElementInnerOuterTextQuery |
|
||||
QueryMsg::InnerWindowDimensionsQuery |
|
||||
|
@ -367,7 +375,7 @@ impl ReflowGoal {
|
|||
/// false if a layout_thread display list is sufficient.
|
||||
pub fn needs_display(&self) -> bool {
|
||||
match *self {
|
||||
ReflowGoal::Full | ReflowGoal::TickAnimations | ReflowGoal::UpdateScrollNode(_) => true,
|
||||
ReflowGoal::UpdateTheRendering | ReflowGoal::UpdateScrollNode(_) => true,
|
||||
ReflowGoal::LayoutQuery(ref querymsg) => match *querymsg {
|
||||
QueryMsg::NodesFromPointQuery |
|
||||
QueryMsg::TextIndexQuery |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue