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

Unified Diff: tracing/tracing/base/color.html

Issue 2776653002: [ESLint] Fix violations when enabling curly rule in eslint. (Closed)
Patch Set: rebase Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tracing/tracing/base/category_util.html ('k') | tracing/tracing/base/color_scheme.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/base/color.html
diff --git a/tracing/tracing/base/color.html b/tracing/tracing/base/color.html
index cbe6ccdb2bead74492874f295ca1dd01e24f899e..df64c7d9f18d8b6eb00f3c34cd8c0dcdfdf09237 100644
--- a/tracing/tracing/base/color.html
+++ b/tracing/tracing/base/color.html
@@ -28,8 +28,9 @@ tr.exportTo('tr.b', function() {
values = tmp.split(',').map(function(v) {
return v.replace(/^\s+/, '', 'g');
});
- if (values.length !== 3)
+ if (values.length !== 3) {
throw new Error('Malformatted rgb-expression');
+ }
return new Color(
parseInt(values[0]),
parseInt(values[1]),
@@ -40,8 +41,9 @@ tr.exportTo('tr.b', function() {
values = tmp.split(',').map(function(v) {
return v.replace(/^\s+/, '', 'g');
});
- if (values.length !== 4)
+ if (values.length !== 4) {
throw new Error('Malformatted rgb-expression');
+ }
return new Color(
parseInt(values[0]),
parseInt(values[1]),
@@ -58,8 +60,9 @@ tr.exportTo('tr.b', function() {
};
Color.lerp = function(a, b, percent) {
- if (a.a !== undefined && b.a !== undefined)
+ if (a.a !== undefined && b.a !== undefined) {
return Color.lerpRGBA(a, b, percent);
+ }
return Color.lerpRGB(a, b, percent);
};
@@ -162,10 +165,11 @@ tr.exportTo('tr.b', function() {
darken: function(opt_k) {
var k;
- if (opt_k !== undefined)
+ if (opt_k !== undefined) {
k = opt_k;
- else
+ } else {
k = 0.45;
+ }
return new Color(
Math.min(255, this.r - Math.floor(this.r * k)),
@@ -176,10 +180,11 @@ tr.exportTo('tr.b', function() {
desaturate: function(opt_desaturateFactor) {
var desaturateFactor;
- if (opt_desaturateFactor !== undefined)
+ if (opt_desaturateFactor !== undefined) {
desaturateFactor = opt_desaturateFactor;
- else
+ } else {
desaturateFactor = 1;
+ }
var hsl = this.toHSL();
hsl.s = clamp01(hsl.s * (1 - desaturateFactor));
@@ -222,15 +227,15 @@ tr.exportTo('tr.b', function() {
s = 0;
} else {
var delta = max - min;
- if (l > 0.5)
+ if (l > 0.5) {
s = delta / (2 - max - min);
- else
+ } else {
s = delta / (max + min);
+ }
if (r === max) {
h = (g - b) / delta;
- if (g < b)
- h += 6;
+ if (g < b) h += 6;
} else if (g === max) {
h = 2 + ((b - r) / delta);
} else {
« no previous file with comments | « tracing/tracing/base/category_util.html ('k') | tracing/tracing/base/color_scheme.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698