mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #11398 - pcwalton:webrender-viewport, r=glennw
script: Keep the DOM-side viewport up to date when scrolling happens in WebRender. This happens asynchronously, just as it does in non-WebRender mode. This functionality is a prerequisite for doing proper display-list-based hit testing in WebRender, since it moves the scroll offsets into Servo (and, specifically, into the script thread, enabling iframe event forwarding) instead of keeping them private to WebRender. Requires servo/webrender_traits#55 and servo/webrender#277. Partially addresses #11108. r? @glennw <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11398) <!-- Reviewable:end -->
This commit is contained in:
commit
27d1f18271
34 changed files with 336 additions and 112 deletions
|
@ -995,13 +995,18 @@ impl Window {
|
|||
};
|
||||
|
||||
// TODO (farodin91): Raise an event to stop the current_viewport
|
||||
let size = self.current_viewport.get().size;
|
||||
self.current_viewport.set(Rect::new(Point2D::new(Au::from_f32_px(x), Au::from_f32_px(y)), size));
|
||||
self.update_viewport_for_scroll(x, y);
|
||||
|
||||
let message = ConstellationMsg::ScrollFragmentPoint(self.pipeline(), layer_id, point, smooth);
|
||||
self.constellation_chan.send(message).unwrap();
|
||||
}
|
||||
|
||||
pub fn update_viewport_for_scroll(&self, x: f32, y: f32) {
|
||||
let size = self.current_viewport.get().size;
|
||||
let new_viewport = Rect::new(Point2D::new(Au::from_f32_px(x), Au::from_f32_px(y)), size);
|
||||
self.current_viewport.set(new_viewport)
|
||||
}
|
||||
|
||||
pub fn client_window(&self) -> (Size2D<u32>, Point2D<i32>) {
|
||||
let (send, recv) = ipc::channel::<(Size2D<u32>, Point2D<i32>)>().unwrap();
|
||||
self.constellation_chan.send(ConstellationMsg::GetClientWindow(send)).unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue