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 3267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3278 * @param {string} originalValue | 3278 * @param {string} originalValue |
3279 * @param {string} replacementString | 3279 * @param {string} replacementString |
3280 * @this {WebInspector.StylesSidebarPane.CSSPropertyPrompt} | 3280 * @this {WebInspector.StylesSidebarPane.CSSPropertyPrompt} |
3281 */ | 3281 */ |
3282 function finishHandler(originalValue, replacementString) | 3282 function finishHandler(originalValue, replacementString) |
3283 { | 3283 { |
3284 // Synthesize property text disregarding any comments, custom whites
pace etc. | 3284 // Synthesize property text disregarding any comments, custom whites
pace etc. |
3285 this._sidebarPane.applyStyleText(this._sidebarPane.nameElement.textC
ontent + ": " + this._sidebarPane.valueElement.textContent, false, false, false)
; | 3285 this._sidebarPane.applyStyleText(this._sidebarPane.nameElement.textC
ontent + ": " + this._sidebarPane.valueElement.textContent, false, false, false)
; |
3286 } | 3286 } |
3287 | 3287 |
| 3288 /** |
| 3289 * @param {string} prefix |
| 3290 * @param {number} number |
| 3291 * @param {string} suffix |
| 3292 * @return {string} |
| 3293 * @this {WebInspector.StylesSidebarPane.CSSPropertyPrompt} |
| 3294 */ |
| 3295 function customNumberHandler(prefix, number, suffix) |
| 3296 { |
| 3297 if (number !== 0 && !suffix.length && WebInspector.CSSMetadata.isLen
gthProperty(this._sidebarPane.property.name)) |
| 3298 suffix = "px"; |
| 3299 return prefix + number + suffix; |
| 3300 } |
| 3301 |
3288 // Handle numeric value increment/decrement only at this point. | 3302 // Handle numeric value increment/decrement only at this point. |
3289 if (!this._isEditingName && WebInspector.handleElementValueModifications
(event, this._sidebarPane.valueElement, finishHandler.bind(this), this._isValueS
uggestion.bind(this))) | 3303 if (!this._isEditingName && WebInspector.handleElementValueModifications
(event, this._sidebarPane.valueElement, finishHandler.bind(this), this._isValueS
uggestion.bind(this), customNumberHandler.bind(this))) |
3290 return true; | 3304 return true; |
3291 | 3305 |
3292 return false; | 3306 return false; |
3293 }, | 3307 }, |
3294 | 3308 |
3295 /** | 3309 /** |
3296 * @param {string} word | 3310 * @param {string} word |
3297 * @return {boolean} | 3311 * @return {boolean} |
3298 */ | 3312 */ |
3299 _isValueSuggestion: function(word) | 3313 _isValueSuggestion: function(word) |
(...skipping 18 matching lines...) Expand all Loading... |
3318 return; | 3332 return; |
3319 } | 3333 } |
3320 | 3334 |
3321 var results = this._cssCompletions.startsWith(prefix); | 3335 var results = this._cssCompletions.startsWith(prefix); |
3322 var selectedIndex = this._cssCompletions.mostUsedOf(results); | 3336 var selectedIndex = this._cssCompletions.mostUsedOf(results); |
3323 completionsReadyCallback(results, selectedIndex); | 3337 completionsReadyCallback(results, selectedIndex); |
3324 }, | 3338 }, |
3325 | 3339 |
3326 __proto__: WebInspector.TextPrompt.prototype | 3340 __proto__: WebInspector.TextPrompt.prototype |
3327 } | 3341 } |
OLD | NEW |