layout/style/test/test_ch_ex_no_infloops.html

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=678671
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 678671</title>
michael@0 8 <script type="application/javascript" src="/MochiKit/packed.js"></script>
michael@0 9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 10 <script type="text/javascript" src="property_database.js"></script>
michael@0 11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 12 </head>
michael@0 13 <body>
michael@0 14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=678671">Mozilla Bug 678671</a>
michael@0 15 <p id="display"></p>
michael@0 16 <div id="content"></div>
michael@0 17 <script type="application/javascript">
michael@0 18
michael@0 19 /** Test for Bug 678671 **/
michael@0 20
michael@0 21 /**
michael@0 22 * Test 'ex' and 'ch' units in every place we possible can to make
michael@0 23 * sure they don't cause an infinite loop.
michael@0 24 */
michael@0 25
michael@0 26 var content = document.getElementById("content");
michael@0 27 var cs = getComputedStyle(content, "");
michael@0 28
michael@0 29 for (var prop in gCSSProperties) {
michael@0 30 var info = gCSSProperties[prop];
michael@0 31 if (info.backend_only) {
michael@0 32 continue;
michael@0 33 }
michael@0 34 function test_val(v) {
michael@0 35 content.style.setProperty(prop, v, "");
michael@0 36 isnot(get_computed_value(cs, prop), "",
michael@0 37 "Setting '" + prop + "' to '" + v + "' should not cause infinite loop");
michael@0 38 }
michael@0 39 test_val('3ex');
michael@0 40 test_val('2ch');
michael@0 41 function test_replaced_values(value_list) {
michael@0 42 // For each item in value_list, if it looks like it has a dimension
michael@0 43 // in it, replace those dimensions with 3ex and 2ch and test it.
michael@0 44 for (var i = 0; i < value_list.length; ++i) {
michael@0 45 var value = value_list[i];
michael@0 46 function try_replace(withval) {
michael@0 47 var rep = value.replace(/[0-9.]+[a-zA-Z]+/g, withval)
michael@0 48 if (rep != value) {
michael@0 49 test_val(rep);
michael@0 50 }
michael@0 51 }
michael@0 52 try_replace('3ex');
michael@0 53 try_replace('2ch');
michael@0 54 }
michael@0 55 }
michael@0 56 test_replaced_values(info.initial_values);
michael@0 57 test_replaced_values(info.other_values);
michael@0 58 content.style.removeProperty(prop);
michael@0 59 }
michael@0 60
michael@0 61 </script>
michael@0 62 </pre>
michael@0 63 </body>
michael@0 64 </html>

mercurial