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

Side by Side Diff: LayoutTests/fast/css3-text/css3-text-decoration/getComputedStyle/script-tests/getComputedStyle-text-underline-position.js

Issue 40733004: Replace compile flag with runtime check for text-underline-position (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Julien's review #2 (rebased) Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 function testElementStyle(propertyJS, propertyCSS, type, value) 1 function testElementStyle(propertyJS, propertyCSS, type, value)
2 { 2 {
3 if (type != null) { 3 if (type != null) {
4 shouldBe("e.style." + propertyJS, "'" + value + "'"); 4 shouldBe("e.style." + propertyJS, "'" + value + "'");
5 shouldBe("e.style.getPropertyCSSValue('" + propertyCSS + "').toString()" , "'" + type + "'"); 5 shouldBe("e.style.getPropertyCSSValue('" + propertyCSS + "').toString()" , "'" + type + "'");
6 shouldBe("e.style.getPropertyCSSValue('" + propertyCSS + "').cssText", " '" + value + "'"); 6 shouldBe("e.style.getPropertyCSSValue('" + propertyCSS + "').cssText", " '" + value + "'");
7 } else 7 } else
8 shouldBeNull("e.style.getPropertyCSSValue('" + propertyCSS + "')"); 8 shouldBeNull("e.style.getPropertyCSSValue('" + propertyCSS + "')");
9 } 9 }
10 10
11 function testComputedStyle(propertyJS, propertyCSS, type, value) 11 function testComputedStyle(propertyJS, propertyCSS, type, value)
12 { 12 {
13 computedStyle = window.getComputedStyle(e, null); 13 computedStyle = window.getComputedStyle(e, null);
14 shouldBe("computedStyle." + propertyJS, "'" + value + "'"); 14 shouldBe("computedStyle." + propertyJS, "'" + value + "'");
15 shouldBe("computedStyle.getPropertyCSSValue('" + propertyCSS + "').toString( )", "'" + type + "'"); 15 shouldBe("computedStyle.getPropertyCSSValue('" + propertyCSS + "').toString( )", "'" + type + "'");
16 shouldBe("computedStyle.getPropertyCSSValue('" + propertyCSS + "').cssText", "'" + value + "'"); 16 shouldBe("computedStyle.getPropertyCSSValue('" + propertyCSS + "').cssText", "'" + value + "'");
17 } 17 }
18 18
19 description("Test to make sure -webkit-text-underline-position property returns values properly.") 19 description("Test to make sure text-underline-position property returns values p roperly.")
20 20
21 // FIXME: This test tests property values 'auto', 'alphabetic' and 'under'. We d on't fully match 21 // FIXME: This test tests property values 'auto', 'alphabetic' and 'under'. We d on't fully match
22 // the specification as we don't support [ left | right ] and this is left for a nother implementation 22 // the specification as we don't support [ left | right ] and this is left for a nother implementation
23 // as the rendering will need to be added. 23 // as the rendering will need to be added.
24 24
25 var testContainer = document.createElement("div"); 25 var testContainer = document.createElement("div");
26 testContainer.contentEditable = true; 26 testContainer.contentEditable = true;
27 document.body.appendChild(testContainer); 27 document.body.appendChild(testContainer);
28 28
29 testContainer.innerHTML = '<div id="test">hello world</div>'; 29 testContainer.innerHTML = '<div id="test">hello world</div>';
30 30
31 debug("Initial value:"); 31 debug("Initial value:");
32 e = document.getElementById('test'); 32 e = document.getElementById('test');
33 testElementStyle("webkitTextUnderlinePosition", "-webkit-text-underline-position ", null, ''); 33 testElementStyle("textUnderlinePosition", "text-underline-position", null, '');
34 testComputedStyle("webkitTextUnderlinePosition", "-webkit-text-underline-positio n", "[object CSSPrimitiveValue]", "auto"); 34 testComputedStyle("textUnderlinePosition", "text-underline-position", "[object C SSPrimitiveValue]", "auto");
35 debug(''); 35 debug('');
36 36
37 debug("Value '':"); 37 debug("Value '':");
38 e.style.webkitTextUnderlinePosition = ''; 38 e.style.textUnderlinePosition = '';
39 testElementStyle("webkitTextUnderlinePosition", "-webkit-text-underline-position ", null, ''); 39 testElementStyle("textUnderlinePosition", "text-underline-position", null, '');
40 testComputedStyle("webkitTextUnderlinePosition", "-webkit-text-underline-positio n", "[object CSSPrimitiveValue]", "auto"); 40 testComputedStyle("textUnderlinePosition", "text-underline-position", "[object C SSPrimitiveValue]", "auto");
41 debug(''); 41 debug('');
42 42
43 debug("Initial value (explicit):"); 43 debug("Initial value (explicit):");
44 e.style.webkitTextUnderlinePosition = 'initial'; 44 e.style.textUnderlinePosition = 'initial';
45 testElementStyle("webkitTextUnderlinePosition", "-webkit-text-underline-position ", "[object CSSValue]", "initial"); 45 testElementStyle("textUnderlinePosition", "text-underline-position", "[object CS SValue]", "initial");
46 testComputedStyle("webkitTextUnderlinePosition", "-webkit-text-underline-positio n", "[object CSSPrimitiveValue]", "auto"); 46 testComputedStyle("textUnderlinePosition", "text-underline-position", "[object C SSPrimitiveValue]", "auto");
47 debug(''); 47 debug('');
48 48
49 debug("Value 'auto':"); 49 debug("Value 'auto':");
50 e.style.webkitTextUnderlinePosition = 'auto'; 50 e.style.textUnderlinePosition = 'auto';
51 testElementStyle("webkitTextUnderlinePosition", "-webkit-text-underline-position ", "[object CSSPrimitiveValue]", "auto"); 51 testElementStyle("textUnderlinePosition", "text-underline-position", "[object CS SPrimitiveValue]", "auto");
52 testComputedStyle("webkitTextUnderlinePosition", "-webkit-text-underline-positio n", "[object CSSPrimitiveValue]", "auto"); 52 testComputedStyle("textUnderlinePosition", "text-underline-position", "[object C SSPrimitiveValue]", "auto");
53 debug(''); 53 debug('');
54 54
55 debug("Value 'alphabetic':"); 55 debug("Value 'alphabetic':");
56 e.style.webkitTextUnderlinePosition = 'alphabetic'; 56 e.style.textUnderlinePosition = 'alphabetic';
57 testElementStyle("webkitTextUnderlinePosition", "-webkit-text-underline-position ", "[object CSSPrimitiveValue]", "alphabetic"); 57 testElementStyle("textUnderlinePosition", "text-underline-position", "[object CS SPrimitiveValue]", "alphabetic");
58 testComputedStyle("webkitTextUnderlinePosition", "-webkit-text-underline-positio n", "[object CSSPrimitiveValue]", "alphabetic"); 58 testComputedStyle("textUnderlinePosition", "text-underline-position", "[object C SSPrimitiveValue]", "alphabetic");
59 debug(''); 59 debug('');
60 60
61 debug("Value 'under':"); 61 debug("Value 'under':");
62 e.style.webkitTextUnderlinePosition = 'under'; 62 e.style.textUnderlinePosition = 'under';
63 testElementStyle("webkitTextUnderlinePosition", "-webkit-text-underline-position ", "[object CSSPrimitiveValue]", "under"); 63 testElementStyle("textUnderlinePosition", "text-underline-position", "[object CS SPrimitiveValue]", "under");
64 testComputedStyle("webkitTextUnderlinePosition", "-webkit-text-underline-positio n", "[object CSSPrimitiveValue]", "under"); 64 testComputedStyle("textUnderlinePosition", "text-underline-position", "[object C SSPrimitiveValue]", "under");
65 debug(''); 65 debug('');
66 66
67 testContainer.innerHTML = '<div id="test-parent" style="-webkit-text-underline-p osition: under;">hello <span id="test-ancestor">world</span></div>'; 67 testContainer.innerHTML = '<div id="test-parent" style="text-underline-position: under;">hello <span id="test-ancestor">world</span></div>';
68 debug("Ancestor inherits values from parent:"); 68 debug("Ancestor inherits values from parent:");
69 e = document.getElementById('test-ancestor'); 69 e = document.getElementById('test-ancestor');
70 testElementStyle("webkitTextUnderlinePosition", "-webkit-text-underline-position ", null, ""); 70 testElementStyle("textUnderlinePosition", "text-underline-position", null, "");
71 testComputedStyle("webkitTextUnderlinePosition", "-webkit-text-underline-positio n", "[object CSSPrimitiveValue]", "under"); 71 testComputedStyle("textUnderlinePosition", "text-underline-position", "[object C SSPrimitiveValue]", "under");
72 debug(''); 72 debug('');
73 73
74 debug("Value 'auto alphabetic':"); 74 debug("Value 'auto alphabetic':");
75 e.style.webkitTextUnderlinePosition = 'auto alphabetic'; 75 e.style.textUnderlinePosition = 'auto alphabetic';
76 testElementStyle("webkitTextUnderlinePosition", "-webkit-text-underline-position ", null, ""); 76 testElementStyle("textUnderlinePosition", "text-underline-position", null, "");
77 debug(''); 77 debug('');
78 78
79 debug("Value 'auto under':"); 79 debug("Value 'auto under':");
80 e.style.webkitTextUnderlinePosition = 'auto under'; 80 e.style.textUnderlinePosition = 'auto under';
81 testElementStyle("webkitTextUnderlinePosition", "-webkit-text-underline-position ", null, ""); 81 testElementStyle("textUnderlinePosition", "text-underline-position", null, "");
82 debug(''); 82 debug('');
83 83
84 debug("Value 'under under':"); 84 debug("Value 'under under':");
85 e.style.webkitTextUnderlinePosition = 'under under'; 85 e.style.textUnderlinePosition = 'under under';
86 testElementStyle("webkitTextUnderlinePosition", "-webkit-text-underline-position ", null, ""); 86 testElementStyle("textUnderlinePosition", "text-underline-position", null, "");
87 debug(''); 87 debug('');
88 88
89 debug("Value 'under under under':"); 89 debug("Value 'under under under':");
90 e.style.webkitTextUnderlinePosition = 'auto alphabetic under'; 90 e.style.textUnderlinePosition = 'auto alphabetic under';
91 testElementStyle("webkitTextUnderlinePosition", "-webkit-text-underline-position ", null, ""); 91 testElementStyle("textUnderlinePosition", "text-underline-position", null, "");
92 debug(''); 92 debug('');
93 93
94 document.body.removeChild(testContainer); 94 document.body.removeChild(testContainer);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698