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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js

Issue 2658383002: [DevTools] Make UI.GlassPane position contentElement for different overlay controls. (Closed)
Patch Set: rebased Created 3 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 function clicked(event) { 116 function clicked(event) {
117 button._clicked(/** @type {!Event} */ (event.data)); 117 button._clicked(/** @type {!Event} */ (event.data));
118 } 118 }
119 119
120 mainButtonClone.setToggled(action.toggled()); 120 mainButtonClone.setToggled(action.toggled());
121 buttons.push(mainButtonClone); 121 buttons.push(mainButtonClone);
122 122
123 var document = button.element.ownerDocument; 123 var document = button.element.ownerDocument;
124 document.documentElement.addEventListener('mouseup', mouseUp, false); 124 document.documentElement.addEventListener('mouseup', mouseUp, false);
125 125
126 var optionsGlassPane = new UI.GlassPane(document); 126 var optionsGlassPane = new UI.GlassPane(document, false /* dimmed */, true /* blockPointerEvents */, event => {});
127 var optionsBar = new UI.Toolbar('fill', optionsGlassPane.element); 127 optionsGlassPane.show();
128 var optionsBar = new UI.Toolbar('fill', optionsGlassPane.contentElement);
128 optionsBar._contentElement.classList.add('floating'); 129 optionsBar._contentElement.classList.add('floating');
129 const buttonHeight = 26; 130 const buttonHeight = 26;
130 131
131 var hostButtonPosition = button.element.totalOffset(); 132 var hostButtonPosition = button.element.totalOffset();
132 133
133 var topNotBottom = hostButtonPosition.top + buttonHeight * buttons.length < document.documentElement.offsetHeight; 134 var topNotBottom = hostButtonPosition.top + buttonHeight * buttons.length < document.documentElement.offsetHeight;
134 135
135 if (topNotBottom) 136 if (topNotBottom)
136 buttons = buttons.reverse(); 137 buttons = buttons.reverse();
137 138
(...skipping 22 matching lines...) Expand all
160 function mouseOut(e) { 161 function mouseOut(e) {
161 if (e.which !== 1) 162 if (e.which !== 1)
162 return; 163 return;
163 var buttonElement = e.target.enclosingNodeOrSelfWithClass('toolbar-item' ); 164 var buttonElement = e.target.enclosingNodeOrSelfWithClass('toolbar-item' );
164 buttonElement.classList.remove('emulate-active'); 165 buttonElement.classList.remove('emulate-active');
165 } 166 }
166 167
167 function mouseUp(e) { 168 function mouseUp(e) {
168 if (e.which !== 1) 169 if (e.which !== 1)
169 return; 170 return;
170 optionsGlassPane.dispose(); 171 optionsGlassPane.hide();
171 document.documentElement.removeEventListener('mouseup', mouseUp, false); 172 document.documentElement.removeEventListener('mouseup', mouseUp, false);
172 173
173 for (var i = 0; i < buttons.length; ++i) { 174 for (var i = 0; i < buttons.length; ++i) {
174 if (buttons[i].element.classList.contains('emulate-active')) { 175 if (buttons[i].element.classList.contains('emulate-active')) {
175 buttons[i].element.classList.remove('emulate-active'); 176 buttons[i].element.classList.remove('emulate-active');
176 buttons[i]._clicked(e); 177 buttons[i]._clicked(e);
177 break; 178 break;
178 } 179 }
179 } 180 }
180 } 181 }
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 996
996 /** 997 /**
997 * @override 998 * @override
998 * @param {boolean} enabled 999 * @param {boolean} enabled
999 */ 1000 */
1000 _applyEnabledState(enabled) { 1001 _applyEnabledState(enabled) {
1001 super._applyEnabledState(enabled); 1002 super._applyEnabledState(enabled);
1002 this.inputElement.disabled = !enabled; 1003 this.inputElement.disabled = !enabled;
1003 } 1004 }
1004 }; 1005 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698