mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
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:
parent
2ae158dec1
commit
3ab5e2a188
25 changed files with 161 additions and 188 deletions
|
@ -645,9 +645,6 @@ impl LayoutThread {
|
|||
Msg::CreateLayoutThread(..) => LayoutHangAnnotation::CreateLayoutThread,
|
||||
Msg::SetFinalUrl(..) => LayoutHangAnnotation::SetFinalUrl,
|
||||
Msg::SetScrollStates(..) => LayoutHangAnnotation::SetScrollStates,
|
||||
Msg::UpdateScrollStateFromScript(..) => {
|
||||
LayoutHangAnnotation::UpdateScrollStateFromScript
|
||||
},
|
||||
Msg::RegisterPaint(..) => LayoutHangAnnotation::RegisterPaint,
|
||||
Msg::SetNavigationStart(..) => LayoutHangAnnotation::SetNavigationStart,
|
||||
};
|
||||
|
@ -753,19 +750,6 @@ impl LayoutThread {
|
|||
Msg::SetScrollStates(new_scroll_states) => {
|
||||
self.set_scroll_states(new_scroll_states, possibly_locked_rw_data);
|
||||
},
|
||||
Msg::UpdateScrollStateFromScript(state) => {
|
||||
let mut rw_data = possibly_locked_rw_data.lock();
|
||||
rw_data
|
||||
.scroll_offsets
|
||||
.insert(state.scroll_id, state.scroll_offset);
|
||||
|
||||
let point = Point2D::new(-state.scroll_offset.x, -state.scroll_offset.y);
|
||||
self.webrender_api.send_scroll_node(
|
||||
webrender_api::units::LayoutPoint::from_untyped(point),
|
||||
state.scroll_id,
|
||||
webrender_api::ScrollClamping::ToContentBounds,
|
||||
);
|
||||
},
|
||||
Msg::CollectReports(reports_chan) => {
|
||||
self.collect_reports(reports_chan, possibly_locked_rw_data);
|
||||
},
|
||||
|
@ -1250,7 +1234,9 @@ impl LayoutThread {
|
|||
rw_data.inner_window_dimensions_response = None;
|
||||
},
|
||||
},
|
||||
ReflowGoal::Full | ReflowGoal::TickAnimations => {},
|
||||
ReflowGoal::Full |
|
||||
ReflowGoal::TickAnimations |
|
||||
ReflowGoal::UpdateScrollNode(_) => {},
|
||||
}
|
||||
return;
|
||||
},
|
||||
|
@ -1619,10 +1605,26 @@ impl LayoutThread {
|
|||
.cloned();
|
||||
},
|
||||
},
|
||||
ReflowGoal::UpdateScrollNode(scroll_state) => {
|
||||
self.update_scroll_node_state(&scroll_state, rw_data);
|
||||
},
|
||||
ReflowGoal::Full | ReflowGoal::TickAnimations => {},
|
||||
}
|
||||
}
|
||||
|
||||
fn update_scroll_node_state(&self, state: &ScrollState, rw_data: &mut LayoutThreadData) {
|
||||
rw_data
|
||||
.scroll_offsets
|
||||
.insert(state.scroll_id, state.scroll_offset);
|
||||
|
||||
let point = Point2D::new(-state.scroll_offset.x, -state.scroll_offset.y);
|
||||
self.webrender_api.send_scroll_node(
|
||||
webrender_api::units::LayoutPoint::from_untyped(point),
|
||||
state.scroll_id,
|
||||
webrender_api::ScrollClamping::ToContentBounds,
|
||||
);
|
||||
}
|
||||
|
||||
fn set_scroll_states<'a, 'b>(
|
||||
&mut self,
|
||||
new_scroll_states: Vec<ScrollState>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue