mirror of
https://github.com/servo/servo.git
synced 2025-09-27 23:30:08 +01:00
script: Use HTMLElement.scrollParent
to implement Element.scrollIntoView
(#39144)
To find scrolling ancestors, we need to walk up the flat tree and only consider the elements that are in the chain of containing block ancestors of an element. `scrollParent` now does this so we can use it to properly implement `scrollIntoView`. Testing: There are WPT tests for this change. --------- Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
286bbe6cb1
commit
9f4f598f44
9 changed files with 141 additions and 71 deletions
|
@ -29,8 +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, ScrollParentResponse,
|
||||
TrustedNodeAddress,
|
||||
ReflowRequest, ReflowRequestRestyle, ReflowResult, RegisterPropertyError,
|
||||
ScrollContainerQueryType, ScrollContainerResponse, TrustedNodeAddress,
|
||||
};
|
||||
use log::{debug, error, warn};
|
||||
use malloc_size_of::{MallocConditionalSizeOf, MallocSizeOf, MallocSizeOfOps};
|
||||
|
@ -92,8 +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_scroll_parent_query,
|
||||
process_text_index_request,
|
||||
process_resolved_font_style_query, process_resolved_style_request,
|
||||
process_scroll_container_query, process_text_index_request,
|
||||
};
|
||||
use crate::traversal::{RecalcStyle, compute_damage_and_repair_style};
|
||||
use crate::{BoxTree, FragmentTree};
|
||||
|
@ -326,9 +326,13 @@ impl Layout for LayoutThread {
|
|||
}
|
||||
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
fn query_scroll_parent(&self, node: TrustedNodeAddress) -> Option<ScrollParentResponse> {
|
||||
fn query_scroll_container(
|
||||
&self,
|
||||
node: TrustedNodeAddress,
|
||||
query_type: ScrollContainerQueryType,
|
||||
) -> Option<ScrollContainerResponse> {
|
||||
let node = unsafe { ServoLayoutNode::new(&node) };
|
||||
process_scroll_parent_query(node)
|
||||
process_scroll_container_query(node, query_type)
|
||||
}
|
||||
|
||||
#[servo_tracing::instrument(skip_all)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue