Bug 157846. Part 0: Make tests more robust to padding changes and clipping of overflowing glyph edges. r=mats
authorRobert O'Callahan <robert@ocallahan.org>
Wed, 15 Jan 2014 22:42:05 +1300
changeset 163740 259c34b488f7a81f27dd59b24ce9e958bbfd58da
parent 163739 2b91fc89e84072f0933544496024d37ad48ac885
child 163741 f94ada7507f40c63d4afcfb1878539274e89f835
push idunknown
push userunknown
push dateunknown
reviewersmats
bugs157846
milestone29.0a1
Bug 157846. Part 0: Make tests more robust to padding changes and clipping of overflowing glyph edges. r=mats
editor/reftests/xul/autocomplete-1.xul
editor/reftests/xul/autocomplete-ref.xul
editor/reftests/xul/empty-1.xul
editor/reftests/xul/empty-2.xul
editor/reftests/xul/empty-ref.xul
editor/reftests/xul/input.css
editor/reftests/xul/plain-1.xul
editor/reftests/xul/plain-ref.xul
editor/reftests/xul/textbox-1.xul
editor/reftests/xul/textbox-disabled.xul
editor/reftests/xul/textbox-readonly.xul
editor/reftests/xul/textbox-ref.xul
layout/reftests/forms/input/number/show-value-ref.html
layout/reftests/forms/input/number/show-value.html
layout/reftests/text-overflow/anonymous-block-ref.html
layout/reftests/text-overflow/anonymous-block.html
layout/xul/test/test_bug563416.html
--- a/editor/reftests/xul/autocomplete-1.xul
+++ b/editor/reftests/xul/autocomplete-1.xul
@@ -2,11 +2,13 @@
 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         title="Textbox tests">
 
   <script type="text/javascript" src="platform.js"/>
 
-  <textbox type="autocomplete" value="test"/>
+  <!-- leading space in the value to ensure no pixels of t get clipped
+       in one rendering but not the other -->
+  <textbox type="autocomplete" value=" test"/>
       
 </window>
--- a/editor/reftests/xul/autocomplete-ref.xul
+++ b/editor/reftests/xul/autocomplete-ref.xul
@@ -3,11 +3,11 @@
 <?xml-stylesheet href="input.css" type="text/css"?>
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         title="Textbox tests">
 
   <script type="text/javascript" src="platform.js"/>
 
-  <html:input class="ac" value="test"/>
+  <html:input class="ac" value=" test"/>
       
 </window>
--- a/editor/reftests/xul/empty-1.xul
+++ b/editor/reftests/xul/empty-1.xul
@@ -3,11 +3,11 @@
 <?xml-stylesheet href="placeholder-reset.css" type="text/css"?>
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         title="Textbox tests">
 
   <script type="text/javascript" src="platform.js"/>
 
-  <textbox placeholder="test"/>
+  <textbox placeholder=" test"/>
       
 </window>
--- a/editor/reftests/xul/empty-2.xul
+++ b/editor/reftests/xul/empty-2.xul
@@ -2,11 +2,11 @@
 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         title="Textbox tests">
 
   <script type="text/javascript" src="platform.js"/>
 
-  <textbox placeholder="test" value="value"/>
+  <textbox placeholder=" test" value="value"/>
       
 </window>
--- a/editor/reftests/xul/empty-ref.xul
+++ b/editor/reftests/xul/empty-ref.xul
@@ -3,11 +3,11 @@
 <?xml-stylesheet href="input.css" type="text/css"?>
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         title="Textbox tests">
 
   <script type="text/javascript" src="platform.js"/>
 
-  <html:input class="empty" value="test"/>
+  <html:input class="empty" value=" test"/>
       
 </window>
--- a/editor/reftests/xul/input.css
+++ b/editor/reftests/xul/input.css
@@ -60,10 +60,11 @@ html|input.num {
 #linux html|input.num {
   -moz-margin-end: 3px;
   padding: 3px;
 }
 
 html|div.plainfield {
   -moz-margin-start: 1px;
   color: -moz-fieldtext;
+  white-space: pre;
 }
 
--- a/editor/reftests/xul/plain-1.xul
+++ b/editor/reftests/xul/plain-1.xul
@@ -2,11 +2,11 @@
 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         title="Textbox tests">
 
   <script type="text/javascript" src="platform.js"/>
 
-  <textbox value="test" class="plain"/>
+  <textbox value=" test" class="plain"/>
       
 </window>
--- a/editor/reftests/xul/plain-ref.xul
+++ b/editor/reftests/xul/plain-ref.xul
@@ -3,11 +3,11 @@
 <?xml-stylesheet href="input.css" type="text/css"?>
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         title="Textbox tests">
 
   <script type="text/javascript" src="platform.js"/>
 
-  <html:div class="plainfield">test</html:div>
+  <html:div class="plainfield"> test</html:div>
       
 </window>
--- a/editor/reftests/xul/textbox-1.xul
+++ b/editor/reftests/xul/textbox-1.xul
@@ -2,11 +2,11 @@
 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         title="Textbox tests">
 
   <script type="text/javascript" src="platform.js"/>
 
-  <textbox value="test"/>
+  <textbox value=" test"/>
       
 </window>
--- a/editor/reftests/xul/textbox-disabled.xul
+++ b/editor/reftests/xul/textbox-disabled.xul
@@ -2,11 +2,11 @@
 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         title="Textbox tests">
 
   <script type="text/javascript" src="platform.js"/>
 
-  <textbox value="test" disabled="true"/>
+  <textbox value=" test" disabled="true"/>
       
 </window>
--- a/editor/reftests/xul/textbox-readonly.xul
+++ b/editor/reftests/xul/textbox-readonly.xul
@@ -2,11 +2,11 @@
 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         title="Textbox tests">
 
   <script type="text/javascript" src="platform.js"/>
 
-  <textbox value="test" readonly="true"/>
+  <textbox value=" test" readonly="true"/>
       
 </window>
--- a/editor/reftests/xul/textbox-ref.xul
+++ b/editor/reftests/xul/textbox-ref.xul
@@ -3,11 +3,11 @@
 <?xml-stylesheet href="input.css" type="text/css"?>
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         title="Textbox tests">
 
   <script type="text/javascript" src="platform.js"/>
 
-  <html:input value="test"/>
+  <html:input value=" test"/>
       
 </window>
--- a/layout/reftests/forms/input/number/show-value-ref.html
+++ b/layout/reftests/forms/input/number/show-value-ref.html
@@ -6,21 +6,21 @@
                                                                                    
 input {                                                                            
   -moz-appearance: none;                                                           
 }                                                                                  
                                                                                    
     </style>                                                                       
   </head>
   <body>
-    <input value='42'><br>
-    <input value='42'><br>
-    <input value='42'><br>
-    <input value='42'><br>
-    <input value='42'><br>
+    <input value='142'><br>
+    <input value='142'><br>
+    <input value='142'><br>
+    <input value='142'><br>
+    <input value='142'><br>
     <form>
-      <input value='42'>
+      <input value='142'>
     </form>
     <!-- div to cover spin box area for type=number to type=text comparison -->
     <div style="display:block; position:absolute; background-color:black; width:200px; height:400px; top:0px; left:100px;">
   </body>
 </html>
 
--- a/layout/reftests/forms/input/number/show-value.html
+++ b/layout/reftests/forms/input/number/show-value.html
@@ -5,36 +5,38 @@
     <style>
 
 input {
   -moz-appearance: none;
 }
 
     </style>
     <script>
+// Using "142" as the magic number as "1" in a monospace font should not have
+// stray leading or trailing antialised pixels that get clipped unexpectedly.
 
 function run() {
   var numbers = document.getElementsByTagName('input');
   numbers[2].style.display = 'inline-block'; // none -> inline-block
-  numbers[3].setAttribute('value', '42');
-  numbers[4].value = '42';
+  numbers[3].setAttribute('value', '142');
+  numbers[4].value = '142';
   numbers[5].varue = '1337'; // deliberately misspelt - should not set value
   document.forms[0].reset(); // numbers[5] value should be 42 again.
   document.documentElement.className = '';
 }
 
 document.addEventListener("MozReftestInvalidate", run);
 
     </script>
   </head>
   <body onload="run();">
-    <input type='number' value='42'><br>
-    <input value='42' type='number'><br>
-    <input type='number' value='42' style="display: none;"><br>
+    <input type='number' value='142'><br>
+    <input value='142' type='number'><br>
+    <input type='number' value='142' style="display: none;"><br>
     <input type='number' value='1337'><br>
     <input type='number' value='1337'><br>
     <form>
-      <input type='number' value='42'>
+      <input type='number' value='142'>
     </form>
     <!-- div to cover spin box area for type=number to type=text comparison -->
     <div style="display:block; position:absolute; background-color:black; width:200px; height:400px; top:0px; left:100px;">
   </body>
 </html>
--- a/layout/reftests/text-overflow/anonymous-block-ref.html
+++ b/layout/reftests/text-overflow/anonymous-block-ref.html
@@ -39,28 +39,28 @@ span {
   left:16em;
 }
 
 .t1 {width:6em;}
 .t2 {width:2em;}
 .t3 {width:25em;}
 .t4 {width:17.5em;}
 
-input { font-family:DejaVuSansMono; width:3em; }
+input { font-family:DejaVuSansMono; }
 
 </style>
 
 </head><body>
 
 
 <div class="test t1"><x>Some ove<m>&#x2026;</m><span><i style="display:block;">anonymous<br>block</i>and</span> unin<m>&#x2026;</m></x></div>
 <div class="test t2"><x>So<m>&#x2026;</m><i style="display:block;">anonymous<br>block</i>an<m>&#x2026;</m></x></div>
 <div style="position:absolute;"><div class="test t3" style="border-style:none;padding:1px"><x>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<m style="padding-left:16em">&#x2026;</m></div></div>
 <div class="test t3"><x>Some overly <span>l&nbsp;&nbsp;&nbsp;</span><span><i style="display:block;">anonymous<br>block</i>and</span> uninformative sentence</x></div>
 <div class="test t4"><x>Some overly <m>&#x2026;</m><span>long<i style="display:block;">anonymous<br>block</i>a&nbsp;&nbsp;</span> uninformative sentence</x></div>
 
-<input placeholder="pla&#x2026;">
-<input dir="rtl" placeholder="der&#x2026;">
-<input placeholder="plaX">
-<input dir="rtl" placeholder="Xder">
+<input size="4" placeholder="pla&#x2026;">
+<input size="4" dir="rtl" placeholder="der&#x2026;">
+<input size="4" placeholder="plaX">
+<input size="4" dir="rtl" placeholder="Xder">
 
 </body>
 </html>
--- a/layout/reftests/text-overflow/anonymous-block.html
+++ b/layout/reftests/text-overflow/anonymous-block.html
@@ -42,17 +42,17 @@ span {
   left:16em;
 }
 
 .t1 {width:6em;}
 .t2 {width:2em;}
 .t3 {width:25em;}
 .t4 {width:17.5em;}
 
-input { font-family:DejaVuSansMono; width:3em; }
+input { font-family:DejaVuSansMono; }
 input::-moz-placeholder {
   overflow:hidden;
   text-overflow:ellipsis;
 }
 input.t5::-moz-placeholder {
   text-overflow:"X";
 }
 
@@ -61,15 +61,15 @@ input.t5::-moz-placeholder {
 </head><body>
 
 
 <div class="test t1"><x>Some overly <span>long<i style="display:block;">anonymous<br>block</i>and</span> uninformative sentence</x></div>
 <div class="test t2"><x>Some overly long<i style="display:block;">anonymous<br>block</i>and uninformative sentence</x></div>
 <div class="test t3"><x>Some overly <span>long<i style="display:block;">anonymous<br>block</i>and</span> uninformative sentence</x></div>
 <div class="test t4"><x>Some overly <span>long<i style="display:block;">anonymous<br>block</i>and</span> uninformative sentence</x></div>
 
-<input placeholder="placeholder">
-<input dir="rtl" placeholder="placeholder">
-<input class="t5" placeholder="placeholder">
-<input class="t5" dir="rtl" placeholder="placeholder">
+<input size="4" placeholder="placeholder">
+<input size="4" dir="rtl" placeholder="placeholder">
+<input size="4" class="t5" placeholder="placeholder">
+<input size="4" class="t5" dir="rtl" placeholder="placeholder">
 
 </body>
 </html>
--- a/layout/xul/test/test_bug563416.html
+++ b/layout/xul/test/test_bug563416.html
@@ -5,17 +5,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 -->
 <head>
   <title>Test for Bug 563416</title>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=563416">Mozilla Bug 563416</a>
-<p id="display"><iframe id="test" src='data:text/html,<textarea style="-moz-box-sizing:content-box; -moz-appearance:none; height: 0px;" cols="20" rows="10">hsldkjvmshlkkajskdlfksdjflskdjflskdjflskdjflskdjfddddddddd</textarea>'></iframe></p>
+<p id="display"><iframe id="test" src='data:text/html,<textarea style="-moz-box-sizing:content-box; -moz-appearance:none; height: 0px; padding: 0px;" cols="20" rows="10">hsldkjvmshlkkajskdlfksdjflskdjflskdjflskdjflskdjfddddddddd</textarea>'></iframe></p>
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
 <script type="application/javascript">
 
 /** Test for Bug 563416 **/