mirror of
https://github.com/servo/servo.git
synced 2025-06-28 02:53:48 +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
|
@ -251,6 +251,10 @@ pub trait Layout {
|
|||
scroll_states: &HashMap<ExternalScrollId, LayoutVector2D>,
|
||||
);
|
||||
|
||||
/// Get the scroll offset of the given scroll node with id of [`ExternalScrollId`] or `None` if it does
|
||||
/// not exist in the tree.
|
||||
fn scroll_offset(&self, id: ExternalScrollId) -> Option<LayoutVector2D>;
|
||||
|
||||
fn query_content_box(&self, node: TrustedNodeAddress) -> Option<Rect<Au>>;
|
||||
fn query_content_boxes(&self, node: TrustedNodeAddress) -> Vec<Rect<Au>>;
|
||||
fn query_client_rect(&self, node: TrustedNodeAddress) -> Rect<i32>;
|
||||
|
@ -309,7 +313,7 @@ pub enum QueryMsg {
|
|||
ContentBox,
|
||||
ContentBoxes,
|
||||
ClientRectQuery,
|
||||
ScrollingAreaQuery,
|
||||
ScrollingAreaOrOffsetQuery,
|
||||
OffsetParentQuery,
|
||||
TextIndexQuery,
|
||||
NodesFromPointQuery,
|
||||
|
@ -351,13 +355,13 @@ impl ReflowGoal {
|
|||
QueryMsg::InnerWindowDimensionsQuery |
|
||||
QueryMsg::NodesFromPointQuery |
|
||||
QueryMsg::ResolvedStyleQuery |
|
||||
QueryMsg::ScrollingAreaOrOffsetQuery |
|
||||
QueryMsg::TextIndexQuery => true,
|
||||
QueryMsg::ClientRectQuery |
|
||||
QueryMsg::ContentBox |
|
||||
QueryMsg::ContentBoxes |
|
||||
QueryMsg::OffsetParentQuery |
|
||||
QueryMsg::ResolvedFontStyleQuery |
|
||||
QueryMsg::ScrollingAreaQuery |
|
||||
QueryMsg::StyleQuery => false,
|
||||
},
|
||||
}
|
||||
|
@ -375,7 +379,7 @@ impl ReflowGoal {
|
|||
QueryMsg::ContentBox |
|
||||
QueryMsg::ContentBoxes |
|
||||
QueryMsg::ClientRectQuery |
|
||||
QueryMsg::ScrollingAreaQuery |
|
||||
QueryMsg::ScrollingAreaOrOffsetQuery |
|
||||
QueryMsg::ResolvedStyleQuery |
|
||||
QueryMsg::ResolvedFontStyleQuery |
|
||||
QueryMsg::OffsetParentQuery |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue