mirror of
https://github.com/servo/servo.git
synced 2025-09-27 23:30:08 +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
|
@ -29,7 +29,8 @@ use layout_api::wrapper_traits::LayoutNode;
|
|||
use layout_api::{
|
||||
BoxAreaType, IFrameSizes, Layout, LayoutConfig, LayoutDamage, LayoutFactory,
|
||||
OffsetParentResponse, PropertyRegistration, QueryMsg, ReflowGoal, ReflowPhasesRun,
|
||||
ReflowRequest, ReflowRequestRestyle, ReflowResult, RegisterPropertyError, TrustedNodeAddress,
|
||||
ReflowRequest, ReflowRequestRestyle, ReflowResult, RegisterPropertyError, ScrollParentResponse,
|
||||
TrustedNodeAddress,
|
||||
};
|
||||
use log::{debug, error, warn};
|
||||
use malloc_size_of::{MallocConditionalSizeOf, MallocSizeOf, MallocSizeOfOps};
|
||||
|
@ -91,7 +92,8 @@ use crate::display_list::{DisplayListBuilder, HitTest, StackingContextTree};
|
|||
use crate::query::{
|
||||
get_the_text_steps, process_box_area_request, process_box_areas_request,
|
||||
process_client_rect_request, process_node_scroll_area_request, process_offset_parent_query,
|
||||
process_resolved_font_style_query, process_resolved_style_request, process_text_index_request,
|
||||
process_resolved_font_style_query, process_resolved_style_request, process_scroll_parent_query,
|
||||
process_text_index_request,
|
||||
};
|
||||
use crate::traversal::{RecalcStyle, compute_damage_and_repair_style};
|
||||
use crate::{BoxTree, FragmentTree};
|
||||
|
@ -323,6 +325,12 @@ impl Layout for LayoutThread {
|
|||
process_offset_parent_query(node).unwrap_or_default()
|
||||
}
|
||||
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
fn query_scroll_parent(&self, node: TrustedNodeAddress) -> Option<ScrollParentResponse> {
|
||||
let node = unsafe { ServoLayoutNode::new(&node) };
|
||||
process_scroll_parent_query(node)
|
||||
}
|
||||
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
fn query_resolved_style(
|
||||
&self,
|
||||
|
@ -1608,6 +1616,7 @@ impl ReflowPhases {
|
|||
QueryMsg::ElementInnerOuterTextQuery |
|
||||
QueryMsg::InnerWindowDimensionsQuery |
|
||||
QueryMsg::OffsetParentQuery |
|
||||
QueryMsg::ScrollParentQuery |
|
||||
QueryMsg::ResolvedFontStyleQuery |
|
||||
QueryMsg::TextIndexQuery |
|
||||
QueryMsg::StyleQuery => Self::empty(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue