OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 /** | 368 /** |
369 * @param {string} originalValue | 369 * @param {string} originalValue |
370 * @param {string} replacementString | 370 * @param {string} replacementString |
371 * @this {WebInspector.MetricsSidebarPane} | 371 * @this {WebInspector.MetricsSidebarPane} |
372 */ | 372 */ |
373 function finishHandler(originalValue, replacementString) | 373 function finishHandler(originalValue, replacementString) |
374 { | 374 { |
375 this._applyUserInput(element, replacementString, originalValue, cont
ext, false); | 375 this._applyUserInput(element, replacementString, originalValue, cont
ext, false); |
376 } | 376 } |
377 | 377 |
378 function customNumberHandler(number) | 378 /** |
| 379 * @param {string} prefix |
| 380 * @param {number} number |
| 381 * @param {string} suffix |
| 382 * @return {string} |
| 383 */ |
| 384 function customNumberHandler(prefix, number, suffix) |
379 { | 385 { |
380 if (styleProperty !== "margin" && number < 0) | 386 if (styleProperty !== "margin" && number < 0) |
381 number = 0; | 387 number = 0; |
382 return number; | 388 return prefix + number + suffix; |
383 } | 389 } |
384 | 390 |
385 WebInspector.handleElementValueModifications(event, element, finishHandl
er.bind(this), undefined, customNumberHandler); | 391 WebInspector.handleElementValueModifications(event, element, finishHandl
er.bind(this), undefined, customNumberHandler); |
386 }, | 392 }, |
387 | 393 |
388 editingEnded: function(element, context) | 394 editingEnded: function(element, context) |
389 { | 395 { |
390 delete this.originalPropertyData; | 396 delete this.originalPropertyData; |
391 delete this.previousPropertyDataCandidate; | 397 delete this.previousPropertyDataCandidate; |
392 element.removeEventListener("keydown", context.keyDownHandler, false); | 398 element.removeEventListener("keydown", context.keyDownHandler, false); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 }, | 489 }, |
484 | 490 |
485 editingCommitted: function(element, userInput, previousContent, context) | 491 editingCommitted: function(element, userInput, previousContent, context) |
486 { | 492 { |
487 this.editingEnded(element, context); | 493 this.editingEnded(element, context); |
488 this._applyUserInput(element, userInput, previousContent, context, true)
; | 494 this._applyUserInput(element, userInput, previousContent, context, true)
; |
489 }, | 495 }, |
490 | 496 |
491 __proto__: WebInspector.SidebarPane.prototype | 497 __proto__: WebInspector.SidebarPane.prototype |
492 } | 498 } |
OLD | NEW |