Backed out changeset 54ddff6ebfa5 (bug 675579)
authorEd Morley <emorley@mozilla.com>
Fri, 17 Jan 2014 15:07:01 +0000
changeset 163962 f5efef8989a538c339c014fdd45b49e872ab743b
parent 163961 3687b6b2e48d0a2e9437380ababcfa0b16cf03de
child 163963 d8f664832da327aa16e7e41a9f591ad3806523dc
push id38594
push useremorley@mozilla.com
push dateFri, 17 Jan 2014 15:07:39 +0000
treeherdermozilla-inbound@d8f664832da3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs675579
milestone29.0a1
backs out54ddff6ebfa5da5bdea7d14520d49e187f696833
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 54ddff6ebfa5 (bug 675579)
editor/libeditor/base/nsEditor.cpp
editor/libeditor/base/nsEditor.h
editor/libeditor/text/tests/test_bug629172.html
--- a/editor/libeditor/base/nsEditor.cpp
+++ b/editor/libeditor/base/nsEditor.cpp
@@ -1846,22 +1846,16 @@ void nsEditor::NotifyEditorObservers(voi
   for (int32_t i = 0; i < mEditorObservers.Count(); i++) {
     mEditorObservers[i]->EditAction();
   }
 
   if (!mDispatchInputEvent) {
     return;
   }
 
-  FireInputEvent();
-}
-
-void
-nsEditor::FireInputEvent()
-{
   // We don't need to dispatch multiple input events if there is a pending
   // input event.  However, it may have different event target.  If we resolved
   // this issue, we need to manage the pending events in an array.  But it's
   // overwork.  We don't need to do it for the very rare case.
 
   nsCOMPtr<nsIContent> target = GetInputEventTargetContent();
   NS_ENSURE_TRUE_VOID(target);
 
@@ -5065,20 +5059,16 @@ nsEditor::SwitchTextDirection()
   } else if (mFlags & nsIPlaintextEditor::eEditorLeftToRight) {
     NS_ASSERTION(!(mFlags & nsIPlaintextEditor::eEditorRightToLeft),
                  "Unexpected mutually exclusive flag");
     mFlags |= nsIPlaintextEditor::eEditorRightToLeft;
     mFlags &= ~nsIPlaintextEditor::eEditorLeftToRight;
     rv = rootElement->SetAttr(kNameSpaceID_None, nsGkAtoms::dir, NS_LITERAL_STRING("rtl"), true);
   }
 
-  if (NS_SUCCEEDED(rv)) {
-    FireInputEvent();
-  }
-
   return rv;
 }
 
 void
 nsEditor::SwitchTextDirectionTo(uint32_t aDirection)
 {
   // Get the current root direction from its frame
   nsIContent* rootElement = GetExposedRoot();
@@ -5088,28 +5078,24 @@ nsEditor::SwitchTextDirectionTo(uint32_t
 
   // Apply the requested direction
   if (aDirection == nsIPlaintextEditor::eEditorLeftToRight &&
       (mFlags & nsIPlaintextEditor::eEditorRightToLeft)) {
     NS_ASSERTION(!(mFlags & nsIPlaintextEditor::eEditorLeftToRight),
                  "Unexpected mutually exclusive flag");
     mFlags &= ~nsIPlaintextEditor::eEditorRightToLeft;
     mFlags |= nsIPlaintextEditor::eEditorLeftToRight;
-    rv = rootElement->SetAttr(kNameSpaceID_None, nsGkAtoms::dir, NS_LITERAL_STRING("ltr"), true);
+    rootElement->SetAttr(kNameSpaceID_None, nsGkAtoms::dir, NS_LITERAL_STRING("ltr"), true);
   } else if (aDirection == nsIPlaintextEditor::eEditorRightToLeft &&
              (mFlags & nsIPlaintextEditor::eEditorLeftToRight)) {
     NS_ASSERTION(!(mFlags & nsIPlaintextEditor::eEditorRightToLeft),
                  "Unexpected mutually exclusive flag");
     mFlags |= nsIPlaintextEditor::eEditorRightToLeft;
     mFlags &= ~nsIPlaintextEditor::eEditorLeftToRight;
-    rv = rootElement->SetAttr(kNameSpaceID_None, nsGkAtoms::dir, NS_LITERAL_STRING("rtl"), true);
-  }
-
-  if (NS_SUCCEEDED(rv)) {
-    FireInputEvent();
+    rootElement->SetAttr(kNameSpaceID_None, nsGkAtoms::dir, NS_LITERAL_STRING("rtl"), true);
   }
 }
 
 #if DEBUG_JOE
 void
 nsEditor::DumpNode(nsIDOMNode *aNode, int32_t indent)
 {
   int32_t i;
--- a/editor/libeditor/base/nsEditor.h
+++ b/editor/libeditor/base/nsEditor.h
@@ -246,17 +246,16 @@ public:
   virtual nsresult UpdateIMEComposition(const nsAString &aCompositionString,
                                         nsIPrivateTextRangeList *aTextRange)=0;
   void EndIMEComposition();
 
   void SwitchTextDirectionTo(uint32_t aDirection);
 
 protected:
   nsresult DetermineCurrentDirection();
-  void FireInputEvent();
 
   /** create a transaction for setting aAttribute to aValue on aElement
     */
   NS_IMETHOD CreateTxnForSetAttribute(mozilla::dom::Element *aElement,
                                       const nsAString &  aAttribute,
                                       const nsAString &  aValue,
                                       ChangeAttributeTxn ** aTxn);
 
--- a/editor/libeditor/text/tests/test_bug629172.html
+++ b/editor/libeditor/text/tests/test_bug629172.html
@@ -43,36 +43,30 @@ SimpleTest.waitForFocus(function() {
       return this[dir];
     }
   };
 
   function testDirection(initialDir) {
     var t = document.createElement("textarea");
     t.setAttribute("dir", initialDir);
     t.value = "test.";
-    var inputEventCount = 0;
-    t.oninput = function() { inputEventCount++; };
     document.getElementById("content").appendChild(t);
     document.body.clientWidth;
     var s1 = snapshotWindow(window);
     ok(compareSnapshots(s1, Screenshots.get(initialDir, false), true)[0],
        "Textarea should appear correctly before switching the direction (" + initialDir + ")");
     t.focus();
-    is(inputEventCount, 0, "input event count must be 0 before");
     synthesizeKey("x", {accelKey: true, shiftKey: true});
     is(t.getAttribute("dir"), initialDir == "ltr" ? "rtl" : "ltr", "The dir attribute must be correctly updated");
-    is(inputEventCount, 1, "input event count must be 1 after");
     t.blur();
     var s2 = snapshotWindow(window);
     ok(compareSnapshots(s2, Screenshots.get(initialDir, true), true)[0],
        "Textarea should appear correctly after switching the direction (" + initialDir + ")");
     t.focus();
-    is(inputEventCount, 1, "input event count must be 1 before");
     synthesizeKey("x", {accelKey: true, shiftKey: true});
-    is(inputEventCount, 2, "input event count must be 2 after");
     is(t.getAttribute("dir"), initialDir == "ltr" ? "ltr" : "rtl", "The dir attribute must be correctly updated");
     t.blur();
     var s3 = snapshotWindow(window);
     ok(compareSnapshots(s3, Screenshots.get(initialDir, false), true)[0],
        "Textarea should appear correctly after switching back the direction (" + initialDir + ")");
     t.parentNode.removeChild(t);
   }