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

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

Issue 1907263002: DevTools: Fix all outstanding JavaScript style issues. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove yoda disable. fix throw parens Created 4 years, 8 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
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 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 this._hexContainer.hidden = true; 681 this._hexContainer.hidden = true;
682 this._displayContainer.hidden = false; 682 this._displayContainer.hidden = false;
683 var isRgb = this._colorFormat === cf.RGB; 683 var isRgb = this._colorFormat === cf.RGB;
684 this._textLabels.textContent = isRgb ? "RGBA" : "HSLA"; 684 this._textLabels.textContent = isRgb ? "RGBA" : "HSLA";
685 var colorValues = isRgb ? this._color().canonicalRGBA() : this._colo r().canonicalHSLA(); 685 var colorValues = isRgb ? this._color().canonicalRGBA() : this._colo r().canonicalHSLA();
686 for (var i = 0; i < 3; ++i) { 686 for (var i = 0; i < 3; ++i) {
687 this._textValues[i].value = colorValues[i]; 687 this._textValues[i].value = colorValues[i];
688 if (!isRgb && (i === 1 || i === 2)) 688 if (!isRgb && (i === 1 || i === 2))
689 this._textValues[i].value += "%"; 689 this._textValues[i].value += "%";
690 } 690 }
691 this._textValues[3].value= Math.round(colorValues[3] * 100) / 100; 691 this._textValues[3].value = Math.round(colorValues[3] * 100) / 100;
692 } 692 }
693 }, 693 },
694 694
695 /** 695 /**
696 * @param {number} requiredContrast 696 * @param {number} requiredContrast
697 */ 697 */
698 _drawContrastRatioLine: function(requiredContrast) 698 _drawContrastRatioLine: function(requiredContrast)
699 { 699 {
700 if (!this._contrastColor || !this.dragWidth || !this.dragHeight) 700 if (!this._contrastColor || !this.dragWidth || !this.dragHeight)
701 return; 701 return;
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
942 * @param {string} b 942 * @param {string} b
943 * @return {number} 943 * @return {number}
944 */ 944 */
945 function hueComparator(a, b) 945 function hueComparator(a, b)
946 { 946 {
947 var hsva = paletteColors.get(a).hsva(); 947 var hsva = paletteColors.get(a).hsva();
948 var hsvb = paletteColors.get(b).hsva(); 948 var hsvb = paletteColors.get(b).hsva();
949 949
950 // First trim the shades of gray 950 // First trim the shades of gray
951 if (hsvb[1] < 0.12 && hsva[1] < 0.12) 951 if (hsvb[1] < 0.12 && hsva[1] < 0.12)
952 return hsvb[2]*hsvb[3] - hsva[2]*hsva[3]; 952 return hsvb[2] * hsvb[3] - hsva[2] * hsva[3];
953 if (hsvb[1] < 0.12) 953 if (hsvb[1] < 0.12)
954 return -1; 954 return -1;
955 if (hsva[1] < 0.12) 955 if (hsva[1] < 0.12)
956 return 1; 956 return 1;
957 957
958 // Equal hue -> sort by sat 958 // Equal hue -> sort by sat
959 if (hsvb[0] === hsva[0]) 959 if (hsvb[0] === hsva[0])
960 return hsvb[1]*hsvb[3] - hsva[1]*hsva[3]; 960 return hsvb[1] * hsvb[3] - hsva[1] * hsva[3];
961 961
962 return (hsvb[0] + 0.94) % 1 - (hsva[0] + 0.94) % 1; 962 return (hsvb[0] + 0.94) % 1 - (hsva[0] + 0.94) % 1;
963 } 963 }
964 964
965 var colors = this._frequencyMap.keysArray(); 965 var colors = this._frequencyMap.keysArray();
966 colors = colors.sort(this._frequencyComparator.bind(this)); 966 colors = colors.sort(this._frequencyComparator.bind(this));
967 /** @type {!Map.<string, !WebInspector.Color>} */ 967 /** @type {!Map.<string, !WebInspector.Color>} */
968 var paletteColors = new Map(); 968 var paletteColors = new Map();
969 var colorsPerRow = 24; 969 var colorsPerRow = 24;
970 while (paletteColors.size < colorsPerRow && colors.length) { 970 while (paletteColors.size < colorsPerRow && colors.length) {
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 "#FFEB3B": ["#FFFDE7", "#FFF9C4", "#FFF59D", "#FFF176", "#FFEE58", "#FFEB3B" , "#FDD835", "#FBC02D", "#F9A825", "#F57F17"], 1020 "#FFEB3B": ["#FFFDE7", "#FFF9C4", "#FFF59D", "#FFF176", "#FFEE58", "#FFEB3B" , "#FDD835", "#FBC02D", "#F9A825", "#F57F17"],
1021 "#FFC107": ["#FFF8E1", "#FFECB3", "#FFE082", "#FFD54F", "#FFCA28", "#FFC107" , "#FFB300", "#FFA000", "#FF8F00", "#FF6F00"], 1021 "#FFC107": ["#FFF8E1", "#FFECB3", "#FFE082", "#FFD54F", "#FFCA28", "#FFC107" , "#FFB300", "#FFA000", "#FF8F00", "#FF6F00"],
1022 "#FF9800": ["#FFF3E0", "#FFE0B2", "#FFCC80", "#FFB74D", "#FFA726", "#FF9800" , "#FB8C00", "#F57C00", "#EF6C00", "#E65100"], 1022 "#FF9800": ["#FFF3E0", "#FFE0B2", "#FFCC80", "#FFB74D", "#FFA726", "#FF9800" , "#FB8C00", "#F57C00", "#EF6C00", "#E65100"],
1023 "#FF5722": ["#FBE9E7", "#FFCCBC", "#FFAB91", "#FF8A65", "#FF7043", "#FF5722" , "#F4511E", "#E64A19", "#D84315", "#BF360C"], 1023 "#FF5722": ["#FBE9E7", "#FFCCBC", "#FFAB91", "#FF8A65", "#FF7043", "#FF5722" , "#F4511E", "#E64A19", "#D84315", "#BF360C"],
1024 "#795548": ["#EFEBE9", "#D7CCC8", "#BCAAA4", "#A1887F", "#8D6E63", "#795548" , "#6D4C41", "#5D4037", "#4E342E", "#3E2723"], 1024 "#795548": ["#EFEBE9", "#D7CCC8", "#BCAAA4", "#A1887F", "#8D6E63", "#795548" , "#6D4C41", "#5D4037", "#4E342E", "#3E2723"],
1025 "#9E9E9E": ["#FAFAFA", "#F5F5F5", "#EEEEEE", "#E0E0E0", "#BDBDBD", "#9E9E9E" , "#757575", "#616161", "#424242", "#212121"], 1025 "#9E9E9E": ["#FAFAFA", "#F5F5F5", "#EEEEEE", "#E0E0E0", "#BDBDBD", "#9E9E9E" , "#757575", "#616161", "#424242", "#212121"],
1026 "#607D8B": ["#ECEFF1", "#CFD8DC", "#B0BEC5", "#90A4AE", "#78909C", "#607D8B" , "#546E7A", "#455A64", "#37474F", "#263238"] 1026 "#607D8B": ["#ECEFF1", "#CFD8DC", "#B0BEC5", "#90A4AE", "#78909C", "#607D8B" , "#546E7A", "#455A64", "#37474F", "#263238"]
1027 }; 1027 };
1028 1028
1029 WebInspector.Spectrum.MaterialPalette = { title: "Material", mutable: false, mat chUserFormat: true, colors: Object.keys(WebInspector.Spectrum.MaterialPaletteSha des) }; 1029 WebInspector.Spectrum.MaterialPalette = { title: "Material", mutable: false, mat chUserFormat: true, colors: Object.keys(WebInspector.Spectrum.MaterialPaletteSha des) };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698