script: Chain up keyboard scrolling to parent <iframe>s (#39469)

When an `<iframe>` cannot scroll because the size of the frame is
greater than or
equal to the size of page contents, chain up the keyboard scroll
operation to the parent frame.

Testing: A new Servo-only WPT tests is added, though needs to be
manually
run with `--product servodriver`.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Delan Azabani <dazabani@igalia.com>
This commit is contained in:
Martin Robinson 2025-09-25 13:16:41 +02:00 committed by GitHub
parent 75e32ba5a4
commit ffdb7d3663
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 406 additions and 132 deletions

View file

@ -12,7 +12,7 @@ use euclid::{SideOffsets2D, Size2D};
use itertools::Itertools;
use layout_api::wrapper_traits::{LayoutNode, ThreadSafeLayoutElement, ThreadSafeLayoutNode};
use layout_api::{
BoxAreaType, LayoutElementType, LayoutNodeType, OffsetParentResponse,
AxesOverflow, BoxAreaType, LayoutElementType, LayoutNodeType, OffsetParentResponse,
ScrollContainerQueryFlags, ScrollContainerResponse,
};
use script::layout_dom::{ServoLayoutNode, ServoThreadSafeLayoutNode};
@ -676,9 +676,14 @@ pub fn process_offset_parent_query(
///
#[inline]
pub(crate) fn process_scroll_container_query(
node: ServoLayoutNode<'_>,
node: Option<ServoLayoutNode<'_>>,
query_flags: ScrollContainerQueryFlags,
viewport_overflow: AxesOverflow,
) -> Option<ScrollContainerResponse> {
let Some(node) = node else {
return Some(ScrollContainerResponse::Viewport(viewport_overflow));
};
let layout_data = node.to_threadsafe().inner_layout_data()?;
// 1. If any of the following holds true, return null and terminate this algorithm:
@ -776,7 +781,7 @@ pub(crate) fn process_scroll_container_query(
match current_position_value {
Position::Fixed => None,
_ => Some(ScrollContainerResponse::Viewport),
_ => Some(ScrollContainerResponse::Viewport(viewport_overflow)),
}
}