Skip to content

Commit 11edf22

Browse files
committed
keeping the currently scrolling layer
align match elements
1 parent c4a0c01 commit 11edf22

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

webrender/src/frame.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ pub struct Frame {
5353
BuildHasherDefault<FnvHasher>>,
5454
pub root_scroll_layer_id: Option<ScrollLayerId>,
5555
pending_scroll_offsets: HashMap<(PipelineId, ServoScrollRootId), LayerPoint>,
56+
current_scroll_layer_id: Option<ScrollLayerId>,
5657
id: FrameId,
5758
debug: bool,
5859
frame_builder_config: FrameBuilderConfig,
@@ -212,6 +213,7 @@ impl Frame {
212213
layers: HashMap::with_hasher(Default::default()),
213214
root_scroll_layer_id: None,
214215
pending_scroll_offsets: HashMap::new(),
216+
current_scroll_layer_id: None,
215217
id: FrameId(0),
216218
debug: debug,
217219
frame_builder: None,
@@ -340,9 +342,17 @@ impl Frame {
340342
None => return false,
341343
};
342344

343-
let scroll_layer_id = match self.get_scroll_layer(&cursor, root_scroll_layer_id) {
344-
Some(scroll_layer_id) => scroll_layer_id,
345-
None => return false,
345+
let scroll_layer_id = match (
346+
phase,
347+
self.get_scroll_layer(&cursor, root_scroll_layer_id),
348+
self.current_scroll_layer_id) {
349+
(ScrollEventPhase::Start, Some(scroll_layer_id), _) => {
350+
self.current_scroll_layer_id = Some(scroll_layer_id);
351+
scroll_layer_id
352+
},
353+
(ScrollEventPhase::Start, None, _) => return false,
354+
(_, _, Some(scroll_layer_id)) => scroll_layer_id,
355+
(_, _, None) => return false,
346356
};
347357

348358
let scroll_root_id = match scroll_layer_id.info {

0 commit comments

Comments
 (0)