-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When suppressing anchoring on an scrollframe, forward to the frame th…
…at actually maintains the anchor as needed. The test-case is position-change-heuristic.html but with body and #space having overflow: hidden, which makes it fail on Nightly. Differential Revision: https://phabricator.services.mozilla.com/D75825 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1538537 gecko-commit: bd3a170fc984a92ff6478480b16e3d8ce9cb2f68 gecko-integration-branch: autoland gecko-reviewers: dholbert
- Loading branch information
Showing
1 changed file
with
85 additions
and
0 deletions.
There are no files selected for viewing
85 changes: 85 additions & 0 deletions
85
css/css-scroll-anchoring/position-change-heuristic-in-nested-scroll-box.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<!DOCTYPE html> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<link rel="help" href="https://drafts.csswg.org/css-scroll-anchoring/#suppression-triggers"> | ||
<style> | ||
#space { | ||
height: 4000px; | ||
overflow: hidden; | ||
} | ||
#header { | ||
background-color: #F5B335; | ||
height: 50px; | ||
width: 100%; | ||
} | ||
#content { | ||
background-color: #D3D3D3; | ||
height: 400px; | ||
} | ||
.scroller { | ||
overflow: scroll; | ||
position: relative; | ||
width: 600px; | ||
height: 600px; | ||
} | ||
body { | ||
overflow: hidden; | ||
} | ||
</style> | ||
<div id="maybeScroller"> | ||
<div id="space"> | ||
<div id="header"></div> | ||
<div id="before"></div> | ||
<div id="content"></div> | ||
</div> | ||
</div> | ||
<script> | ||
|
||
// Tests that scroll anchoring is suppressed when an element in the scroller | ||
// changes its in-flow state. | ||
|
||
var scroller; | ||
|
||
function runCase(oldPos, newPos, expectSuppression, skipInverse) { | ||
var header = document.querySelector("#header"); | ||
var before = document.querySelector("#before"); | ||
|
||
header.style.position = oldPos; | ||
before.style.height = "0"; | ||
scroller.scrollTop = 200; | ||
|
||
header.style.position = newPos; | ||
before.style.height = "25px"; | ||
|
||
var expectedTop = expectSuppression ? 200 : 225; | ||
assert_equals(scroller.scrollTop, expectedTop); | ||
|
||
if (!skipInverse) | ||
runCase(newPos, oldPos, expectSuppression, true); | ||
} | ||
|
||
test(() => { | ||
scroller = document.scrollingElement; | ||
document.querySelector("#maybeScroller").className = ""; | ||
|
||
runCase("static", "fixed", true); | ||
runCase("static", "absolute", true); | ||
runCase("static", "relative", false); | ||
runCase("fixed", "absolute", false); | ||
runCase("fixed", "relative", true); | ||
runCase("absolute", "relative", true); | ||
}, "Position changes in document scroller."); | ||
|
||
test(() => { | ||
scroller = document.querySelector("#maybeScroller"); | ||
scroller.className = "scroller"; | ||
|
||
runCase("static", "fixed", true); | ||
runCase("static", "absolute", true); | ||
runCase("static", "relative", false); | ||
runCase("fixed", "absolute", false); | ||
runCase("fixed", "relative", true); | ||
runCase("absolute", "relative", true); | ||
}, "Position changes in scrollable <div>."); | ||
|
||
</script> |