зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1439288 - Remove unused synthesizeText function. r=ato
MozReview-Commit-ID: 6XjmPbUmXWq --HG-- extra : rebase_source : 4850215ce177d1418546674ce545edc16d50de90
This commit is contained in:
Родитель
5dc6ad75e7
Коммит
f7a8ac6c75
|
@ -1034,89 +1034,6 @@ event.synthesizeComposition = function(ev, window = undefined) {
|
|||
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.
|
||||
*
|
||||
|
|
Загрузка…
Ссылка в новой задаче