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

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

Issue 727823002: [DevTools] Ban getSelection, requestAnimationFrame, cancelAnimationFrame global functions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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
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 a5d99f82b4f3e806c13ff927e934209424eeb327..024102969a8a686fcd9158d66876493e4dd02ab2 100644
--- a/Source/devtools/front_end/ui/TextPrompt.js
+++ b/Source/devtools/front_end/ui/TextPrompt.js
@@ -239,7 +239,7 @@ WebInspector.TextPrompt.prototype = {
function moveBackIfOutside()
{
delete this._selectionTimeout;
- if (!this.isCaretInsidePrompt() && window.getSelection().isCollapsed) {
+ if (!this.isCaretInsidePrompt() && this._element.window().getSelection().isCollapsed) {
this.moveCaretToEndOfPrompt();
this.autoCompleteSoon();
}
@@ -377,7 +377,7 @@ WebInspector.TextPrompt.prototype = {
complete: function(force, reverse)
{
this.clearAutoComplete(true);
- var selection = window.getSelection();
+ var selection = this._element.window().getSelection();
if (!selection.rangeCount)
return;
@@ -570,7 +570,7 @@ WebInspector.TextPrompt.prototype = {
finalSelectionRange.setEnd(completionTextNode, completionText.length);
- var selection = window.getSelection();
+ var selection = this._element.window().getSelection();
selection.removeAllRanges();
selection.addRange(finalSelectionRange);
if (isIntermediateSuggestion)
@@ -603,7 +603,7 @@ WebInspector.TextPrompt.prototype = {
finalSelectionRange.setStart(textNode, text.length);
finalSelectionRange.setEnd(textNode, text.length);
- var selection = window.getSelection();
+ var selection = this._element.window().getSelection();
selection.removeAllRanges();
selection.addRange(finalSelectionRange);
@@ -643,7 +643,7 @@ WebInspector.TextPrompt.prototype = {
*/
isCaretAtEndOfPrompt: function()
{
- var selection = window.getSelection();
+ var selection = this._element.window().getSelection();
if (!selection.rangeCount || !selection.isCollapsed)
return false;
@@ -674,7 +674,7 @@ WebInspector.TextPrompt.prototype = {
*/
isCaretOnFirstLine: function()
{
- var selection = window.getSelection();
+ var selection = this._element.window().getSelection();
var focusNode = selection.focusNode;
if (!focusNode || focusNode.nodeType !== Node.TEXT_NODE || focusNode.parentNode !== this._element)
return true;
@@ -699,7 +699,7 @@ WebInspector.TextPrompt.prototype = {
*/
isCaretOnLastLine: function()
{
- var selection = window.getSelection();
+ var selection = this._element.window().getSelection();
var focusNode = selection.focusNode;
if (!focusNode || focusNode.nodeType !== Node.TEXT_NODE || focusNode.parentNode !== this._element)
return true;
@@ -721,7 +721,7 @@ WebInspector.TextPrompt.prototype = {
moveCaretToEndOfPrompt: function()
{
- var selection = window.getSelection();
+ var selection = this._element.window().getSelection();
var selectionRange = this._createRange();
var offset = this._element.childNodes.length;
@@ -905,7 +905,7 @@ WebInspector.TextPromptWithHistory.prototype = {
if (firstNewlineIndex === -1)
this.moveCaretToEndOfPrompt();
else {
- var selection = window.getSelection();
+ var selection = this._element.window().getSelection();
var selectionRange = this._createRange();
selectionRange.setStart(this._element.firstChild, firstNewlineIndex);

Powered by Google App Engine
This is Rietveld 408576698