| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Brian Grinstead All rights reserved. | 2 * Copyright (C) 2011 Brian Grinstead 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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 | 439 |
| 440 __proto__: WebInspector.Object.prototype | 440 __proto__: WebInspector.Object.prototype |
| 441 } | 441 } |
| 442 | 442 |
| 443 /** | 443 /** |
| 444 * @constructor | 444 * @constructor |
| 445 * @param {boolean=} readOnly | 445 * @param {boolean=} readOnly |
| 446 */ | 446 */ |
| 447 WebInspector.ColorSwatch = function(readOnly) | 447 WebInspector.ColorSwatch = function(readOnly) |
| 448 { | 448 { |
| 449 this.element = document.createElementWithClass("span", "swatch"); | 449 this.element = createElementWithClass("span", "swatch"); |
| 450 this._swatchInnerElement = this.element.createChild("span", "swatch-inner"); | 450 this._swatchInnerElement = this.element.createChild("span", "swatch-inner"); |
| 451 var shiftClickMessage = WebInspector.UIString("Shift-click to change color f
ormat."); | 451 var shiftClickMessage = WebInspector.UIString("Shift-click to change color f
ormat."); |
| 452 this.element.title = readOnly ? shiftClickMessage : String.sprintf("%s\n%s",
WebInspector.UIString("Click to open a colorpicker."), shiftClickMessage); | 452 this.element.title = readOnly ? shiftClickMessage : String.sprintf("%s\n%s",
WebInspector.UIString("Click to open a colorpicker."), shiftClickMessage); |
| 453 this.element.addEventListener("mousedown", consumeEvent, false); | 453 this.element.addEventListener("mousedown", consumeEvent, false); |
| 454 this.element.addEventListener("dblclick", consumeEvent, false); | 454 this.element.addEventListener("dblclick", consumeEvent, false); |
| 455 } | 455 } |
| 456 | 456 |
| 457 WebInspector.ColorSwatch.prototype = { | 457 WebInspector.ColorSwatch.prototype = { |
| 458 /** | 458 /** |
| 459 * @param {string} colorString | 459 * @param {string} colorString |
| 460 */ | 460 */ |
| 461 setColorString: function(colorString) | 461 setColorString: function(colorString) |
| 462 { | 462 { |
| 463 this._swatchInnerElement.style.backgroundColor = colorString; | 463 this._swatchInnerElement.style.backgroundColor = colorString; |
| 464 } | 464 } |
| 465 } | 465 } |
| OLD | NEW |