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

Side by Side Diff: Source/devtools/front_end/components/OverviewGrid.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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 /** 31 /**
32 * @constructor 32 * @constructor
33 * @param {string} prefix 33 * @param {string} prefix
34 */ 34 */
35 WebInspector.OverviewGrid = function(prefix) 35 WebInspector.OverviewGrid = function(prefix)
36 { 36 {
37 this.element = document.createElement("div"); 37 this.element = createElement("div");
38 this.element.id = prefix + "-overview-container"; 38 this.element.id = prefix + "-overview-container";
39 39
40 this._grid = new WebInspector.TimelineGrid(); 40 this._grid = new WebInspector.TimelineGrid();
41 this._grid.element.id = prefix + "-overview-grid"; 41 this._grid.element.id = prefix + "-overview-grid";
42 this._grid.setScrollAndDividerTop(0, 0); 42 this._grid.setScrollAndDividerTop(0, 0);
43 43
44 this.element.appendChild(this._grid.element); 44 this.element.appendChild(this._grid.element);
45 45
46 this._window = new WebInspector.OverviewGrid.Window(this.element, this._grid .dividersLabelBarElement); 46 this._window = new WebInspector.OverviewGrid.Window(this.element, this._grid .dividersLabelBarElement);
47 } 47 }
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 __proto__: WebInspector.Object.prototype 445 __proto__: WebInspector.Object.prototype
446 } 446 }
447 447
448 /** 448 /**
449 * @constructor 449 * @constructor
450 */ 450 */
451 WebInspector.OverviewGrid.WindowSelector = function(parent, position) 451 WebInspector.OverviewGrid.WindowSelector = function(parent, position)
452 { 452 {
453 this._startPosition = position; 453 this._startPosition = position;
454 this._width = parent.offsetWidth; 454 this._width = parent.offsetWidth;
455 this._windowSelector = document.createElement("div"); 455 this._windowSelector = createElement("div");
456 this._windowSelector.className = "overview-grid-window-selector"; 456 this._windowSelector.className = "overview-grid-window-selector";
457 this._windowSelector.style.left = this._startPosition + "px"; 457 this._windowSelector.style.left = this._startPosition + "px";
458 this._windowSelector.style.right = this._width - this._startPosition + "px"; 458 this._windowSelector.style.right = this._width - this._startPosition + "px";
459 parent.appendChild(this._windowSelector); 459 parent.appendChild(this._windowSelector);
460 } 460 }
461 461
462 WebInspector.OverviewGrid.WindowSelector.prototype = { 462 WebInspector.OverviewGrid.WindowSelector.prototype = {
463 _close: function(position) 463 _close: function(position)
464 { 464 {
465 position = Math.max(0, Math.min(position, this._width)); 465 position = Math.max(0, Math.min(position, this._width));
466 this._windowSelector.remove(); 466 this._windowSelector.remove();
467 return this._startPosition < position ? {start: this._startPosition, end : position} : {start: position, end: this._startPosition}; 467 return this._startPosition < position ? {start: this._startPosition, end : position} : {start: position, end: this._startPosition};
468 }, 468 },
469 469
470 _updatePosition: function(position) 470 _updatePosition: function(position)
471 { 471 {
472 position = Math.max(0, Math.min(position, this._width)); 472 position = Math.max(0, Math.min(position, this._width));
473 if (position < this._startPosition) { 473 if (position < this._startPosition) {
474 this._windowSelector.style.left = position + "px"; 474 this._windowSelector.style.left = position + "px";
475 this._windowSelector.style.right = this._width - this._startPosition + "px"; 475 this._windowSelector.style.right = this._width - this._startPosition + "px";
476 } else { 476 } else {
477 this._windowSelector.style.left = this._startPosition + "px"; 477 this._windowSelector.style.left = this._startPosition + "px";
478 this._windowSelector.style.right = this._width - position + "px"; 478 this._windowSelector.style.right = this._width - position + "px";
479 } 479 }
480 } 480 }
481 } 481 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698