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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/css/cssText-shorthand.html

Issue 2083703005: Shorthand serialization should check for var in longhands. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added test case 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/StylePropertySerializer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script> 2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script> 3 <script src="../../resources/testharnessreport.js"></script>
4 <script> 4 <script>
5 5
6 var tests = [ 6 var tests = [
7 ['border: 1px; border-top: 1px;', 'border: 1px;'], 7 ['border: 1px; border-top: 1px;', 'border: 1px;'],
8 ['border: 1px solid red;', 'border: 1px solid red;'], 8 ['border: 1px solid red;', 'border: 1px solid red;'],
9 ['border: 1px red;', 'border: 1px red;'], 9 ['border: 1px red;', 'border: 1px red;'],
10 ['border: red;', 'border: red;'], 10 ['border: red;', 'border: red;'],
(...skipping 10 matching lines...) Expand all
21 ['border-width: 1px;', 'border-width: 1px;'], 21 ['border-width: 1px;', 'border-width: 1px;'],
22 22
23 ['-webkit-border-horizontal-spacing: 1px; -webkit-border-vertical-spacing: 2 px;', 'border-spacing: 1px 2px;'], 23 ['-webkit-border-horizontal-spacing: 1px; -webkit-border-vertical-spacing: 2 px;', 'border-spacing: 1px 2px;'],
24 24
25 // We don't use shorthand for font-family, etc... for compatibility reasons 25 // We don't use shorthand for font-family, etc... for compatibility reasons
26 ['font-family: sans-serif; line-height: 2em; font-size: 3em; font-style: ita lic; font-weight: bold;', 26 ['font-family: sans-serif; line-height: 2em; font-size: 3em; font-style: ita lic; font-weight: bold;',
27 'font-family: sans-serif; line-height: 2em; font-size: 3em; font-style: italic; font-weight: bold;'], 27 'font-family: sans-serif; line-height: 2em; font-size: 3em; font-style: italic; font-weight: bold;'],
28 28
29 ['list-style-type: circle; list-style-position: inside; list-style-image: in itial;', 'list-style: circle inside;'], 29 ['list-style-type: circle; list-style-position: inside; list-style-image: in itial;', 'list-style: circle inside;'],
30 ['margin-top: 1px; margin-right: 2px; margin-bottom: 3px; margin-left: 4px;' , 'margin: 1px 2px 3px 4px;'], 30 ['margin-top: 1px; margin-right: 2px; margin-bottom: 3px; margin-left: 4px;' , 'margin: 1px 2px 3px 4px;'],
31 ['margin: 1px 2px; margin-top: var(--x);', 'margin-right: 2px; margin-bottom : 1px; margin-left: 2px; margin-top: var(--x);'],
31 ['outline-width: 2px; outline-style: dotted; outline-color: blue;', 'outline : blue dotted 2px;'], 32 ['outline-width: 2px; outline-style: dotted; outline-color: blue;', 'outline : blue dotted 2px;'],
32 ['overflow-x: scroll; overflow-y: hidden;', 'overflow-x: scroll; overflow-y: hidden;'], 33 ['overflow-x: scroll; overflow-y: hidden;', 'overflow-x: scroll; overflow-y: hidden;'],
33 ['overflow-x: scroll; overflow-y: scroll;', 'overflow: scroll;'], 34 ['overflow-x: scroll; overflow-y: scroll;', 'overflow: scroll;'],
34 ['padding-top: 1px; padding-right: 2px; padding-bottom: 3px; padding-left: 4 px;', 'padding: 1px 2px 3px 4px;'], 35 ['padding-top: 1px; padding-right: 2px; padding-bottom: 3px; padding-left: 4 px;', 'padding: 1px 2px 3px 4px;'],
35 ['padding: initial; padding-top: initial !important', 36 ['padding: initial; padding-top: initial !important',
36 'padding-top: initial !important; padding-right: initial; padding-bottom : initial; padding-left: initial;'], 37 'padding-top: initial !important; padding-right: initial; padding-bottom : initial; padding-left: initial;'],
37 38
38 ['list-style-type: lower-alpha;', 'list-style-type: lower-alpha;'] 39 ['list-style-type: lower-alpha;', 'list-style-type: lower-alpha;']
39 ]; 40 ];
40 41
41 function normalizeCssText(text) { return text.trim().split(/;\s*/).sort().slice( 1).join("; "); } 42 function normalizeCssText(text) { return text.trim().split(/;\s*/).sort().slice( 1).join("; "); }
42 43
43 var element; 44 var element;
44 tests.forEach(function (values) { 45 tests.forEach(function (values) {
45 var styleAttribute = values[0]; 46 var styleAttribute = values[0];
46 var expectedCssText = values[1]; 47 var expectedCssText = values[1];
47 test(function() { 48 test(function() {
48 49
49 element = document.createElement('div'); 50 element = document.createElement('div');
50 element.setAttribute('style', styleAttribute); 51 element.setAttribute('style', styleAttribute);
51 52
52 assert_equals(normalizeCssText(element.style.cssText), normalizeCssText( expectedCssText)); 53 assert_equals(normalizeCssText(element.style.cssText), normalizeCssText( expectedCssText));
53 }, "cssText set to " + JSON.stringify(styleAttribute) + " is read back as " + JSON.stringify(expectedCssText)); 54 }, "cssText set to " + JSON.stringify(styleAttribute) + " is read back as " + JSON.stringify(expectedCssText));
54 }); 55 });
55 56
56 </script> 57 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/StylePropertySerializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698