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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 userInput = userInput.toLowerCase(); | 426 userInput = userInput.toLowerCase(); |
427 // Append a "px" unit if the user input was just a number. | 427 // Append a "px" unit if the user input was just a number. |
428 if (/^\d+$/.test(userInput)) | 428 if (/^\d+$/.test(userInput)) |
429 userInput += "px"; | 429 userInput += "px"; |
430 | 430 |
431 var styleProperty = context.styleProperty; | 431 var styleProperty = context.styleProperty; |
432 var computedStyle = context.computedStyle; | 432 var computedStyle = context.computedStyle; |
433 | 433 |
434 if (computedStyle.getPropertyValue("box-sizing") === "border-box" && (st
yleProperty === "width" || styleProperty === "height")) { | 434 if (computedStyle.getPropertyValue("box-sizing") === "border-box" && (st
yleProperty === "width" || styleProperty === "height")) { |
435 if (!userInput.match(/px$/)) { | 435 if (!userInput.match(/px$/)) { |
436 WebInspector.console.log("For elements with box-sizing: border-b
ox, only absolute content area dimensions can be applied", WebInspector.ConsoleM
essage.MessageLevel.Error, true); | 436 WebInspector.messageSink.addErrorMessage("For elements with box-
sizing: border-box, only absolute content area dimensions can be applied", true)
; |
437 return; | 437 return; |
438 } | 438 } |
439 | 439 |
440 var borderBox = this._getBox(computedStyle, "border"); | 440 var borderBox = this._getBox(computedStyle, "border"); |
441 var paddingBox = this._getBox(computedStyle, "padding"); | 441 var paddingBox = this._getBox(computedStyle, "padding"); |
442 var userValuePx = Number(userInput.replace(/px$/, "")); | 442 var userValuePx = Number(userInput.replace(/px$/, "")); |
443 if (isNaN(userValuePx)) | 443 if (isNaN(userValuePx)) |
444 return; | 444 return; |
445 if (styleProperty === "width") | 445 if (styleProperty === "width") |
446 userValuePx += borderBox.left + borderBox.right + paddingBox.lef
t + paddingBox.right; | 446 userValuePx += borderBox.left + borderBox.right + paddingBox.lef
t + paddingBox.right; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 }, | 483 }, |
484 | 484 |
485 editingCommitted: function(element, userInput, previousContent, context) | 485 editingCommitted: function(element, userInput, previousContent, context) |
486 { | 486 { |
487 this.editingEnded(element, context); | 487 this.editingEnded(element, context); |
488 this._applyUserInput(element, userInput, previousContent, context, true)
; | 488 this._applyUserInput(element, userInput, previousContent, context, true)
; |
489 }, | 489 }, |
490 | 490 |
491 __proto__: WebInspector.SidebarPane.prototype | 491 __proto__: WebInspector.SidebarPane.prototype |
492 } | 492 } |
OLD | NEW |