-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't consider collapsed margins for in-flow line bounds if we're not…
… a BFC. So that our client{Width,Height} and scroll{Width,Height} calculations make sense. Differential Revision: https://phabricator.services.mozilla.com/D231629 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1936156 gecko-commit: a661bff10b1fea7e6d828efad298bbdbe2a8574c gecko-reviewers: dshin
- Loading branch information
1 parent
e60fed9
commit 36d48df
Showing
4 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
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
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
51 changes: 51 additions & 0 deletions
51
css/cssom-view/scrollWidthHeight-overflow-visible-margin-collapsing.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,51 @@ | ||
<!doctype html> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:[email protected]"> | ||
<link rel="author" title="Mozilla" href="https://mozilla.org"> | ||
<link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-element-scrollwidth"> | ||
<link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-element-scrollheight"> | ||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1936156"> | ||
<title>scroll{Width,Height} shouldn't account for collapsed margins, in order not to report unnecessary overflow</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<style> | ||
#target div { | ||
height: 20px; | ||
min-width: 20px; | ||
background-color: green; | ||
margin: 20px 10px; | ||
} | ||
</style> | ||
<div id="target"> | ||
<div> | ||
<div></div> | ||
</div> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
</div> | ||
<script> | ||
let target = document.getElementById("target"); | ||
// "clip" is not really scrollable, but should match as well. | ||
for (let overflow of ["visible", "hidden", "auto", "scroll", "clip"]) { | ||
for (let padding of ["0", "2px"]) { | ||
for (let border of ["0", "3px solid"]) { | ||
for (let display of ["flex", "block", "flow-root", "inline-block", "inline-flex", "grid", "inline-grid"]) { | ||
test(function() { | ||
target.style.overflow = overflow; | ||
target.style.display = display; | ||
target.style.border = border; | ||
target.style.padding = padding; | ||
let sh = target.scrollHeight; | ||
let sw = target.scrollWidth; | ||
let ch = target.clientHeight; | ||
let cw = target.clientWidth; | ||
assert_equals(sh, ch, "scrollHeight should match clientHeight, since there's no overflow"); | ||
assert_equals(sw, cw, "scrollWidth should match clientWidth, since there's no overflow"); | ||
}, `scroll{Width,Height} with margins should match client{Width,Height} if there would be no overflow width overflow: ${overflow}, padding: ${padding}, border: ${border}, display: ${display}`); | ||
} | ||
} | ||
} | ||
} | ||
</script> |
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