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 |
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 container.classList.toggle(activeClassName, !!input.value); |
140 } | 141 } |
141 input.addEventListener('input', searchHandler, false); | 142 input.addEventListener('input', searchHandler, false); |
142 | 143 |
143 /** | 144 /** |
144 * @param {!Event} event | 145 * @param {!Event} event |
145 */ | 146 */ |
146 function keydownHandler(event) { | 147 function keydownHandler(event) { |
147 if (event.key !== 'Escape' || !input.value) | 148 if (event.key !== 'Escape' || !input.value) |
148 return; | 149 return; |
149 event.consume(true); | 150 event.consume(true); |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 } | 525 } |
525 | 526 |
526 /** | 527 /** |
527 * @return {!Element} | 528 * @return {!Element} |
528 */ | 529 */ |
529 _createStylesSidebarToolbar() { | 530 _createStylesSidebarToolbar() { |
530 var container = this.element.createChild('div', 'styles-sidebar-pane-toolbar
-container'); | 531 var container = this.element.createChild('div', 'styles-sidebar-pane-toolbar
-container'); |
531 var hbox = container.createChild('div', 'hbox styles-sidebar-pane-toolbar'); | 532 var hbox = container.createChild('div', 'hbox styles-sidebar-pane-toolbar'); |
532 var filterContainerElement = hbox.createChild('div', 'styles-sidebar-pane-fi
lter-box'); | 533 var filterContainerElement = hbox.createChild('div', 'styles-sidebar-pane-fi
lter-box'); |
533 var filterInput = Elements.StylesSidebarPane.createPropertyFilterElement( | 534 var filterInput = Elements.StylesSidebarPane.createPropertyFilterElement( |
534 Common.UIString('Filter'), hbox, this._onFilterChanged.bind(this)); | 535 Common.UIString('Filter'), hbox, this._onFilterChanged.bind(this), 'styl
es-filter-engaged'); |
535 UI.ARIAUtils.setAccessibleName(filterInput, Common.UIString('Filter Styles')
); | 536 UI.ARIAUtils.setAccessibleName(filterInput, Common.UIString('Filter Styles')
); |
536 filterContainerElement.appendChild(filterInput); | 537 filterContainerElement.appendChild(filterInput); |
537 var toolbar = new UI.Toolbar('styles-pane-toolbar', hbox); | 538 var toolbar = new UI.Toolbar('styles-pane-toolbar', hbox); |
538 toolbar.makeToggledGray(); | 539 toolbar.makeToggledGray(); |
539 toolbar.appendLocationItems('styles-sidebarpane-toolbar'); | 540 toolbar.appendLocationItems('styles-sidebarpane-toolbar'); |
540 var toolbarPaneContainer = container.createChild('div', 'styles-sidebar-tool
bar-pane-container'); | 541 var toolbarPaneContainer = container.createChild('div', 'styles-sidebar-tool
bar-pane-container'); |
541 var toolbarPaneContent = toolbarPaneContainer.createChild('div', 'styles-sid
ebar-toolbar-pane'); | 542 var toolbarPaneContent = toolbarPaneContainer.createChild('div', 'styles-sid
ebar-toolbar-pane'); |
542 | 543 |
543 return toolbarPaneContent; | 544 return toolbarPaneContent; |
544 } | 545 } |
(...skipping 2689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3234 } | 3235 } |
3235 | 3236 |
3236 /** | 3237 /** |
3237 * @override | 3238 * @override |
3238 * @return {!UI.ToolbarItem} | 3239 * @return {!UI.ToolbarItem} |
3239 */ | 3240 */ |
3240 item() { | 3241 item() { |
3241 return this._button; | 3242 return this._button; |
3242 } | 3243 } |
3243 }; | 3244 }; |
OLD | NEW |