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) { |
154 if (this._pendingWidgetToggle) | 123 // TODO(luoe): remove this function once its providers have an alternative w
ay to reveal their views. |
155 this._pendingWidgetToggle.setToggled(false); | 124 this._stylesWidget.showToolbarPane(widget, toggle); |
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 } | 125 } |
166 | 126 |
167 /** | 127 /** |
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 | 128 * @override |
219 * @param {!SDK.DOMModel} domModel | 129 * @param {!SDK.DOMModel} domModel |
220 */ | 130 */ |
221 modelAdded(domModel) { | 131 modelAdded(domModel) { |
222 var treeOutline = new Elements.ElementsTreeOutline(domModel, true, true); | 132 var treeOutline = new Elements.ElementsTreeOutline(domModel, true, true); |
223 treeOutline.setWordWrap(Common.moduleSetting('domWordWrap').get()); | 133 treeOutline.setWordWrap(Common.moduleSetting('domWordWrap').get()); |
224 treeOutline.wireToDOMModel(); | 134 treeOutline.wireToDOMModel(); |
225 treeOutline.addEventListener( | 135 treeOutline.addEventListener( |
226 Elements.ElementsTreeOutline.Events.SelectedNodeChanged, this._selectedN
odeChanged, this); | 136 Elements.ElementsTreeOutline.Events.SelectedNodeChanged, this._selectedN
odeChanged, this); |
227 treeOutline.addEventListener( | 137 treeOutline.addEventListener( |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 | 743 |
834 var extensionSidebarPanes = Extensions.extensionServer.sidebarPanes(); | 744 var extensionSidebarPanes = Extensions.extensionServer.sidebarPanes(); |
835 if (this.sidebarPaneView) { | 745 if (this.sidebarPaneView) { |
836 this.sidebarPaneView.tabbedPane().detach(); | 746 this.sidebarPaneView.tabbedPane().detach(); |
837 this._splitWidget.uninstallResizer(this.sidebarPaneView.tabbedPane().heade
rElement()); | 747 this._splitWidget.uninstallResizer(this.sidebarPaneView.tabbedPane().heade
rElement()); |
838 } | 748 } |
839 | 749 |
840 this._splitWidget.setVertical(this._splitMode === Elements.ElementsPanel._sp
litMode.Vertical); | 750 this._splitWidget.setVertical(this._splitMode === Elements.ElementsPanel._sp
litMode.Vertical); |
841 this.showToolbarPane(null /* widget */, null /* toggle */); | 751 this.showToolbarPane(null /* widget */, null /* toggle */); |
842 | 752 |
843 var matchedStylesContainer = new UI.VBox(); | |
844 matchedStylesContainer.element.appendChild(this._stylesSidebarToolbar); | |
845 var matchedStylePanesWrapper = new UI.VBox(); | 753 var matchedStylePanesWrapper = new UI.VBox(); |
846 matchedStylePanesWrapper.element.classList.add('style-panes-wrapper'); | 754 matchedStylePanesWrapper.element.classList.add('style-panes-wrapper'); |
847 matchedStylePanesWrapper.show(matchedStylesContainer.element); | |
848 this._stylesWidget.show(matchedStylePanesWrapper.element); | 755 this._stylesWidget.show(matchedStylePanesWrapper.element); |
849 | 756 |
850 var computedStylePanesWrapper = new UI.VBox(); | 757 var computedStylePanesWrapper = new UI.VBox(); |
851 computedStylePanesWrapper.element.classList.add('style-panes-wrapper'); | 758 computedStylePanesWrapper.element.classList.add('style-panes-wrapper'); |
852 this._computedStyleWidget.show(computedStylePanesWrapper.element); | 759 this._computedStyleWidget.show(computedStylePanesWrapper.element); |
853 | 760 |
854 /** | 761 /** |
855 * @param {boolean} inComputedStyle | 762 * @param {boolean} inComputedStyle |
856 * @this {Elements.ElementsPanel} | 763 * @this {Elements.ElementsPanel} |
857 */ | 764 */ |
(...skipping 28 matching lines...) Expand all Loading... |
886 this._splitWidget.installResizer(tabbedPane.headerElement()); | 793 this._splitWidget.installResizer(tabbedPane.headerElement()); |
887 | 794 |
888 var stylesView = new UI.SimpleView(Common.UIString('Styles')); | 795 var stylesView = new UI.SimpleView(Common.UIString('Styles')); |
889 this.sidebarPaneView.appendView(stylesView); | 796 this.sidebarPaneView.appendView(stylesView); |
890 if (splitMode === Elements.ElementsPanel._splitMode.Horizontal) { | 797 if (splitMode === Elements.ElementsPanel._splitMode.Horizontal) { |
891 // Styles and computed are merged into a single tab. | 798 // Styles and computed are merged into a single tab. |
892 stylesView.element.classList.add('flex-auto'); | 799 stylesView.element.classList.add('flex-auto'); |
893 | 800 |
894 var splitWidget = new UI.SplitWidget(true, true, 'stylesPaneSplitViewState
', 215); | 801 var splitWidget = new UI.SplitWidget(true, true, 'stylesPaneSplitViewState
', 215); |
895 splitWidget.show(stylesView.element); | 802 splitWidget.show(stylesView.element); |
896 splitWidget.setMainWidget(matchedStylesContainer); | 803 splitWidget.setMainWidget(matchedStylePanesWrapper); |
897 splitWidget.setSidebarWidget(computedStylePanesWrapper); | 804 splitWidget.setSidebarWidget(computedStylePanesWrapper); |
898 } else { | 805 } else { |
899 // Styles and computed are in separate tabs. | 806 // Styles and computed are in separate tabs. |
900 stylesView.element.classList.add('flex-auto', 'metrics-and-styles'); | 807 stylesView.element.classList.add('flex-auto', 'metrics-and-styles'); |
901 matchedStylesContainer.show(stylesView.element); | 808 matchedStylePanesWrapper.show(stylesView.element); |
902 | 809 |
903 var computedView = new UI.SimpleView(Common.UIString('Computed')); | 810 var computedView = new UI.SimpleView(Common.UIString('Computed')); |
904 computedView.element.classList.add('composite', 'fill', 'metrics-and-compu
ted'); | 811 computedView.element.classList.add('composite', 'fill', 'metrics-and-compu
ted'); |
905 computedStylePanesWrapper.show(computedView.element); | 812 computedStylePanesWrapper.show(computedView.element); |
906 | 813 |
907 tabbedPane.addEventListener(UI.TabbedPane.Events.TabSelected, tabSelected,
this); | 814 tabbedPane.addEventListener(UI.TabbedPane.Events.TabSelected, tabSelected,
this); |
908 this.sidebarPaneView.appendView(computedView); | 815 this.sidebarPaneView.appendView(computedView); |
909 } | 816 } |
910 this._stylesViewToReveal = stylesView; | 817 this._stylesViewToReveal = stylesView; |
911 | 818 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 * @param {!SDK.DOMNode} node | 985 * @param {!SDK.DOMNode} node |
1079 * @return {?{title: string, color: string}} | 986 * @return {?{title: string, color: string}} |
1080 */ | 987 */ |
1081 decorate(node) { | 988 decorate(node) { |
1082 return { | 989 return { |
1083 color: 'orange', | 990 color: 'orange', |
1084 title: Common.UIString('Element state: %s', ':' + node.domModel().cssModel
().pseudoState(node).join(', :')) | 991 title: Common.UIString('Element state: %s', ':' + node.domModel().cssModel
().pseudoState(node).join(', :')) |
1085 }; | 992 }; |
1086 } | 993 } |
1087 }; | 994 }; |
OLD | NEW |