Skip to content

Truly independent web browser

LibWeb: Honor the scrolling attribute on frame viewports

sideshowbarkerbe67f0d90713
diff --git a/Libraries/LibWeb/DOM/Node.h b/Libraries/LibWeb/DOM/Node.h
index 066a0a40aa8..b312c40c2a6 100644
--- a/Libraries/LibWeb/DOM/Node.h
+++ b/Libraries/LibWeb/DOM/Node.h
@@ -94,6 +94,7 @@ enum class RootNodeComposed {
X(KeyframeEffect) \
X(LayoutTreeUpdate) \
X(MathMLAttributeChange) \
+ X(FrameScrollingAttributeChange) \
X(NavigableSetViewportSize) \
X(SVGImageElementFetchTheDocument) \
X(SVGResourceElementAttributeChange) \
diff --git a/Libraries/LibWeb/HTML/LocalNavigable.cpp b/Libraries/LibWeb/HTML/LocalNavigable.cpp
index 8f3c3fe08e5..794895e6284 100644
--- a/Libraries/LibWeb/HTML/LocalNavigable.cpp
+++ b/Libraries/LibWeb/HTML/LocalNavigable.cpp
@@ -1608,11 +1608,21 @@ ReplicatedContainerState LocalNavigable::container_state() const
return container->replicated_container_state();
}
+bool LocalNavigable::container_suppresses_viewport_scrolling() const
+{
+ if (auto container = this->container())
+ return container->suppresses_viewport_scrolling();
+ return m_root_container_state.suppresses_viewport_scrolling;
+}
+
void LocalNavigable::set_root_container_state(ReplicatedContainerState state)
{
VERIFY(is_local_root() && parent());
auto used_color_scheme_changed = m_root_container_state.used_color_scheme != state.used_color_scheme;
+ bool scroll_mode_changed = m_root_container_state.suppresses_viewport_scrolling != state.suppresses_viewport_scrolling;
m_root_container_state = move(state);
+ if (scroll_mode_changed && m_active_document)
+ m_active_document->set_needs_layout_update(DOM::SetNeedsLayoutReason::FrameScrollingAttributeChange);
// The container's used color scheme decides whether the canvas is opaque.
if (used_color_scheme_changed && m_active_document) {
diff --git a/Libraries/LibWeb/HTML/LocalNavigable.h b/Libraries/LibWeb/HTML/LocalNavigable.h
index 8f50cb664ae..bf5b77b6285 100644
--- a/Libraries/LibWeb/HTML/LocalNavigable.h
+++ b/Libraries/LibWeb/HTML/LocalNavigable.h
@@ -104,6 +104,7 @@ public:
GC::Ptr<RemoteNavigable> provisional_for() const { return m_provisional_for; }
void clear_provisional_for() { m_provisional_for = nullptr; }
static GC::Ref<LocalNavigable> create_stand_in(Badge<Page>, RemoteNavigable&, SessionHistoryEntryDescriptor const& current_history_entry);
+ bool container_suppresses_viewport_scrolling() const;
void set_root_container_state(ReplicatedContainerState);
void set_parent_compositor_context(Optional<Web::CompositorContextId>);
diff --git a/Libraries/LibWeb/HTML/NavigableContainer.cpp b/Libraries/LibWeb/HTML/NavigableContainer.cpp
index 7b7766d3b62..1ba0147b5d9 100644
--- a/Libraries/LibWeb/HTML/NavigableContainer.cpp
+++ b/Libraries/LibWeb/HTML/NavigableContainer.cpp
@@ -620,9 +620,28 @@ void NavigableContainer::report_used_color_scheme(CSS::PreferredColorScheme colo
document().page().client().page_did_change_navigable_container_state(m_content_navigable->id(), replicated_container_state());
}
+void NavigableContainer::attribute_changed(Utf16FlyString const& name, Optional<Utf16String> const& old_value, Optional<Utf16String> const& value, Optional<Utf16FlyString> const& namespace_)
+{
+ Base::attribute_changed(name, old_value, value, namespace_);
+ if (namespace_.has_value() || name != AttributeNames::scrolling || !first_is_one_of(local_name(), TagNames::iframe, TagNames::frame))
+ return;
+
+ // https://html.spec.whatwg.org/multipage/rendering.html#the-page
+ bool suppresses_scrolling = value.has_value() && value->is_one_of_ignoring_ascii_case(u"no"sv, u"off"sv, u"noscroll"sv);
+ if (m_suppresses_viewport_scrolling == suppresses_scrolling)
+ return;
+ m_suppresses_viewport_scrolling = suppresses_scrolling;
+ if (!m_content_navigable)
+ return;
+ if (auto* child = as_if<LocalNavigable>(*m_content_navigable); child && child->active_document())
+ child->active_document()->set_needs_layout_update(DOM::SetNeedsLayoutReason::FrameScrollingAttributeChange);
+ document().page().client().page_did_change_navigable_container_state(m_content_navigable->id(), replicated_container_state());
+}
+
ReplicatedContainerState NavigableContainer::replicated_container_state()
{
ReplicatedContainerState state;
+ state.suppresses_viewport_scrolling = m_suppresses_viewport_scrolling;
state.is_in_document_tree = document().is_ancestor_of(*this);
if (auto const* iframe = as_if<HTMLIFrameElement>(*this))
state.iframe_sandboxing_flag_set = iframe->iframe_sandboxing_flag_set();
diff --git a/Libraries/LibWeb/HTML/NavigableContainer.h b/Libraries/LibWeb/HTML/NavigableContainer.h
index 0b7b5c60dc1..2234506c6b7 100644
--- a/Libraries/LibWeb/HTML/NavigableContainer.h
+++ b/Libraries/LibWeb/HTML/NavigableContainer.h
@@ -50,6 +50,7 @@ public:
bool content_navigable_has_session_history_entry_and_ready_for_navigation() const;
ReplicatedContainerState replicated_container_state();
+ bool suppresses_viewport_scrolling() const { return m_suppresses_viewport_scrolling; }
// https://w3c.github.io/webappsec-permissions-policy/#algo-process-policy-attributes
PermissionsPolicy::PolicyDirective process_permissions_policy_attributes() const;
@@ -67,6 +68,7 @@ protected:
NavigableContainer(DOM::Document&, DOM::QualifiedName);
virtual void visit_edges(Cell::Visitor&) override;
+ virtual void attribute_changed(Utf16FlyString const&, Optional<Utf16String> const&, Optional<Utf16String> const&, Optional<Utf16FlyString> const&) override;
// https://html.spec.whatwg.org/multipage/iframe-embed-object.html#shared-attribute-processing-steps-for-iframe-and-frame-elements
Optional<URL::URL> shared_attribute_processing_steps_for_iframe_and_frame(InitialInsertion initial_insertion);
@@ -91,6 +93,7 @@ private:
void report_stats_displayed(bool);
Optional<bool> m_reported_stats_displayed;
+ bool m_suppresses_viewport_scrolling { false };
bool m_potentially_delays_the_load_event { true };
struct ReportedContentNavigableViewport {
diff --git a/Libraries/LibWeb/Layout/UpdateLayout.cpp b/Libraries/LibWeb/Layout/UpdateLayout.cpp
index 85d73eef5f0..b977c0f69d7 100644
--- a/Libraries/LibWeb/Layout/UpdateLayout.cpp
+++ b/Libraries/LibWeb/Layout/UpdateLayout.cpp
@@ -50,6 +50,7 @@ Layout::RustFFI::FfiLayoutUpdateHostCallbacks Document::layout_update_host_callb
.should_collect_devtools_layout_data = document.page().client().has_active_devtools_client(),
.document_in_quirks_mode = document.in_quirks_mode(),
.document_in_limited_quirks_mode = document.in_limited_quirks_mode(),
+ .suppresses_viewport_scrolling = document_is_active && navigable->container_suppresses_viewport_scrolling(),
.viewport_inline_size_raw = viewport_rect.width().raw_value(),
.viewport_block_size_raw = viewport_rect.height().raw_value(),
.document_style_node = document.style_node_id().value(),
diff --git a/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs b/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
index fb7a839e9ed..86fd226b7d6 100644
--- a/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
+++ b/Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
@@ -1215,6 +1215,7 @@ pub(crate) struct LayoutNodeArena {
/// The nodes whose boxes a running tree build or layout write changed, which the host hears of
/// once it is over, or `None` while none runs.
queued_box_presence: Option<Vec<BoundNode>>,
+ pub(crate) suppresses_viewport_scrolling: bool,
/// Whether the document is an SVG file decoded as an image, which is fixed for its lifetime.
document_is_decoded_svg: bool,
/// Depth of synchronous layout passes, including their commits, on the stack.
@@ -1379,6 +1380,7 @@ impl LayoutNodeArena {
style_engine: ArenaStyleEngine(crate::css::style::StyleEngineHandle::null()),
box_presence_host: None,
queued_box_presence: None,
+ suppresses_viewport_scrolling: false,
document_is_decoded_svg: (false),
active_layout_pass_depth: 0,
layout_root: (NodeSlotId::INVALID),
diff --git a/Libraries/LibWeb/Rust/src/layout/update_layout.rs b/Libraries/LibWeb/Rust/src/layout/update_layout.rs
index ccecc72e8e7..e9e251ea187 100644
--- a/Libraries/LibWeb/Rust/src/layout/update_layout.rs
+++ b/Libraries/LibWeb/Rust/src/layout/update_layout.rs
@@ -128,6 +128,7 @@ pub struct FfiLayoutUpdateDocumentFacts {
pub should_collect_devtools_layout_data: bool,
pub document_in_quirks_mode: bool,
pub document_in_limited_quirks_mode: bool,
+ pub suppresses_viewport_scrolling: bool,
pub viewport_inline_size_raw: i32,
pub viewport_block_size_raw: i32,
/// The document's style node, which a layout tree build walks from.
@@ -748,6 +749,7 @@ impl LayoutRoundJob {
fn run_with(mut self, state: &mut ArenaHandle, work: &OwedHostWork) -> LayoutRoundAnswer {
let facts = self.facts;
+ state.arena_mut().suppresses_viewport_scrolling = facts.suppresses_viewport_scrolling;
if self.build.is_none()
&& state.arena().layout_tree_update_marks_need_build()
&& let Some(document) = state.arena().document_style_node()
@@ -1285,6 +1287,7 @@ mod tests {
should_collect_devtools_layout_data: false,
document_in_quirks_mode: false,
document_in_limited_quirks_mode: false,
+ suppresses_viewport_scrolling: false,
viewport_inline_size_raw: 0,
viewport_block_size_raw: 0,
document_style_node: 0,
diff --git a/Libraries/LibWeb/Rust/src/layout/viewport_propagation.rs b/Libraries/LibWeb/Rust/src/layout/viewport_propagation.rs
index 9611cc1fc0a..33a0e710757 100644
--- a/Libraries/LibWeb/Rust/src/layout/viewport_propagation.rs
+++ b/Libraries/LibWeb/Rust/src/layout/viewport_propagation.rs
@@ -327,6 +327,11 @@ pub(crate) fn propagate_root_styles_to_viewport(
) {
assert!(!viewport.is_invalid());
let apply_overflow = |arena: &mut LayoutNodeArena, node: NodeSlotId, (x, y): (u8, u8)| {
+ let (x, y) = if node == viewport && arena.suppresses_viewport_scrolling {
+ (overflow::HIDDEN, overflow::HIDDEN)
+ } else {
+ (x, y)
+ };
arena.update_layout_style(host_calls, node, |style, _| style.set_overflow(x, y));
};
let apply_writing_mode_and_direction =
diff --git a/Libraries/LibWebCommon/HTML/ReplicatedNavigableState.cpp b/Libraries/LibWebCommon/HTML/ReplicatedNavigableState.cpp
index 89a1aa148c0..fa7ad3962f0 100644
--- a/Libraries/LibWebCommon/HTML/ReplicatedNavigableState.cpp
+++ b/Libraries/LibWebCommon/HTML/ReplicatedNavigableState.cpp
@@ -15,6 +15,7 @@ template<>
ErrorOr<void> encode(Encoder& encoder, Web::HTML::ReplicatedContainerState const& state)
{
TRY(encoder.encode(state.is_in_document_tree));
+ TRY(encoder.encode(state.suppresses_viewport_scrolling));
TRY(encoder.encode(state.iframe_sandboxing_flag_set));
TRY(encoder.encode(state.document_active_sandboxing_flag_set));
TRY(encoder.encode(state.document_embedder_policy));
@@ -55,6 +56,7 @@ ErrorOr<Web::HTML::ReplicatedContainerState> decode(Decoder& decoder)
{
return Web::HTML::ReplicatedContainerState {
.is_in_document_tree = TRY(decoder.decode<bool>()),
+ .suppresses_viewport_scrolling = TRY(decoder.decode<bool>()),
.iframe_sandboxing_flag_set = TRY(decoder.decode<Web::HTML::SandboxingFlagSet>()),
.document_active_sandboxing_flag_set = TRY(decoder.decode<Web::HTML::SandboxingFlagSet>()),
.document_embedder_policy = TRY(decoder.decode<Web::HTML::EmbedderPolicy>()),
diff --git a/Libraries/LibWebCommon/HTML/ReplicatedNavigableState.h b/Libraries/LibWebCommon/HTML/ReplicatedNavigableState.h
index edc297c6496..cb26fb5b96d 100644
--- a/Libraries/LibWebCommon/HTML/ReplicatedNavigableState.h
+++ b/Libraries/LibWebCommon/HTML/ReplicatedNavigableState.h
@@ -31,6 +31,7 @@ struct ReplicatedContainerState {
// Whether the container is in its node document's tree rather than a shadow tree, which makes the navigable a
// document-tree child navigable of that document.
bool is_in_document_tree { false };
+ bool suppresses_viewport_scrolling { false };
// https://html.spec.whatwg.org/multipage/browsers.html#iframe-sandboxing-flag-set
SandboxingFlagSet iframe_sandboxing_flag_set {};
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/html/rendering/non-replaced-elements/the-page/iframe-scrolling-attribute-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/html/rendering/non-replaced-elements/the-page/iframe-scrolling-attribute-ref.html
new file mode 100644
index 00000000000..424e039e3fb
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/html/rendering/non-replaced-elements/the-page/iframe-scrolling-attribute-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<title>iframe: changing the scrolling attribute</title>
+<link rel="author" href="mailto:[email protected]">
+
+
+
+<style>
+ iframe {
+ width: 100px;
+ height: 100px;
+ }
+</style>
+
+<p>These two iframes should *both* render with scrollbars:</p>
+<iframe src="support/big-page.html" scrolling="unknown"></iframe>
+<iframe src="support/big-page.html" scrolling="unknown"></iframe>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/html/rendering/non-replaced-elements/the-page/iframe-scrolling-attribute-values-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/html/rendering/non-replaced-elements/the-page/iframe-scrolling-attribute-values-ref.html
new file mode 100644
index 00000000000..2ead59af399
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/html/rendering/non-replaced-elements/the-page/iframe-scrolling-attribute-values-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<title>The scrolling attribute</title>
+<link rel="author" href="mailto:[email protected]">
+
+
+
+<style>
+ iframe {
+ width: 100px;
+ height: 100px;
+ }
+</style>
+
+<p>This page tests the behavior of the <tt>scrolling</tt> attribute on
+<tt>&lt;iframe&gt;</tt> elements which contain a page large enough to need to
+be scrolled.</p>
+
+<iframe src="support/big-page.html" scrolling="auto"></iframe>
+<iframe src="support/big-page.html" scrolling="auto"></iframe>
+<iframe src="support/big-page.html" scrolling="auto"></iframe>
+<iframe src="support/big-page.html" scrolling="auto"></iframe>
+<iframe src="support/big-page.html" scrolling="auto"></iframe>
+<iframe src="support/big-page.html" scrolling="no"></iframe>
+<iframe src="support/big-page.html" scrolling="no"></iframe>
+<iframe src="support/big-page.html" scrolling="no"></iframe>
+<iframe src="support/big-page.html" scrolling="no"></iframe>
+<iframe src="support/big-page.html" scrolling="auto"></iframe>
+<iframe src="support/big-page.html" scrolling="auto"></iframe>
+
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/html/rendering/non-replaced-elements/the-page/support/big-page.html b/Tests/LibWeb/Ref/expected/wpt-import/html/rendering/non-replaced-elements/the-page/support/big-page.html
new file mode 100644
index 00000000000..65f2a65bcf0
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/html/rendering/non-replaced-elements/the-page/support/big-page.html
@@ -0,0 +1,2 @@
+<p>Scroll me</p>
+<div style="width: 400px; height: 400px; background-color: blue"></div>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/html/rendering/non-replaced-elements/the-page/iframe-scrolling-attribute-values.html b/Tests/LibWeb/Ref/input/wpt-import/html/rendering/non-replaced-elements/the-page/iframe-scrolling-attribute-values.html
new file mode 100644
index 00000000000..edaf812cea3
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/html/rendering/non-replaced-elements/the-page/iframe-scrolling-attribute-values.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<title>The scrolling attribute</title>
+<link rel="author" href="mailto:[email protected]">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#the-page">
+<link rel="match" href="../../../../../../expected/wpt-import/html/rendering/non-replaced-elements/the-page/iframe-scrolling-attribute-values-ref.html">
+<meta name="fuzzy" content="maxDifference=0-1;totalPixels=0-4">
+
+<style>
+ iframe {
+ width: 100px;
+ height: 100px;
+ }
+</style>
+
+<p>This page tests the behavior of the <tt>scrolling</tt> attribute on
+<tt>&lt;iframe&gt;</tt> elements which contain a page large enough to need to
+be scrolled.</p>
+
+<iframe src="support/big-page.html"></iframe>
+<iframe src="support/big-page.html" scrolling></iframe>
+<iframe src="support/big-page.html" scrolling=""></iframe>
+<iframe src="support/big-page.html" scrolling="auto"></iframe>
+<iframe src="support/big-page.html" scrolling="yes"></iframe>
+<iframe src="support/big-page.html" scrolling="no"></iframe>
+<iframe src="support/big-page.html" scrolling="noscroll"></iframe>
+<iframe src="support/big-page.html" scrolling="off"></iframe>
+<iframe src="support/big-page.html" scrolling="NoScRoLl"></iframe>
+<iframe src="support/big-page.html" scrolling="bogus"></iframe>
+<iframe src="support/big-page.html" scrolling="1234"></iframe>
+
diff --git a/Tests/LibWeb/Ref/input/wpt-import/html/rendering/non-replaced-elements/the-page/iframe-scrolling-attribute.html b/Tests/LibWeb/Ref/input/wpt-import/html/rendering/non-replaced-elements/the-page/iframe-scrolling-attribute.html
new file mode 100644
index 00000000000..64a3dc9b5de
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/html/rendering/non-replaced-elements/the-page/iframe-scrolling-attribute.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<title>iframe: changing the scrolling attribute</title>
+<link rel="author" href="mailto:[email protected]">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#the-page">
+<link rel="match" href="../../../../../../expected/wpt-import/html/rendering/non-replaced-elements/the-page/iframe-scrolling-attribute-ref.html">
+
+<style>
+ iframe {
+ width: 100px;
+ height: 100px;
+ }
+</style>
+
+<p>These two iframes should *both* render with scrollbars:</p>
+<iframe src="support/big-page.html" scrolling="unknown"></iframe>
+<iframe src="support/big-page.html" scrolling="unknown"></iframe>
+
+<script>
+ var iframe = document.getElementsByTagName("iframe")[1];
+ // Setting scrolling=no and then back to scrolling=unknown
+ // should result in a final value of auto.
+ iframe.setAttribute("scrolling", "no");
+ iframe.setAttribute("scrolling", "unknown");
+</script>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/html/rendering/non-replaced-elements/the-page/support/big-page.html b/Tests/LibWeb/Ref/input/wpt-import/html/rendering/non-replaced-elements/the-page/support/big-page.html
new file mode 100644
index 00000000000..65f2a65bcf0
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/html/rendering/non-replaced-elements/the-page/support/big-page.html
@@ -0,0 +1,2 @@
+<p>Scroll me</p>
+<div style="width: 400px; height: 400px; background-color: blue"></div>
diff --git a/Tests/LibWeb/Text/expected/SiteIsolation/iframe/wheel-over-isolated-iframe-with-scrolling-no.txt b/Tests/LibWeb/Text/expected/SiteIsolation/iframe/wheel-over-isolated-iframe-with-scrolling-no.txt
new file mode 100644
index 00000000000..c094762c484
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/SiteIsolation/iframe/wheel-over-isolated-iframe-with-scrolling-no.txt
@@ -0,0 +1 @@
+page: 100, frame: 0
diff --git a/Tests/LibWeb/Text/expected/async-scrolling/iframe-scrolling-attribute.txt b/Tests/LibWeb/Text/expected/async-scrolling/iframe-scrolling-attribute.txt
new file mode 100644
index 00000000000..17291e30e2a
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/async-scrolling/iframe-scrolling-attribute.txt
@@ -0,0 +1,4 @@
+NoScRoLl: page 100, frame 0
+script scroll: 80
+attribute removed: page 100, frame 180
+off: page 200, frame 180
diff --git a/Tests/LibWeb/Text/input/SiteIsolation/iframe/wheel-over-isolated-iframe-with-scrolling-no.html b/Tests/LibWeb/Text/input/SiteIsolation/iframe/wheel-over-isolated-iframe-with-scrolling-no.html
new file mode 100644
index 00000000000..1de295d6fad
--- /dev/null
+++ b/Tests/LibWeb/Text/input/SiteIsolation/iframe/wheel-over-isolated-iframe-with-scrolling-no.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<script src="../../include.js"></script>
+<style>
+ body { margin: 0; height: 2000px; }
+ iframe { position: fixed; inset: 0; width: 200px; height: 150px; border: 0; }
+</style>
+<script>
+ promiseTest(async () => {
+ const child = new URL(await httpTestServer().createEcho("GET", "/isolated-frame-scroll-mode", {
+ status: 200,
+ headers: { "Content-Type": "text/html" },
+ body: `<!DOCTYPE html><style>body { margin: 0; height: 2000px }</style><script>
+ onmessage = () => parent.postMessage(scrollY, "*");
+ onload = () => parent.postMessage("ready", "*");
+ <\/script>`,
+ }));
+ child.hostname = uniqueLocalhostHostname("isolated-frame-scroll-mode");
+ const frame = document.createElement("iframe");
+ const nextMessage = () => new Promise(resolve => addEventListener("message", event => resolve(event.data), { once: true }));
+ const ready = nextMessage();
+ frame.scrolling = "no";
+ frame.src = child;
+ document.body.append(frame);
+ await ready;
+ await animationFrame();
+ await animationFrame();
+ await internals.wheelThroughUIProcess(100, 75, 0, 100, true);
+ const offset = nextMessage();
+ frame.contentWindow.postMessage("offset", "*");
+ println(`page: ${scrollY}, frame: ${await offset}`);
+ });
+</script>
diff --git a/Tests/LibWeb/Text/input/async-scrolling/iframe-scrolling-attribute.html b/Tests/LibWeb/Text/input/async-scrolling/iframe-scrolling-attribute.html
new file mode 100644
index 00000000000..543594f5bdf
--- /dev/null
+++ b/Tests/LibWeb/Text/input/async-scrolling/iframe-scrolling-attribute.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<script src="../include.js"></script>
+<style>
+ body { margin: 0; height: 3000px; }
+ iframe { position: fixed; top: 0; left: 0; width: 300px; height: 200px; border: 0; }
+</style>
+<script>
+ promiseTest(async () => {
+ const frame = document.createElement("iframe");
+ frame.scrolling = "NoScRoLl";
+ frame.srcdoc = "<!doctype html><style>html { overflow: scroll } body { margin: 0; height: 1600px }</style>";
+ const loaded = new Promise(resolve => frame.onload = resolve);
+ document.body.append(frame);
+ await loaded;
+ const child = frame.contentWindow;
+ async function wheel(description, scrollTarget) {
+ await animationFrame();
+ await animationFrame();
+ await scrollSettled(scrollTarget, async () => {
+ await internals.wheelThroughUIProcess(100, 100, 0, 100, true, "ongoing");
+ await internals.wheelThroughUIProcess(100, 100, 0, 0, true, "ended");
+ });
+ println(`${description}: page ${scrollY}, frame ${child.scrollY}`);
+ }
+ await wheel("NoScRoLl", document);
+ await scrollSettled(child.document, () => child.scrollTo(0, 80));
+ println(`script scroll: ${child.scrollY}`);
+ frame.removeAttribute("scrolling");
+ await wheel("attribute removed", child.document);
+ frame.scrolling = "off";
+ await wheel("off", document);
+ });
+</script>