mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
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:
parent
75e32ba5a4
commit
ffdb7d3663
23 changed files with 406 additions and 132 deletions
|
@ -157,6 +157,7 @@ use crate::dom::promise::Promise;
|
|||
use crate::dom::reportingendpoint::{ReportingEndpoint, SendReportsToEndpoints};
|
||||
use crate::dom::reportingobserver::ReportingObserver;
|
||||
use crate::dom::screen::Screen;
|
||||
use crate::dom::scrolling_box::{ScrollingBox, ScrollingBoxSource};
|
||||
use crate::dom::selection::Selection;
|
||||
use crate::dom::shadowroot::ShadowRoot;
|
||||
use crate::dom::storage::Storage;
|
||||
|
@ -2628,13 +2629,37 @@ impl Window {
|
|||
|
||||
pub(crate) fn scroll_container_query(
|
||||
&self,
|
||||
node: &Node,
|
||||
node: Option<&Node>,
|
||||
flags: ScrollContainerQueryFlags,
|
||||
) -> Option<ScrollContainerResponse> {
|
||||
self.layout_reflow(QueryMsg::ScrollParentQuery);
|
||||
self.layout
|
||||
.borrow()
|
||||
.query_scroll_container(node.to_trusted_node_address(), flags)
|
||||
.query_scroll_container(node.map(Node::to_trusted_node_address), flags)
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
pub(crate) fn scrolling_box_query(
|
||||
&self,
|
||||
node: Option<&Node>,
|
||||
flags: ScrollContainerQueryFlags,
|
||||
) -> Option<ScrollingBox> {
|
||||
self.scroll_container_query(node, flags)
|
||||
.and_then(|response| {
|
||||
Some(match response {
|
||||
ScrollContainerResponse::Viewport(overflow) => {
|
||||
(ScrollingBoxSource::Viewport(self.Document()), overflow)
|
||||
},
|
||||
ScrollContainerResponse::Element(parent_node_address, overflow) => {
|
||||
let node = unsafe { from_untrusted_node_address(parent_node_address) };
|
||||
(
|
||||
ScrollingBoxSource::Element(DomRoot::downcast(node)?),
|
||||
overflow,
|
||||
)
|
||||
},
|
||||
})
|
||||
})
|
||||
.map(|(source, overflow)| ScrollingBox::new(source, overflow))
|
||||
}
|
||||
|
||||
pub(crate) fn text_index_query(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue