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

Side by Side Diff: Source/devtools/front_end/sources/RevisionHistoryView.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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 * @param {boolean} allowRevert 202 * @param {boolean} allowRevert
203 */ 203 */
204 WebInspector.RevisionHistoryTreeElement = function(revision, baseRevision, allow Revert) 204 WebInspector.RevisionHistoryTreeElement = function(revision, baseRevision, allow Revert)
205 { 205 {
206 TreeElement.call(this, revision.timestamp.toLocaleTimeString(), null, true); 206 TreeElement.call(this, revision.timestamp.toLocaleTimeString(), null, true);
207 this.selectable = false; 207 this.selectable = false;
208 208
209 this._revision = revision; 209 this._revision = revision;
210 this._baseRevision = baseRevision; 210 this._baseRevision = baseRevision;
211 211
212 this._revertElement = document.createElement("span"); 212 this._revertElement = createElement("span");
213 this._revertElement.className = "revision-history-link"; 213 this._revertElement.className = "revision-history-link";
214 this._revertElement.textContent = WebInspector.UIString("apply revision cont ent"); 214 this._revertElement.textContent = WebInspector.UIString("apply revision cont ent");
215 this._revertElement.addEventListener("click", this._revision.revertToThis.bi nd(this._revision), false); 215 this._revertElement.addEventListener("click", this._revision.revertToThis.bi nd(this._revision), false);
216 if (!allowRevert) 216 if (!allowRevert)
217 this._revertElement.classList.add("hidden"); 217 this._revertElement.classList.add("hidden");
218 } 218 }
219 219
220 WebInspector.RevisionHistoryTreeElement.prototype = { 220 WebInspector.RevisionHistoryTreeElement.prototype = {
221 onattach: function() 221 onattach: function()
222 { 222 {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 * @param {?number} baseLineNumber 303 * @param {?number} baseLineNumber
304 * @param {?number} newLineNumber 304 * @param {?number} newLineNumber
305 * @param {string} lineContent 305 * @param {string} lineContent
306 * @param {string} changeType 306 * @param {string} changeType
307 */ 307 */
308 _createLine: function(baseLineNumber, newLineNumber, lineContent, changeType ) 308 _createLine: function(baseLineNumber, newLineNumber, lineContent, changeType )
309 { 309 {
310 var child = new TreeElement("", null, false); 310 var child = new TreeElement("", null, false);
311 child.selectable = false; 311 child.selectable = false;
312 this.appendChild(child); 312 this.appendChild(child);
313 var lineElement = document.createElement("span"); 313 var lineElement = createElement("span");
314 314
315 function appendLineNumber(lineNumber) 315 function appendLineNumber(lineNumber)
316 { 316 {
317 var numberString = lineNumber !== null ? numberToStringWithSpacesPad ding(lineNumber + 1, 4) : spacesPadding(4); 317 var numberString = lineNumber !== null ? numberToStringWithSpacesPad ding(lineNumber + 1, 4) : spacesPadding(4);
318 var lineNumberSpan = document.createElement("span"); 318 var lineNumberSpan = createElement("span");
319 lineNumberSpan.classList.add("webkit-line-number"); 319 lineNumberSpan.classList.add("webkit-line-number");
320 lineNumberSpan.textContent = numberString; 320 lineNumberSpan.textContent = numberString;
321 child.listItemElement.appendChild(lineNumberSpan); 321 child.listItemElement.appendChild(lineNumberSpan);
322 } 322 }
323 323
324 appendLineNumber(baseLineNumber); 324 appendLineNumber(baseLineNumber);
325 appendLineNumber(newLineNumber); 325 appendLineNumber(newLineNumber);
326 326
327 var contentSpan = document.createElement("span"); 327 var contentSpan = createElement("span");
328 contentSpan.textContent = lineContent; 328 contentSpan.textContent = lineContent;
329 child.listItemElement.appendChild(contentSpan); 329 child.listItemElement.appendChild(contentSpan);
330 child.listItemElement.classList.add("revision-history-line"); 330 child.listItemElement.classList.add("revision-history-line");
331 contentSpan.classList.add("revision-history-line-" + changeType); 331 contentSpan.classList.add("revision-history-line-" + changeType);
332 }, 332 },
333 333
334 allowRevert: function() 334 allowRevert: function()
335 { 335 {
336 this._revertElement.classList.remove("hidden"); 336 this._revertElement.classList.remove("hidden");
337 }, 337 },
338 338
339 __proto__: TreeElement.prototype 339 __proto__: TreeElement.prototype
340 } 340 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sources/Placard.js ('k') | Source/devtools/front_end/sources/ScopeChainSidebarPane.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698