Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1205)

Unified Diff: Source/devtools/front_end/ui/TextPrompt.js

Issue 663083004: [DevTools] Remove remaining usages of global properties. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed review comments Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/ui/SuggestBox.js ('k') | Source/devtools/front_end/ui/UIUtils.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/ui/TextPrompt.js
diff --git a/Source/devtools/front_end/ui/TextPrompt.js b/Source/devtools/front_end/ui/TextPrompt.js
index d9bd0a311b0e0074a25f0101c77161c8f577ef5a..0e63e8312e1012938ed0d199cb541c07146f490b 100644
--- a/Source/devtools/front_end/ui/TextPrompt.js
+++ b/Source/devtools/front_end/ui/TextPrompt.js
@@ -445,6 +445,15 @@ WebInspector.TextPrompt.prototype = {
},
/**
+ * @return {?Range}
+ * @suppressGlobalPropertiesCheck
+ */
+ _createRange: function()
+ {
+ return document.createRange();
+ },
+
+ /**
* @param {!Selection} selection
* @param {!Range} originalWordPrefixRange
* @param {boolean} reverse
@@ -461,7 +470,7 @@ WebInspector.TextPrompt.prototype = {
var selectionRange = selection.getRangeAt(0);
- var fullWordRange = document.createRange();
+ var fullWordRange = this._createRange();
fullWordRange.setStart(originalWordPrefixRange.startContainer, originalWordPrefixRange.startOffset);
fullWordRange.setEnd(selectionRange.endContainer, selectionRange.endOffset);
@@ -488,7 +497,7 @@ WebInspector.TextPrompt.prototype = {
var suffixText = completionText.substring(wordPrefixLength);
this._userEnteredRange.deleteContents();
this._element.normalize();
- var finalSelectionRange = document.createRange();
+ var finalSelectionRange = this._createRange();
var prefixTextNode = createTextNode(prefixText);
fullWordRange.insertNode(prefixTextNode);
@@ -544,7 +553,7 @@ WebInspector.TextPrompt.prototype = {
this._userEnteredRange.deleteContents();
this._element.normalize();
- var finalSelectionRange = document.createRange();
+ var finalSelectionRange = this._createRange();
var completionTextNode = createTextNode(completionText);
this._userEnteredRange.insertNode(completionTextNode);
if (this.autoCompleteElement) {
@@ -588,7 +597,7 @@ WebInspector.TextPrompt.prototype = {
this.autoCompleteElement.parentNode.replaceChild(textNode, this.autoCompleteElement);
delete this.autoCompleteElement;
- var finalSelectionRange = document.createRange();
+ var finalSelectionRange = this._createRange();
finalSelectionRange.setStart(textNode, text.length);
finalSelectionRange.setEnd(textNode, text.length);
@@ -711,7 +720,7 @@ WebInspector.TextPrompt.prototype = {
moveCaretToEndOfPrompt: function()
{
var selection = window.getSelection();
- var selectionRange = document.createRange();
+ var selectionRange = this._createRange();
var offset = this._element.childNodes.length;
selectionRange.setStart(this._element, offset);
@@ -895,7 +904,7 @@ WebInspector.TextPromptWithHistory.prototype = {
this.moveCaretToEndOfPrompt();
else {
var selection = window.getSelection();
- var selectionRange = document.createRange();
+ var selectionRange = this._createRange();
selectionRange.setStart(this._element.firstChild, firstNewlineIndex);
selectionRange.setEnd(this._element.firstChild, firstNewlineIndex);
« no previous file with comments | « Source/devtools/front_end/ui/SuggestBox.js ('k') | Source/devtools/front_end/ui/UIUtils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698