Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/components/Spectrum.js

Issue 2278203003: DevTools: Allow shadow-editor value manipulation with arrow keys and mousewheel (Closed)
Patch Set: Add return annotations Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/ui/CSSShadowEditor.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 /** 816 /**
817 * @param {!Element} element 817 * @param {!Element} element
818 * @return {string} 818 * @return {string}
819 */ 819 */
820 function elementValue(element) 820 function elementValue(element)
821 { 821 {
822 return element.value; 822 return element.value;
823 } 823 }
824 824
825 var inputElement = /** @type {!Element} */(event.currentTarget); 825 var inputElement = /** @type {!Element} */(event.currentTarget);
826 var arrowKeyOrMouseWheelEvent = (event.key === "ArrowUp" || event.key == = "ArrowDown" || event.type === "mousewheel"); 826 var newValue = WebInspector.createReplacementString(inputElement.value, event);
827 var pageKeyPressed = (event.key === "PageUp" || event.key === "PageDown" ); 827 if (newValue) {
828 if (arrowKeyOrMouseWheelEvent || pageKeyPressed) { 828 inputElement.value = newValue;
829 var newValue = WebInspector.createReplacementString(inputElement.val ue, event); 829 inputElement.selectionStart = 0;
830 if (newValue) { 830 inputElement.selectionEnd = newValue.length;
831 inputElement.value = newValue;
832 inputElement.selectionStart = 0;
833 inputElement.selectionEnd = newValue.length;
834 }
835 event.consume(true); 831 event.consume(true);
836 } 832 }
837 833
838 const cf = WebInspector.Color.Format; 834 const cf = WebInspector.Color.Format;
839 var colorString; 835 var colorString;
840 if (this._colorFormat === cf.HEX || this._colorFormat === cf.ShortHEX) { 836 if (this._colorFormat === cf.HEX || this._colorFormat === cf.ShortHEX) {
841 colorString = this._hexValue.value; 837 colorString = this._hexValue.value;
842 } else { 838 } else {
843 var format = this._colorFormat === cf.RGB ? "rgba" : "hsla"; 839 var format = this._colorFormat === cf.RGB ? "rgba" : "hsla";
844 var values = this._textValues.map(elementValue).join(","); 840 var values = this._textValues.map(elementValue).join(", ");
845 colorString = String.sprintf("%s(%s)", format, values); 841 colorString = String.sprintf("%s(%s)", format, values);
846 } 842 }
847 843
848 var color = WebInspector.Color.parse(colorString); 844 var color = WebInspector.Color.parse(colorString);
849 if (!color) 845 if (!color)
850 return; 846 return;
851 var hsv = color.hsva(); 847 var hsv = color.hsva();
852 if (this._colorFormat === cf.HEX || this._colorFormat === cf.ShortHEX) 848 if (this._colorFormat === cf.HEX || this._colorFormat === cf.ShortHEX)
853 this._colorFormat = color.canBeShortHex() ? cf.ShortHEX : cf.HEX; 849 this._colorFormat = color.canBeShortHex() ? cf.ShortHEX : cf.HEX;
854 this._innerSetColor(hsv, colorString, undefined, WebInspector.Spectrum._ ChangeSource.Input); 850 this._innerSetColor(hsv, colorString, undefined, WebInspector.Spectrum._ ChangeSource.Input);
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 "#FFEB3B": ["#FFFDE7", "#FFF9C4", "#FFF59D", "#FFF176", "#FFEE58", "#FFEB3B" , "#FDD835", "#FBC02D", "#F9A825", "#F57F17"], 1017 "#FFEB3B": ["#FFFDE7", "#FFF9C4", "#FFF59D", "#FFF176", "#FFEE58", "#FFEB3B" , "#FDD835", "#FBC02D", "#F9A825", "#F57F17"],
1022 "#FFC107": ["#FFF8E1", "#FFECB3", "#FFE082", "#FFD54F", "#FFCA28", "#FFC107" , "#FFB300", "#FFA000", "#FF8F00", "#FF6F00"], 1018 "#FFC107": ["#FFF8E1", "#FFECB3", "#FFE082", "#FFD54F", "#FFCA28", "#FFC107" , "#FFB300", "#FFA000", "#FF8F00", "#FF6F00"],
1023 "#FF9800": ["#FFF3E0", "#FFE0B2", "#FFCC80", "#FFB74D", "#FFA726", "#FF9800" , "#FB8C00", "#F57C00", "#EF6C00", "#E65100"], 1019 "#FF9800": ["#FFF3E0", "#FFE0B2", "#FFCC80", "#FFB74D", "#FFA726", "#FF9800" , "#FB8C00", "#F57C00", "#EF6C00", "#E65100"],
1024 "#FF5722": ["#FBE9E7", "#FFCCBC", "#FFAB91", "#FF8A65", "#FF7043", "#FF5722" , "#F4511E", "#E64A19", "#D84315", "#BF360C"], 1020 "#FF5722": ["#FBE9E7", "#FFCCBC", "#FFAB91", "#FF8A65", "#FF7043", "#FF5722" , "#F4511E", "#E64A19", "#D84315", "#BF360C"],
1025 "#795548": ["#EFEBE9", "#D7CCC8", "#BCAAA4", "#A1887F", "#8D6E63", "#795548" , "#6D4C41", "#5D4037", "#4E342E", "#3E2723"], 1021 "#795548": ["#EFEBE9", "#D7CCC8", "#BCAAA4", "#A1887F", "#8D6E63", "#795548" , "#6D4C41", "#5D4037", "#4E342E", "#3E2723"],
1026 "#9E9E9E": ["#FAFAFA", "#F5F5F5", "#EEEEEE", "#E0E0E0", "#BDBDBD", "#9E9E9E" , "#757575", "#616161", "#424242", "#212121"], 1022 "#9E9E9E": ["#FAFAFA", "#F5F5F5", "#EEEEEE", "#E0E0E0", "#BDBDBD", "#9E9E9E" , "#757575", "#616161", "#424242", "#212121"],
1027 "#607D8B": ["#ECEFF1", "#CFD8DC", "#B0BEC5", "#90A4AE", "#78909C", "#607D8B" , "#546E7A", "#455A64", "#37474F", "#263238"] 1023 "#607D8B": ["#ECEFF1", "#CFD8DC", "#B0BEC5", "#90A4AE", "#78909C", "#607D8B" , "#546E7A", "#455A64", "#37474F", "#263238"]
1028 }; 1024 };
1029 1025
1030 WebInspector.Spectrum.MaterialPalette = { title: "Material", mutable: false, mat chUserFormat: true, colors: Object.keys(WebInspector.Spectrum.MaterialPaletteSha des) }; 1026 WebInspector.Spectrum.MaterialPalette = { title: "Material", mutable: false, mat chUserFormat: true, colors: Object.keys(WebInspector.Spectrum.MaterialPaletteSha des) };
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/ui/CSSShadowEditor.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698