Bug 1590357 - Update overflow areas for visible -> unscrollable clip changes. r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D50049

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-10-22 19:02:36 +00:00
parent 1bf9113bfe
commit 1442d5b174
4 changed files with 96 additions and 2 deletions

View File

@ -2903,8 +2903,8 @@ nsChangeHint nsStyleDisplay::CalcDifference(
} else {
// Otherwise this is a change between visible and
// -moz-hidden-unscrollable. Here only whether we have a clip changes, so
// just repaint in that case.
hint |= nsChangeHint_RepaintFrame;
// just repaint and update our overflow areas in that case.
hint |= nsChangeHint_UpdateOverflow | nsChangeHint_RepaintFrame;
}
}

View File

@ -0,0 +1,27 @@
<!doctype html>
<meta charset="utf-8">
<title>CSS Test Reference</title>
<style>
#target {
width: 100px;
height: 100px;
background: red;
/* For this simple case, hidden and clip are equivalent */
overflow: hidden;
}
#container {
overflow: auto;
height: 300px;
}
#fill {
background: blue;
height: 5000px;
}
</style>
<div id="container">
<div id="target">
<div id="fill"></div>
</div>
</div>

View File

@ -0,0 +1,31 @@
<!doctype html>
<meta charset="utf-8">
<title>overflow: clip clips its contents and doesn't cause scrollable overflow</title>
<link rel="help" href="https://drafts.csswg.org/css-overflow/#valdef-overflow-clip">
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="author" title="Mozilla" href="https://mozilla.org">
<link rel="match" href="clip-001-ref.html">
<style>
#target {
width: 100px;
height: 100px;
background: red;
overflow: -moz-hidden-unscrollable;
overflow: clip;
}
#container {
overflow: auto;
height: 300px;
}
#fill {
background: blue;
height: 5000px;
}
</style>
<div id="container">
<div id="target">
<div id="fill"></div>
</div>
</div>

View File

@ -0,0 +1,36 @@
<!doctype html>
<meta charset="utf-8">
<title>Overflow areas are updated when dynamically changed to overflow: clip</title>
<link rel="help" href="https://drafts.csswg.org/css-overflow/#valdef-overflow-clip">
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="author" title="Mozilla" href="https://mozilla.org">
<link rel="match" href="clip-001-ref.html">
<style>
#target {
width: 100px;
height: 100px;
overflow: visible;
}
#container {
overflow: auto;
height: 300px;
}
#fill {
height: 5000px;
background: blue;
}
</style>
<div id="container">
<div id="target">
<div id="fill"></div>
</div>
</div>
<script>
onload = function() {
let target = document.getElementById("target");
window.unused = target.getBoundingClientRect(); // Update layout
target.style.overflow = "-moz-hidden-unscrollable";
target.style.overflow = "clip";
}
</script>