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

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

Issue 2702523003: [DevTools] Continue GlassPane refactoring. (Closed)
Patch Set: element 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, false /* dimmed */, true /* blockPointerEvents */, event => {}); 126 var optionsGlassPane = new UI.GlassPane();
127 optionsGlassPane.show(); 127 optionsGlassPane.setBlockPointerEvents(true);
128 optionsGlassPane.showGlassPane(document);
128 var optionsBar = new UI.Toolbar('fill', optionsGlassPane.contentElement); 129 var optionsBar = new UI.Toolbar('fill', optionsGlassPane.contentElement);
129 optionsBar._contentElement.classList.add('floating'); 130 optionsBar._contentElement.classList.add('floating');
130 const buttonHeight = 26; 131 const buttonHeight = 26;
131 132
132 var hostButtonPosition = button.element.totalOffset(); 133 var hostButtonPosition = button.element.totalOffset();
133 134
134 var topNotBottom = hostButtonPosition.top + buttonHeight * buttons.length < document.documentElement.offsetHeight; 135 var topNotBottom = hostButtonPosition.top + buttonHeight * buttons.length < document.documentElement.offsetHeight;
135 136
136 if (topNotBottom) 137 if (topNotBottom)
137 buttons = buttons.reverse(); 138 buttons = buttons.reverse();
(...skipping 23 matching lines...) Expand all
161 function mouseOut(e) { 162 function mouseOut(e) {
162 if (e.which !== 1) 163 if (e.which !== 1)
163 return; 164 return;
164 var buttonElement = e.target.enclosingNodeOrSelfWithClass('toolbar-item' ); 165 var buttonElement = e.target.enclosingNodeOrSelfWithClass('toolbar-item' );
165 buttonElement.classList.remove('emulate-active'); 166 buttonElement.classList.remove('emulate-active');
166 } 167 }
167 168
168 function mouseUp(e) { 169 function mouseUp(e) {
169 if (e.which !== 1) 170 if (e.which !== 1)
170 return; 171 return;
171 optionsGlassPane.hide(); 172 optionsGlassPane.hideGlassPane();
172 document.documentElement.removeEventListener('mouseup', mouseUp, false); 173 document.documentElement.removeEventListener('mouseup', mouseUp, false);
173 174
174 for (var i = 0; i < buttons.length; ++i) { 175 for (var i = 0; i < buttons.length; ++i) {
175 if (buttons[i].element.classList.contains('emulate-active')) { 176 if (buttons[i].element.classList.contains('emulate-active')) {
176 buttons[i].element.classList.remove('emulate-active'); 177 buttons[i].element.classList.remove('emulate-active');
177 buttons[i]._clicked(e); 178 buttons[i]._clicked(e);
178 break; 179 break;
179 } 180 }
180 } 181 }
181 } 182 }
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 /** 1047 /**
1047 * @param {!Common.Setting} setting 1048 * @param {!Common.Setting} setting
1048 * @param {string=} tooltip 1049 * @param {string=} tooltip
1049 * @param {string=} alternateTitle 1050 * @param {string=} alternateTitle
1050 */ 1051 */
1051 constructor(setting, tooltip, alternateTitle) { 1052 constructor(setting, tooltip, alternateTitle) {
1052 super(alternateTitle || setting.title() || '', tooltip); 1053 super(alternateTitle || setting.title() || '', tooltip);
1053 UI.SettingsUI.bindCheckbox(this.inputElement, setting); 1054 UI.SettingsUI.bindCheckbox(this.inputElement, setting);
1054 } 1055 }
1055 }; 1056 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698