mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
script: Get scroll offsets from layout (#37509)
No longer store scroll offsets for elements in the DOM. Instead consistently get and set these in layout's `ScrollTree`. This more consistently requires layout to run when querying scroll offsets, which ensures that they are up-to-date and properly bounded by scrollable overflow area. Testing: This causes several WPT tests to start passing, and one to start failing. In the case of `/shadow-dom/scroll-to-the-fragment-in-shadow-tree.html`, I believe the issue is that we don't properly handle scrolling and shadow DOM elements. Before, the faulty scrolling was hiding this issue. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
518729a4f5
commit
3774ef00d4
14 changed files with 116 additions and 117 deletions
|
@ -9,6 +9,7 @@ use dom_struct::dom_struct;
|
|||
use embedder_traits::CompositorHitTestResult;
|
||||
use euclid::default::Point2D;
|
||||
use js::rust::HandleObject;
|
||||
use script_bindings::codegen::GenericBindings::WindowBinding::WindowMethods;
|
||||
use servo_config::pref;
|
||||
|
||||
use crate::dom::bindings::codegen::Bindings::EventBinding::Event_Binding::EventMethods;
|
||||
|
@ -373,9 +374,7 @@ impl MouseEventMethods<crate::DomTypeHolder> for MouseEvent {
|
|||
if self.upcast::<Event>().dispatching() {
|
||||
self.page_x.get()
|
||||
} else {
|
||||
let global = self.global();
|
||||
let window = global.as_window();
|
||||
window.current_viewport().origin.x.to_px() + self.client_x.get()
|
||||
self.global().as_window().ScrollX() + self.client_x.get()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -384,9 +383,7 @@ impl MouseEventMethods<crate::DomTypeHolder> for MouseEvent {
|
|||
if self.upcast::<Event>().dispatching() {
|
||||
self.page_y.get()
|
||||
} else {
|
||||
let global = self.global();
|
||||
let window = global.as_window();
|
||||
window.current_viewport().origin.y.to_px() + self.client_y.get()
|
||||
self.global().as_window().ScrollY() + self.client_y.get()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue