| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 var toolbar = new WebInspector.ExtensibleToolbar("styles-sidebarpane-toolbar
", this.titleElement); | 43 var toolbar = new WebInspector.ExtensibleToolbar("styles-sidebarpane-toolbar
", this.titleElement); |
| 44 toolbar.element.classList.add("styles-pane-toolbar"); | 44 toolbar.element.classList.add("styles-pane-toolbar"); |
| 45 toolbar.makeNarrow(); | 45 toolbar.makeNarrow(); |
| 46 | 46 |
| 47 this._requestShowCallback = requestShowCallback; | 47 this._requestShowCallback = requestShowCallback; |
| 48 var toolbarPaneContainer = this.bodyElement.createChild("div", "styles-sideb
ar-toolbar-pane-container"); | 48 var toolbarPaneContainer = this.bodyElement.createChild("div", "styles-sideb
ar-toolbar-pane-container"); |
| 49 this._toolbarPaneElement = toolbarPaneContainer.createChild("div", "styles-s
idebar-toolbar-pane"); | 49 this._toolbarPaneElement = toolbarPaneContainer.createChild("div", "styles-s
idebar-toolbar-pane"); |
| 50 this._sectionsContainer = this.bodyElement.createChild("div"); | 50 this._sectionsContainer = this.bodyElement.createChild("div"); |
| 51 | 51 |
| 52 this._stylesPopoverHelper = new WebInspector.StylesPopoverHelper(); | 52 this._editorPopoverHelper = new WebInspector.EditorPopoverHelper(); |
| 53 | 53 |
| 54 this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.Defa
ultCSSFormatter()); | 54 this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.Defa
ultCSSFormatter()); |
| 55 | 55 |
| 56 this.element.classList.add("styles-pane"); | 56 this.element.classList.add("styles-pane"); |
| 57 this.element.addEventListener("mousemove", this._mouseMovedOverElement.bind(
this), false); | 57 this.element.addEventListener("mousemove", this._mouseMovedOverElement.bind(
this), false); |
| 58 this._keyDownBound = this._keyDown.bind(this); | 58 this._keyDownBound = this._keyDown.bind(this); |
| 59 this._keyUpBound = this._keyUp.bind(this); | 59 this._keyUpBound = this._keyUp.bind(this); |
| 60 } | 60 } |
| 61 | 61 |
| 62 // Keep in sync with ComputedStyleConstants.h PseudoId enum. Array below contain
s pseudo id names for corresponding enum indexes. | 62 // Keep in sync with ComputedStyleConstants.h PseudoId enum. Array below contain
s pseudo id names for corresponding enum indexes. |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 // We should update SSP on main frame navigation only. | 296 // We should update SSP on main frame navigation only. |
| 297 var mainFrameNavigated = node && this.node() && node.ownerDocument !== t
his.node().ownerDocument; | 297 var mainFrameNavigated = node && this.node() && node.ownerDocument !== t
his.node().ownerDocument; |
| 298 if (!mainFrameNavigated && node !== this.node()) { | 298 if (!mainFrameNavigated && node !== this.node()) { |
| 299 this.element.classList.toggle("no-affect", this._isEditingStyle); | 299 this.element.classList.toggle("no-affect", this._isEditingStyle); |
| 300 if (this._isEditingStyle) { | 300 if (this._isEditingStyle) { |
| 301 this._pendingNode = node; | 301 this._pendingNode = node; |
| 302 return; | 302 return; |
| 303 } | 303 } |
| 304 } | 304 } |
| 305 | 305 |
| 306 this._stylesPopoverHelper.hide(); | 306 this._editorPopoverHelper.hide(); |
| 307 node = WebInspector.SharedSidebarModel.elementNode(node); | 307 node = WebInspector.SharedSidebarModel.elementNode(node); |
| 308 | 308 |
| 309 this._resetCache(); | 309 this._resetCache(); |
| 310 WebInspector.ElementsSidebarPane.prototype.setNode.call(this, node); | 310 WebInspector.ElementsSidebarPane.prototype.setNode.call(this, node); |
| 311 }, | 311 }, |
| 312 | 312 |
| 313 /** | 313 /** |
| 314 * @param {!WebInspector.StylePropertiesSection=} editedSection | 314 * @param {!WebInspector.StylePropertiesSection=} editedSection |
| 315 */ | 315 */ |
| 316 _refreshUpdate: function(editedSection) | 316 _refreshUpdate: function(editedSection) |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 this.element.ownerDocument.body.addEventListener("keyup", this._keyUpBou
nd, false); | 750 this.element.ownerDocument.body.addEventListener("keyup", this._keyUpBou
nd, false); |
| 751 }, | 751 }, |
| 752 | 752 |
| 753 /** | 753 /** |
| 754 * @override | 754 * @override |
| 755 */ | 755 */ |
| 756 willHide: function() | 756 willHide: function() |
| 757 { | 757 { |
| 758 this.element.ownerDocument.body.removeEventListener("keydown", this._key
DownBound, false); | 758 this.element.ownerDocument.body.removeEventListener("keydown", this._key
DownBound, false); |
| 759 this.element.ownerDocument.body.removeEventListener("keyup", this._keyUp
Bound, false); | 759 this.element.ownerDocument.body.removeEventListener("keyup", this._keyUp
Bound, false); |
| 760 this._stylesPopoverHelper.hide(); | 760 this._editorPopoverHelper.hide(); |
| 761 this._discardElementUnderMouse(); | 761 this._discardElementUnderMouse(); |
| 762 WebInspector.ElementsSidebarPane.prototype.willHide.call(this); | 762 WebInspector.ElementsSidebarPane.prototype.willHide.call(this); |
| 763 }, | 763 }, |
| 764 | 764 |
| 765 _discardElementUnderMouse: function() | 765 _discardElementUnderMouse: function() |
| 766 { | 766 { |
| 767 if (this._elementUnderMouse) | 767 if (this._elementUnderMouse) |
| 768 this._elementUnderMouse.classList.remove("styles-panel-hovered"); | 768 this._elementUnderMouse.classList.remove("styles-panel-hovered"); |
| 769 delete this._elementUnderMouse; | 769 delete this._elementUnderMouse; |
| 770 }, | 770 }, |
| (...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2072 var color = WebInspector.Color.parse(text); | 2072 var color = WebInspector.Color.parse(text); |
| 2073 if (!color) | 2073 if (!color) |
| 2074 return createTextNode(text); | 2074 return createTextNode(text); |
| 2075 | 2075 |
| 2076 if (!this._styleRule.editable()) { | 2076 if (!this._styleRule.editable()) { |
| 2077 var swatch = WebInspector.ColorSwatch.create(); | 2077 var swatch = WebInspector.ColorSwatch.create(); |
| 2078 swatch.setColorText(text); | 2078 swatch.setColorText(text); |
| 2079 return swatch; | 2079 return swatch; |
| 2080 } | 2080 } |
| 2081 | 2081 |
| 2082 var stylesPopoverHelper = this._parentPane._stylesPopoverHelper; | 2082 var editorPopoverHelper = this._parentPane._editorPopoverHelper; |
| 2083 return new WebInspector.ColowSwatchPopoverIcon(this, stylesPopoverHelper
, text).element(); | 2083 return new WebInspector.ColorSwatchPopoverIcon(this, editorPopoverHelper
, text).element(); |
| 2084 }, | 2084 }, |
| 2085 | 2085 |
| 2086 /** | 2086 /** |
| 2087 * @return {string} | 2087 * @return {string} |
| 2088 */ | 2088 */ |
| 2089 renderedPropertyText: function() | 2089 renderedPropertyText: function() |
| 2090 { | 2090 { |
| 2091 return this.nameElement.textContent + ": " + this.valueElement.textConte
nt; | 2091 return this.nameElement.textContent + ": " + this.valueElement.textConte
nt; |
| 2092 }, | 2092 }, |
| 2093 | 2093 |
| 2094 /** | 2094 /** |
| 2095 * @param {string} text | 2095 * @param {string} text |
| 2096 * @return {!Node} | 2096 * @return {!Node} |
| 2097 */ | 2097 */ |
| 2098 _processBezier: function(text) | 2098 _processBezier: function(text) |
| 2099 { | 2099 { |
| 2100 var geometry = WebInspector.Geometry.CubicBezier.parse(text); | 2100 var geometry = WebInspector.Geometry.CubicBezier.parse(text); |
| 2101 if (!geometry || !this._styleRule.editable()) | 2101 if (!geometry || !this._styleRule.editable()) |
| 2102 return createTextNode(text); | 2102 return createTextNode(text); |
| 2103 var stylesPopoverHelper = this._parentPane._stylesPopoverHelper; | 2103 var editorPopoverHelper = this._parentPane._editorPopoverHelper; |
| 2104 return new WebInspector.BezierPopoverIcon(this, stylesPopoverHelper, tex
t).element(); | 2104 return new WebInspector.BezierPopoverIcon(this, editorPopoverHelper, tex
t).element(); |
| 2105 }, | 2105 }, |
| 2106 | 2106 |
| 2107 _updateState: function() | 2107 _updateState: function() |
| 2108 { | 2108 { |
| 2109 if (!this.listItemElement) | 2109 if (!this.listItemElement) |
| 2110 return; | 2110 return; |
| 2111 | 2111 |
| 2112 if (this.style().isPropertyImplicit(this.name)) | 2112 if (this.style().isPropertyImplicit(this.name)) |
| 2113 this.listItemElement.classList.add("implicit"); | 2113 this.listItemElement.classList.add("implicit"); |
| 2114 else | 2114 else |
| (...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3255 | 3255 |
| 3256 /** | 3256 /** |
| 3257 * @override | 3257 * @override |
| 3258 * @return {?WebInspector.ToolbarItem} | 3258 * @return {?WebInspector.ToolbarItem} |
| 3259 */ | 3259 */ |
| 3260 item: function() | 3260 item: function() |
| 3261 { | 3261 { |
| 3262 return this._button; | 3262 return this._button; |
| 3263 } | 3263 } |
| 3264 } | 3264 } |
| OLD | NEW |