Truly independent web browser
LibWeb: Update overflow clips when `overflow` changes
Tim Ledbetter148b0c0ec65a
diff --git a/Libraries/LibWeb/CSS/Properties.json b/Libraries/LibWeb/CSS/Properties.jsonindex 1a8942f3d58..0aa8a2402ed 100644--- a/Libraries/LibWeb/CSS/Properties.json+++ b/Libraries/LibWeb/CSS/Properties.json@@ -4181,6 +4181,7 @@},"overflow-x": {"style-group": "BoxValues",+ "affects-accumulated-visual-contexts": true,"animation-type": "discrete","inherited": false,"initial": "visible",@@ -4194,6 +4195,7 @@},"overflow-y": {"style-group": "BoxValues",+ "affects-accumulated-visual-contexts": true,"animation-type": "discrete","inherited": false,"initial": "visible",diff --git a/Tests/LibWeb/Text/expected/visual-context/overflow-change-updates-the-clip.txt b/Tests/LibWeb/Text/expected/visual-context/overflow-change-updates-the-clip.txtnew file mode 100644index 00000000000..01adf67a853--- /dev/null+++ b/Tests/LibWeb/Text/expected/visual-context/overflow-change-updates-the-clip.txt@@ -0,0 +1,8 @@+div content past the box after overflow becomes clip: BODY+div content past the box after overflow becomes visible: child+outer svg content past the viewport before overflow changes: BODY+outer svg content past the viewport after overflow becomes visible: outer-rect+outer svg content past the viewport after overflow becomes hidden: BODY+nested svg content past the viewport after the overflow attribute becomes visible: nested-rect+nested svg content past the viewport after overflow becomes hidden: svg+full builds: 0diff --git a/Tests/LibWeb/Text/input/visual-context/overflow-change-updates-the-clip.html b/Tests/LibWeb/Text/input/visual-context/overflow-change-updates-the-clip.htmlnew file mode 100644index 00000000000..673f3d6aa90--- /dev/null+++ b/Tests/LibWeb/Text/input/visual-context/overflow-change-updates-the-clip.html@@ -0,0 +1,46 @@+<!DOCTYPE html>+<script src="../include.js"></script>+<style>+ body { margin: 0; }+ svg { display: block; }+ #host { width: 50px; height: 50px; }+ #child { width: 100px; height: 50px; background: green; }+</style>+<div id="host"><div id="child"></div></div>+<svg id="outer" width="50" height="50"><rect id="outer-rect" width="100" height="50" fill="green"/></svg>+<svg width="100" height="50"><svg id="nested" width="50" height="50"><rect id="nested-rect" width="100" height="50" fill="green"/></svg></svg>+<script>+ test(() => {+ const targetAt = (x, y) => {+ const element = document.elementFromPoint(x, y);+ return element.id || element.tagName;+ };+ const host = document.getElementById("host");+ const outer = document.getElementById("outer");+ const nested = document.getElementById("nested");+ targetAt(0, 0);+ const fullBuilds = internals.accumulatedVisualContextTreeBuildCount();+ const lines = [];++ host.style.overflow = "clip";+ lines.push(`div content past the box after overflow becomes clip: ${targetAt(75, 10)}`);+ host.style.overflow = "visible";+ lines.push(`div content past the box after overflow becomes visible: ${targetAt(75, 10)}`);++ lines.push(`outer svg content past the viewport before overflow changes: ${targetAt(75, 60)}`);+ outer.style.overflow = "visible";+ lines.push(`outer svg content past the viewport after overflow becomes visible: ${targetAt(75, 60)}`);+ outer.style.overflow = "hidden";+ lines.push(`outer svg content past the viewport after overflow becomes hidden: ${targetAt(75, 60)}`);++ nested.setAttribute("overflow", "visible");+ lines.push(`nested svg content past the viewport after the overflow attribute becomes visible: ${targetAt(75, 110)}`);+ nested.style.overflow = "hidden";+ lines.push(`nested svg content past the viewport after overflow becomes hidden: ${targetAt(75, 110)}`);++ lines.push(`full builds: ${internals.accumulatedVisualContextTreeBuildCount() - fullBuilds}`);++ for (const line of lines)+ println(line);+ });+</script>