Bug 1439288 - Remove unused synthesizeText function. r?ato draft
authorCameron McCormack <cam@mcc.id.au>
Mon, 19 Feb 2018 10:52:39 +0800
changeset 756874 717aca4170fc0951cf7db8fb88473cf16c2fcfdd
parent 756852 ad133cd410a719c0b67e61b8d3b1c77a32fd80a9
child 756878 c0c70356451c0faba5d8fa7ac60dd07a460da8f7
push id99570
push userbmo:cam@mcc.id.au
push dateMon, 19 Feb 2018 02:54:16 +0000
reviewersato
bugs1439288
milestone60.0a1
Bug 1439288 - Remove unused synthesizeText function. r?ato MozReview-Commit-ID: 6XjmPbUmXWq
testing/marionette/event.js
--- a/testing/marionette/event.js
+++ b/testing/marionette/event.js
@@ -1030,99 +1030,16 @@ event.synthesizeKeyExpectEvent = functio
  *     Window object.  Defaults to the current window.
  */
 event.synthesizeComposition = function(ev, window = undefined) {
   let domutils = getDOMWindowUtils(window);
   domutils.sendCompositionEvent(ev.type, ev.data || "", ev.locale || "");
 };
 
 /**
- * Synthesize a text event.
- *
- * The text event's information, this has |composition| and |caret|
- * members.  |composition| has |string| and |clauses| members. |clauses|
- * must be array object.  Each object has |length| and |attr|.
- * And |caret| has |start| and |length|.  See the following tree image.
- *
- *     ev
- *      +-- composition
- *      |     +-- string
- *      |     +-- clauses[]
- *      |           +-- length
- *      |           +-- attr
- *      +-- caret
- *            +-- start
- *            +-- length
- *
- * Set the composition string to |composition.string|.  Set its clauses
- * information to the |clauses| array.
- *
- * When it's composing, set the each clauses' length
- * to the |composition.clauses[n].length|.  The sum
- * of the all length values must be same as the length of
- * |composition.string|. Set nsIDOMWindowUtils.COMPOSITION_ATTR_* to the
- * |composition.clauses[n].attr|.
- *
- * When it's not composing, set 0 to the |composition.clauses[0].length|
- * and |composition.clauses[0].attr|.
- *
- * Set caret position to the |caret.start|. Its offset from the start of
- * the composition string.  Set caret length to |caret.length|.  If it's
- * larger than 0, it should be wide caret.  However, current nsEditor
- * doesn't support wide caret, therefore, you should always set 0 now.
- *
- * @param {Object.<string, ?>} ev
- *     The text event's information,
- * @param {Window=} window
- *     Window object.  Defaults to the current window.
- */
-event.synthesizeText = function(ev, window = undefined) {
-  let domutils = getDOMWindowUtils(window);
-
-  if (!ev.composition ||
-      !ev.composition.clauses ||
-      !ev.composition.clauses[0]) {
-    return;
-  }
-
-  let firstClauseLength = ev.composition.clauses[0].length;
-  let firstClauseAttr   = ev.composition.clauses[0].attr;
-  let secondClauseLength = 0;
-  let secondClauseAttr = 0;
-  let thirdClauseLength = 0;
-  let thirdClauseAttr = 0;
-  if (ev.composition.clauses[1]) {
-    secondClauseLength = ev.composition.clauses[1].length;
-    secondClauseAttr   = ev.composition.clauses[1].attr;
-    if (event.composition.clauses[2]) {
-      thirdClauseLength = ev.composition.clauses[2].length;
-      thirdClauseAttr   = ev.composition.clauses[2].attr;
-    }
-  }
-
-  let caretStart = -1;
-  let caretLength = 0;
-  if (event.caret) {
-    caretStart = ev.caret.start;
-    caretLength = ev.caret.length;
-  }
-
-  domutils.sendTextEvent(
-      ev.composition.string,
-      firstClauseLength,
-      firstClauseAttr,
-      secondClauseLength,
-      secondClauseAttr,
-      thirdClauseLength,
-      thirdClauseAttr,
-      caretStart,
-      caretLength);
-};
-
-/**
  * Synthesize a query selected text event.
  *
  * @param {Window=}
  *     Window object.  Defaults to the current window.
  *
  * @return {(nsIQueryContentEventResult|null)}
  *     Event's result, or null if it failed.
  */