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

Side by Side Diff: Source/devtools/front_end/settings/EditFileSystemDialog.js

Issue 1356363002: [DevTools] Remove relativeToElement from Dialog. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 3 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 this._excludedFolderList.element.classList.add("excluded-folders-list"); 84 this._excludedFolderList.element.classList.add("excluded-folders-list");
85 this._excludedFolderListContainer.appendChild(this._excludedFolderList.eleme nt); 85 this._excludedFolderListContainer.appendChild(this._excludedFolderList.eleme nt);
86 this._excludedFolderEntries = new Map(); 86 this._excludedFolderEntries = new Map();
87 for (var i = 0; i < excludedFolderEntries.length; ++i) 87 for (var i = 0; i < excludedFolderEntries.length; ++i)
88 this._addExcludedFolderRow(excludedFolderEntries[i]); 88 this._addExcludedFolderRow(excludedFolderEntries[i]);
89 89
90 this.element.tabIndex = 0; 90 this.element.tabIndex = 0;
91 this._hasMappingChanges = false; 91 this._hasMappingChanges = false;
92 } 92 }
93 93
94 WebInspector.EditFileSystemDialog.show = function(element, fileSystemPath) 94 WebInspector.EditFileSystemDialog.show = function(fileSystemPath)
95 { 95 {
96 var dialog = new WebInspector.EditFileSystemDialog(fileSystemPath); 96 var dialog = new WebInspector.EditFileSystemDialog(fileSystemPath);
97 WebInspector.Dialog.show(element, dialog); 97 WebInspector.Dialog.show(dialog);
98 var glassPane = dialog.element.ownerDocument.getElementById("glass-pane"); 98 var glassPane = dialog.element.ownerDocument.getElementById("glass-pane");
99 glassPane.classList.add("settings-glass-pane"); 99 glassPane.classList.add("settings-glass-pane");
100 } 100 }
101 101
102 WebInspector.EditFileSystemDialog.prototype = { 102 WebInspector.EditFileSystemDialog.prototype = {
103 /** 103 /**
104 * @override 104 * @override
105 * @param {!Element} element 105 * @param {!Element} element
106 */ 106 */
107 show: function(element) 107 show: function(element)
108 { 108 {
109 this._dialogElement = element; 109 this._dialogElement = element;
110 element.appendChild(this.element); 110 element.appendChild(this.element);
111 element.classList.add("settings-dialog", "settings-tab"); 111 element.classList.add("settings-dialog", "settings-tab");
112 }, 112 },
113 113
114 _resize: function() 114 _resize: function()
115 { 115 {
116 if (!this._dialogElement || !this._relativeToElement) 116 if (!this._dialogElement || !this._container)
117 return; 117 return;
118 118
119 const minWidth = 200; 119 const minWidth = 200;
120 const minHeight = 150; 120 const minHeight = 150;
121 var maxHeight = this._relativeToElement.offsetHeight - 10; 121 var maxHeight = this._container.offsetHeight - 10;
122 maxHeight = Math.max(minHeight, maxHeight); 122 maxHeight = Math.max(minHeight, maxHeight);
123 var maxWidth = Math.min(540, this._relativeToElement.offsetWidth - 10); 123 var maxWidth = Math.min(540, this._container.offsetWidth - 10);
124 maxWidth = Math.max(minWidth, maxWidth); 124 maxWidth = Math.max(minWidth, maxWidth);
125 this._dialogElement.style.maxHeight = maxHeight + "px"; 125 this._dialogElement.style.maxHeight = maxHeight + "px";
126 this._dialogElement.style.width = maxWidth + "px"; 126 this._dialogElement.style.width = maxWidth + "px";
127 127
128 WebInspector.DialogDelegate.prototype.position(this._dialogElement, this ._relativeToElement); 128 WebInspector.DialogDelegate.prototype.position(this._dialogElement, this ._container);
129 }, 129 },
130 130
131 /** 131 /**
132 * @override 132 * @override
133 * @param {!Element} element 133 * @param {!Element} element
134 * @param {!Element} relativeToElement 134 * @param {!Element} container
135 */ 135 */
136 position: function(element, relativeToElement) 136 position: function(element, container)
137 { 137 {
138 this._relativeToElement = relativeToElement; 138 this._container = container;
139 this._resize(); 139 this._resize();
140 }, 140 },
141 141
142 willHide: function(event) 142 willHide: function(event)
143 { 143 {
144 if (!this._hasMappingChanges) 144 if (!this._hasMappingChanges)
145 return; 145 return;
146 if (window.confirm(WebInspector.UIString("It is recommended to restart D evTools after making these changes. Would you like to restart it?"))) 146 if (window.confirm(WebInspector.UIString("It is recommended to restart D evTools after making these changes. Would you like to restart it?")))
147 WebInspector.reload(); 147 WebInspector.reload();
148 }, 148 },
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 { 405 {
406 WebInspector.Dialog.hide(); 406 WebInspector.Dialog.hide();
407 }, 407 },
408 408
409 onEnter: function() 409 onEnter: function()
410 { 410 {
411 }, 411 },
412 412
413 __proto__: WebInspector.DialogDelegate.prototype 413 __proto__: WebInspector.DialogDelegate.prototype
414 } 414 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/devices/DevicesDialog.js ('k') | Source/devtools/front_end/settings/FrameworkBlackboxDialog.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698