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

Side by Side Diff: Source/devtools/front_end/resources/IndexedDBViews.js

Issue 662793002: [DevTools] Replace usages of document with custom functions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 this.update(database); 63 this.update(database);
64 } 64 }
65 65
66 WebInspector.IDBDatabaseView.prototype = { 66 WebInspector.IDBDatabaseView.prototype = {
67 /** 67 /**
68 * @param {string} name 68 * @param {string} name
69 * @param {string} value 69 * @param {string} value
70 */ 70 */
71 _formatHeader: function(name, value) 71 _formatHeader: function(name, value)
72 { 72 {
73 var fragment = document.createDocumentFragment(); 73 var fragment = createDocumentFragment();
74 fragment.createChild("div", "attribute-name").textContent = name + ":"; 74 fragment.createChild("div", "attribute-name").textContent = name + ":";
75 fragment.createChild("div", "attribute-value source-code").textContent = value; 75 fragment.createChild("div", "attribute-value source-code").textContent = value;
76 76
77 return fragment; 77 return fragment;
78 }, 78 },
79 79
80 _refreshDatabase: function() 80 _refreshDatabase: function()
81 { 81 {
82 this._securityOriginTreeElement.title = this._formatHeader(WebInspector. UIString("Security origin"), this._database.databaseId.securityOrigin); 82 this._securityOriginTreeElement.title = this._formatHeader(WebInspector. UIString("Security origin"), this._database.databaseId.securityOrigin);
83 this._nameTreeElement.title = this._formatHeader(WebInspector.UIString(" Name"), this._database.databaseId.name); 83 this._nameTreeElement.title = this._formatHeader(WebInspector.UIString(" Name"), this._database.databaseId.name);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 return dataGrid; 155 return dataGrid;
156 }, 156 },
157 157
158 /** 158 /**
159 * @param {string} prefix 159 * @param {string} prefix
160 * @param {*} keyPath 160 * @param {*} keyPath
161 * @return {!DocumentFragment} 161 * @return {!DocumentFragment}
162 */ 162 */
163 _keyColumnHeaderFragment: function(prefix, keyPath) 163 _keyColumnHeaderFragment: function(prefix, keyPath)
164 { 164 {
165 var keyColumnHeaderFragment = document.createDocumentFragment(); 165 var keyColumnHeaderFragment = createDocumentFragment();
166 keyColumnHeaderFragment.createTextChild(prefix); 166 keyColumnHeaderFragment.createTextChild(prefix);
167 if (keyPath === null) 167 if (keyPath === null)
168 return keyColumnHeaderFragment; 168 return keyColumnHeaderFragment;
169 169
170 keyColumnHeaderFragment.createTextChild(" (" + WebInspector.UIString("Ke y path: ")); 170 keyColumnHeaderFragment.createTextChild(" (" + WebInspector.UIString("Ke y path: "));
171 if (keyPath instanceof Array) { 171 if (keyPath instanceof Array) {
172 keyColumnHeaderFragment.createTextChild("["); 172 keyColumnHeaderFragment.createTextChild("[");
173 for (var i = 0; i < keyPath.length; ++i) { 173 for (var i = 0; i < keyPath.length; ++i) {
174 if (i != 0) 174 if (i != 0)
175 keyColumnHeaderFragment.createTextChild(", "); 175 keyColumnHeaderFragment.createTextChild(", ");
176 keyColumnHeaderFragment.appendChild(this._keyPathStringFragment( keyPath[i])); 176 keyColumnHeaderFragment.appendChild(this._keyPathStringFragment( keyPath[i]));
177 } 177 }
178 keyColumnHeaderFragment.createTextChild("]"); 178 keyColumnHeaderFragment.createTextChild("]");
179 } else { 179 } else {
180 var keyPathString = /** @type {string} */ (keyPath); 180 var keyPathString = /** @type {string} */ (keyPath);
181 keyColumnHeaderFragment.appendChild(this._keyPathStringFragment(keyP athString)); 181 keyColumnHeaderFragment.appendChild(this._keyPathStringFragment(keyP athString));
182 } 182 }
183 keyColumnHeaderFragment.createTextChild(")"); 183 keyColumnHeaderFragment.createTextChild(")");
184 return keyColumnHeaderFragment; 184 return keyColumnHeaderFragment;
185 }, 185 },
186 186
187 /** 187 /**
188 * @param {string} keyPathString 188 * @param {string} keyPathString
189 * @return {!DocumentFragment} 189 * @return {!DocumentFragment}
190 */ 190 */
191 _keyPathStringFragment: function(keyPathString) 191 _keyPathStringFragment: function(keyPathString)
192 { 192 {
193 var keyPathStringFragment = document.createDocumentFragment(); 193 var keyPathStringFragment = createDocumentFragment();
194 keyPathStringFragment.createTextChild("\""); 194 keyPathStringFragment.createTextChild("\"");
195 var keyPathSpan = keyPathStringFragment.createChild("span", "source-code console-formatted-string"); 195 var keyPathSpan = keyPathStringFragment.createChild("span", "source-code console-formatted-string");
196 keyPathSpan.textContent = keyPathString; 196 keyPathSpan.textContent = keyPathString;
197 keyPathStringFragment.createTextChild("\""); 197 keyPathStringFragment.createTextChild("\"");
198 return keyPathStringFragment; 198 return keyPathStringFragment;
199 }, 199 },
200 200
201 /** 201 /**
202 * @return {!Element} 202 * @return {!Element}
203 */ 203 */
204 _createEditorToolbar: function() 204 _createEditorToolbar: function()
205 { 205 {
206 var editorToolbar = document.createElement("div"); 206 var editorToolbar = createElement("div");
207 editorToolbar.classList.add("status-bar"); 207 editorToolbar.classList.add("status-bar");
208 editorToolbar.classList.add("data-view-toolbar"); 208 editorToolbar.classList.add("data-view-toolbar");
209 209
210 this._pageBackButton = editorToolbar.createChild("button", "back-button" ); 210 this._pageBackButton = editorToolbar.createChild("button", "back-button" );
211 this._pageBackButton.classList.add("status-bar-item"); 211 this._pageBackButton.classList.add("status-bar-item");
212 this._pageBackButton.title = WebInspector.UIString("Show previous page." ); 212 this._pageBackButton.title = WebInspector.UIString("Show previous page." );
213 this._pageBackButton.disabled = true; 213 this._pageBackButton.disabled = true;
214 this._pageBackButton.appendChild(document.createElement("img")); 214 this._pageBackButton.appendChild(createElement("img"));
215 this._pageBackButton.addEventListener("click", this._pageBackButtonClick ed.bind(this), false); 215 this._pageBackButton.addEventListener("click", this._pageBackButtonClick ed.bind(this), false);
216 editorToolbar.appendChild(this._pageBackButton); 216 editorToolbar.appendChild(this._pageBackButton);
217 217
218 this._pageForwardButton = editorToolbar.createChild("button", "forward-b utton"); 218 this._pageForwardButton = editorToolbar.createChild("button", "forward-b utton");
219 this._pageForwardButton.classList.add("status-bar-item"); 219 this._pageForwardButton.classList.add("status-bar-item");
220 this._pageForwardButton.title = WebInspector.UIString("Show next page.") ; 220 this._pageForwardButton.title = WebInspector.UIString("Show next page.") ;
221 this._pageForwardButton.disabled = true; 221 this._pageForwardButton.disabled = true;
222 this._pageForwardButton.appendChild(document.createElement("img")); 222 this._pageForwardButton.appendChild(createElement("img"));
223 this._pageForwardButton.addEventListener("click", this._pageForwardButto nClicked.bind(this), false); 223 this._pageForwardButton.addEventListener("click", this._pageForwardButto nClicked.bind(this), false);
224 editorToolbar.appendChild(this._pageForwardButton); 224 editorToolbar.appendChild(this._pageForwardButton);
225 225
226 this._keyInputElement = editorToolbar.createChild("input", "key-input"); 226 this._keyInputElement = editorToolbar.createChild("input", "key-input");
227 this._keyInputElement.placeholder = WebInspector.UIString("Start from ke y"); 227 this._keyInputElement.placeholder = WebInspector.UIString("Start from ke y");
228 this._keyInputElement.addEventListener("paste", this._keyInputChanged.bi nd(this), false); 228 this._keyInputElement.addEventListener("paste", this._keyInputChanged.bi nd(this), false);
229 this._keyInputElement.addEventListener("cut", this._keyInputChanged.bind (this), false); 229 this._keyInputElement.addEventListener("cut", this._keyInputChanged.bind (this), false);
230 this._keyInputElement.addEventListener("keypress", this._keyInputChanged .bind(this), false); 230 this._keyInputElement.addEventListener("keypress", this._keyInputChanged .bind(this), false);
231 this._keyInputElement.addEventListener("keydown", this._keyInputChanged. bind(this), false); 231 this._keyInputElement.addEventListener("keydown", this._keyInputChanged. bind(this), false);
232 232
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 contents.createTextChildren("\"", value.description, "\""); 420 contents.createTextChildren("\"", value.description, "\"");
421 break; 421 break;
422 default: 422 default:
423 contents.classList.add("primitive-value"); 423 contents.classList.add("primitive-value");
424 contents.createTextChild(value.description); 424 contents.createTextChild(value.description);
425 } 425 }
426 }, 426 },
427 427
428 __proto__: WebInspector.DataGridNode.prototype 428 __proto__: WebInspector.DataGridNode.prototype
429 } 429 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/resources/DatabaseTableView.js ('k') | Source/devtools/front_end/resources/ResourcesPanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698