| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @extends {WebInspector.Object} | 7 * @extends {WebInspector.Object} |
| 8 */ | 8 */ |
| 9 WebInspector.StylesPopoverHelper = function() | 9 WebInspector.StylesPopoverHelper = function() |
| 10 { | 10 { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 */ | 141 */ |
| 142 WebInspector.BezierPopoverIcon = function(treeElement, stylesPopoverHelper, text
) | 142 WebInspector.BezierPopoverIcon = function(treeElement, stylesPopoverHelper, text
) |
| 143 { | 143 { |
| 144 this._treeElement = treeElement; | 144 this._treeElement = treeElement; |
| 145 this._stylesPopoverHelper = stylesPopoverHelper; | 145 this._stylesPopoverHelper = stylesPopoverHelper; |
| 146 this._createDOM(text); | 146 this._createDOM(text); |
| 147 | 147 |
| 148 this._boundBezierChanged = this._bezierChanged.bind(this); | 148 this._boundBezierChanged = this._bezierChanged.bind(this); |
| 149 } | 149 } |
| 150 | 150 |
| 151 /** |
| 152 * @param {!Element} parentElement |
| 153 * @return {!Element} |
| 154 */ |
| 155 WebInspector.BezierPopoverIcon.createIcon = function(parentElement) |
| 156 { |
| 157 var element = parentElement.createSVGChild("svg", "popover-icon bezier-icon"
); |
| 158 element.setAttribute("height", 10); |
| 159 element.setAttribute("width", 10); |
| 160 var path = element.createSVGChild("path"); |
| 161 path.setAttribute("d", "M2,8 C2,3 8,7 8,2"); |
| 162 return element; |
| 163 } |
| 164 |
| 151 WebInspector.BezierPopoverIcon.prototype = { | 165 WebInspector.BezierPopoverIcon.prototype = { |
| 152 /** | 166 /** |
| 153 * @return {!Element} | 167 * @return {!Element} |
| 154 */ | 168 */ |
| 155 element: function() | 169 element: function() |
| 156 { | 170 { |
| 157 return this._element; | 171 return this._element; |
| 158 }, | 172 }, |
| 159 | 173 |
| 160 /** | 174 /** |
| 161 * @param {string} text | 175 * @param {string} text |
| 162 */ | 176 */ |
| 163 _createDOM: function(text) | 177 _createDOM: function(text) |
| 164 { | 178 { |
| 165 this._element = createElement("nobr"); | 179 this._element = createElement("nobr"); |
| 166 | 180 this._iconElement = WebInspector.BezierPopoverIcon.createIcon(this._elem
ent); |
| 167 this._iconElement = this._element.createSVGChild("svg", "popover-icon be
zier-icon"); | |
| 168 this._iconElement.setAttribute("height", 10); | |
| 169 this._iconElement.setAttribute("width", 10); | |
| 170 this._iconElement.addEventListener("click", this._iconClick.bind(this),
false); | 181 this._iconElement.addEventListener("click", this._iconClick.bind(this),
false); |
| 171 var g = this._iconElement.createSVGChild("g"); | |
| 172 var path = g.createSVGChild("path"); | |
| 173 path.setAttribute("d", "M2,8 C2,3 8,7 8,2"); | |
| 174 | |
| 175 this._bezierValueElement = this._element.createChild("span"); | 182 this._bezierValueElement = this._element.createChild("span"); |
| 176 this._bezierValueElement.textContent = text; | 183 this._bezierValueElement.textContent = text; |
| 177 }, | 184 }, |
| 178 | 185 |
| 179 /** | 186 /** |
| 180 * @param {!Event} event | 187 * @param {!Event} event |
| 181 */ | 188 */ |
| 182 _iconClick: function(event) | 189 _iconClick: function(event) |
| 183 { | 190 { |
| 184 event.consume(true); | 191 event.consume(true); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 { | 323 { |
| 317 this._spectrum.removeEventListener(WebInspector.Spectrum.Events.ColorCha
nged, this._boundSpectrumChanged); | 324 this._spectrum.removeEventListener(WebInspector.Spectrum.Events.ColorCha
nged, this._boundSpectrumChanged); |
| 318 delete this._spectrum; | 325 delete this._spectrum; |
| 319 | 326 |
| 320 var propertyText = commitEdit ? this._treeElement.renderedPropertyText()
: this._originalPropertyText; | 327 var propertyText = commitEdit ? this._treeElement.renderedPropertyText()
: this._originalPropertyText; |
| 321 this._treeElement.applyStyleText(propertyText, true); | 328 this._treeElement.applyStyleText(propertyText, true); |
| 322 this._treeElement.parentPane().setEditingStyle(false); | 329 this._treeElement.parentPane().setEditingStyle(false); |
| 323 delete this._originalPropertyText; | 330 delete this._originalPropertyText; |
| 324 } | 331 } |
| 325 } | 332 } |
| OLD | NEW |