Chromium Code Reviews| 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 307 /** | 307 /** |
| 308 * @param {!Element} element | 308 * @param {!Element} element |
| 309 * @return {string} | 309 * @return {string} |
| 310 */ | 310 */ |
| 311 function elementValue(element) | 311 function elementValue(element) |
| 312 { | 312 { |
| 313 return element.value; | 313 return element.value; |
| 314 } | 314 } |
| 315 | 315 |
| 316 var element = /** @type {!Element} */(event.currentTarget); | 316 var element = /** @type {!Element} */(event.currentTarget); |
| 317 WebInspector.handleElementValueModifications(event, element); | 317 var arrowKeyOrMouseWheelEvent = (event.keyIdentifier === "Up" || event.k eyIdentifier === "Down" || event.type === "mousewheel"); |
| 318 var pageKeyPressed = (event.keyIdentifier === "PageUp" || event.keyIdent ifier === "PageDown"); | |
|
lushnikov
2015/06/18 15:36:06
why not a single "var whitelistedEvent = ..." ?
sergeyv
2015/06/18 16:55:36
Acknowledged.
| |
| 319 if (arrowKeyOrMouseWheelEvent || pageKeyPressed) { | |
| 320 var newValue = WebInspector.createReplacementString(element.value, e vent); | |
| 321 if (newValue) { | |
| 322 element.value = newValue; | |
| 323 element.selectionStart = 0; | |
|
lushnikov
2015/06/18 15:36:06
are these defined on HTMLInputElement only? Can we
sergeyv
2015/06/18 16:55:36
renamed inputElement
| |
| 324 element.selectionEnd = newValue.length; | |
| 325 } | |
| 326 } | |
| 318 | 327 |
| 319 const cf = WebInspector.Color.Format; | 328 const cf = WebInspector.Color.Format; |
| 320 var colorString; | 329 var colorString; |
| 321 if (this._currentFormat === cf.HEX || this._currentFormat === cf.ShortHE X) { | 330 if (this._currentFormat === cf.HEX || this._currentFormat === cf.ShortHE X) { |
| 322 colorString = this._hexValue.value; | 331 colorString = this._hexValue.value; |
| 323 } else { | 332 } else { |
| 324 var format = this._currentFormat === cf.RGB ? "rgba" : "hsla"; | 333 var format = this._currentFormat === cf.RGB ? "rgba" : "hsla"; |
| 325 var values = this._textValues.map(elementValue).join(","); | 334 var values = this._textValues.map(elementValue).join(","); |
| 326 colorString = String.sprintf("%s(%s)", format, values); | 335 colorString = String.sprintf("%s(%s)", format, values); |
| 327 } | 336 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 378 var rgba = [rgbColor.r, rgbColor.g, rgbColor.b, (rgbColor.a / 2.55 | 0) / 100]; | 387 var rgba = [rgbColor.r, rgbColor.g, rgbColor.b, (rgbColor.a / 2.55 | 0) / 100]; |
| 379 var color = WebInspector.Color.fromRGBA(rgba); | 388 var color = WebInspector.Color.fromRGBA(rgba); |
| 380 this.setColor(color); | 389 this.setColor(color); |
| 381 this._dispatchChangeEvent(); | 390 this._dispatchChangeEvent(); |
| 382 InspectorFrontendHost.bringToFront(); | 391 InspectorFrontendHost.bringToFront(); |
| 383 }, | 392 }, |
| 384 | 393 |
| 385 | 394 |
| 386 __proto__: WebInspector.VBox.prototype | 395 __proto__: WebInspector.VBox.prototype |
| 387 } | 396 } |
| OLD | NEW |