Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Unified Diff: third_party/WebKit/LayoutTests/css3/motion-path/offset-position.html

Issue 2352273002: CSS Motion Path: offset-anchor and offset-position (Closed)
Patch Set: rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/css3/motion-path/offset-position.html
diff --git a/third_party/WebKit/LayoutTests/css3/motion-path/offset-position.html b/third_party/WebKit/LayoutTests/css3/motion-path/offset-position.html
new file mode 100644
index 0000000000000000000000000000000000000000..3015e272c4afa11b6726e3c9bfc4e833e0bd2cd0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/css3/motion-path/offset-position.html
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<style>
+body {
+ font-size: 10px;
+}
+#container {
+ offset-position: 30% 40%;
+}
+#child1 {
+ offset-position: inherit;
+}
+</style>
+<div id="container">
+ <div id="child1"></div>
+ <div id="child2"></div>
+</div>
+<script>
+"use strict";
+
+test(function() {
+ var element = document.createElement('div');
+ document.body.appendChild(element);
+ assert_equals(getComputedStyle(element, null).offsetPosition, 'auto');
+}, 'offset-position default is auto');
+
+test(function() {
+ assert_equals(getComputedStyle(container, null).offsetPosition, '30% 40%');
+}, 'offset-position can be two percentages');
+
+test(function() {
+ assert_equals(getComputedStyle(child1, null).offsetPosition, '30% 40%');
+}, 'offset-position can explicitly inherited');
+
+test(function() {
+ assert_equals(getComputedStyle(child2, null).offsetPosition, 'auto');
+}, 'offset-position is not inherited by default');
+
+function computed(specified) {
+ var element = document.createElement('div');
+ element.style['offset-position'] = specified;
+ document.body.appendChild(element);
+ return getComputedStyle(element, null).offsetPosition;
+}
+
+test(function() {
+ assert_equals(computed('auto'), 'auto');
+}, 'offset-position can be auto');
+
+test(function() {
+ assert_equals(computed('10px 20px'), '10px 20px');
+}, 'offset-position can be two lengths');
+
+test(function() {
+ assert_equals(computed('30px top'), '30px 0%');
+}, 'offset-position can be a length and a keyword');
+
+test(function() {
+ assert_equals(computed('left 40px'), '0% 40px');
+}, 'offset-position can be a keyword and a length');
+
+test(function() {
+ assert_equals(computed('top'), '50% 0%');
+}, 'offset-position can be supplied with a single keyword');
+
+test(function() {
+ assert_equals(computed('center'), '50% 50%');
+}, 'offset-position can be supplied with center');
+
+test(function() {
+ assert_equals(computed('5em 6em'), '50px 60px');
+}, 'offset-position can be supplied with em');
+</script>

Powered by Google App Engine
This is Rietveld 408576698