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

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/ColorSwatch.js

Issue 2319763004: DevTools: (DO NOT COMMIT) Add shadow swatches to Sources, work in progress (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/ui/ColorSwatch.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/ColorSwatch.js b/third_party/WebKit/Source/devtools/front_end/ui/ColorSwatch.js
index 903183a7c3c5097d94e06b268e328d553d2568e2..f43067a156cb7d833f774863fd81ca4076d50f51 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/ColorSwatch.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/ColorSwatch.js
@@ -164,20 +164,60 @@ WebInspector.ColorSwatch._nextColorFormat = function(color, curFormat)
}
}
-
-WebInspector.BezierSwatch = {}
+/**
+ * @constructor
+ * @extends {HTMLSpanElement}
+ */
+WebInspector.BezierSwatch = function()
+{
+}
/**
- * @return {!Element}
+ * @return {!WebInspector.BezierSwatch}
*/
WebInspector.BezierSwatch.create = function()
{
- var element = createElementWithClass("span", "bezier-icon");
- var root = WebInspector.createShadowRootWithCoreStyles(element, "ui/bezierSwatch.css");
- root.createChild("span", "bezier-swatch");
- return element;
+ if (!WebInspector.BezierSwatch._constructor)
+ WebInspector.BezierSwatch._constructor = registerCustomElement("span", "bezier-swatch", WebInspector.BezierSwatch.prototype);
+
+ return /** @type {!WebInspector.BezierSwatch} */(new WebInspector.BezierSwatch._constructor());
}
+WebInspector.BezierSwatch.prototype = {
+ /**
+ * @param {string} text
+ */
+ setText: function(text)
+ {
+ this._textElement.textContent = text;
+ },
+
+ /**
+ * @param {boolean} hide
+ */
+ hideText: function(hide)
+ {
+ this._textElement.hidden = hide;
+ },
+
+ /**
+ * @return {!Element}
+ */
+ iconElement: function()
+ {
+ return this._iconElement;
+ },
+
+ createdCallback: function()
+ {
+ var root = WebInspector.createShadowRootWithCoreStyles(this, "ui/bezierSwatch.css");
+ this._iconElement = root.createChild("span", "bezier-swatch-icon");
+ this._textElement = this.createChild("span");
+ root.createChild("content");
+ },
+
+ __proto__: HTMLSpanElement.prototype
+}
/**
* @constructor
@@ -231,7 +271,7 @@ WebInspector.CSSShadowSwatch.prototype = {
/**
* @param {boolean} hide
*/
- setTextHidden: function(hide)
+ hideText: function(hide)
{
this._contentElement.hidden = hide;
},

Powered by Google App Engine
This is Rietveld 408576698