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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui_lazy/OverviewGrid.js

Issue 1427823002: DevTools: Grey out outside parts of selection window on timeline overview. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: refactor Created 5 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
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 26 matching lines...) Expand all
37 this.element = 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.setScrollTop(0); 42 this._grid.setScrollTop(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 this._window.addEventListener(WebInspector.OverviewGrid.Events.WindowChanged , this._onWindowChanged, this);
47 } 48 }
48 49
49 WebInspector.OverviewGrid.prototype = { 50 WebInspector.OverviewGrid.prototype = {
50 /** 51 /**
51 * @return {number} 52 * @return {number}
52 */ 53 */
53 clientWidth: function() 54 clientWidth: function()
54 { 55 {
55 return this.element.clientWidth; 56 return this.element.clientWidth;
56 }, 57 },
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 { 126 {
126 this._window._zoom(zoomFactor, referencePoint); 127 this._window._zoom(zoomFactor, referencePoint);
127 }, 128 },
128 129
129 /** 130 /**
130 * @param {boolean} enabled 131 * @param {boolean} enabled
131 */ 132 */
132 setResizeEnabled: function(enabled) 133 setResizeEnabled: function(enabled)
133 { 134 {
134 this._window.setEnabled(enabled); 135 this._window.setEnabled(enabled);
136 },
137
138 _onWindowChanged: function()
139 {
140 this._grid.showCurtains(this.windowLeft(), this.windowRight());
135 } 141 }
136 } 142 }
137 143
138 144
139 WebInspector.OverviewGrid.MinSelectableSize = 14; 145 WebInspector.OverviewGrid.MinSelectableSize = 14;
140 146
141 WebInspector.OverviewGrid.WindowScrollSpeedFactor = .3; 147 WebInspector.OverviewGrid.WindowScrollSpeedFactor = .3;
142 148
143 WebInspector.OverviewGrid.ResizerOffset = 3.5; // half pixel because offset valu es are not rounded but ceiled 149 WebInspector.OverviewGrid.ResizerOffset = 3.5; // half pixel because offset valu es are not rounded but ceiled
144 150
145 /** 151 /**
146 * @constructor 152 * @constructor
147 * @extends {WebInspector.Object} 153 * @extends {WebInspector.Object}
148 * @param {!Element} parentElement 154 * @param {!Element} parentElement
149 * @param {!Element=} dividersLabelBarElement 155 * @param {!Element=} dividersLabelBarElement
150 */ 156 */
151 WebInspector.OverviewGrid.Window = function(parentElement, dividersLabelBarEleme nt) 157 WebInspector.OverviewGrid.Window = function(parentElement, dividersLabelBarEleme nt)
152 { 158 {
153 this._parentElement = parentElement; 159 this._parentElement = parentElement;
154 160
155 WebInspector.installDragHandle(this._parentElement, this._startWindowSelecto rDragging.bind(this), this._windowSelectorDragging.bind(this), this._endWindowSe lectorDragging.bind(this), "text", null); 161 WebInspector.installDragHandle(this._parentElement, this._startWindowSelecto rDragging.bind(this), this._windowSelectorDragging.bind(this), this._endWindowSe lectorDragging.bind(this), "text", null);
156 if (dividersLabelBarElement) 162 if (dividersLabelBarElement)
157 WebInspector.installDragHandle(dividersLabelBarElement, this._startWindo wDragging.bind(this), this._windowDragging.bind(this), null, "-webkit-grabbing", "-webkit-grab"); 163 WebInspector.installDragHandle(dividersLabelBarElement, this._startWindo wDragging.bind(this), this._windowDragging.bind(this), null, "-webkit-grabbing", "-webkit-grab");
158 164
159 this.windowLeft = 0.0; 165 this.windowLeft = 0.0;
160 this.windowRight = 1.0; 166 this.windowRight = 1.0;
161 167
162 this._parentElement.addEventListener("mousewheel", this._onMouseWheel.bind(t his), true); 168 this._parentElement.addEventListener("mousewheel", this._onMouseWheel.bind(t his), true);
163 this._parentElement.addEventListener("dblclick", this._resizeWindowMaximum.b ind(this), true); 169 this._parentElement.addEventListener("dblclick", this._resizeWindowMaximum.b ind(this), true);
164 170 this._parentElement.appendChild(WebInspector.Widget.createStyleElement("ui_l azy/overviewGrid.css"));
165 this._overviewWindowElement = parentElement.createChild("div", "overview-gri d-window");
166 this._overviewWindowElement.appendChild(WebInspector.Widget.createStyleEleme nt("ui_lazy/overviewGrid.css"));
167 this._overviewWindowBordersElement = parentElement.createChild("div", "overv iew-grid-window-rulers");
168 parentElement.createChild("div", "overview-grid-dividers-background");
169 171
170 this._leftResizeElement = parentElement.createChild("div", "overview-grid-wi ndow-resizer"); 172 this._leftResizeElement = parentElement.createChild("div", "overview-grid-wi ndow-resizer");
171 this._leftResizeElement.style.left = 0; 173 this._leftResizeElement.style.left = 0;
172 WebInspector.installDragHandle(this._leftResizeElement, this._resizerElement StartDragging.bind(this), this._leftResizeElementDragging.bind(this), null, "ew- resize"); 174 WebInspector.installDragHandle(this._leftResizeElement, this._resizerElement StartDragging.bind(this), this._leftResizeElementDragging.bind(this), null, "ew- resize");
173 175
174 this._rightResizeElement = parentElement.createChild("div", "overview-grid-w indow-resizer overview-grid-window-resizer-right"); 176 this._rightResizeElement = parentElement.createChild("div", "overview-grid-w indow-resizer");
175 this._rightResizeElement.style.right = 0; 177 this._rightResizeElement.style.right = 0;
176 WebInspector.installDragHandle(this._rightResizeElement, this._resizerElemen tStartDragging.bind(this), this._rightResizeElementDragging.bind(this), null, "e w-resize"); 178 WebInspector.installDragHandle(this._rightResizeElement, this._resizerElemen tStartDragging.bind(this), this._rightResizeElementDragging.bind(this), null, "e w-resize");
177 this.setEnabled(true); 179 this.setEnabled(true);
178 } 180 }
179 181
180 WebInspector.OverviewGrid.Events = { 182 WebInspector.OverviewGrid.Events = {
181 WindowChanged: "WindowChanged", 183 WindowChanged: "WindowChanged",
182 Click: "Click" 184 Click: "Click"
183 } 185 }
184 186
185 WebInspector.OverviewGrid.Window.prototype = { 187 WebInspector.OverviewGrid.Window.prototype = {
186 reset: function() 188 reset: function()
187 { 189 {
188 this.windowLeft = 0.0; 190 this.windowLeft = 0.0;
189 this.windowRight = 1.0; 191 this.windowRight = 1.0;
190
191 this._overviewWindowElement.style.left = "0%";
192 this._overviewWindowElement.style.width = "100%";
193 this._overviewWindowBordersElement.style.left = "0%";
194 this._overviewWindowBordersElement.style.right = "0%";
195 this._leftResizeElement.style.left = "0%"; 192 this._leftResizeElement.style.left = "0%";
196 this._rightResizeElement.style.left = "100%"; 193 this._rightResizeElement.style.left = "100%";
197 this.setEnabled(true); 194 this.setEnabled(true);
198 }, 195 },
199 196
200 /** 197 /**
201 * @param {boolean} enabled 198 * @param {boolean} enabled
202 */ 199 */
203 setEnabled: function(enabled) 200 setEnabled: function(enabled)
204 { 201 {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 var factor = minWidthInPixels / widthInPixels; 354 var factor = minWidthInPixels / widthInPixels;
358 left = ((windowRight + windowLeft) - width * factor) / 2; 355 left = ((windowRight + windowLeft) - width * factor) / 2;
359 right = ((windowRight + windowLeft) + width * factor) / 2; 356 right = ((windowRight + windowLeft) + width * factor) / 2;
360 } 357 }
361 358
362 this.windowLeft = windowLeft; 359 this.windowLeft = windowLeft;
363 this._leftResizeElement.style.left = left * 100 + "%"; 360 this._leftResizeElement.style.left = left * 100 + "%";
364 this.windowRight = windowRight; 361 this.windowRight = windowRight;
365 this._rightResizeElement.style.left = right * 100 + "%"; 362 this._rightResizeElement.style.left = right * 100 + "%";
366 363
367 this._overviewWindowElement.style.left = left * 100 + "%";
368 this._overviewWindowBordersElement.style.left = left * 100 + "%";
369 this._overviewWindowElement.style.width = (right - left) * 100 + "%";
370 this._overviewWindowBordersElement.style.right = (1 - right) * 100 + "%" ;
371
372 this.dispatchEventToListeners(WebInspector.OverviewGrid.Events.WindowCha nged); 364 this.dispatchEventToListeners(WebInspector.OverviewGrid.Events.WindowCha nged);
373 }, 365 },
374 366
375 /** 367 /**
376 * @param {?number} start 368 * @param {?number} start
377 * @param {?number} end 369 * @param {?number} end
378 */ 370 */
379 _setWindowPosition: function(start, end) 371 _setWindowPosition: function(start, end)
380 { 372 {
381 var clientWidth = this._parentElement.clientWidth; 373 var clientWidth = this._parentElement.clientWidth;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 position = Math.max(0, Math.min(position, this._width)); 459 position = Math.max(0, Math.min(position, this._width));
468 if (position < this._startPosition) { 460 if (position < this._startPosition) {
469 this._windowSelector.style.left = position + "px"; 461 this._windowSelector.style.left = position + "px";
470 this._windowSelector.style.right = this._width - this._startPosition + "px"; 462 this._windowSelector.style.right = this._width - this._startPosition + "px";
471 } else { 463 } else {
472 this._windowSelector.style.left = this._startPosition + "px"; 464 this._windowSelector.style.left = this._startPosition + "px";
473 this._windowSelector.style.right = this._width - position + "px"; 465 this._windowSelector.style.right = this._width - position + "px";
474 } 466 }
475 } 467 }
476 } 468 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698