Bug 1102175 Part 3 - Add reftests for altering <body> dynamically. r=jfkthame
authorTing-Yu Lin <tlin@mozilla.com>
Thu, 10 Oct 2019 04:44:40 +0000
changeset 497329 171c70db54de024df49059cb35bb6be68d5829a7
parent 497328 20bed215cb68ddabed8d12d1dc65b5ea82b902b5
child 497330 c42855b477b170876a13ae32a60032d06698814c
push id36682
push userncsoregi@mozilla.com
push dateSat, 12 Oct 2019 09:52:03 +0000
treeherdermozilla-central@06ea2371f897 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1102175
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1102175 Part 3 - Add reftests for altering <body> dynamically. r=jfkthame Differential Revision: https://phabricator.services.mozilla.com/D45580
testing/web-platform/tests/css/css-writing-modes/wm-propagation-body-dynamic-change-001.html
testing/web-platform/tests/css/css-writing-modes/wm-propagation-body-dynamic-change-002-ref.html
testing/web-platform/tests/css/css-writing-modes/wm-propagation-body-dynamic-change-002.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-writing-modes/wm-propagation-body-dynamic-change-001.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+  <meta charset="utf-8">
+  <title>CSS-Writing Modes Test: propagation of the writing-mode property from body to root</title>
+  <link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
+  <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
+  <link rel=help href="https://drafts.csswg.org/css-writing-modes-3/#principal-flow">
+  <link rel="match" href="block-flow-direction-025-ref.xht">
+  <meta name=assert content="The writing mode of the body must be propagated to the root with the dynamic change.">
+
+  <script>
+  function runTest() {
+    document.body.offsetHeight;
+    document.body.style.writingMode = "vertical-rl";
+  }
+  </script>
+
+  <style>
+  div {
+    background-color: blue;
+    height: 100px;
+    width: 100px;
+  }
+  </style>
+
+  <body onload="runTest();">
+    <div></div>
+
+    <p><img src="support/block-flow-direction-025-exp-res.png" width="359" height="36" alt="Image download support must be enabled"></p>
+    <!--
+         The image says:
+         Test passes if there is a blue square in the
+         <strong>upper-right corner</strong> of the page.
+    -->
+  </body>
+</html>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-writing-modes/wm-propagation-body-dynamic-change-002-ref.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+  <meta charset="utf-8">
+  <title>CSS-Writing Modes Test: propagation of the writing-mode property from body to root</title>
+  <link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
+  <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
+
+  <style>
+  html {
+    writing-mode: vertical-rl;
+  }
+
+  main {
+    writing-mode: horizontal-tb;
+    inline-size: 100px;
+  }
+
+  div {
+    background-color: blue;
+    height: 100px;
+    width: 100px;
+  }
+  </style>
+
+  <main>
+    <div></div>
+    <p>Test passes if you see a blue square in the upper-right corner of the page</p>
+  </main>
+</html>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-writing-modes/wm-propagation-body-dynamic-change-002.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+  <meta charset="utf-8">
+  <title>CSS-Writing Modes Test: propagation of the writing-mode property from body to root</title>
+  <link rel="author" title="Ting-Yu Lin" href="tlin@mozilla.com">
+  <link rel="author" title="Mozilla" href="http://www.mozilla.org/">
+  <link rel=help href="https://drafts.csswg.org/css-writing-modes-3/#principal-flow">
+  <link rel="match" href="wm-propagation-body-dynamic-change-002-ref.html">
+  <meta name=assert content="The writing mode of the newly inserted body must be propagated to the root.">
+
+  <script>
+  function runTest() {
+    document.body.offsetHeight;
+
+    var newBody = document.createElement("body");
+    newBody.id = "new-body";
+    var oldBody = document.getElementById("old-body");
+
+    /* Insert a new <body> before the old one, which should become the primary <body>. */
+    document.documentElement.insertBefore(newBody, oldBody);
+  }
+  </script>
+
+  <style>
+  #new-body {
+    /* This writing-mode should propagate to the root element. */
+    writing-mode: vertical-rl;
+    margin: 0;
+  }
+
+  #old-body {
+    writing-mode: horizontal-tb;
+    inline-size: 100px;
+  }
+
+  div {
+    background-color: blue;
+    height: 100px;
+    width: 100px;
+  }
+  </style>
+
+  <body id="old-body" onload="runTest();">
+    <div></div>
+    <p>Test passes if you see a blue square in the upper-right corner of the page</p>
+  </body>
+</html>