| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 
 | <!doctype html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Scrollable Overflow of a Scroll Container with Transformed Child in Unreachable Scrollable Overflow Region.</title>
<link rel="help" href="https://drafts.csswg.org/css-overflow-3/#unreachable-scrollable-overflow-region">
<link rel="help" href="https://drafts.csswg.org/css-overflow-3/#scrollable">
<link rel="author" title="Jo Steven Novaryo" href="mailto:steven.novaryo@gmail.com">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<style>
body { margin: 0 }
.wrapper {
  width: 100px;
  height: 200px;
  overflow: scroll;
}
.inner {
  width: 100px;
  height: 200px;
  background-color: lime;
  transform: translate(-3px, -6px) scale(1.10);
}
</style>
<div class="wrapper">
  <div class="inner"></div>
</div>
<script>
const wrapper = document.querySelector(".wrapper");
const contentBox = {
  width: 100,
  height: 200,
};
function getCurrentTestName(display, direction, writingMode, flexDirection, flexWrap) {
  return `display: ${display}; ` +
         `direction: ${direction}; ` +
         `writing-mode: ${writingMode}; ` +
         `flex-direction: ${flexDirection}; ` +
         `flex-wrap: ${flexWrap};`;
}
for (let display of ["flow-root", "flex", "grid"]) {
  for (let flexDirection of ["row", "row-reverse", "column", "column-reverse"]) {
    if (flexDirection != "row" && display != "flex") {
      // Don't bother retesting with all flexDirection values unless we're actually a flex container
      continue;
    }
    for (let flexWrap of ["nowrap", "wrap-reverse"]) {
      if (flexWrap != "nowrap" && display != "flex") {
        // Don't bother retesting with all flexWrap values unless we're actually a flex container
        continue;
      }
      for (let direction of ["ltr", "rtl"]) {
        for (let writingMode of ["horizontal-tb", "vertical-lr", "vertical-rl"]) {
          wrapper.style.display = display;
          wrapper.style.direction = direction;
          wrapper.style.writingMode = writingMode;
          wrapper.style.flexDirection = flexDirection;
          wrapper.style.flexWrap = flexWrap;
          // Suppress scrollbars because they get added to the padding are
          // and would need to account for them in flexbox.
          wrapper.style.scrollbarWidth = display == "flex" ? "none" : "";
          let vertical = writingMode.startsWith("vertical");
          let scrollToTop = vertical && direction == "rtl";
          let scrollToLeft = (!vertical && direction == "rtl") || writingMode == "vertical-rl";
          let flexMainAxisIsVertical = flexDirection.startsWith("row") == vertical;
          if (display == "flex") {
            if (flexDirection.endsWith("-reverse")) {
              if (flexMainAxisIsVertical) {
                scrollToTop = !scrollToTop;
              } else {
                scrollToLeft = !scrollToLeft;
              }
            }
            if (flexWrap == "wrap-reverse") {
              if (flexMainAxisIsVertical) {
                scrollToLeft = !scrollToLeft;
              } else {
                scrollToTop = !scrollToTop;
              }
            }
          }
          currentTestName = getCurrentTestName(display, direction, writingMode, flexDirection, flexWrap);
          test(function() {
            assert_equals(wrapper.scrollWidth, (scrollToLeft ? 108 : 102), "scrollWidth");
          }, "scrollWidth of " + currentTestName);
          test(function() {
            assert_equals(wrapper.scrollHeight, (scrollToTop ? 216 : 204), "scrollHeight");
          }, "scrollHeight of " + currentTestName);
        }
      }
    }
  }
}
</script>
 |