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

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

Issue 2652153003: DevTools: migrate SoftContextMenu icons over to UI.Icon (Closed)
Patch Set: rebaseline 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) 2011 Google Inc. All Rights Reserved. 2 * Copyright (C) 2011 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 117 }
118 118
119 _createMenuItem(item) { 119 _createMenuItem(item) {
120 if (item.type === 'separator') 120 if (item.type === 'separator')
121 return this._createSeparator(); 121 return this._createSeparator();
122 122
123 if (item.type === 'subMenu') 123 if (item.type === 'subMenu')
124 return this._createSubMenu(item); 124 return this._createSubMenu(item);
125 125
126 var menuItemElement = createElementWithClass('div', 'soft-context-menu-item' ); 126 var menuItemElement = createElementWithClass('div', 'soft-context-menu-item' );
127 var checkMarkElement = menuItemElement.createChild('div', 'checkmark'); 127 var checkMarkElement = UI.Icon.create('smallicon-checkmark', 'checkmark');
128 menuItemElement.appendChild(checkMarkElement);
128 if (!item.checked) 129 if (!item.checked)
129 checkMarkElement.style.opacity = '0'; 130 checkMarkElement.style.opacity = '0';
130 131
131 if (item.element) { 132 if (item.element) {
132 var wrapper = menuItemElement.createChild('div', 'soft-context-menu-custom -item'); 133 var wrapper = menuItemElement.createChild('div', 'soft-context-menu-custom -item');
133 wrapper.appendChild(item.element); 134 wrapper.appendChild(item.element);
134 menuItemElement._isCustom = true; 135 menuItemElement._isCustom = true;
135 return menuItemElement; 136 return menuItemElement;
136 } 137 }
137 138
(...skipping 11 matching lines...) Expand all
149 150
150 menuItemElement._actionId = item.id; 151 menuItemElement._actionId = item.id;
151 return menuItemElement; 152 return menuItemElement;
152 } 153 }
153 154
154 _createSubMenu(item) { 155 _createSubMenu(item) {
155 var menuItemElement = createElementWithClass('div', 'soft-context-menu-item' ); 156 var menuItemElement = createElementWithClass('div', 'soft-context-menu-item' );
156 menuItemElement._subItems = item.subItems; 157 menuItemElement._subItems = item.subItems;
157 158
158 // Occupy the same space on the left in all items. 159 // Occupy the same space on the left in all items.
159 var checkMarkElement = menuItemElement.createChild('span', 'soft-context-men u-item-checkmark checkmark'); 160 var checkMarkElement = UI.Icon.create('smallicon-checkmark', 'soft-context-m enu-item-checkmark');
160 checkMarkElement.textContent = '\u2713 '; // Checkmark Unicode symbol 161 checkMarkElement.classList.add('checkmark');
162 menuItemElement.appendChild(checkMarkElement);
161 checkMarkElement.style.opacity = '0'; 163 checkMarkElement.style.opacity = '0';
162 164
163 menuItemElement.createTextChild(item.label); 165 menuItemElement.createTextChild(item.label);
164 166
165 var subMenuArrowElement = menuItemElement.createChild('span', 'soft-context- menu-item-submenu-arrow'); 167 var subMenuArrowElement = menuItemElement.createChild('span', 'soft-context- menu-item-submenu-arrow');
166 subMenuArrowElement.textContent = '\u25B6'; // BLACK RIGHT-POINTING TRIANGL E 168 subMenuArrowElement.textContent = '\u25B6'; // BLACK RIGHT-POINTING TRIANGL E
167 169
168 menuItemElement.addEventListener('mousedown', this._menuItemMouseDown.bind(t his), false); 170 menuItemElement.addEventListener('mousedown', this._menuItemMouseDown.bind(t his), false);
169 menuItemElement.addEventListener('mouseup', this._menuItemMouseUp.bind(this) , false); 171 menuItemElement.addEventListener('mouseup', this._menuItemMouseUp.bind(this) , false);
170 172
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 /** 252 /**
251 * @param {?Element} menuItemElement 253 * @param {?Element} menuItemElement
252 * @param {boolean} scheduleSubMenu 254 * @param {boolean} scheduleSubMenu
253 */ 255 */
254 _highlightMenuItem(menuItemElement, scheduleSubMenu) { 256 _highlightMenuItem(menuItemElement, scheduleSubMenu) {
255 if (this._highlightedMenuItemElement === menuItemElement) 257 if (this._highlightedMenuItemElement === menuItemElement)
256 return; 258 return;
257 259
258 this._hideSubMenu(); 260 this._hideSubMenu();
259 if (this._highlightedMenuItemElement) { 261 if (this._highlightedMenuItemElement) {
262 this._highlightedMenuItemElement.classList.remove('force-white-icons');
260 this._highlightedMenuItemElement.classList.remove('soft-context-menu-item- mouse-over'); 263 this._highlightedMenuItemElement.classList.remove('soft-context-menu-item- mouse-over');
261 if (this._highlightedMenuItemElement._subItems && this._highlightedMenuIte mElement._subMenuTimer) { 264 if (this._highlightedMenuItemElement._subItems && this._highlightedMenuIte mElement._subMenuTimer) {
262 clearTimeout(this._highlightedMenuItemElement._subMenuTimer); 265 clearTimeout(this._highlightedMenuItemElement._subMenuTimer);
263 delete this._highlightedMenuItemElement._subMenuTimer; 266 delete this._highlightedMenuItemElement._subMenuTimer;
264 } 267 }
265 } 268 }
266 this._highlightedMenuItemElement = menuItemElement; 269 this._highlightedMenuItemElement = menuItemElement;
267 if (this._highlightedMenuItemElement) { 270 if (this._highlightedMenuItemElement) {
271 this._highlightedMenuItemElement.classList.add('force-white-icons');
268 this._highlightedMenuItemElement.classList.add('soft-context-menu-item-mou se-over'); 272 this._highlightedMenuItemElement.classList.add('soft-context-menu-item-mou se-over');
269 this._contextMenuElement.focus(); 273 this._contextMenuElement.focus();
270 if (scheduleSubMenu && this._highlightedMenuItemElement._subItems && 274 if (scheduleSubMenu && this._highlightedMenuItemElement._subItems &&
271 !this._highlightedMenuItemElement._subMenuTimer) { 275 !this._highlightedMenuItemElement._subMenuTimer) {
272 this._highlightedMenuItemElement._subMenuTimer = 276 this._highlightedMenuItemElement._subMenuTimer =
273 setTimeout(this._showSubMenu.bind(this, this._highlightedMenuItemEle ment), 150); 277 setTimeout(this._showSubMenu.bind(this, this._highlightedMenuItemEle ment), 150);
274 } 278 }
275 } 279 }
276 } 280 }
277 281
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 388
385 _discardSubMenus() { 389 _discardSubMenus() {
386 if (this._subMenu) 390 if (this._subMenu)
387 this._subMenu._discardSubMenus(); 391 this._subMenu._discardSubMenus();
388 if (this.element) 392 if (this.element)
389 this.element.remove(); 393 this.element.remove();
390 if (this._parentMenu) 394 if (this._parentMenu)
391 delete this._parentMenu._subMenu; 395 delete this._parentMenu._subMenu;
392 } 396 }
393 }; 397 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698