Bug 1121459 - Remove TouchCaret and SelectionCarets prefs in test files. r=mtseng, r=roc draft
authorTing-Yu Lin <tlin@mozilla.com>
Tue, 22 Dec 2015 14:14:12 +0800
changeset 316809 30f221da26c8e222b6c8270896452076f3aeaa29
parent 316808 3508d8a46639e88c9a3ab0deae27c78a09591451
child 316810 68a49aad735653ca358eadce908ca934d84002c1
push id8615
push usertlin@mozilla.com
push dateTue, 22 Dec 2015 06:14:37 +0000
reviewersmtseng, roc
bugs1121459, 648573, 644768
milestone46.0a1
Bug 1121459 - Remove TouchCaret and SelectionCarets prefs in test files. r=mtseng, r=roc For test_bug648573.html and test_bug644768.html, we no longer need to create an iframe to turn off the preferences. I move the content of iframe.src back to the test files.
dom/events/test/bug648573.html
dom/events/test/mochitest.ini
dom/events/test/test_bug648573.html
dom/events/test/test_clickevent_on_input.html
editor/reftests/reftest.list
layout/base/tests/bug644768.html
layout/base/tests/mochitest.ini
layout/base/tests/test_bug1070851.html
layout/base/tests/test_bug558663.html
layout/base/tests/test_bug644768.html
layout/base/tests/test_reftests_with_caret.html
layout/base/tests/test_touchcaret_visibility.html
deleted file mode 100644
--- a/dom/events/test/bug648573.html
+++ /dev/null
@@ -1,106 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=648573
--->
-<head>
-  <title>Test for Bug 648573</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=648573">Mozilla Bug 648573</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script type="application/javascript">
-
-/** Test for Bug 648573 **/
-SimpleTest.waitForExplicitFinish();
-var utils = SpecialPowers.getDOMWindowUtils(window);
-
-ok("createTouch" in document, "Should have createTouch function");
-ok("createTouchList" in document, "Should have createTouchList function");
-ok(document.createEvent("touchevent"), "Should be able to create TouchEvent objects");
-
-var t1 = document.createTouch(window, document, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
-is(t1.target, document, "Wrong target");
-is(t1.identifier, 1, "Wrong identifier");
-is(t1.pageX, 2, "Wrong pageX");
-is(t1.pageY, 3, "Wrong pageY");
-is(t1.screenX, 4, "Wrong screenX");
-is(t1.screenY, 5, "Wrong screenY");
-is(t1.clientX, 6, "Wrong clientX");
-is(t1.clientY, 7, "Wrong clientY");
-is(t1.radiusX, 8, "Wrong radiusX");
-is(t1.radiusY, 9, "Wrong radiusY");
-is(t1.rotationAngle, 10, "Wrong rotationAngle");
-is(t1.force, 11, "Wrong force");
-
-var t2 = document.createTouch();
-
-var l1 = document.createTouchList(t1);
-is(l1.length, 1, "Wrong length");
-is(l1.item(0), t1, "Wront item (1)");
-is(l1[0], t1, "Wront item (2)");
-
-var l2 = document.createTouchList([t1, t2]);
-is(l2.length, 2, "Wrong length");
-is(l2.item(0), t1, "Wront item (3)");
-is(l2.item(1), t2, "Wront item (4)");
-is(l2[0], t1, "Wront item (5)");
-is(l2[1], t2, "Wront item (6)");
-
-var l3 = document.createTouchList();
-
-var e = document.createEvent("touchevent");
-e.initTouchEvent("touchmove", true, true, window, 0, true, true, true, true,
-                 l1, l2, l3);
-is(e.touches, l1, "Wrong list (1)");
-is(e.targetTouches, l2, "Wrong list (2)");
-is(e.changedTouches, l3, "Wrong list (3)");
-ok(e.altKey, "Alt should be true");
-ok(e.metaKey, "Meta should be true");
-ok(e.ctrlKey, "Ctrl should be true");
-ok(e.shiftKey, "Shift should be true");
-
-
-var events =
-  ["touchstart",
-   "touchend",
-   "touchmove",
-   "touchcancel"];
-
-function runEventTest(type) {
-  var e = document.createEvent("touchevent");
-  e.initTouchEvent(type, true, true, window, 0, true, true, true, true,
-                   l1, l2, l3);
-  var t = document.createElement("div");
-  // Testing target.onFoo;
-  var didCall = false;
-  t["on" + type] = function (evt) {
-    is(evt, e, "Wrong event");
-    evt.target.didCall = true;
-  }
-  t.dispatchEvent(e);
-  ok(t.didCall, "Should have called the listener(1)");
-
-  // Testing <element onFoo="">
-  t = document.createElement("div");
-  t.setAttribute("on" + type, "this.didCall = true;");
-  t.dispatchEvent(e);
-  ok(t.didCall, "Should have called the listener(2)");
-}
-
-for (var i = 0; i < events.length; ++i) {
-  runEventTest(events[i]);
-}
-
-SimpleTest.finish();
-</script>
-</pre>
-</body>
-</html>
-
--- a/dom/events/test/mochitest.ini
+++ b/dom/events/test/mochitest.ini
@@ -1,16 +1,15 @@
 [DEFAULT]
 skip-if = toolkit == 'android' #CRASH_DUMP, RANDOM
 support-files =
   bug226361_iframe.xhtml
   bug299673.js
   bug322588-popup.html
   bug426082.html
-  bug648573.html
   bug656379-1.html
   bug418986-3.js
   error_event_worker.js
   empty.js
   window_bug493251.html
   window_bug659071.html
   window_wheel_default_action.html
 
--- a/dom/events/test/test_bug648573.html
+++ b/dom/events/test/test_bug648573.html
@@ -1,30 +1,109 @@
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <!DOCTYPE html>
 <html>
+  <!--
+       https://bugzilla.mozilla.org/show_bug.cgi?id=648573
+     -->
   <head>
-    <title>Bug 648573 test</title>
-    <style>
-      iframe {
-        width: 600px;
-        height: 400px;
-      }
-    </style>
+    <title>Test for Bug 648573</title>
+    <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+    <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
   </head>
   <body>
-    <div id="container"></div>
+    <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=648573">Mozilla Bug 648573</a>
+    <p id="display"></p>
+    <div id="content" style="display: none">
+
+    </div>
+    <pre id="test">
+      <script type="application/javascript">
+
+      /** Test for Bug 648573 **/
+      SimpleTest.waitForExplicitFinish();
+      var utils = SpecialPowers.getDOMWindowUtils(window);
+
+      ok("createTouch" in document, "Should have createTouch function");
+      ok("createTouchList" in document, "Should have createTouchList function");
+      ok(document.createEvent("touchevent"), "Should be able to create TouchEvent objects");
+
+      var t1 = document.createTouch(window, document, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);
+      is(t1.target, document, "Wrong target");
+      is(t1.identifier, 1, "Wrong identifier");
+      is(t1.pageX, 2, "Wrong pageX");
+      is(t1.pageY, 3, "Wrong pageY");
+      is(t1.screenX, 4, "Wrong screenX");
+      is(t1.screenY, 5, "Wrong screenY");
+      is(t1.clientX, 6, "Wrong clientX");
+      is(t1.clientY, 7, "Wrong clientY");
+      is(t1.radiusX, 8, "Wrong radiusX");
+      is(t1.radiusY, 9, "Wrong radiusY");
+      is(t1.rotationAngle, 10, "Wrong rotationAngle");
+      is(t1.force, 11, "Wrong force");
+
+      var t2 = document.createTouch();
+
+      var l1 = document.createTouchList(t1);
+      is(l1.length, 1, "Wrong length");
+      is(l1.item(0), t1, "Wront item (1)");
+      is(l1[0], t1, "Wront item (2)");
+
+      var l2 = document.createTouchList([t1, t2]);
+      is(l2.length, 2, "Wrong length");
+      is(l2.item(0), t1, "Wront item (3)");
+      is(l2.item(1), t2, "Wront item (4)");
+      is(l2[0], t1, "Wront item (5)");
+      is(l2[1], t2, "Wront item (6)");
+
+      var l3 = document.createTouchList();
+
+      var e = document.createEvent("touchevent");
+      e.initTouchEvent("touchmove", true, true, window, 0, true, true, true, true,
+                       l1, l2, l3);
+      is(e.touches, l1, "Wrong list (1)");
+      is(e.targetTouches, l2, "Wrong list (2)");
+      is(e.changedTouches, l3, "Wrong list (3)");
+      ok(e.altKey, "Alt should be true");
+      ok(e.metaKey, "Meta should be true");
+      ok(e.ctrlKey, "Ctrl should be true");
+      ok(e.shiftKey, "Shift should be true");
+
+
+      var events =
+      ["touchstart",
+       "touchend",
+       "touchmove",
+       "touchcancel"];
+
+      function runEventTest(type) {
+        var e = document.createEvent("touchevent");
+        e.initTouchEvent(type, true, true, window, 0, true, true, true, true,
+                         l1, l2, l3);
+        var t = document.createElement("div");
+        // Testing target.onFoo;
+        var didCall = false;
+        t["on" + type] = function (evt) {
+          is(evt, e, "Wrong event");
+          evt.target.didCall = true;
+        }
+        t.dispatchEvent(e);
+        ok(t.didCall, "Should have called the listener(1)");
+
+        // Testing <element onFoo="">
+        t = document.createElement("div");
+        t.setAttribute("on" + type, "this.didCall = true;");
+        t.dispatchEvent(e);
+        ok(t.didCall, "Should have called the listener(2)");
+      }
+
+      for (var i = 0; i < events.length; ++i) {
+        runEventTest(events[i]);
+      }
+
+      SimpleTest.finish();
+      </script>
+    </pre>
   </body>
-  <script>
-  // Touch/Selection caret's pref is checked only when PresShell is initialized.
-  // To turn off the pref, we test bug 648573 in an iframe.
-  SpecialPowers.pushPrefEnv({"set": [['touchcaret.enabled', false]]}, function() {
-    SpecialPowers.pushPrefEnv({"set": [['selectioncaret.enabled', false]]}, function() {
-      var iframe = document.createElement("iframe");
-      iframe.src = "bug648573.html";
-      document.getElementById('container').appendChild(iframe);
-    });
-  });
-  </script>
 </html>
--- a/dom/events/test/test_clickevent_on_input.html
+++ b/dom/events/test/test_clickevent_on_input.html
@@ -44,37 +44,36 @@ function isEnabledMiddleClickPaste()
 {
   try {
     return SpecialPowers.getBoolPref("middlemouse.paste");
   } catch (e) {
     return false;
   }
 }
 
-function isEnabledTouchCaret()
+function isEnabledAccessibleCaret()
 {
   try {
-    return SpecialPowers.getBoolPref("touchcaret.enabled") ||
-           SpecialPowers.getBoolPref("layout.accessiblecaret.enabled");
+    return SpecialPowers.getBoolPref("layout.accessiblecaret.enabled");
   } catch (e) {
     return false;
   }
 }
 
 function doTest(aButton)
 {
   // NOTE #1: Right click causes a context menu to popup, then, the click event
   //          isn't generated.
   // NOTE #2: If middle click causes text to be pasted, then, the click event
   //          isn't generated.
   // NOTE #3: If touch caret is enabled, touch caret would ovelap input element,
   //          then, the click event isn't generated.
   if (aButton != 2 &&
       (aButton != 1 || !isEnabledMiddleClickPaste()) &&
-      (aButton != 0 || !isEnabledTouchCaret())) {
+      (aButton != 0 || !isEnabledAccessibleCaret())) {
     gClickCount = 0;
     // click on border of input
     synthesizeMouse(input, 5, 5, { button: aButton });
     is(gClickCount, 1,
        "click event doesn't fired on input element (button is " +
          aButton + ")");
 
     gClickCount = 0;
--- a/editor/reftests/reftest.list
+++ b/editor/reftests/reftest.list
@@ -52,20 +52,20 @@ skip-if(B2G||Mulet) random-if(Android) n
 skip-if(B2G||Mulet) random-if(Android) needs-focus != spellcheck-textarea-attr-dynamic.html spellcheck-textarea-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
 skip-if(B2G||Mulet) random-if(Android) needs-focus != spellcheck-textarea-attr-dynamic-inherit.html spellcheck-textarea-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
 skip-if(B2G||Mulet) random-if(Android) needs-focus != spellcheck-textarea-property-dynamic.html spellcheck-textarea-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
 skip-if(B2G||Mulet) random-if(Android) needs-focus != spellcheck-textarea-property-dynamic-inherit.html spellcheck-textarea-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
 skip-if(B2G||Mulet) random-if(Android) needs-focus != spellcheck-textarea-attr-dynamic-override.html spellcheck-textarea-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
 skip-if(B2G||Mulet) random-if(Android) needs-focus != spellcheck-textarea-attr-dynamic-override-inherit.html spellcheck-textarea-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
 skip-if(B2G||Mulet) random-if(Android) needs-focus != spellcheck-textarea-property-dynamic-override.html spellcheck-textarea-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
 skip-if(B2G||Mulet) random-if(Android) needs-focus != spellcheck-textarea-property-dynamic-override-inherit.html spellcheck-textarea-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
-needs-focus pref(touchcaret.enabled,false) == caret_on_focus.html caret_on_focus-ref.html
+needs-focus == caret_on_focus.html caret_on_focus-ref.html
 needs-focus != caret_on_textarea_lastline.html caret_on_textarea_lastline-ref.html
-needs-focus pref(touchcaret.enabled,false) pref(selectioncaret.enabled,false) == input-text-onfocus-reframe.html input-text-onfocus-reframe-ref.html
-needs-focus pref(touchcaret.enabled,false) pref(selectioncaret.enabled,false) == input-text-notheme-onfocus-reframe.html input-text-notheme-onfocus-reframe-ref.html
+needs-focus == input-text-onfocus-reframe.html input-text-onfocus-reframe-ref.html
+needs-focus == input-text-notheme-onfocus-reframe.html input-text-notheme-onfocus-reframe-ref.html
 skip-if(B2G||Mulet) needs-focus == caret_after_reframe.html caret_after_reframe-ref.html # B2G timed out waiting for reftest-wait to be removed # Initial mulet triage: parity with B2G/B2G Desktop
 == nobogusnode-1.html nobogusnode-ref.html
 == nobogusnode-2.html nobogusnode-ref.html
 == spellcheck-hyphen-valid.html spellcheck-hyphen-valid-ref.html
 skip-if(B2G||Mulet) fails-if(Android) needs-focus != spellcheck-hyphen-invalid.html spellcheck-hyphen-invalid-ref.html # Initial mulet triage: parity with B2G/B2G Desktop
 == spellcheck-slash-valid.html spellcheck-slash-valid-ref.html
 == spellcheck-period-valid.html spellcheck-period-valid-ref.html
 == spellcheck-space-valid.html spellcheck-space-valid-ref.html
@@ -99,25 +99,25 @@ skip-if(Android||B2G||Mulet) needs-focus
 == readonly-editable.html readonly-editable-ref.html
 == dynamic-overflow-change.html dynamic-overflow-change-ref.html
 == 694880-1.html 694880-ref.html
 == 694880-2.html 694880-ref.html
 == 694880-3.html 694880-ref.html
 == 388980-1.html 388980-1-ref.html
 needs-focus == spellcheck-superscript-1.html spellcheck-superscript-1-ref.html
 skip-if(B2G||Mulet) fails-if(Android) needs-focus != spellcheck-superscript-2.html spellcheck-superscript-2-ref.html # bug 783658 # Initial mulet triage: parity with B2G/B2G Desktop
-needs-focus pref(selectioncaret.enabled,false) pref(layout.accessiblecaret.enabled,false) == 824080-1.html 824080-1-ref.html
-needs-focus pref(selectioncaret.enabled,false) pref(layout.accessiblecaret.enabled,false) == 824080-2.html 824080-2-ref.html
-needs-focus pref(selectioncaret.enabled,false) pref(layout.accessiblecaret.enabled,false) == 824080-3.html 824080-3-ref.html
+needs-focus pref(layout.accessiblecaret.enabled,false) == 824080-1.html 824080-1-ref.html
+needs-focus pref(layout.accessiblecaret.enabled,false) == 824080-2.html 824080-2-ref.html
+needs-focus pref(layout.accessiblecaret.enabled,false) == 824080-3.html 824080-3-ref.html
 needs-focus != 824080-2.html 824080-3.html
-needs-focus pref(selectioncaret.enabled,false) pref(layout.accessiblecaret.enabled,false) == 824080-4.html 824080-4-ref.html
-needs-focus pref(selectioncaret.enabled,false) pref(layout.accessiblecaret.enabled,false) == 824080-5.html 824080-5-ref.html
+needs-focus pref(layout.accessiblecaret.enabled,false) == 824080-4.html 824080-4-ref.html
+needs-focus pref(layout.accessiblecaret.enabled,false) == 824080-5.html 824080-5-ref.html
 needs-focus != 824080-4.html 824080-5.html
 needs-focus == 824080-6.html 824080-6-ref.html
-needs-focus pref(selectioncaret.enabled,false) pref(layout.accessiblecaret.enabled,false) == 824080-7.html 824080-7-ref.html
+needs-focus pref(layout.accessiblecaret.enabled,false) == 824080-7.html 824080-7-ref.html
 needs-focus != 824080-6.html 824080-7.html
 # Bug 674927: copy spellcheck-textarea tests to contenteditable
 == spellcheck-contenteditable-attr.html spellcheck-contenteditable-nofocus-ref.html
 fails-if(Android||B2G||Mulet) needs-focus != spellcheck-contenteditable-attr.html spellcheck-contenteditable-ref.html # B2G no spellcheck underline # Initial mulet triage: parity with B2G/B2G Desktop
 needs-focus == spellcheck-contenteditable-focused.html spellcheck-contenteditable-ref.html
 needs-focus == spellcheck-contenteditable-focused-reframe.html spellcheck-contenteditable-ref.html
 == spellcheck-contenteditable-nofocus.html spellcheck-contenteditable-disabled-ref.html
 == spellcheck-contenteditable-disabled.html spellcheck-contenteditable-disabled-ref.html
deleted file mode 100644
--- a/layout/base/tests/bug644768.html
+++ /dev/null
@@ -1,58 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=644768
--->
-<head>
-  <title>Test for Bug 644768</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
-  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body onload="test()">
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=644768">Mozilla Bug 644768</a>
-<p id="display"></p>
-<div id="content">
-<!-- test text is
-== زادروزها ==
-* [[۱۳۰۷]]
--->
- <textarea id="testInput" dir="rtl" cols="80" rows="25">
-
-== &#x0632;&#x0627;&#x062F;&#x0631;&#x0648;&#x0632;&#x0647;&#x0627; ==
-* [[&#x06F1;&#x06F3;&#x06F0;&#x06F7;]]</textarea>
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-/** Test for Bug 644768 **/
-
-SimpleTest.waitForExplicitFinish();
-
-function test() {
-  var textInput = $("testInput");
-  var s1, s2, equal, str1, str2;
-
-  textInput.focus();
-  s1 = snapshotWindow(window);
-
-  synthesizeKey("VK_UP", { });
-  synthesizeKey("VK_UP", { });
-  synthesizeKey("VK_UP", { });
-  synthesizeKey("VK_DELETE", { });
-  synthesizeKey("VK_RETURN", { });
-  // Bug 1016184: Touch caret will hide due to key event.
-  s2 = snapshotWindow(window);
-
-  [equal, str1, str2] = compareSnapshots(s1, s2, true);
-  ok(equal, "newline before bidi text shouldn't change direction: expected " +
-     str1 + " but got " + str2);
-
-  SimpleTest.finish();
-}
-
-</script>
-</pre>
-</body>
-</html>
--- a/layout/base/tests/mochitest.ini
+++ b/layout/base/tests/mochitest.ini
@@ -7,17 +7,16 @@ support-files =
   preserve3d_sorting_hit_testing_iframe.html
   image_rgrg-256x256.png
   image_rrgg-256x256.png
   bug369950-subframe.xml
   file_bug842853.sjs
   file_bug842853.html
   ../../../dom/plugins/test/mochitest/plugin-utils.js
   bug558663.html
-  bug644768.html
   bug956530-1.html
   bug956530-1-ref.html
   bug989012-1.html
   bug989012-1-ref.html
   bug989012-2.html
   bug989012-2-ref.html
   bug989012-3.html
   bug989012-3-ref.html
@@ -242,25 +241,23 @@ skip-if = true || (toolkit == 'android')
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # Bug 948948
 [test_bug687297.html]
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') # Bug 948948
 support-files =
   bug687297_a.html
   bug687297_b.html
   bug687297_c.html
 [test_bug990340.html]
-[test_bug1070851.html]
 [test_bug1080360.html]
 support-files = bug1080360_inner.html
 [test_bug1078327.html]
 support-files = bug1078327_inner.html
 [test_bug1080361.html]
 support-files = bug1080361_inner.html
 [test_frame_reconstruction_for_pseudo_elements.html]
-[test_touchcaret_visibility.html]
 [test_bug1093686.html]
 support-files = bug1093686_inner.html
 [test_bug1120705.html]
 skip-if = buildapp == 'android' || buildapp == 'b2g' || buildapp == 'b2g-debug' || os == 'mac' || toolkit == 'gtk2' || toolkit == 'gtk3' # android and b2g do not have clickable scrollbars, mac does not have scrollbar down and up buttons, gtk may or may not have scrollbar buttons depending on theme
 [test_bug1153130.html]
 support-files = bug1153130_inner.html
 [test_bug1162990.html]
 support-files =
deleted file mode 100644
--- a/layout/base/tests/test_bug1070851.html
+++ /dev/null
@@ -1,59 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1070851
--->
-<head>
-  <meta charset="utf-8">
-  <title>Test for Bug 1070851</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-
-  <style>
-  /* Eliminate the blue glow when focusing an element. */
-  input, textarea, div {
-    background: none;
-    border: none;
-    outline: none;
-  }
-  </style>
-
-  <script type="application/javascript">
-
-  /** Test for Bug 1070851 **/
-
-  SimpleTest.waitForExplicitFinish();
-
-  function testSnapshot(aElementId)
-  {
-    var noTouchCaret = snapshotWindow(window, true);
-
-    // Focus the element to make the touch caret show, but do not capture it.
-    var element = document.getElementById(aElementId);
-    element.focus();
-    var notCaptureTouchCaret = snapshotWindow(window, false);
-
-    [result, first, second] = compareSnapshots(noTouchCaret, notCaptureTouchCaret,
-                                               true);
-    ok(result, "Both snapshots of " + aElementId + " should have no touch caret." +
-       "\nFirst snapshot: " + first + "\nSecond snapshot: " + second);
-
-    element.blur();
-  }
-
-  SimpleTest.waitForFocus(function() {
-    testSnapshot('input');
-    testSnapshot('textarea');
-    testSnapshot('content');
-    SimpleTest.finish();
-  })
-  </script>
-</head>
-<body>
-  <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1070851">Mozilla Bug 1070851</a>
-  <input id="input">
-  <textarea id="textarea"></textarea>
-  <div id="content" contenteditable="true">test</div>
-</body>
-</html>
--- a/layout/base/tests/test_bug558663.html
+++ b/layout/base/tests/test_bug558663.html
@@ -21,18 +21,17 @@
     <div id="container"></div>
   </body>
   <script>
   if (navigator.platform.startsWith("Linux")) {
     // For e10s issue of bug 966157
     SimpleTest.expectAssertions(0, 2);
   }
   SimpleTest.waitForExplicitFinish();
-  // Selection caret's pref is checked only when PresShell is initialized. To turn
+  // AccessibleCaret's pref is checked only when PresShell is initialized. To turn
   // off the pref, we test bug 558663 in an iframe.
-  SpecialPowers.pushPrefEnv({"set": [['selectioncaret.enabled', false],
-                                     ['layout.accessiblecaret.enabled', false]]}, function() {
+  SpecialPowers.pushPrefEnv({"set": [['layout.accessiblecaret.enabled', false]]}, function() {
     var iframe = document.createElement("iframe");
     iframe.src = "bug558663.html";
     document.getElementById('container').appendChild(iframe);
   });
   </script>
 </html>
--- a/layout/base/tests/test_bug644768.html
+++ b/layout/base/tests/test_bug644768.html
@@ -1,28 +1,62 @@
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <!DOCTYPE html>
 <html>
+  <!--
+       https://bugzilla.mozilla.org/show_bug.cgi?id=644768
+     -->
   <head>
-    <title>Bug 644768 test</title>
-    <style>
-      iframe {
-        width: 600px;
-        height: 400px;
-      }
-    </style>
+    <title>Test for Bug 644768</title>
+    <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+    <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
+    <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+    <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
   </head>
-  <body>
-    <div id="container"></div>
+  <body onload="test()">
+    <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=644768">Mozilla Bug 644768</a>
+    <p id="display"></p>
+    <div id="content">
+      <!-- test text is
+           == زادروزها ==
+           * [[۱۳۰۷]]
+         -->
+      <textarea id="testInput" dir="rtl" cols="80" rows="25">
+
+== &#x0632;&#x0627;&#x062F;&#x0631;&#x0648;&#x0632;&#x0647;&#x0627; ==
+* [[&#x06F1;&#x06F3;&#x06F0;&#x06F7;]]</textarea>
+    </div>
+    <pre id="test">
+      <script class="testbody" type="text/javascript">
+
+      /** Test for Bug 644768 **/
+
+      SimpleTest.waitForExplicitFinish();
+
+      function test() {
+        var textInput = $("testInput");
+        var s1, s2, equal, str1, str2;
+
+        textInput.focus();
+        s1 = snapshotWindow(window);
+
+        synthesizeKey("VK_UP", { });
+        synthesizeKey("VK_UP", { });
+        synthesizeKey("VK_UP", { });
+        synthesizeKey("VK_DELETE", { });
+        synthesizeKey("VK_RETURN", { });
+        // Bug 1016184: Touch caret will hide due to key event.
+        s2 = snapshotWindow(window);
+
+        [equal, str1, str2] = compareSnapshots(s1, s2, true);
+        ok(equal, "newline before bidi text shouldn't change direction: expected " +
+                  str1 + " but got " + str2);
+
+        SimpleTest.finish();
+      }
+
+      </script>
+    </pre>
   </body>
-  <script>
-  // Touch caret's pref is checked only when PresShell is initialized. To turn
-  // off the pref, we test bug 644768 in an iframe.
-  SpecialPowers.pushPrefEnv({"set": [['touchcaret.enabled', false]]}, function() {
-    var iframe = document.createElement("iframe");
-    iframe.src = "bug644768.html";
-    document.getElementById('container').appendChild(iframe);
-  });
-  </script>
 </html>
--- a/layout/base/tests/test_reftests_with_caret.html
+++ b/layout/base/tests/test_reftests_with_caret.html
@@ -102,21 +102,19 @@ function endTest() {
 var tests = [
     [ 'bug106855-1.html' , 'bug106855-1-ref.html' ] ,
     [ 'bug106855-2.html' , 'bug106855-1-ref.html' ] ,
     [ 'bug389321-2.html' , 'bug389321-2-ref.html' ] ,
     [ 'bug613807-1.html' , 'bug613807-1-ref.html' ] ,
     [ 'bug1082486-1.html', 'bug1082486-1-ref.html'] ,
     [ 'bug1082486-2.html', 'bug1082486-2-ref.html'] ,
     // The following test cases are all involving with one sending
-    // synthesizeKey(), the other without. They fail when the touch
-    // or selection caret is enabled. Test them with these preferences off.
-    function() {SpecialPowers.pushPrefEnv({'set': [['touchcaret.enabled', false],
-                                                   ['selectioncaret.enabled', false],
-                                                   ['layout.accessiblecaret.enabled', false]]}, nextTest);} ,
+    // synthesizeKey(), the other without. They fail when accessiblecaret
+    // is enabled. Test them with the preference off.
+    function() {SpecialPowers.pushPrefEnv({'set': [['layout.accessiblecaret.enabled', false]]}, nextTest);} ,
     [ 'bug240933-1.html' , 'bug240933-1-ref.html' ] ,
     [ 'bug240933-2.html' , 'bug240933-1-ref.html' ] ,
     [ 'bug389321-1.html' , 'bug389321-1-ref.html' ] ,
     [ 'bug389321-3.html' , 'bug389321-3-ref.html' ] ,
     [ 'bug482484.html'   , 'bug482484-ref.html'   ] ,
     [ 'bug503399.html'   , 'bug503399-ref.html'   ] ,
     [ 'bug585922.html'   , 'bug585922-ref.html'   ] ,
     [ 'bug597519-1.html' , 'bug597519-1-ref.html' ] ,
@@ -152,41 +150,36 @@ var tests = [
     [ 'bug1061468.html'  , 'bug1061468-ref.html'  ] ,
     [ 'bug1097242-1.html', 'bug1097242-1-ref.html'] ,
     [ 'bug1109968-1.html', 'bug1109968-1-ref.html'] ,
     [ 'bug1109968-2.html', 'bug1109968-2-ref.html'] ,
     // [ 'bug1123067-1.html' , 'bug1123067-ref.html'  ] , TODO: bug 1129205
     [ 'bug1123067-2.html' , 'bug1123067-ref.html'  ] ,
     [ 'bug1123067-3.html' , 'bug1123067-ref.html'  ] ,
     [ 'bug1132768-1.html' , 'bug1132768-1-ref.html'] ,
-    function() {SpecialPowers.pushPrefEnv({'clear': [['touchcaret.enabled'],
-                                                     ['selectioncaret.enabled'],
-                                                     ['layout.accessiblecaret.enabled']]}, nextTest);} ,
+    function() {SpecialPowers.pushPrefEnv({'clear': [['layout.accessiblecaret.enabled']]}, nextTest);} ,
 ];
 
 if (navigator.appVersion.indexOf("Android") == -1 &&
   SpecialPowers.Services.appinfo.name != "B2G") {
-  tests.push(function() {SpecialPowers.pushPrefEnv({'set': [['touchcaret.enabled', false]]}, nextTest);});
   tests.push([ 'bug512295-1.html' , 'bug512295-1-ref.html' ]);
   tests.push([ 'bug512295-2.html' , 'bug512295-2-ref.html' ]);
   tests.push([ 'bug923376.html'   , 'bug923376-ref.html'   ]);
-  tests.push(function() {SpecialPowers.pushPrefEnv({'clear': [['touchcaret.enabled']]}, nextTest);});
   tests.push(function() {SpecialPowers.pushPrefEnv({'set': [['layout.css.overflow-clip-box.enabled', true]]}, nextTest);});
   tests.push([ 'bug966992-1.html' , 'bug966992-1-ref.html' ]);
   tests.push([ 'bug966992-2.html' , 'bug966992-2-ref.html' ]);
   tests.push([ 'bug966992-3.html' , 'bug966992-3-ref.html' ]);
   tests.push(function() {SpecialPowers.pushPrefEnv({'clear': [['layout.css.overflow-clip-box.enabled']]}, nextTest);});
 } else {
   is(SpecialPowers.getIntPref("layout.spellcheckDefault"), 0, "Spellcheck should be turned off for this platrom or this if..else check removed");
 }
 
 if (navigator.platform.indexOf("Linux") >= 0 &&
     SpecialPowers.Services.appinfo.name != "B2G") {
   tests = tests.concat([
-    function() {SpecialPowers.pushPrefEnv({'set': [['touchcaret.enabled', false]]}, nextTest);} ,
     // eDirPrevious, Shift+click
     [ 'multi-range-user-select.html#prev1S_' , 'multi-range-user-select-ref.html#prev1S_'  ] ,
     [ 'multi-range-user-select.html#prev2S_' , 'multi-range-user-select-ref.html#prev2S_'  ] ,
     [ 'multi-range-user-select.html#prev3S_' , 'multi-range-user-select-ref.html#prev3S_'  ] ,
     [ 'multi-range-user-select.html#prev4S_' , 'multi-range-user-select-ref.html#prev4S_'  ] ,
     [ 'multi-range-user-select.html#prev5S_' , 'multi-range-user-select-ref.html#prev5S_'  ] ,
     [ 'multi-range-user-select.html#prev6S_' , 'multi-range-user-select-ref.html#prev6S_'  ] ,
     [ 'multi-range-user-select.html#prev7S_' , 'multi-range-user-select-ref.html#prev7S_'  ] ,
@@ -269,17 +262,16 @@ if (navigator.platform.indexOf("Linux") 
     [ 'multi-range-script-select.html#next6SA' , 'multi-range-script-select-ref.html#next6SA'  ] ,
     [ 'multi-range-script-select.html#next7SA' , 'multi-range-script-select-ref.html#next7SA'  ] ,
     // eDirNext, Accel+drag-select (adding an additional range)
     [ 'multi-range-script-select.html#next1AD' , 'multi-range-script-select-ref.html#next1AD'  ] ,
     [ 'multi-range-script-select.html#next7AD' , 'multi-range-script-select-ref.html#next7AD'  ] ,
     // eDirNext, VK_RIGHT / LEFT
     [ 'multi-range-script-select.html#next1SR' , 'multi-range-script-select-ref.html#next1SR'  ] ,
     [ 'multi-range-script-select.html#next1SL' , 'multi-range-script-select-ref.html#next1SL'  ] ,
-    function() {SpecialPowers.pushPrefEnv({'clear': [['touchcaret.enabled']]}, nextTest);} ,
   ]);
 }
 
 var testIndex = 0;
 
 function nextTest() {
   if (testIndex < tests.length) {
     if (typeof(tests[testIndex]) == 'function') {
deleted file mode 100644
--- a/layout/base/tests/test_touchcaret_visibility.html
+++ /dev/null
@@ -1,97 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1059165
--->
-<head>
-  <meta charset="utf-8">
-  <title>Test for Bug 1070851</title>
-  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="application/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-
-  <style>
-  /* Eliminate the blue glow when focusing an element. */
-  input, textarea, div {
-    background: none;
-    border: none;
-    outline: none;
-  }
-  </style>
-
-  <script type="application/javascript;version=1.7">
-
-  /** Test for Bug 1059165 **/
-
-  SimpleTest.waitForExplicitFinish();
-
-  function replaceContent(aElement, aTextToReplace)
-  {
-    // The element is an input or a textarea.
-    if (typeof aElement.value != "undefined") {
-      aElement.value = aTextToReplace;
-    } else {
-      aElement.innerHTML = aTextToReplace;
-    }
-  }
-
-  function runTest(aSelector, aTextToReplace)
-  {
-    let snapshotCaret = true;
-
-    let element = document.querySelector(aSelector);
-
-    // Reset the content in the element.
-    replaceContent(element, "");
-
-    element.focus();
-    let noTouchCaret = snapshotWindow(window, snapshotCaret);
-
-    // Insert content with a space to the element so that it makes no difference
-    // visually in the snapshots.
-    replaceContent(element, aTextToReplace);
-
-    // Move caret to the front so that the caret position is the same as in the
-    // first snapshot.
-    sendKey('LEFT');
-
-    element.blur();
-    element.focus();
-    let hasTouchCaret = snapshotWindow(window, snapshotCaret);
-
-    // If touch caret is enabled, the two snapshots should be different.
-    let expected = !SpecialPowers.getBoolPref("touchcaret.enabled");
-    let [result, first, second] = compareSnapshots(noTouchCaret, hasTouchCaret,
-                                                   expected);
-
-    let message = "First snapshot of " + aSelector + " shouldn't have touch caret.  " +
-                  "Second snapshot of " + aSelector + " with content \'" +
-                   aTextToReplace + "\' should have touch caret.\n";
-
-    if(!result) {
-      message += "First snapshot: " + first + "\nSecond snapshot: " + second;
-    }
-
-    ok(result, message);
-
-    element.blur();
-  }
-
-  SimpleTest.waitForFocus(function() {
-    runTest('input', " ");
-    runTest('textarea', " ");
-    runTest('div', "&nbsp;");
-    runTest('div', "<span>&nbsp;</span>");
-
-    SimpleTest.finish();
-  })
-  </script>
-</head>
-<body>
-  <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1059165">Mozilla Bug 1059165</a>
-  <input>
-  <textarea></textarea>
-  <div contenteditable="true"></div>
-</body>
-</html>