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

Unified Diff: third_party/WebKit/Source/devtools/front_end/resources/AppManifestView.js

Issue 2310633002: DevTools: Reduce color parsing by passing in Color to ColorSwatch (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/resources/AppManifestView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/AppManifestView.js b/third_party/WebKit/Source/devtools/front_end/resources/AppManifestView.js
index c90c911645e8aaab1cf51d90f98d0d5188f91283..6ee02431a98bef9da42ff1173bf6667dfba5f619 100644
--- a/third_party/WebKit/Source/devtools/front_end/resources/AppManifestView.js
+++ b/third_party/WebKit/Source/devtools/front_end/resources/AppManifestView.js
@@ -97,10 +97,21 @@ WebInspector.AppManifestView.prototype = {
if (startURL)
this._startURLField.appendChild(WebInspector.linkifyResourceAsNode(/** @type {string} */(WebInspector.ParsedURL.completeURL(url, startURL)), undefined, undefined, undefined, undefined, startURL));
- this._themeColorSwatch.classList.toggle("hidden", !stringProperty("theme_color"));
- this._themeColorSwatch.setColorText(stringProperty("theme_color") || "white");
- this._backgroundColorSwatch.classList.toggle("hidden", !stringProperty("background_color"));
- this._backgroundColorSwatch.setColorText(stringProperty("background_color") || "white");
+ if (stringProperty("theme_color")) {
+ this._themeColorSwatch.classList.remove("hidden");
+ var themeColor = WebInspector.Color.parse(stringProperty("theme_color")) || WebInspector.Color.parse("white");
dgozman 2016/09/02 22:08:01 This is a semantic change. Leave it as parse(strin
flandy 2016/09/02 23:09:18 We need the extra || WebInspector.Color.parse("whi
+ this._themeColorSwatch.setColor(/** @type {!WebInspector.Color} */ (themeColor));
+ } else {
+ this._themeColorSwatch.classList.add("hidden");
+ }
+
+ if (stringProperty("background_color")) {
+ this._backgroundColorSwatch.classList.remove("hidden");
+ var backgroundColor = WebInspector.Color.parse(stringProperty("background_color")) || WebInspector.Color.parse("white");
dgozman 2016/09/02 22:08:01 ditto
+ this._backgroundColorSwatch.setColor(/** @type {!WebInspector.Color} */ (backgroundColor));
+ } else {
+ this._backgroundColorSwatch.classList.add("hidden");
+ }
this._orientationField.textContent = stringProperty("orientation");
this._displayField.textContent = stringProperty("display");

Powered by Google App Engine
This is Rietveld 408576698