Skip to content

Truly independent web browser

1.7 KB
Raw Blame
<!doctype html>
<title>ResizeObserver test: no observation is fired after the change of writing mode when box's specified size comes from logical size properties</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="./resources/resizeTestHelper.js"></script>
<body>
<div id="log"></div>

<script>
'use strict';

function test() {
  let t = createAndAppendElement("div");
  t.style.writingMode = "vertical-lr";
  t.style.inlineSize = "100px";
  t.style.blockSize = "50px";

  let helper = new ResizeTestHelper(
    "no observation is fired after the change of writing mode when " +
    "box's specified size comes from logical size properties.",
  [
    {
      setup: observer => {
        observer.observe(t);
      },
      notify: entries => {
        assert_equals(entries.length, 1, "1 pending notification");
        assert_equals(entries[0].target, t, "target is t");
        assert_equals(entries[0].contentRect.width, 50, "target width");
        assert_equals(entries[0].contentRect.height, 100, "target height");
        assert_equals(entries[0].contentBoxSize[0].inlineSize, 100,
                      "target content-box inline size");
        assert_equals(entries[0].contentBoxSize[0].blockSize, 50,
                      "target content-box block size");
        return true;
      }
    },
    {
      setup: observer => {
        t.style.writingMode = "horizontal-tb";
      },
      notify: entries => {
        assert_unreached("the logical size of content-box doesn't change");
      },
      timeout: () => {
        // expected: We don't change the logical size of content-box.
      }
    }
  ]);

  return helper.start(() => t.remove());
}

(async () => await test())();
</script>