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 22 matching lines...) Expand all Loading... |
33 */ | 33 */ |
34 WebInspector.StylesSidebarPane = function() | 34 WebInspector.StylesSidebarPane = function() |
35 { | 35 { |
36 WebInspector.ElementsSidebarPane.call(this, WebInspector.UIString("Styles"))
; | 36 WebInspector.ElementsSidebarPane.call(this, WebInspector.UIString("Styles"))
; |
37 this.setMinimumSize(96, 26); | 37 this.setMinimumSize(96, 26); |
38 | 38 |
39 WebInspector.moduleSetting("colorFormat").addChangeListener(this.update.bind
(this)); | 39 WebInspector.moduleSetting("colorFormat").addChangeListener(this.update.bind
(this)); |
40 WebInspector.moduleSetting("textEditorIndent").addChangeListener(this.update
.bind(this)); | 40 WebInspector.moduleSetting("textEditorIndent").addChangeListener(this.update
.bind(this)); |
41 | 41 |
42 this._sectionsContainer = this.element.createChild("div"); | 42 this._sectionsContainer = this.element.createChild("div"); |
43 this._stylesPopoverHelper = new WebInspector.StylesPopoverHelper(); | 43 this._iconPopoverHelper = new WebInspector.IconPopoverHelper(); |
44 this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.Defa
ultCSSFormatter()); | 44 this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.Defa
ultCSSFormatter()); |
45 | 45 |
46 this.element.classList.add("styles-pane"); | 46 this.element.classList.add("styles-pane"); |
47 this.element.addEventListener("mousemove", this._mouseMovedOverElement.bind(
this), false); | 47 this.element.addEventListener("mousemove", this._mouseMovedOverElement.bind(
this), false); |
48 this._keyDownBound = this._keyDown.bind(this); | 48 this._keyDownBound = this._keyDown.bind(this); |
49 this._keyUpBound = this._keyUp.bind(this); | 49 this._keyUpBound = this._keyUp.bind(this); |
50 | 50 |
51 /** @type {!Array<!WebInspector.SectionBlock>} */ | 51 /** @type {!Array<!WebInspector.SectionBlock>} */ |
52 this._sectionBlocks = []; | 52 this._sectionBlocks = []; |
53 WebInspector.StylesSidebarPane._instance = this; | 53 WebInspector.StylesSidebarPane._instance = this; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 */ | 129 */ |
130 revealProperty: function(cssProperty) | 130 revealProperty: function(cssProperty) |
131 { | 131 { |
132 this._decorator = new WebInspector.PropertyRevealHighlighter(this, cssPr
operty); | 132 this._decorator = new WebInspector.PropertyRevealHighlighter(this, cssPr
operty); |
133 this._decorator.perform(); | 133 this._decorator.perform(); |
134 this.update(); | 134 this.update(); |
135 }, | 135 }, |
136 | 136 |
137 forceUpdate: function() | 137 forceUpdate: function() |
138 { | 138 { |
139 this._stylesPopoverHelper.hide(); | 139 this._iconPopoverHelper.hide(); |
140 this._resetCache(); | 140 this._resetCache(); |
141 this.update(); | 141 this.update(); |
142 }, | 142 }, |
143 | 143 |
144 /** | 144 /** |
145 * @param {!Event} event | 145 * @param {!Event} event |
146 */ | 146 */ |
147 _onAddButtonLongClick: function(event) | 147 _onAddButtonLongClick: function(event) |
148 { | 148 { |
149 var cssModel = this.cssModel(); | 149 var cssModel = this.cssModel(); |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 this.element.ownerDocument.body.addEventListener("keyup", this._keyUpBou
nd, false); | 483 this.element.ownerDocument.body.addEventListener("keyup", this._keyUpBou
nd, false); |
484 }, | 484 }, |
485 | 485 |
486 /** | 486 /** |
487 * @override | 487 * @override |
488 */ | 488 */ |
489 willHide: function() | 489 willHide: function() |
490 { | 490 { |
491 this.element.ownerDocument.body.removeEventListener("keydown", this._key
DownBound, false); | 491 this.element.ownerDocument.body.removeEventListener("keydown", this._key
DownBound, false); |
492 this.element.ownerDocument.body.removeEventListener("keyup", this._keyUp
Bound, false); | 492 this.element.ownerDocument.body.removeEventListener("keyup", this._keyUp
Bound, false); |
493 this._stylesPopoverHelper.hide(); | 493 this._iconPopoverHelper.hide(); |
494 this._discardElementUnderMouse(); | 494 this._discardElementUnderMouse(); |
495 WebInspector.ElementsSidebarPane.prototype.willHide.call(this); | 495 WebInspector.ElementsSidebarPane.prototype.willHide.call(this); |
496 }, | 496 }, |
497 | 497 |
498 _discardElementUnderMouse: function() | 498 _discardElementUnderMouse: function() |
499 { | 499 { |
500 if (this._elementUnderMouse) | 500 if (this._elementUnderMouse) |
501 this._elementUnderMouse.classList.remove("styles-panel-hovered"); | 501 this._elementUnderMouse.classList.remove("styles-panel-hovered"); |
502 delete this._elementUnderMouse; | 502 delete this._elementUnderMouse; |
503 }, | 503 }, |
(...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1951 var color = WebInspector.Color.parse(text); | 1951 var color = WebInspector.Color.parse(text); |
1952 if (!color) | 1952 if (!color) |
1953 return createTextNode(text); | 1953 return createTextNode(text); |
1954 | 1954 |
1955 if (!this._editable()) { | 1955 if (!this._editable()) { |
1956 var swatch = WebInspector.ColorSwatch.create(); | 1956 var swatch = WebInspector.ColorSwatch.create(); |
1957 swatch.setColorText(text); | 1957 swatch.setColorText(text); |
1958 return swatch; | 1958 return swatch; |
1959 } | 1959 } |
1960 | 1960 |
1961 var stylesPopoverHelper = this._parentPane._stylesPopoverHelper; | 1961 var iconPopoverHelper = this._parentPane._iconPopoverHelper; |
1962 var swatchIcon = new WebInspector.ColorSwatchPopoverIcon(this, stylesPop
overHelper, text); | 1962 var swatchIcon = new WebInspector.ColorSwatchPopoverIcon(this, iconPopov
erHelper, text); |
1963 | 1963 |
1964 /** | 1964 /** |
1965 * @param {?Array<string>} backgroundColors | 1965 * @param {?Array<string>} backgroundColors |
1966 */ | 1966 */ |
1967 function computedCallback(backgroundColors) | 1967 function computedCallback(backgroundColors) |
1968 { | 1968 { |
1969 // TODO(aboxhall): distinguish between !backgroundColors (no text) a
nd | 1969 // TODO(aboxhall): distinguish between !backgroundColors (no text) a
nd |
1970 // !backgroundColors.length (no computed bg color) | 1970 // !backgroundColors.length (no computed bg color) |
1971 if (!backgroundColors || !backgroundColors.length) | 1971 if (!backgroundColors || !backgroundColors.length) |
1972 return; | 1972 return; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2006 | 2006 |
2007 /** | 2007 /** |
2008 * @param {string} text | 2008 * @param {string} text |
2009 * @return {!Node} | 2009 * @return {!Node} |
2010 */ | 2010 */ |
2011 _processBezier: function(text) | 2011 _processBezier: function(text) |
2012 { | 2012 { |
2013 var geometry = WebInspector.Geometry.CubicBezier.parse(text); | 2013 var geometry = WebInspector.Geometry.CubicBezier.parse(text); |
2014 if (!geometry || !this._editable()) | 2014 if (!geometry || !this._editable()) |
2015 return createTextNode(text); | 2015 return createTextNode(text); |
2016 var stylesPopoverHelper = this._parentPane._stylesPopoverHelper; | 2016 var iconPopoverHelper = this._parentPane._iconPopoverHelper; |
2017 return new WebInspector.BezierPopoverIcon(this, stylesPopoverHelper, tex
t).element(); | 2017 return new WebInspector.BezierPopoverIcon(this, iconPopoverHelper, text)
.element(); |
2018 }, | 2018 }, |
2019 | 2019 |
2020 _updateState: function() | 2020 _updateState: function() |
2021 { | 2021 { |
2022 if (!this.listItemElement) | 2022 if (!this.listItemElement) |
2023 return; | 2023 return; |
2024 | 2024 |
2025 if (this._style.isPropertyImplicit(this.name)) | 2025 if (this._style.isPropertyImplicit(this.name)) |
2026 this.listItemElement.classList.add("implicit"); | 2026 this.listItemElement.classList.add("implicit"); |
2027 else | 2027 else |
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3109 | 3109 |
3110 /** | 3110 /** |
3111 * @override | 3111 * @override |
3112 * @return {!WebInspector.ToolbarItem} | 3112 * @return {!WebInspector.ToolbarItem} |
3113 */ | 3113 */ |
3114 item: function() | 3114 item: function() |
3115 { | 3115 { |
3116 return this._button; | 3116 return this._button; |
3117 } | 3117 } |
3118 } | 3118 } |
OLD | NEW |