| Index: Source/devtools/blink/chromeServerProfile/Default/Cache/f_000045
|
| diff --git a/Source/devtools/front_end/TextPrompt.js b/Source/devtools/blink/chromeServerProfile/Default/Cache/f_000045
|
| similarity index 93%
|
| copy from Source/devtools/front_end/TextPrompt.js
|
| copy to Source/devtools/blink/chromeServerProfile/Default/Cache/f_000045
|
| index be8d39100727febc5c8a946f7bdabfdb9547c38f..3ad875f45fab620459f70a16f37114ccb32433ab 100644
|
| --- a/Source/devtools/front_end/TextPrompt.js
|
| +++ b/Source/devtools/blink/chromeServerProfile/Default/Cache/f_000045
|
| @@ -109,20 +109,18 @@ WebInspector.TextPrompt.prototype = {
|
| this._element = element;
|
|
|
| this._boundOnKeyDown = this.onKeyDown.bind(this);
|
| - this._boundOnInput = this.onInput.bind(this);
|
| this._boundOnMouseWheel = this.onMouseWheel.bind(this);
|
| this._boundSelectStart = this._selectStart.bind(this);
|
| - this._boundRemoveSuggestionAids = this._removeSuggestionAids.bind(this);
|
| + this._boundHideSuggestBox = this.hideSuggestBox.bind(this);
|
| this._proxyElement = element.ownerDocument.createElement("span");
|
| this._proxyElement.style.display = this._proxyElementDisplay;
|
| element.parentElement.insertBefore(this.proxyElement, element);
|
| this.proxyElement.appendChild(element);
|
| this._element.classList.add("text-prompt");
|
| this._element.addEventListener("keydown", this._boundOnKeyDown, false);
|
| - this._element.addEventListener("input", this._boundOnInput, false);
|
| this._element.addEventListener("mousewheel", this._boundOnMouseWheel, false);
|
| this._element.addEventListener("selectstart", this._boundSelectStart, false);
|
| - this._element.addEventListener("blur", this._boundRemoveSuggestionAids, false);
|
| + this._element.addEventListener("blur", this._boundHideSuggestBox, false);
|
|
|
| if (typeof this._suggestBoxClassName === "string")
|
| this._suggestBox = new WebInspector.SuggestBox(this, this._element, this._suggestBoxClassName);
|
| @@ -137,6 +135,9 @@ WebInspector.TextPrompt.prototype = {
|
| this.proxyElement.remove();
|
| delete this._proxyElement;
|
| this._element.classList.remove("text-prompt");
|
| + this._element.removeEventListener("keydown", this._boundOnKeyDown, false);
|
| + this._element.removeEventListener("mousewheel", this._boundOnMouseWheel, false);
|
| + this._element.removeEventListener("selectstart", this._boundSelectStart, false);
|
| WebInspector.restoreFocusFromElement(this._element);
|
| },
|
|
|
| @@ -169,9 +170,8 @@ WebInspector.TextPrompt.prototype = {
|
| {
|
| this.clearAutoComplete(true);
|
| this._element.removeEventListener("keydown", this._boundOnKeyDown, false);
|
| - this._element.removeEventListener("input", this._boundOnInput, false);
|
| this._element.removeEventListener("selectstart", this._boundSelectStart, false);
|
| - this._element.removeEventListener("blur", this._boundRemoveSuggestionAids, false);
|
| + this._element.removeEventListener("blur", this._boundHideSuggestBox, false);
|
| if (this._isEditing)
|
| this._stopEditing();
|
| if (this._suggestBox)
|
| @@ -236,6 +236,16 @@ WebInspector.TextPrompt.prototype = {
|
|
|
| /**
|
| * @param {boolean=} force
|
| + * @return {boolean}
|
| + */
|
| + defaultKeyHandler: function(event, force)
|
| + {
|
| + this._updateAutoComplete(force);
|
| + return false;
|
| + },
|
| +
|
| + /**
|
| + * @param {boolean=} force
|
| */
|
| _updateAutoComplete: function(force)
|
| {
|
| @@ -253,11 +263,12 @@ WebInspector.TextPrompt.prototype = {
|
|
|
| /**
|
| * @param {?Event} event
|
| + * @return {boolean}
|
| */
|
| onKeyDown: function(event)
|
| {
|
| var handled = false;
|
| - delete this._needUpdateAutocomplete;
|
| + var invokeDefault = true;
|
|
|
| switch (event.keyIdentifier) {
|
| case "U+0009": // Tab
|
| @@ -266,6 +277,7 @@ WebInspector.TextPrompt.prototype = {
|
| case "Left":
|
| case "Home":
|
| this._removeSuggestionAids();
|
| + invokeDefault = false;
|
| break;
|
| case "Right":
|
| case "End":
|
| @@ -273,6 +285,7 @@ WebInspector.TextPrompt.prototype = {
|
| handled = this.acceptAutoComplete();
|
| else
|
| this._removeSuggestionAids();
|
| + invokeDefault = false;
|
| break;
|
| case "U+001B": // Esc
|
| if (this.isSuggestBoxVisible()) {
|
| @@ -282,7 +295,7 @@ WebInspector.TextPrompt.prototype = {
|
| break;
|
| case "U+0020": // Space
|
| if (event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey) {
|
| - this._updateAutoComplete(true);
|
| + this.defaultKeyHandler(event, true);
|
| handled = true;
|
| }
|
| break;
|
| @@ -290,26 +303,20 @@ WebInspector.TextPrompt.prototype = {
|
| case "Meta":
|
| case "Shift":
|
| case "Control":
|
| + invokeDefault = false;
|
| break;
|
| }
|
|
|
| if (!handled && this.isSuggestBoxVisible())
|
| handled = this._suggestBox.keyPressed(event);
|
|
|
| - if (!handled)
|
| - this._needUpdateAutocomplete = true;
|
| + if (!handled && invokeDefault)
|
| + handled = this.defaultKeyHandler(event);
|
|
|
| if (handled)
|
| event.consume(true);
|
| - },
|
|
|
| - /**
|
| - * @param {?Event} event
|
| - */
|
| - onInput: function(event)
|
| - {
|
| - if (this._needUpdateAutocomplete)
|
| - this._updateAutoComplete();
|
| + return handled;
|
| },
|
|
|
| /**
|
| @@ -342,6 +349,24 @@ WebInspector.TextPrompt.prototype = {
|
|
|
| this.autoCompleteElement.remove();
|
| delete this.autoCompleteElement;
|
| +
|
| + if (!this._userEnteredRange || !this._userEnteredText)
|
| + return;
|
| +
|
| + this._userEnteredRange.deleteContents();
|
| + this._element.normalize();
|
| +
|
| + var userTextNode = document.createTextNode(this._userEnteredText);
|
| + this._userEnteredRange.insertNode(userTextNode);
|
| +
|
| + var selectionRange = document.createRange();
|
| + selectionRange.setStart(userTextNode, this._userEnteredText.length);
|
| + selectionRange.setEnd(userTextNode, this._userEnteredText.length);
|
| +
|
| + var selection = window.getSelection();
|
| + selection.removeAllRanges();
|
| + selection.addRange(selectionRange);
|
| +
|
| delete this._userEnteredRange;
|
| delete this._userEnteredText;
|
| },
|
| @@ -846,21 +871,22 @@ WebInspector.TextPromptWithHistory.prototype = {
|
|
|
| /**
|
| * @override
|
| + * @return {boolean}
|
| */
|
| - onKeyDown: function(event)
|
| + defaultKeyHandler: function(event, force)
|
| {
|
| var newText;
|
| var isPrevious;
|
|
|
| switch (event.keyIdentifier) {
|
| case "Up":
|
| - if (!this.isCaretOnFirstLine() || this.isSuggestBoxVisible())
|
| + if (!this.isCaretOnFirstLine())
|
| break;
|
| newText = this._previous();
|
| isPrevious = true;
|
| break;
|
| case "Down":
|
| - if (!this.isCaretOnLastLine() || this.isSuggestBoxVisible())
|
| + if (!this.isCaretOnLastLine())
|
| break;
|
| newText = this._next();
|
| break;
|
| @@ -896,10 +922,10 @@ WebInspector.TextPromptWithHistory.prototype = {
|
| }
|
| }
|
|
|
| - return;
|
| + return true;
|
| }
|
|
|
| - WebInspector.TextPrompt.prototype.onKeyDown.apply(this, arguments);
|
| + return WebInspector.TextPrompt.prototype.defaultKeyHandler.apply(this, arguments);
|
| },
|
|
|
| __proto__: WebInspector.TextPrompt.prototype
|
|
|