OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 // FIXME: crbug.com/425984 | 61 // FIXME: crbug.com/425984 |
62 if (Common.moduleSetting('domWordWrap').get()) | 62 if (Common.moduleSetting('domWordWrap').get()) |
63 this._contentElement.classList.add('elements-wrap'); | 63 this._contentElement.classList.add('elements-wrap'); |
64 Common.moduleSetting('domWordWrap').addChangeListener(this._domWordWrapSetti ngChanged.bind(this)); | 64 Common.moduleSetting('domWordWrap').addChangeListener(this._domWordWrapSetti ngChanged.bind(this)); |
65 | 65 |
66 crumbsContainer.id = 'elements-crumbs'; | 66 crumbsContainer.id = 'elements-crumbs'; |
67 this._breadcrumbs = new Elements.ElementsBreadcrumbs(); | 67 this._breadcrumbs = new Elements.ElementsBreadcrumbs(); |
68 this._breadcrumbs.show(crumbsContainer); | 68 this._breadcrumbs.show(crumbsContainer); |
69 this._breadcrumbs.addEventListener(Elements.ElementsBreadcrumbs.Events.NodeS elected, this._crumbNodeSelected, this); | 69 this._breadcrumbs.addEventListener(Elements.ElementsBreadcrumbs.Events.NodeS elected, this._crumbNodeSelected, this); |
70 | 70 |
71 /** @type {?UI.Widget} */ | |
72 this._currentToolbarPane = null; | |
73 /** @type {?UI.Widget} */ | |
74 this._animatedToolbarPane = null; | |
75 /** @type {?UI.Widget} */ | |
76 this._pendingWidget = null; | |
77 /** @type {?UI.ToolbarToggle} */ | |
78 this._pendingWidgetToggle = null; | |
79 | |
80 this._stylesWidget = new Elements.StylesSidebarPane(); | 71 this._stylesWidget = new Elements.StylesSidebarPane(); |
81 this._computedStyleWidget = new Elements.ComputedStyleWidget(); | 72 this._computedStyleWidget = new Elements.ComputedStyleWidget(); |
82 this._metricsWidget = new Elements.MetricsSidebarPane(); | 73 this._metricsWidget = new Elements.MetricsSidebarPane(); |
83 | 74 |
84 this._stylesSidebarToolbar = this._createStylesSidebarToolbar(); | |
85 | |
86 Common.moduleSetting('sidebarPosition').addChangeListener(this._updateSideba rPosition.bind(this)); | 75 Common.moduleSetting('sidebarPosition').addChangeListener(this._updateSideba rPosition.bind(this)); |
87 this._updateSidebarPosition(); | 76 this._updateSidebarPosition(); |
88 | 77 |
89 /** @type {!Array.<!Elements.ElementsTreeOutline>} */ | 78 /** @type {!Array.<!Elements.ElementsTreeOutline>} */ |
90 this._treeOutlines = []; | 79 this._treeOutlines = []; |
91 /** @type {!Map<!Elements.ElementsTreeOutline, !Element>} */ | 80 /** @type {!Map<!Elements.ElementsTreeOutline, !Element>} */ |
92 this._treeOutlineHeaders = new Map(); | 81 this._treeOutlineHeaders = new Map(); |
93 SDK.targetManager.observeModels(SDK.DOMModel, this); | 82 SDK.targetManager.observeModels(SDK.DOMModel, this); |
94 SDK.targetManager.addEventListener( | 83 SDK.targetManager.addEventListener( |
95 SDK.TargetManager.Events.NameChanged, | 84 SDK.TargetManager.Events.NameChanged, |
(...skipping 15 matching lines...) Expand all Loading... | |
111 /** | 100 /** |
112 * @param {!SDK.CSSProperty} cssProperty | 101 * @param {!SDK.CSSProperty} cssProperty |
113 */ | 102 */ |
114 _revealProperty(cssProperty) { | 103 _revealProperty(cssProperty) { |
115 return this.sidebarPaneView.showView(this._stylesViewToReveal).then(() => { | 104 return this.sidebarPaneView.showView(this._stylesViewToReveal).then(() => { |
116 this._stylesWidget.revealProperty(/** @type {!SDK.CSSProperty} */ (cssProp erty)); | 105 this._stylesWidget.revealProperty(/** @type {!SDK.CSSProperty} */ (cssProp erty)); |
117 }); | 106 }); |
118 } | 107 } |
119 | 108 |
120 /** | 109 /** |
121 * @return {!Element} | |
122 */ | |
123 _createStylesSidebarToolbar() { | |
124 var container = createElementWithClass('div', 'styles-sidebar-pane-toolbar-c ontainer'); | |
125 var hbox = container.createChild('div', 'hbox styles-sidebar-pane-toolbar'); | |
126 var filterContainerElement = hbox.createChild('div', 'styles-sidebar-pane-fi lter-box'); | |
127 var filterInput = Elements.StylesSidebarPane.createPropertyFilterElement( | |
128 Common.UIString('Filter'), hbox, this._stylesWidget.onFilterChanged.bind (this._stylesWidget)); | |
129 UI.ARIAUtils.setAccessibleName(filterInput, Common.UIString('Filter Styles') ); | |
130 filterContainerElement.appendChild(filterInput); | |
131 var toolbar = new UI.Toolbar('styles-pane-toolbar', hbox); | |
132 toolbar.makeToggledGray(); | |
133 toolbar.appendLocationItems('styles-sidebarpane-toolbar'); | |
134 var toolbarPaneContainer = container.createChild('div', 'styles-sidebar-tool bar-pane-container'); | |
135 this._toolbarPaneElement = createElementWithClass('div', 'styles-sidebar-too lbar-pane'); | |
136 toolbarPaneContainer.appendChild(this._toolbarPaneElement); | |
137 return container; | |
138 } | |
139 | |
140 /** | |
141 * @override | 110 * @override |
142 * @param {string} locationName | 111 * @param {string} locationName |
143 * @return {?UI.ViewLocation} | 112 * @return {?UI.ViewLocation} |
144 */ | 113 */ |
145 resolveLocation(locationName) { | 114 resolveLocation(locationName) { |
146 return this.sidebarPaneView; | 115 return this.sidebarPaneView; |
147 } | 116 } |
148 | 117 |
149 /** | 118 /** |
150 * @param {?UI.Widget} widget | 119 * @param {?UI.Widget} widget |
151 * @param {?UI.ToolbarToggle} toggle | 120 * @param {?UI.ToolbarToggle} toggle |
152 */ | 121 */ |
153 showToolbarPane(widget, toggle) { | 122 showToolbarPane(widget, toggle) { |
dgozman
2017/06/05 21:07:23
Why this method is still here?
luoe
2017/06/05 21:31:30
It's still used by some providers:
- https://cs.ch
dgozman
2017/06/06 21:43:06
Let's add a TODO to remove this.
luoe
2017/06/06 22:00:01
Done.
| |
154 if (this._pendingWidgetToggle) | 123 this._stylesWidget.showToolbarPane(widget, toggle); |
155 this._pendingWidgetToggle.setToggled(false); | |
156 this._pendingWidgetToggle = toggle; | |
157 | |
158 if (this._animatedToolbarPane) | |
159 this._pendingWidget = widget; | |
160 else | |
161 this._startToolbarPaneAnimation(widget); | |
162 | |
163 if (widget && toggle) | |
164 toggle.setToggled(true); | |
165 } | 124 } |
166 | 125 |
167 /** | 126 /** |
168 * @param {?UI.Widget} widget | |
169 */ | |
170 _startToolbarPaneAnimation(widget) { | |
171 if (widget === this._currentToolbarPane) | |
172 return; | |
173 | |
174 if (widget && this._currentToolbarPane) { | |
175 this._currentToolbarPane.detach(); | |
176 widget.show(this._toolbarPaneElement); | |
177 this._currentToolbarPane = widget; | |
178 this._currentToolbarPane.focus(); | |
179 return; | |
180 } | |
181 | |
182 this._animatedToolbarPane = widget; | |
183 | |
184 if (this._currentToolbarPane) | |
185 this._toolbarPaneElement.style.animationName = 'styles-element-state-pane- slideout'; | |
186 else if (widget) | |
187 this._toolbarPaneElement.style.animationName = 'styles-element-state-pane- slidein'; | |
188 | |
189 if (widget) | |
190 widget.show(this._toolbarPaneElement); | |
191 | |
192 var listener = onAnimationEnd.bind(this); | |
193 this._toolbarPaneElement.addEventListener('animationend', listener, false); | |
194 | |
195 /** | |
196 * @this {Elements.ElementsPanel} | |
197 */ | |
198 function onAnimationEnd() { | |
199 this._toolbarPaneElement.style.removeProperty('animation-name'); | |
200 this._toolbarPaneElement.removeEventListener('animationend', listener, fal se); | |
201 | |
202 if (this._currentToolbarPane) | |
203 this._currentToolbarPane.detach(); | |
204 | |
205 this._currentToolbarPane = this._animatedToolbarPane; | |
206 if (this._currentToolbarPane) | |
207 this._currentToolbarPane.focus(); | |
208 this._animatedToolbarPane = null; | |
209 | |
210 if (this._pendingWidget) { | |
211 this._startToolbarPaneAnimation(this._pendingWidget); | |
212 this._pendingWidget = null; | |
213 } | |
214 } | |
215 } | |
216 | |
217 /** | |
218 * @override | 127 * @override |
219 * @param {!SDK.DOMModel} domModel | 128 * @param {!SDK.DOMModel} domModel |
220 */ | 129 */ |
221 modelAdded(domModel) { | 130 modelAdded(domModel) { |
222 var treeOutline = new Elements.ElementsTreeOutline(domModel, true, true); | 131 var treeOutline = new Elements.ElementsTreeOutline(domModel, true, true); |
223 treeOutline.setWordWrap(Common.moduleSetting('domWordWrap').get()); | 132 treeOutline.setWordWrap(Common.moduleSetting('domWordWrap').get()); |
224 treeOutline.wireToDOMModel(); | 133 treeOutline.wireToDOMModel(); |
225 treeOutline.addEventListener( | 134 treeOutline.addEventListener( |
226 Elements.ElementsTreeOutline.Events.SelectedNodeChanged, this._selectedN odeChanged, this); | 135 Elements.ElementsTreeOutline.Events.SelectedNodeChanged, this._selectedN odeChanged, this); |
227 treeOutline.addEventListener( | 136 treeOutline.addEventListener( |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
833 | 742 |
834 var extensionSidebarPanes = Extensions.extensionServer.sidebarPanes(); | 743 var extensionSidebarPanes = Extensions.extensionServer.sidebarPanes(); |
835 if (this.sidebarPaneView) { | 744 if (this.sidebarPaneView) { |
836 this.sidebarPaneView.tabbedPane().detach(); | 745 this.sidebarPaneView.tabbedPane().detach(); |
837 this._splitWidget.uninstallResizer(this.sidebarPaneView.tabbedPane().heade rElement()); | 746 this._splitWidget.uninstallResizer(this.sidebarPaneView.tabbedPane().heade rElement()); |
838 } | 747 } |
839 | 748 |
840 this._splitWidget.setVertical(this._splitMode === Elements.ElementsPanel._sp litMode.Vertical); | 749 this._splitWidget.setVertical(this._splitMode === Elements.ElementsPanel._sp litMode.Vertical); |
841 this.showToolbarPane(null /* widget */, null /* toggle */); | 750 this.showToolbarPane(null /* widget */, null /* toggle */); |
842 | 751 |
843 var matchedStylesContainer = new UI.VBox(); | |
844 matchedStylesContainer.element.appendChild(this._stylesSidebarToolbar); | |
845 var matchedStylePanesWrapper = new UI.VBox(); | 752 var matchedStylePanesWrapper = new UI.VBox(); |
846 matchedStylePanesWrapper.element.classList.add('style-panes-wrapper'); | 753 matchedStylePanesWrapper.element.classList.add('style-panes-wrapper'); |
847 matchedStylePanesWrapper.show(matchedStylesContainer.element); | |
848 this._stylesWidget.show(matchedStylePanesWrapper.element); | 754 this._stylesWidget.show(matchedStylePanesWrapper.element); |
849 | 755 |
850 var computedStylePanesWrapper = new UI.VBox(); | 756 var computedStylePanesWrapper = new UI.VBox(); |
851 computedStylePanesWrapper.element.classList.add('style-panes-wrapper'); | 757 computedStylePanesWrapper.element.classList.add('style-panes-wrapper'); |
852 this._computedStyleWidget.show(computedStylePanesWrapper.element); | 758 this._computedStyleWidget.show(computedStylePanesWrapper.element); |
853 | 759 |
854 /** | 760 /** |
855 * @param {boolean} inComputedStyle | 761 * @param {boolean} inComputedStyle |
856 * @this {Elements.ElementsPanel} | 762 * @this {Elements.ElementsPanel} |
857 */ | 763 */ |
(...skipping 28 matching lines...) Expand all Loading... | |
886 this._splitWidget.installResizer(tabbedPane.headerElement()); | 792 this._splitWidget.installResizer(tabbedPane.headerElement()); |
887 | 793 |
888 var stylesView = new UI.SimpleView(Common.UIString('Styles')); | 794 var stylesView = new UI.SimpleView(Common.UIString('Styles')); |
889 this.sidebarPaneView.appendView(stylesView); | 795 this.sidebarPaneView.appendView(stylesView); |
890 if (splitMode === Elements.ElementsPanel._splitMode.Horizontal) { | 796 if (splitMode === Elements.ElementsPanel._splitMode.Horizontal) { |
891 // Styles and computed are merged into a single tab. | 797 // Styles and computed are merged into a single tab. |
892 stylesView.element.classList.add('flex-auto'); | 798 stylesView.element.classList.add('flex-auto'); |
893 | 799 |
894 var splitWidget = new UI.SplitWidget(true, true, 'stylesPaneSplitViewState ', 215); | 800 var splitWidget = new UI.SplitWidget(true, true, 'stylesPaneSplitViewState ', 215); |
895 splitWidget.show(stylesView.element); | 801 splitWidget.show(stylesView.element); |
896 splitWidget.setMainWidget(matchedStylesContainer); | 802 splitWidget.setMainWidget(matchedStylePanesWrapper); |
897 splitWidget.setSidebarWidget(computedStylePanesWrapper); | 803 splitWidget.setSidebarWidget(computedStylePanesWrapper); |
898 } else { | 804 } else { |
899 // Styles and computed are in separate tabs. | 805 // Styles and computed are in separate tabs. |
900 stylesView.element.classList.add('flex-auto', 'metrics-and-styles'); | 806 stylesView.element.classList.add('flex-auto', 'metrics-and-styles'); |
901 matchedStylesContainer.show(stylesView.element); | 807 matchedStylePanesWrapper.show(stylesView.element); |
902 | 808 |
903 var computedView = new UI.SimpleView(Common.UIString('Computed')); | 809 var computedView = new UI.SimpleView(Common.UIString('Computed')); |
904 computedView.element.classList.add('composite', 'fill', 'metrics-and-compu ted'); | 810 computedView.element.classList.add('composite', 'fill', 'metrics-and-compu ted'); |
905 computedStylePanesWrapper.show(computedView.element); | 811 computedStylePanesWrapper.show(computedView.element); |
906 | 812 |
907 tabbedPane.addEventListener(UI.TabbedPane.Events.TabSelected, tabSelected, this); | 813 tabbedPane.addEventListener(UI.TabbedPane.Events.TabSelected, tabSelected, this); |
908 this.sidebarPaneView.appendView(computedView); | 814 this.sidebarPaneView.appendView(computedView); |
909 } | 815 } |
910 this._stylesViewToReveal = stylesView; | 816 this._stylesViewToReveal = stylesView; |
911 | 817 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1078 * @param {!SDK.DOMNode} node | 984 * @param {!SDK.DOMNode} node |
1079 * @return {?{title: string, color: string}} | 985 * @return {?{title: string, color: string}} |
1080 */ | 986 */ |
1081 decorate(node) { | 987 decorate(node) { |
1082 return { | 988 return { |
1083 color: 'orange', | 989 color: 'orange', |
1084 title: Common.UIString('Element state: %s', ':' + node.domModel().cssModel ().pseudoState(node).join(', :')) | 990 title: Common.UIString('Element state: %s', ':' + node.domModel().cssModel ().pseudoState(node).join(', :')) |
1085 }; | 991 }; |
1086 } | 992 } |
1087 }; | 993 }; |
OLD | NEW |