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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Sty
leSheetAdded, this._styleSheetOrMediaQueryResultChanged, this); | 67 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Sty
leSheetAdded, this._styleSheetOrMediaQueryResultChanged, this); |
68 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Sty
leSheetRemoved, this._styleSheetOrMediaQueryResultChanged, this); | 68 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Sty
leSheetRemoved, this._styleSheetOrMediaQueryResultChanged, this); |
69 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Sty
leSheetChanged, this._styleSheetOrMediaQueryResultChanged, this); | 69 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Sty
leSheetChanged, this._styleSheetOrMediaQueryResultChanged, this); |
70 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Med
iaQueryResultChanged, this._styleSheetOrMediaQueryResultChanged, this); | 70 WebInspector.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Med
iaQueryResultChanged, this._styleSheetOrMediaQueryResultChanged, this); |
71 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrModi
fied, this._attributeChanged, this); | 71 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrModi
fied, this._attributeChanged, this); |
72 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrRemo
ved, this._attributeChanged, this); | 72 WebInspector.domAgent.addEventListener(WebInspector.DOMAgent.Events.AttrRemo
ved, this._attributeChanged, this); |
73 WebInspector.settings.showUserAgentStyles.addChangeListener(this._showUserAg
entStylesSettingChanged.bind(this)); | 73 WebInspector.settings.showUserAgentStyles.addChangeListener(this._showUserAg
entStylesSettingChanged.bind(this)); |
74 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.FrameResized, this._frameResized, this); | 74 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.FrameResized, this._frameResized, this); |
75 this.element.classList.add("styles-pane"); | 75 this.element.classList.add("styles-pane"); |
76 this.element.enableStyleClass("show-user-styles", WebInspector.settings.show
UserAgentStyles.get()); | 76 this.element.classList.toggle("show-user-styles", WebInspector.settings.show
UserAgentStyles.get()); |
77 this.element.addEventListener("mousemove", this._mouseMovedOverElement.bind(
this), false); | 77 this.element.addEventListener("mousemove", this._mouseMovedOverElement.bind(
this), false); |
78 document.body.addEventListener("keydown", this._keyDown.bind(this), false); | 78 document.body.addEventListener("keydown", this._keyDown.bind(this), false); |
79 document.body.addEventListener("keyup", this._keyUp.bind(this), false); | 79 document.body.addEventListener("keyup", this._keyUp.bind(this), false); |
80 } | 80 } |
81 | 81 |
82 // Keep in sync with RenderStyleConstants.h PseudoId enum. Array below contains
pseudo id names for corresponding enum indexes. | 82 // Keep in sync with RenderStyleConstants.h PseudoId enum. Array below contains
pseudo id names for corresponding enum indexes. |
83 // First item is empty due to its artificial NOPSEUDO nature in the enum. | 83 // First item is empty due to its artificial NOPSEUDO nature in the enum. |
84 // FIXME: find a way of generating this mapping or getting it from combination o
f RenderStyleConstants and CSSSelector.cpp at | 84 // FIXME: find a way of generating this mapping or getting it from combination o
f RenderStyleConstants and CSSSelector.cpp at |
85 // runtime. | 85 // runtime. |
86 WebInspector.StylesSidebarPane.PseudoIdNames = [ | 86 WebInspector.StylesSidebarPane.PseudoIdNames = [ |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 { | 184 { |
185 return this.node ? (this.node.getUserProperty("pseudoState") || undefine
d) : undefined; | 185 return this.node ? (this.node.getUserProperty("pseudoState") || undefine
d) : undefined; |
186 }, | 186 }, |
187 | 187 |
188 _updateForcedPseudoStateInputs: function() | 188 _updateForcedPseudoStateInputs: function() |
189 { | 189 { |
190 if (!this.node) | 190 if (!this.node) |
191 return; | 191 return; |
192 | 192 |
193 var hasPseudoType = !!this.node.pseudoType(); | 193 var hasPseudoType = !!this.node.pseudoType(); |
194 this._elementStateButton.enableStyleClass("hidden", hasPseudoType); | 194 this._elementStateButton.classList.toggle("hidden", hasPseudoType); |
195 this._elementStatePane.enableStyleClass("expanded", !hasPseudoType && th
is._elementStateButton.classList.contains("toggled")); | 195 this._elementStatePane.classList.toggle("expanded", !hasPseudoType && th
is._elementStateButton.classList.contains("toggled")); |
196 | 196 |
197 var nodePseudoState = this._forcedPseudoClasses; | 197 var nodePseudoState = this._forcedPseudoClasses; |
198 if (!nodePseudoState) | 198 if (!nodePseudoState) |
199 nodePseudoState = []; | 199 nodePseudoState = []; |
200 | 200 |
201 var inputs = this._elementStatePane.inputs; | 201 var inputs = this._elementStatePane.inputs; |
202 for (var i = 0; i < inputs.length; ++i) | 202 for (var i = 0; i < inputs.length; ++i) |
203 inputs[i].checked = nodePseudoState.indexOf(inputs[i].state) >= 0; | 203 inputs[i].checked = nodePseudoState.indexOf(inputs[i].state) >= 0; |
204 }, | 204 }, |
205 | 205 |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 } | 754 } |
755 }, | 755 }, |
756 | 756 |
757 _toggleElementStatePane: function(event) | 757 _toggleElementStatePane: function(event) |
758 { | 758 { |
759 event.consume(); | 759 event.consume(); |
760 | 760 |
761 var buttonToggled = !this._elementStateButton.classList.contains("toggle
d"); | 761 var buttonToggled = !this._elementStateButton.classList.contains("toggle
d"); |
762 if (buttonToggled) | 762 if (buttonToggled) |
763 this.expand(); | 763 this.expand(); |
764 this._elementStateButton.enableStyleClass("toggled", buttonToggled); | 764 this._elementStateButton.classList.toggle("toggled", buttonToggled); |
765 this._elementStatePane.enableStyleClass("expanded", buttonToggled); | 765 this._elementStatePane.classList.toggle("expanded", buttonToggled); |
766 }, | 766 }, |
767 | 767 |
768 _createElementStatePane: function() | 768 _createElementStatePane: function() |
769 { | 769 { |
770 this._elementStatePane = document.createElement("div"); | 770 this._elementStatePane = document.createElement("div"); |
771 this._elementStatePane.className = "styles-element-state-pane source-cod
e"; | 771 this._elementStatePane.className = "styles-element-state-pane source-cod
e"; |
772 var table = document.createElement("table"); | 772 var table = document.createElement("table"); |
773 | 773 |
774 var inputs = []; | 774 var inputs = []; |
775 this._elementStatePane.inputs = inputs; | 775 this._elementStatePane.inputs = inputs; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 | 818 |
819 this._elementStatePane.appendChild(table); | 819 this._elementStatePane.appendChild(table); |
820 }, | 820 }, |
821 | 821 |
822 /** | 822 /** |
823 * @param {!WebInspector.Event} event | 823 * @param {!WebInspector.Event} event |
824 */ | 824 */ |
825 _showUserAgentStylesSettingChanged: function(event) | 825 _showUserAgentStylesSettingChanged: function(event) |
826 { | 826 { |
827 var showStyles = /** @type {boolean} */ (event.data); | 827 var showStyles = /** @type {boolean} */ (event.data); |
828 this.element.enableStyleClass("show-user-styles", showStyles); | 828 this.element.classList.toggle("show-user-styles", showStyles); |
829 }, | 829 }, |
830 | 830 |
831 willHide: function() | 831 willHide: function() |
832 { | 832 { |
833 this._spectrumHelper.hide(); | 833 this._spectrumHelper.hide(); |
834 this._discardElementUnderMouse(); | 834 this._discardElementUnderMouse(); |
835 }, | 835 }, |
836 | 836 |
837 _discardElementUnderMouse: function() | 837 _discardElementUnderMouse: function() |
838 { | 838 { |
(...skipping 2195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3034 return; | 3034 return; |
3035 } | 3035 } |
3036 | 3036 |
3037 var results = this._cssCompletions.startsWith(prefix); | 3037 var results = this._cssCompletions.startsWith(prefix); |
3038 var selectedIndex = this._cssCompletions.mostUsedOf(results); | 3038 var selectedIndex = this._cssCompletions.mostUsedOf(results); |
3039 completionsReadyCallback(results, selectedIndex); | 3039 completionsReadyCallback(results, selectedIndex); |
3040 }, | 3040 }, |
3041 | 3041 |
3042 __proto__: WebInspector.TextPrompt.prototype | 3042 __proto__: WebInspector.TextPrompt.prototype |
3043 } | 3043 } |
OLD | NEW |