Bug 1636090 [wpt PR 23454] - Add page-orientation descriptor., a=testonly
authorMorten Stenshorne <mstensho@chromium.org>
Wed, 13 May 2020 09:46:50 +0000
changeset 531137 0ec0a03a4b0ba46583bef12bf5cd3977710f6796
parent 531136 7e0732c18cc89df92bdb4bd853d094621db65e08
child 531138 8a683c9718daf7590605a0b900e5effed2717f3e
push id37435
push userapavel@mozilla.com
push dateWed, 20 May 2020 15:28:23 +0000
treeherdermozilla-central@5415da14ec9a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1636090, 23454, 1079212, 1079214, 1053768, 2187211, 766534
milestone78.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 1636090 [wpt PR 23454] - Add page-orientation descriptor., a=testonly Automatic update from web-platform-tests Add page-orientation descriptor. This will be supported in @page rules to set the orientation of a page (without affecting layout). Typically to be used together with named pages (or @page :first, etc.) See https://drafts.csswg.org/css-page-3/#page-orientation-prop and https://github.com/w3c/csswg-drafts/issues/4491 The tests added have some failures, due to crbug.com/1079212 and crbug.com/1079214 Bug: 1053768 Change-Id: I96f93e3e34beee92b4c30f65d7e46498a8110464 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2187211 Reviewed-by: Rune Lillesveen <futhark@chromium.org> Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org> Reviewed-by: Chris Harrelson <chrishtr@chromium.org> Commit-Queue: Chris Harrelson <chrishtr@chromium.org> Cr-Commit-Position: refs/heads/master@{#766534} -- wpt-commits: f8ad4cf5d37166c24ef2b464414b3ebee59595ac wpt-pr: 23454
testing/web-platform/tests/css/css-page/page-orientation.tentative.html
testing/web-platform/tests/css/css-page/parsing/page-orientation-computed.tentative.html
testing/web-platform/tests/css/css-page/parsing/page-orientation-invalid.tentative.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-page/page-orientation.tentative.html
@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<link rel="help" href="https://drafts.csswg.org/css-page-3/#page-orientation-prop">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+  @page {
+      page-orientation: rotate-right;
+  }
+  @page :left {
+      page-orientation: rotate-left;
+  }
+  @page :right {
+      page-orientation: rotate-right;
+  }
+  @page :first {
+      page-orientation: rotate-left;
+  }
+  @page named1 {
+      page-orientation: upright;
+  }
+  @page named2 {
+      page-orientation: hotpink;
+  }
+  @page named3 {
+      page-orientation: rotate-right;
+  }
+  @page named4 {
+      page-orientation: rotate-right;
+      page-orientation: rotate-left;
+  }
+  @page named5 {
+      page-orientation: hotpink;
+      page-orientation: rotate-right;
+  }
+  @page named6 {
+      page-orientation: rotate-right;
+      page-orientation: inherit;
+      page-orientation: initial;
+      page-orientation: none;
+      page-orientation: hotpink;
+  }
+  h5 {
+      page-orientation: rotate-right;
+      display: block;
+  }
+</style>
+<script>
+  let pageRuleExpectations = {
+      "" : "page-orientation: rotate-right;",
+      ":left" : "page-orientation: rotate-left;",
+      ":right" : "page-orientation: rotate-right;",
+      ":first" : "page-orientation: rotate-left;",
+      "named1" : "page-orientation: upright;",
+      "named2" : "",
+      "named3" : "page-orientation: rotate-right;",
+      "named4" : "page-orientation: rotate-left;",
+      "named5" : "page-orientation: rotate-right;",
+      "named6" : "page-orientation: rotate-right;",
+  };
+  let styleRuleExpectations = {
+      "h5" : "display: block;"
+  };
+  let styleSheets = document.styleSheets;
+  for (let i = 0; i < styleSheets.length; i++) {
+      let rules = styleSheets[i].cssRules;
+      for (let rule of rules) {
+          if (rule.type == CSSRule.PAGE_RULE) {
+              let expected = pageRuleExpectations[rule.selectorText];
+              test(function() {
+                  assert_equals(rule.style.cssText, expected, "unexpected @page contents");
+              }, "contents for selector ['" + rule.selectorText + "']");
+          } else if (rule.type == CSSRule.STYLE_RULE) {
+              let expected = styleRuleExpectations[rule.selectorText];
+              test(function() {
+                  assert_equals(rule.style.cssText, expected, "unexpected style rule contents");
+              }, "contents for selector ['" + rule.selectorText + "']");
+          }
+      }
+  }
+</script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-page/parsing/page-orientation-computed.tentative.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<link rel="help" href="https://drafts.csswg.org/css-page-3/#page-orientation-prop">
+<div id="elm" style="page-orientation:rotate-right;"></div>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+  test(()=> {
+      assert_equals(getComputedStyle(elm).pageOrientation, "");
+  }, "page-orientation is not a property (only a descriptor)");
+</script>
+
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-page/parsing/page-orientation-invalid.tentative.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org">
+<link rel="help" href="https://drafts.csswg.org/css-page-3/#page-orientation-prop">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/css/support/parsing-testcommon.js"></script>
+<script>
+  // page-orientation is not a property. test_invalid_value() tries to specify
+  // it on an element, and this should fail, even when using a valid
+  // value. page-orientation is only valid as a descriptor inside an @page rule.
+  test_invalid_value("page-orientation", "hotpink");
+  test_invalid_value("page-orientation", "upright");
+  test_invalid_value("page-orientation", "rotate-left");
+  test_invalid_value("page-orientation", "rotate-right");
+</script>