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

Side by Side Diff: Source/devtools/front_end/resources/DatabaseQueryView.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 this.element.addEventListener("click", this._messagesClicked.bind(this), tru e); 50 this.element.addEventListener("click", this._messagesClicked.bind(this), tru e);
51 } 51 }
52 52
53 WebInspector.DatabaseQueryView.Events = { 53 WebInspector.DatabaseQueryView.Events = {
54 SchemaUpdated: "SchemaUpdated" 54 SchemaUpdated: "SchemaUpdated"
55 } 55 }
56 56
57 WebInspector.DatabaseQueryView.prototype = { 57 WebInspector.DatabaseQueryView.prototype = {
58 _messagesClicked: function() 58 _messagesClicked: function()
59 { 59 {
60 if (!this._prompt.isCaretInsidePrompt() && window.getSelection().isColla psed) 60 if (!this._prompt.isCaretInsidePrompt() && this.element.window().getSele ction().isCollapsed)
61 this._prompt.moveCaretToEndOfPrompt(); 61 this._prompt.moveCaretToEndOfPrompt();
62 }, 62 },
63 63
64 /** 64 /**
65 * @param {!Element} proxyElement 65 * @param {!Element} proxyElement
66 * @param {!Range} wordRange 66 * @param {!Range} wordRange
67 * @param {boolean} force 67 * @param {boolean} force
68 * @param {function(!Array.<string>, number=)} completionsReadyCallback 68 * @param {function(!Array.<string>, number=)} completionsReadyCallback
69 */ 69 */
70 completions: function(proxyElement, wordRange, force, completionsReadyCallba ck) 70 completions: function(proxyElement, wordRange, force, completionsReadyCallba ck)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 clearTimeout(this._selectionTimeout); 102 clearTimeout(this._selectionTimeout);
103 103
104 this._prompt.clearAutoComplete(); 104 this._prompt.clearAutoComplete();
105 105
106 /** 106 /**
107 * @this {WebInspector.DatabaseQueryView} 107 * @this {WebInspector.DatabaseQueryView}
108 */ 108 */
109 function moveBackIfOutside() 109 function moveBackIfOutside()
110 { 110 {
111 delete this._selectionTimeout; 111 delete this._selectionTimeout;
112 if (!this._prompt.isCaretInsidePrompt() && window.getSelection().isC ollapsed) 112 if (!this._prompt.isCaretInsidePrompt() && this.element.window().get Selection().isCollapsed)
113 this._prompt.moveCaretToEndOfPrompt(); 113 this._prompt.moveCaretToEndOfPrompt();
114 this._prompt.autoCompleteSoon(); 114 this._prompt.autoCompleteSoon();
115 } 115 }
116 116
117 this._selectionTimeout = setTimeout(moveBackIfOutside.bind(this), 100); 117 this._selectionTimeout = setTimeout(moveBackIfOutside.bind(this), 100);
118 }, 118 },
119 119
120 _promptKeyDown: function(event) 120 _promptKeyDown: function(event)
121 { 121 {
122 if (isEnterKey(event)) { 122 if (isEnterKey(event)) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 element.appendChild(commandTextElement); 198 element.appendChild(commandTextElement);
199 199
200 var resultElement = createElement("div"); 200 var resultElement = createElement("div");
201 resultElement.className = "database-query-result"; 201 resultElement.className = "database-query-result";
202 element.appendChild(resultElement); 202 element.appendChild(resultElement);
203 return resultElement; 203 return resultElement;
204 }, 204 },
205 205
206 __proto__: WebInspector.VBox.prototype 206 __proto__: WebInspector.VBox.prototype
207 } 207 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698