mirror of
https://github.com/servo/servo.git
synced 2025-09-27 15:20:09 +01:00
script/layout: Implement HTMLElement.scrollParent
(#39110)
This new API allows getting the element which establishes an element's scroll container. This will be used to properly implement `scrollIntoView`. There is still work to do for this API and `offsetParent` to properly handle ancestors which are closed-shadow-hidden from the original query element. In addition, fix an issue where inline boxes were establishing scrolling containers (they shouldn't do that). Testing: There are tests for this change. Fixes: #39096. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
5c7ea4bdee
commit
2c7866eb24
13 changed files with 173 additions and 49 deletions
|
@ -295,6 +295,7 @@ pub trait Layout {
|
|||
fn query_client_rect(&self, node: TrustedNodeAddress) -> Rect<i32>;
|
||||
fn query_element_inner_outer_text(&self, node: TrustedNodeAddress) -> String;
|
||||
fn query_offset_parent(&self, node: TrustedNodeAddress) -> OffsetParentResponse;
|
||||
fn query_scroll_parent(&self, node: TrustedNodeAddress) -> Option<ScrollParentResponse>;
|
||||
fn query_resolved_style(
|
||||
&self,
|
||||
node: TrustedNodeAddress,
|
||||
|
@ -351,6 +352,12 @@ pub struct OffsetParentResponse {
|
|||
pub rect: Rect<Au>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum ScrollParentResponse {
|
||||
DocumentScrollingElement,
|
||||
Element(UntrustedNodeAddress),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum QueryMsg {
|
||||
BoxArea,
|
||||
|
@ -361,6 +368,7 @@ pub enum QueryMsg {
|
|||
InnerWindowDimensionsQuery,
|
||||
NodesFromPointQuery,
|
||||
OffsetParentQuery,
|
||||
ScrollParentQuery,
|
||||
ResolvedFontStyleQuery,
|
||||
ResolvedStyleQuery,
|
||||
ScrollingAreaOrOffsetQuery,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue