OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 if (hasUnknownVendorPrefix(value)) | 120 if (hasUnknownVendorPrefix(value)) |
121 return true; | 121 return true; |
122 | 122 |
123 return false; | 123 return false; |
124 } | 124 } |
125 | 125 |
126 /** | 126 /** |
127 * @param {string} placeholder | 127 * @param {string} placeholder |
128 * @param {!Element} container | 128 * @param {!Element} container |
129 * @param {function(?RegExp)} filterCallback | 129 * @param {function(?RegExp)} filterCallback |
130 * @param {string=} activeClassName | |
lushnikov
2017/06/08 23:23:40
should not be optional
luoe
2017/06/08 23:26:29
Done.
| |
130 * @return {!Element} | 131 * @return {!Element} |
131 */ | 132 */ |
132 static createPropertyFilterElement(placeholder, container, filterCallback) { | 133 static createPropertyFilterElement(placeholder, container, filterCallback, act iveClassName) { |
133 var input = createElementWithClass('input'); | 134 var input = createElementWithClass('input'); |
134 input.placeholder = placeholder; | 135 input.placeholder = placeholder; |
135 | 136 |
136 function searchHandler() { | 137 function searchHandler() { |
137 var regex = input.value ? new RegExp(input.value.escapeForRegExp(), 'i') : null; | 138 var regex = input.value ? new RegExp(input.value.escapeForRegExp(), 'i') : null; |
138 filterCallback(regex); | 139 filterCallback(regex); |
139 container.classList.toggle('styles-filter-engaged', !!input.value); | 140 if (activeClassName) |
lushnikov
2017/06/08 23:23:40
drop if
luoe
2017/06/08 23:26:29
Done.
| |
141 container.classList.toggle(activeClassName, !!input.value); | |
140 } | 142 } |
141 input.addEventListener('input', searchHandler, false); | 143 input.addEventListener('input', searchHandler, false); |
142 | 144 |
143 /** | 145 /** |
144 * @param {!Event} event | 146 * @param {!Event} event |
145 */ | 147 */ |
146 function keydownHandler(event) { | 148 function keydownHandler(event) { |
147 if (event.key !== 'Escape' || !input.value) | 149 if (event.key !== 'Escape' || !input.value) |
148 return; | 150 return; |
149 event.consume(true); | 151 event.consume(true); |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
524 } | 526 } |
525 | 527 |
526 /** | 528 /** |
527 * @return {!Element} | 529 * @return {!Element} |
528 */ | 530 */ |
529 _createStylesSidebarToolbar() { | 531 _createStylesSidebarToolbar() { |
530 var container = this.element.createChild('div', 'styles-sidebar-pane-toolbar -container'); | 532 var container = this.element.createChild('div', 'styles-sidebar-pane-toolbar -container'); |
531 var hbox = container.createChild('div', 'hbox styles-sidebar-pane-toolbar'); | 533 var hbox = container.createChild('div', 'hbox styles-sidebar-pane-toolbar'); |
532 var filterContainerElement = hbox.createChild('div', 'styles-sidebar-pane-fi lter-box'); | 534 var filterContainerElement = hbox.createChild('div', 'styles-sidebar-pane-fi lter-box'); |
533 var filterInput = Elements.StylesSidebarPane.createPropertyFilterElement( | 535 var filterInput = Elements.StylesSidebarPane.createPropertyFilterElement( |
534 Common.UIString('Filter'), hbox, this._onFilterChanged.bind(this)); | 536 Common.UIString('Filter'), hbox, this._onFilterChanged.bind(this), 'styl es-filter-engaged'); |
535 UI.ARIAUtils.setAccessibleName(filterInput, Common.UIString('Filter Styles') ); | 537 UI.ARIAUtils.setAccessibleName(filterInput, Common.UIString('Filter Styles') ); |
536 filterContainerElement.appendChild(filterInput); | 538 filterContainerElement.appendChild(filterInput); |
537 var toolbar = new UI.Toolbar('styles-pane-toolbar', hbox); | 539 var toolbar = new UI.Toolbar('styles-pane-toolbar', hbox); |
538 toolbar.makeToggledGray(); | 540 toolbar.makeToggledGray(); |
539 toolbar.appendLocationItems('styles-sidebarpane-toolbar'); | 541 toolbar.appendLocationItems('styles-sidebarpane-toolbar'); |
540 var toolbarPaneContainer = container.createChild('div', 'styles-sidebar-tool bar-pane-container'); | 542 var toolbarPaneContainer = container.createChild('div', 'styles-sidebar-tool bar-pane-container'); |
541 var toolbarPaneContent = toolbarPaneContainer.createChild('div', 'styles-sid ebar-toolbar-pane'); | 543 var toolbarPaneContent = toolbarPaneContainer.createChild('div', 'styles-sid ebar-toolbar-pane'); |
542 | 544 |
543 return toolbarPaneContent; | 545 return toolbarPaneContent; |
544 } | 546 } |
(...skipping 2689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3234 } | 3236 } |
3235 | 3237 |
3236 /** | 3238 /** |
3237 * @override | 3239 * @override |
3238 * @return {!UI.ToolbarItem} | 3240 * @return {!UI.ToolbarItem} |
3239 */ | 3241 */ |
3240 item() { | 3242 item() { |
3241 return this._button; | 3243 return this._button; |
3242 } | 3244 } |
3243 }; | 3245 }; |
OLD | NEW |