Scroll from script should trigger a reflow

Scrolling from script should flow layout and send a display list to
WebRender. This allows all of the scroll nodes to exist in WebRender
before asking it to move the node.

See https://gist.github.com/paulirish/5d52fb081b3570c81e3a.
Fixes #29659.
This commit is contained in:
Martin Robinson 2023-04-25 08:29:09 +02:00
parent 2ae158dec1
commit 3ab5e2a188
25 changed files with 161 additions and 188 deletions

View file

@ -81,10 +81,6 @@ pub enum Msg {
/// Tells layout about the new scrolling offsets of each scrollable stacking context.
SetScrollStates(Vec<ScrollState>),
/// Tells layout about a single new scrolling offset from the script. The rest will
/// remain untouched and layout won't forward this back to script.
UpdateScrollStateFromScript(ScrollState),
/// Tells layout that script has added some paint worklet modules.
RegisterPaint(Atom, Vec<Atom>, Box<dyn Painter>),
@ -125,6 +121,10 @@ pub enum ReflowGoal {
Full,
TickAnimations,
LayoutQuery(QueryMsg, u64),
/// Tells layout about a single new scrolling offset from the script. The rest will
/// remain untouched and layout won't forward this back to script.
UpdateScrollNode(ScrollState),
}
impl ReflowGoal {
@ -132,7 +132,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 => true,
ReflowGoal::Full | ReflowGoal::TickAnimations | ReflowGoal::UpdateScrollNode(_) => true,
ReflowGoal::LayoutQuery(ref querymsg, _) => match *querymsg {
QueryMsg::NodesFromPointQuery(..) |
QueryMsg::TextIndexQuery(..) |
@ -155,7 +155,7 @@ impl ReflowGoal {
/// false if a layout_thread display list is sufficient.
pub fn needs_display(&self) -> bool {
match *self {
ReflowGoal::Full | ReflowGoal::TickAnimations => true,
ReflowGoal::Full | ReflowGoal::TickAnimations | ReflowGoal::UpdateScrollNode(_) => true,
ReflowGoal::LayoutQuery(ref querymsg, _) => match *querymsg {
QueryMsg::NodesFromPointQuery(..) |
QueryMsg::TextIndexQuery(..) |