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

Unified Diff: third_party/WebKit/LayoutTests/fast/css/variables/longhand-pending-shorthand-substitution.html

Issue 2089593002: Add expansion of shorthands with custom properties to longhands using a pending substition value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix serialization and temporary property value caching. Add some additional tests. Created 4 years, 6 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/fast/css/variables/longhand-pending-shorthand-substitution.html
diff --git a/third_party/WebKit/LayoutTests/fast/css/variables/longhand-pending-shorthand-substitution.html b/third_party/WebKit/LayoutTests/fast/css/variables/longhand-pending-shorthand-substitution.html
new file mode 100644
index 0000000000000000000000000000000000000000..3116ce71400ae842f75eb518a2483e1887ffed50
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/css/variables/longhand-pending-shorthand-substitution.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<style>
+ #testElem {
+ --height: 30px;
+ --size: 12px;
+ --size-and-height: var(--size)/var(--height);
+ }
Timothy Loh 2016/06/27 04:19:09 just use a single block for the two #testElem case
Andy Mutton 2016/06/28 03:18:51 Done.
+ #testElem {
+ font: italic bold var(--size-and-height) serif, sans-serif;
+ }
+
+ #testElem2 {
+ --width: 5px;
+ }
+</style>
+
+<div id='testElem'></div>
+<div id='testElem2' style='margin: var(--width); margin-top: 10px;'></div>
+<div id='testElem3' style='--b1: 1px solid grey; --b2: 2px dashed green; border: var(--b1); border-right: var(--b2);'></div>
+<script>
+
+test(function() {
+ var te = getComputedStyle(testElem);
Timothy Loh 2016/06/27 04:19:09 this (and similar below) is actually a style not a
Andy Mutton 2016/06/28 03:18:51 Done.
+ assert_equals(te.fontSize, '12px');
+ assert_equals(te.lineHeight, '30px');
+ assert_equals(te.fontStyle, 'italic');
+ assert_equals(te.fontWeight, 'bold');
+ assert_equals(te.fontFamily, 'serif, sans-serif');
+}, "Test shorthand substitution in font.");
+
+test(function() {
+ var te2 = testElem2.style;
+ assert_equals(te2.cssText, 'margin-right: ; margin-bottom: ; margin-left: ; margin-top: 10px;');
+ assert_equals(te2.marginLeft, '');
+ assert_equals(te2.margin, '');
+ assert_equals(te2.marginTop, '10px');
+}, "Test serialization with specific longhand.");
+
+test(function() {
+ var te3 = testElem3.style;
+ assert_equals(te3.cssText, '--b1: 1px solid grey; --b2: 2px dashed green; border-top: var(--b1); border-bottom: var(--b1); border-left: var(--b1); border-image: var(--b1); border-right: var(--b2);')
+ assert_equals(te3.border, '');
+ assert_equals(te3.borderLeft, 'var(--b1)');
+ assert_equals(te3.borderTop, 'var(--b1)');
+ assert_equals(te3.borderBottom, 'var(--b1)');
+ assert_equals(te3.borderRight, 'var(--b2)');
+}, "Test serialization for shorthands within shorthands.");
+
+test(function() {
+ var cte3 = getComputedStyle(testElem3);
+ assert_equals(cte3.borderTop, '1px solid rgb(128, 128, 128)');
+ assert_equals(cte3.borderRight, '2px dashed rgb(0, 128, 0)');
+}, "Test substitution for border");
+</script>

Powered by Google App Engine
This is Rietveld 408576698