Skip to content

Truly independent web browser

LibWeb: Pass wheel input through fixed overlays to the page

sideshowbarkerc2a18328d50c
diff --git a/Libraries/LibWeb/Rust/src/painting/visual_context/compositor_scroll_table.rs b/Libraries/LibWeb/Rust/src/painting/visual_context/compositor_scroll_table.rs
index 0e367b46fdd..8ca6bfc9379 100644
--- a/Libraries/LibWeb/Rust/src/painting/visual_context/compositor_scroll_table.rs
+++ b/Libraries/LibWeb/Rust/src/painting/visual_context/compositor_scroll_table.rs
@@ -11,7 +11,7 @@ use crate::painting::display_list::commands::UniqueNodeId;
use crate::painting::display_list::device_pixels::DevicePixelConverter;
use crate::painting::paint_passes::CompositorScrollRefreshOutcome;
use crate::painting::paint_read::PaintRead;
-use crate::painting::{paintable_geometry, scroll_snap, style_queries};
+use crate::painting::{paintable_geometry, scroll_snap};
use libcompositing_rust::visual_context::{
CompositorScrollNodeKind, CompositorScrollNodeRecord, CompositorSnapAreaRecord, CompositorSnapContainerRecord,
SpatialData, SpatialNodeIndex, VISUAL_VIEWPORT_NODE_INDEX,
@@ -66,9 +66,6 @@ pub(crate) fn nearest_ancestor_with_compositor_scroll_node(
if compositor_scroll_node_kind(source, candidate, &mut wheel_scrollable_axes).is_some() {
return Some(candidate);
}
- if style_queries::is_fixed_position(source, candidate) {
- return None;
- }
candidate = source.paintable_data(candidate).containing_block;
}
None
diff --git a/Tests/LibWeb/Text/expected/async-scrolling/wheel-over-fixed-overlay-with-iframe.txt b/Tests/LibWeb/Text/expected/async-scrolling/wheel-over-fixed-overlay-with-iframe.txt
new file mode 100644
index 00000000000..7c59917e784
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/async-scrolling/wheel-over-fixed-overlay-with-iframe.txt
@@ -0,0 +1 @@
+page 100, clip 0
diff --git a/Tests/LibWeb/Text/expected/async-scrolling/wheel-over-fixed-overlay.txt b/Tests/LibWeb/Text/expected/async-scrolling/wheel-over-fixed-overlay.txt
new file mode 100644
index 00000000000..7c59917e784
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/async-scrolling/wheel-over-fixed-overlay.txt
@@ -0,0 +1 @@
+page 100, clip 0
diff --git a/Tests/LibWeb/Text/input/async-scrolling/wheel-over-fixed-overlay-with-iframe.html b/Tests/LibWeb/Text/input/async-scrolling/wheel-over-fixed-overlay-with-iframe.html
new file mode 100644
index 00000000000..244de4d4ee7
--- /dev/null
+++ b/Tests/LibWeb/Text/input/async-scrolling/wheel-over-fixed-overlay-with-iframe.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<script src="../include.js"></script>
+<style>
+ body { margin: 0; height: 3000px; }
+ #dialog { position: fixed; top: 100px; left: 100px; width: 400px; }
+ #clip { height: 300px; overflow: hidden; }
+ #wide { width: 410px; height: 50px; }
+ iframe { width: 100px; height: 50px; }
+</style>
+<div id="dialog"><div id="clip"><div id="wide"></div></div></div>
+<iframe></iframe>
+<script>
+ promiseTest(async () => {
+ const frame = document.querySelector("iframe");
+ await waitForCondition(() => frame.contentWindow.internals.compositorScrollState().document === frame.contentDocument);
+ await scrollSettled(document, () => internals.wheelThroughUIProcess(200, 150, 0, 100));
+ println(`page ${scrollY}, clip ${clip.scrollTop}`);
+ });
+</script>
diff --git a/Tests/LibWeb/Text/input/async-scrolling/wheel-over-fixed-overlay.html b/Tests/LibWeb/Text/input/async-scrolling/wheel-over-fixed-overlay.html
new file mode 100644
index 00000000000..4f1f6284779
--- /dev/null
+++ b/Tests/LibWeb/Text/input/async-scrolling/wheel-over-fixed-overlay.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<script src="../include.js"></script>
+<style>
+ body { margin: 0; height: 3000px; }
+ #overlay { position: fixed; inset: 0; }
+ #clip { position: absolute; inset: 50px auto auto 50px; width: 200px; height: 100px; overflow: hidden; }
+ #visible, #hidden { position: absolute; inset: 0; overflow: auto; }
+ #hidden { height: 200px; visibility: hidden; }
+ #hidden > div { height: 400px; }
+</style>
+<div id="overlay">
+ <div id="clip">
+ <div id="visible"></div>
+ <div id="hidden"><div></div></div>
+ </div>
+</div>
+<script>
+ promiseTest(async () => {
+ await waitForCondition(() => internals.compositorScrollState().document === document);
+ await scrollSettled(document, () => internals.wheelThroughUIProcess(100, 100, 0, 100));
+ println(`page ${scrollY}, clip ${clip.scrollTop}`);
+ });
+</script>