diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/tests/mochitest/general/test_domWindowUtils_scrollbarSize.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/tests/mochitest/general/test_domWindowUtils_scrollbarSize.html')
-rw-r--r-- | dom/tests/mochitest/general/test_domWindowUtils_scrollbarSize.html | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/dom/tests/mochitest/general/test_domWindowUtils_scrollbarSize.html b/dom/tests/mochitest/general/test_domWindowUtils_scrollbarSize.html new file mode 100644 index 000000000..b440870fd --- /dev/null +++ b/dom/tests/mochitest/general/test_domWindowUtils_scrollbarSize.html @@ -0,0 +1,65 @@ +<!DOCTYPE HTML> +<html> +<head> + <title>nsIDOMWindowUtils::getScrollbarSize test</title> + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"> +</head> + +<body id="body"> + <script type="application/javascript;version=1.8"> + function doTests() { + let iframe = document.getElementById("iframe"); + let cwindow = iframe.contentWindow; + let utils = SpecialPowers.getDOMWindowUtils(cwindow); + let doc = cwindow.document; + + function haveNonFloatingScrollbars() { + return doc.getElementById("float").offsetWidth > 200; + } + + checkScrollbarSizeFlush(utils, (w, h) => w == 0 && h == 0, + "[overflow=hidden] corrrect scrollbar size after flushing"); + + // Some platforms (esp. mobile) may have floating scrollbars that don't + // affect layout. Thus getScrollbarSize() would always return zeros. + if (haveNonFloatingScrollbars()) { + let body = doc.querySelector("body"); + body.style.overflowY = "scroll"; + + checkScrollbarSize(utils, (w, h) => w == 0 && h == 0, + "[overflowY=scroll] correct scrollbar size w/o flushing"); + + checkScrollbarSizeFlush(utils, (w, h) => w > 0 && h == 0, + "[overflowY=scroll] correct scrollbar size after flushing"); + + body.style.overflowX = "scroll"; + checkScrollbarSize(utils, (w, h) => w > 0 && h == 0, + "[overflowXY=scroll] correct scrollbar size w/o flushing"); + + checkScrollbarSizeFlush(utils, (w, h) => w > 0 && h > 0, + "[overflowXY=scroll] correct scrollbar size after flushing"); + } + + SimpleTest.finish(); + } + + function checkScrollbarSize(utils, check, msg, flush = false) { + let width = {}, height = {}; + utils.getScrollbarSize(flush, width, height); + ok(check(width.value, height.value), msg); + } + + function checkScrollbarSizeFlush(utils, check, msg) { + checkScrollbarSize(utils, check, msg, true); + } + + SimpleTest.waitForExplicitFinish(); + </script> + + <iframe src="http://mochi.test:8888/tests/dom/tests/mochitest/general/file_domWindowUtils_scrollbarSize.html" + id="iframe" onload="doTests();"> + </iframe> + +</body> +</html> |