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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 userInput = userInput.toLowerCase(); | 432 userInput = userInput.toLowerCase(); |
433 // Append a "px" unit if the user input was just a number. | 433 // Append a "px" unit if the user input was just a number. |
434 if (/^\d+$/.test(userInput)) | 434 if (/^\d+$/.test(userInput)) |
435 userInput += "px"; | 435 userInput += "px"; |
436 | 436 |
437 var styleProperty = context.styleProperty; | 437 var styleProperty = context.styleProperty; |
438 var computedStyle = context.computedStyle; | 438 var computedStyle = context.computedStyle; |
439 | 439 |
440 if (computedStyle.getPropertyValue("box-sizing") === "border-box" && (st
yleProperty === "width" || styleProperty === "height")) { | 440 if (computedStyle.getPropertyValue("box-sizing") === "border-box" && (st
yleProperty === "width" || styleProperty === "height")) { |
441 if (!userInput.match(/px$/)) { | 441 if (!userInput.match(/px$/)) { |
442 WebInspector.console.addErrorMessage("For elements with box-sizi
ng: border-box, only absolute content area dimensions can be applied", true); | 442 WebInspector.console.error("For elements with box-sizing: border
-box, only absolute content area dimensions can be applied"); |
443 return; | 443 return; |
444 } | 444 } |
445 | 445 |
446 var borderBox = this._getBox(computedStyle, "border"); | 446 var borderBox = this._getBox(computedStyle, "border"); |
447 var paddingBox = this._getBox(computedStyle, "padding"); | 447 var paddingBox = this._getBox(computedStyle, "padding"); |
448 var userValuePx = Number(userInput.replace(/px$/, "")); | 448 var userValuePx = Number(userInput.replace(/px$/, "")); |
449 if (isNaN(userValuePx)) | 449 if (isNaN(userValuePx)) |
450 return; | 450 return; |
451 if (styleProperty === "width") | 451 if (styleProperty === "width") |
452 userValuePx += borderBox.left + borderBox.right + paddingBox.lef
t + paddingBox.right; | 452 userValuePx += borderBox.left + borderBox.right + paddingBox.lef
t + paddingBox.right; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 }, | 489 }, |
490 | 490 |
491 editingCommitted: function(element, userInput, previousContent, context) | 491 editingCommitted: function(element, userInput, previousContent, context) |
492 { | 492 { |
493 this.editingEnded(element, context); | 493 this.editingEnded(element, context); |
494 this._applyUserInput(element, userInput, previousContent, context, true)
; | 494 this._applyUserInput(element, userInput, previousContent, context, true)
; |
495 }, | 495 }, |
496 | 496 |
497 __proto__: WebInspector.SidebarPane.prototype | 497 __proto__: WebInspector.SidebarPane.prototype |
498 } | 498 } |
OLD | NEW |