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

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

Issue 1531583004: [DevTools] Improve Device Mode icons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@toolbar-refactor
Patch Set: test Created 5 years 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/Toolbar.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js b/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
index fde87775171b883c4c816e97542995fff880ef3c..98900e554d5f6a686de5de5ab1a68945f10e8b30 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/Toolbar.js
@@ -37,18 +37,25 @@ WebInspector.Toolbar = function(className, parentElement)
{
/** @type {!Array.<!WebInspector.ToolbarItem>} */
this._items = [];
+ this._reverse = false;
this.element = parentElement ? parentElement.createChild("div") : createElement("div");
this.element.className = className;
this.element.classList.add("toolbar");
this._shadowRoot = WebInspector.createShadowRootWithCoreStyles(this.element, "ui/toolbar.css");
this._contentElement = this._shadowRoot.createChild("div", "toolbar-shadow");
- this._contentElement.createChild("content");
+ this._insertionPoint = this._contentElement.createChild("content");
}
WebInspector.Toolbar.prototype = {
- makeWrappable: function()
+ /**
+ * @param {boolean=} reverse
+ */
+ makeWrappable: function(reverse)
{
this._contentElement.classList.add("wrappable");
+ this._reverse = !!reverse;
+ if (reverse)
+ this._contentElement.classList.add("wrappable-reverse");
},
makeVertical: function()
@@ -82,7 +89,10 @@ WebInspector.Toolbar.prototype = {
{
this._items.push(item);
item._toolbar = this;
- this._contentElement.insertBefore(item.element, this._contentElement.lastChild);
+ if (this._reverse)
+ this._contentElement.insertBefore(item.element, this._insertionPoint.nextSibling);
+ else
+ this._contentElement.insertBefore(item.element, this._insertionPoint);
this._hideSeparatorDupes();
},
@@ -107,7 +117,7 @@ WebInspector.Toolbar.prototype = {
delete item._toolbar;
this._items = [];
this._contentElement.removeChildren();
- this._contentElement.createChild("content");
+ this._insertionPoint = this._contentElement.createChild("content");
},
/**
@@ -315,6 +325,14 @@ WebInspector.ToolbarTextGlyphItem.prototype = {
this.element.classList.toggle("toolbar-bold", bold);
},
+ /**
+ * @param {boolean} dimmed
+ */
+ setDimmed: function(dimmed)
+ {
+ this.element.classList.toggle("toolbar-dimmed", dimmed);
+ },
+
__proto__: WebInspector.ToolbarItem.prototype
}

Powered by Google App Engine
This is Rietveld 408576698