Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (187518 => 187519)
--- trunk/Source/WebInspectorUI/ChangeLog 2015-07-28 21:50:46 UTC (rev 187518)
+++ trunk/Source/WebInspectorUI/ChangeLog 2015-07-28 21:53:10 UTC (rev 187519)
@@ -1,3 +1,52 @@
+2015-07-28 Brian J. Burg <[email protected]>
+
+ Web Inspector: Convert NavigationItem subclasses to ES6
+ https://bugs.webkit.org/show_bug.cgi?id=147364
+
+ Reviewed by Timothy Hatcher.
+
+ Convert remaining NavigationItem subclasses to use ES6 class.
+
+ Also promote the _additionalClassNames to be a protected getter,
+ and inline the style class names that are only used in one place.
+
+ Mechanical changes are elided from the changelog.
+
+ * UserInterface/Views/ActivateButtonNavigationItem.js:
+ (WebInspector.ActivateButtonNavigationItem):
+ (WebInspector.ActivateButtonNavigationItem.prototype.get additionalClassNames):
+ * UserInterface/Views/ActivateButtonToolbarItem.js:
+ (WebInspector.ActivateButtonToolbarItem):
+ * UserInterface/Views/ButtonNavigationItem.js:
+ (WebInspector.ButtonNavigationItem):
+ (WebInspector.ButtonNavigationItem.prototype.get additionalClassNames):
+ * UserInterface/Views/ButtonToolbarItem.js:
+ (WebInspector.ButtonToolbarItem):
+ * UserInterface/Views/ControlToolbarItem.js:
+ (WebInspector.ControlToolbarItem):
+ (WebInspector.ControlToolbarItem.prototype.get additionalClassNames):
+ * UserInterface/Views/DividerNavigationItem.js:
+ (WebInspector.DividerNavigationItem):
+ (WebInspector.DividerNavigationItem.prototype.get additionalClassNames):
+ * UserInterface/Views/FlexibleSpaceNavigationItem.js:
+ (WebInspector.FlexibleSpaceNavigationItem):
+ (WebInspector.FlexibleSpaceNavigationItem.prototype.get additionalClassNames):
+ * UserInterface/Views/HierarchicalPathNavigationItem.js:
+ (WebInspector.HierarchicalPathNavigationItem.prototype.get additionalClassNames):
+ (WebInspector.HierarchicalPathNavigationItem.prototype.get _additionalClassNames): Deleted.
+ * UserInterface/Views/NavigationItem.js:
+ (WebInspector.NavigationItem):
+ (WebInspector.NavigationItem.prototype.get _classNames):
+ * UserInterface/Views/RadioButtonNavigationItem.js:
+ (WebInspector.RadioButtonNavigationItem):
+ (WebInspector.RadioButtonNavigationItem.prototype.get additionalClassNames):
+ * UserInterface/Views/ToggleButtonNavigationItem.js:
+ (WebInspector.ToggleButtonNavigationItem):
+ (WebInspector.ToggleButtonNavigationItem.prototype.get additionalClassNames):
+ * UserInterface/Views/ToggleControlToolbarItem.js:
+ (WebInspector.ToggleControlToolbarItem):
+ (WebInspector.ToggleControlToolbarItem.prototype.get additionalClassNames):
+
2015-07-28 Joseph Pecoraro <[email protected]>
Web Inspector: Include <template> node content in DOM Tree
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ActivateButtonNavigationItem.js (187518 => 187519)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ActivateButtonNavigationItem.js 2015-07-28 21:50:46 UTC (rev 187518)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ActivateButtonNavigationItem.js 2015-07-28 21:53:10 UTC (rev 187519)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,37 +23,33 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.ActivateButtonNavigationItem = function(identifier, defaultToolTip, activatedToolTip, image, imageWidth, imageHeight, suppressEmboss, role)
+WebInspector.ActivateButtonNavigationItem = class ActivateButtonNavigationItem extends WebInspector.ButtonNavigationItem
{
- WebInspector.ButtonNavigationItem.call(this, identifier, defaultToolTip, image, imageWidth, imageHeight, suppressEmboss, role);
+ constructor(identifier, defaultToolTip, activatedToolTip, image, imageWidth, imageHeight, suppressEmboss, role)
+ {
+ super(identifier, defaultToolTip, image, imageWidth, imageHeight, suppressEmboss, role);
- this._defaultToolTip = defaultToolTip;
- this._activatedToolTip = activatedToolTip || defaultToolTip;
- this._role = role;
-};
+ this._defaultToolTip = defaultToolTip;
+ this._activatedToolTip = activatedToolTip || defaultToolTip;
+ this._role = role;
+ }
-WebInspector.ActivateButtonNavigationItem.StyleClassName = "activate";
-WebInspector.ActivateButtonNavigationItem.ActivatedStyleClassName = "activated";
-
-WebInspector.ActivateButtonNavigationItem.prototype = {
- constructor: WebInspector.ActivateButtonNavigationItem,
-
// Public
get defaultToolTip()
{
return this._defaultToolTip;
- },
+ }
get activatedToolTip()
{
return this._activatedToolTip;
- },
+ }
get activated()
{
return this.element.classList.contains(WebInspector.ActivateButtonNavigationItem.ActivatedStyleClassName);
- },
+ }
set activated(flag)
{
@@ -68,9 +64,9 @@
if (this._role === "tab")
this.element.removeAttribute("aria-selected");
}
- },
+ }
- generateStyleText: function(parentSelector)
+ generateStyleText(parentSelector)
{
var classNames = this._classNames.join(".");
@@ -93,11 +89,14 @@
}
return styleText;
- },
+ }
- // Private
+ // Protected
- _additionalClassNames: [WebInspector.ActivateButtonNavigationItem.StyleClassName, WebInspector.ButtonNavigationItem.StyleClassName]
+ get additionalClassNames()
+ {
+ return ["activate", "button"];
+ }
};
-WebInspector.ActivateButtonNavigationItem.prototype.__proto__ = WebInspector.ButtonNavigationItem.prototype;
+WebInspector.ActivateButtonNavigationItem.ActivatedStyleClassName = "activated";
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ActivateButtonToolbarItem.js (187518 => 187519)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ActivateButtonToolbarItem.js 2015-07-28 21:50:46 UTC (rev 187518)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ActivateButtonToolbarItem.js 2015-07-28 21:53:10 UTC (rev 187519)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,28 +23,27 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.ActivateButtonToolbarItem = function(identifier, defaultToolTip, activatedToolTip, label, image, suppressEmboss, role)
+WebInspector.ActivateButtonToolbarItem = class ActivateButtonToolbarItem extends WebInspector.ActivateButtonNavigationItem
{
- WebInspector.ActivateButtonNavigationItem.call(this, identifier, defaultToolTip, activatedToolTip, image, 32, 32, suppressEmboss, role);
+ constructor(identifier, defaultToolTip, activatedToolTip, label, image, suppressEmboss, role)
+ {
+ super(identifier, defaultToolTip, activatedToolTip, image, 32, 32, suppressEmboss, role);
- if (typeof label === "string") {
- this._labelElement = document.createElement("div");
- this._labelElement.className = WebInspector.ButtonToolbarItem.LabelStyleClassName;
- this._element.appendChild(this._labelElement);
+ if (typeof label === "string") {
+ this._labelElement = document.createElement("div");
+ this._labelElement.className = WebInspector.ButtonToolbarItem.LabelStyleClassName;
+ this._element.appendChild(this._labelElement);
- this.label = label;
+ this.label = label;
+ }
}
-};
-WebInspector.ActivateButtonToolbarItem.prototype = {
- constructor: WebInspector.ActivateButtonToolbarItem,
-
// Public
get label()
{
return this._labelElement.textContent;
- },
+ }
set label(newLabel)
{
@@ -55,5 +54,3 @@
this._labelElement.textContent = newLabel;
}
};
-
-WebInspector.ActivateButtonToolbarItem.prototype.__proto__ = WebInspector.ActivateButtonNavigationItem.prototype;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ButtonNavigationItem.js (187518 => 187519)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ButtonNavigationItem.js 2015-07-28 21:50:46 UTC (rev 187518)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ButtonNavigationItem.js 2015-07-28 21:53:10 UTC (rev 187519)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,59 +23,46 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.ButtonNavigationItem = function(identifier, toolTipOrLabel, image, imageWidth, imageHeight, suppressEmboss, role, label) {
- WebInspector.NavigationItem.call(this, identifier);
+WebInspector.ButtonNavigationItem = class ButtonNavigationItem extends WebInspector.NavigationItem
+{
+ constructor(identifier, toolTipOrLabel, image, imageWidth, imageHeight, suppressEmboss, role, label)
+ {
+ super(identifier);
- console.assert(identifier);
- console.assert(toolTipOrLabel);
+ this._embossedImageStates = WebInspector.ButtonNavigationItem.States;
+ this._imageCacheable = true;
- this.toolTip = toolTipOrLabel;
+ console.assert(identifier);
+ console.assert(toolTipOrLabel);
- this._element.addEventListener("click", this._mouseClicked.bind(this));
+ this.toolTip = toolTipOrLabel;
- this._element.setAttribute("role", role || "button");
+ this._element.addEventListener("click", this._mouseClicked.bind(this));
- if (label)
- this._element.setAttribute("aria-label", label);
+ this._element.setAttribute("role", role || "button");
- this._imageWidth = imageWidth || 16;
- this._imageHeight = imageHeight || 16;
- this._suppressEmboss = suppressEmboss || false;
+ if (label)
+ this._element.setAttribute("aria-label", label);
- if (suppressEmboss)
- this._element.classList.add(WebInspector.ButtonNavigationItem.SuppressEmbossStyleClassName);
+ this._imageWidth = imageWidth || 16;
+ this._imageHeight = imageHeight || 16;
+ this._suppressEmboss = suppressEmboss || false;
- if (image)
- this.image = image;
- else
- this.label = toolTipOrLabel;
-};
+ if (suppressEmboss)
+ this._element.classList.add(WebInspector.ButtonNavigationItem.SuppressEmbossStyleClassName);
-WebInspector.ButtonNavigationItem.StyleClassName = "button";
-WebInspector.ButtonNavigationItem.DisabledStyleClassName = "disabled";
-WebInspector.ButtonNavigationItem.SuppressBezelStyleClassName = "suppress-bezel";
-WebInspector.ButtonNavigationItem.SuppressEmbossStyleClassName = "suppress-emboss";
-WebInspector.ButtonNavigationItem.TextOnlyClassName = "text-only";
+ if (image)
+ this.image = image;
+ else
+ this.label = toolTipOrLabel;
+ }
-WebInspector.ButtonNavigationItem.States = {};
-WebInspector.ButtonNavigationItem.States.Normal = "normal";
-WebInspector.ButtonNavigationItem.States.Active = "active";
-WebInspector.ButtonNavigationItem.States.Focus = "focus";
-WebInspector.ButtonNavigationItem.States.ActiveFocus = "active-focus";
-
-WebInspector.ButtonNavigationItem.Event = {
- Clicked: "button-navigation-item-clicked"
-};
-
-WebInspector.ButtonNavigationItem.prototype = {
- constructor: WebInspector.ButtonNavigationItem,
-
// Public
get toolTip()
{
return this._element.title;
- },
+ }
set toolTip(newToolTip)
{
@@ -84,12 +71,12 @@
return;
this._element.title = newToolTip;
- },
+ }
get label()
{
return this._element.textContent;
- },
+ }
set label(newLabel)
{
@@ -97,12 +84,12 @@
this._element.textContent = newLabel || "";
if (this.parentNavigationBar)
this.parentNavigationBar.updateLayout();
- },
+ }
get image()
{
return this._image;
- },
+ }
set image(newImage)
{
@@ -121,12 +108,12 @@
this._element.appendChild(this._glyphElement);
this._updateImage();
- },
+ }
get enabled()
{
return !this._element.classList.contains(WebInspector.ButtonNavigationItem.DisabledStyleClassName);
- },
+ }
set enabled(flag)
{
@@ -134,12 +121,12 @@
this._element.classList.remove(WebInspector.ButtonNavigationItem.DisabledStyleClassName);
else
this._element.classList.add(WebInspector.ButtonNavigationItem.DisabledStyleClassName);
- },
+ }
get suppressBezel()
{
return this._element.classList.contains(WebInspector.ButtonNavigationItem.SuppressBezelStyleClassName);
- },
+ }
set suppressBezel(flag)
{
@@ -147,9 +134,9 @@
this._element.classList.add(WebInspector.ButtonNavigationItem.SuppressBezelStyleClassName);
else
this._element.classList.remove(WebInspector.ButtonNavigationItem.SuppressBezelStyleClassName);
- },
+ }
- generateStyleText: function(parentSelector)
+ generateStyleText(parentSelector)
{
var classNames = this._classNames.join(".");
@@ -167,42 +154,58 @@
}
return styleText;
- },
+ }
+ // Protected
+
+ get additionalClassNames()
+ {
+ return ["button"];
+ }
+
// Private
- _additionalClassNames: [WebInspector.ButtonNavigationItem.StyleClassName],
- _embossedImageStates: WebInspector.ButtonNavigationItem.States,
- _imageCacheable: true,
-
- _mouseClicked: function(event)
+ _mouseClicked(event)
{
if (!this.enabled)
return;
this.dispatchEventToListeners(WebInspector.ButtonNavigationItem.Event.Clicked);
- },
+ }
- _canvasIdentifier: function(state)
+ _canvasIdentifier(state)
{
console.assert(!this._suppressEmboss);
return "navigation-item-" + this._identifier + "-" + (state || WebInspector.ButtonNavigationItem.States.Normal);
- },
+ }
- _updateImage: function()
+ _updateImage()
{
if (this._suppressEmboss)
this._glyphElement.style.webkitMask = "url(" + this._image + ")";
else
this._generateImages();
- },
+ }
- _generateImages: function()
+ _generateImages()
{
console.assert(!this._suppressEmboss);
if (this._suppressEmboss)
return;
generateEmbossedImages(this.image, this._imageWidth, this._imageHeight, this._embossedImageStates, this._canvasIdentifier.bind(this), !this._imageCacheable);
}
+}
+
+WebInspector.ButtonNavigationItem.DisabledStyleClassName = "disabled";
+WebInspector.ButtonNavigationItem.SuppressBezelStyleClassName = "suppress-bezel";
+WebInspector.ButtonNavigationItem.SuppressEmbossStyleClassName = "suppress-emboss";
+WebInspector.ButtonNavigationItem.TextOnlyClassName = "text-only";
+
+WebInspector.ButtonNavigationItem.States = {};
+WebInspector.ButtonNavigationItem.States.Normal = "normal";
+WebInspector.ButtonNavigationItem.States.Active = "active";
+WebInspector.ButtonNavigationItem.States.Focus = "focus";
+WebInspector.ButtonNavigationItem.States.ActiveFocus = "active-focus";
+
+WebInspector.ButtonNavigationItem.Event = {
+ Clicked: "button-navigation-item-clicked"
};
-
-WebInspector.ButtonNavigationItem.prototype.__proto__ = WebInspector.NavigationItem.prototype;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ButtonToolbarItem.js (187518 => 187519)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ButtonToolbarItem.js 2015-07-28 21:50:46 UTC (rev 187518)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ButtonToolbarItem.js 2015-07-28 21:53:10 UTC (rev 187519)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,30 +23,27 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.ButtonToolbarItem = function(identifier, toolTip, label, image, suppressEmboss, role)
+WebInspector.ButtonToolbarItem = class ButtonToolbarItem extends WebInspector.ButtonNavigationItem
{
- WebInspector.ButtonNavigationItem.call(this, identifier, toolTip, image, 16, 16, suppressEmboss, role);
+ constructor(identifier, toolTip, label, image, suppressEmboss, role)
+ {
+ super(identifier, toolTip, image, 16, 16, suppressEmboss, role);
- if (typeof label === "string") {
- this._labelElement = document.createElement("div");
- this._labelElement.className = WebInspector.ButtonToolbarItem.LabelStyleClassName;
- this._element.appendChild(this._labelElement);
+ if (typeof label === "string") {
+ this._labelElement = document.createElement("div");
+ this._labelElement.className = WebInspector.ButtonToolbarItem.LabelStyleClassName;
+ this._element.appendChild(this._labelElement);
- this.label = label;
+ this.label = label;
+ }
}
-};
-WebInspector.ButtonToolbarItem.LabelStyleClassName = "label";
-
-WebInspector.ButtonToolbarItem.prototype = {
- constructor: WebInspector.ButtonToolbarItem,
-
// Public
get label()
{
return this._labelElement.textContent;
- },
+ }
set label(newLabel)
{
@@ -58,4 +55,4 @@
}
};
-WebInspector.ButtonToolbarItem.prototype.__proto__ = WebInspector.ButtonNavigationItem.prototype;
+WebInspector.ButtonToolbarItem.LabelStyleClassName = "label";
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ControlToolbarItem.js (187518 => 187519)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ControlToolbarItem.js 2015-07-28 21:50:46 UTC (rev 187518)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ControlToolbarItem.js 2015-07-28 21:53:10 UTC (rev 187519)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,19 +23,17 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.ControlToolbarItem = function(identifier, toolTip, image, imageWidth, imageHeight)
+WebInspector.ControlToolbarItem = class ControlToolbarItem extends WebInspector.ButtonNavigationItem
{
- WebInspector.ButtonNavigationItem.call(this, identifier, toolTip, image, imageWidth, imageHeight, false);
-};
+ constructor(identifier, toolTip, image, imageWidth, imageHeight)
+ {
+ super(identifier, toolTip, image, imageWidth, imageHeight, false);
+ }
-WebInspector.ControlToolbarItem.StyleClassName = "control";
+ // Protected
-WebInspector.ControlToolbarItem.prototype = {
- constructor: WebInspector.ControlToolbarItem,
-
- // Private
-
- _additionalClassNames: [WebInspector.ControlToolbarItem.StyleClassName],
+ get additionalClassNames()
+ {
+ return ["control"];
+ }
};
-
-WebInspector.ControlToolbarItem.prototype.__proto__ = WebInspector.ButtonNavigationItem.prototype;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DividerNavigationItem.js (187518 => 187519)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DividerNavigationItem.js 2015-07-28 21:50:46 UTC (rev 187518)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DividerNavigationItem.js 2015-07-28 21:53:10 UTC (rev 187519)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,18 +23,17 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.DividerNavigationItem = function(identifier) {
- WebInspector.NavigationItem.call(this, identifier);
-};
+WebInspector.DividerNavigationItem = class DividerNavigationItem extends WebInspector.NavigationItem
+{
+ constructor(identifier)
+ {
+ super(identifier);
+ }
-WebInspector.DividerNavigationItem.StyleClassName = "divider";
+ // Protected
-WebInspector.DividerNavigationItem.prototype = {
- constructor: WebInspector.DividerNavigationItem,
-
- // Private
-
- _additionalClassNames: [WebInspector.DividerNavigationItem.StyleClassName],
+ get additionalClassNames()
+ {
+ return ["divider"];
+ }
};
-
-WebInspector.DividerNavigationItem.prototype.__proto__ = WebInspector.NavigationItem.prototype;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/FlexibleSpaceNavigationItem.js (187518 => 187519)
--- trunk/Source/WebInspectorUI/UserInterface/Views/FlexibleSpaceNavigationItem.js 2015-07-28 21:50:46 UTC (rev 187518)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/FlexibleSpaceNavigationItem.js 2015-07-28 21:53:10 UTC (rev 187519)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,18 +23,17 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.FlexibleSpaceNavigationItem = function(identifier) {
- WebInspector.NavigationItem.call(this, identifier);
-};
+WebInspector.FlexibleSpaceNavigationItem = class FlexibleSpaceNavigationItem extends WebInspector.NavigationItem
+{
+ constructor(identifier)
+ {
+ super(identifier);
+ }
-WebInspector.FlexibleSpaceNavigationItem.StyleClassName = "flexible-space";
+ // Protected
-WebInspector.FlexibleSpaceNavigationItem.prototype = {
- constructor: WebInspector.FlexibleSpaceNavigationItem,
-
- // Private
-
- _additionalClassNames: [WebInspector.FlexibleSpaceNavigationItem.StyleClassName],
+ get additionalClassNames()
+ {
+ return ["flexible-space"];
+ }
};
-
-WebInspector.FlexibleSpaceNavigationItem.prototype.__proto__ = WebInspector.NavigationItem.prototype;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/HierarchicalPathNavigationItem.js (187518 => 187519)
--- trunk/Source/WebInspectorUI/UserInterface/Views/HierarchicalPathNavigationItem.js 2015-07-28 21:50:46 UTC (rev 187518)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/HierarchicalPathNavigationItem.js 2015-07-28 21:53:10 UTC (rev 187519)
@@ -219,8 +219,7 @@
// Protected
- // FIXME: Should not be prefixed with an underscore.
- get _additionalClassNames()
+ get additionalClassNames()
{
return ["hierarchical-path"];
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NavigationItem.js (187518 => 187519)
--- trunk/Source/WebInspectorUI/UserInterface/Views/NavigationItem.js 2015-07-28 21:50:46 UTC (rev 187518)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NavigationItem.js 2015-07-28 21:53:10 UTC (rev 187519)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,57 +23,52 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.NavigationItem = function(identifier, role, label) {
- // FIXME: Convert this to a WebInspector.Object subclass, and call super().
- // WebInspector.Object.call(this);
+WebInspector.NavigationItem = class NavigationItem extends WebInspector.Object
+{
+ constructor(identifier, role, label)
+ {
+ super();
- this._identifier = identifier || null;
+ this._identifier = identifier || null;
- this._element = document.createElement("div");
- this._hidden = false;
+ this._element = document.createElement("div");
+ this._hidden = false;
- if (role)
- this._element.setAttribute("role", role);
- if (label)
- this._element.setAttribute("aria-label", label);
+ if (role)
+ this._element.setAttribute("role", role);
+ if (label)
+ this._element.setAttribute("aria-label", label);
- this._element.classList.add(...this._classNames);
- this._element.navigationItem = this;
-};
+ this._element.classList.add(...this._classNames);
+ this._element.navigationItem = this;
+ }
-WebInspector.NavigationItem.StyleClassName = "item";
-WebInspector.NavigationItem.HiddenStyleClassName = "hidden";
-
-
-WebInspector.NavigationItem.prototype = {
- constructor: WebInspector.NavigationItem,
-
// Public
get identifier()
{
return this._identifier;
- },
+ }
get element()
{
return this._element;
- },
+ }
get parentNavigationBar()
{
return this._parentNavigationBar;
- },
+ }
- updateLayout: function(expandOnly)
+ updateLayout(expandOnly)
{
// Implemented by subclasses.
- },
+ }
get hidden()
{
return this._hidden;
- },
+ }
set hidden(flag)
{
@@ -82,26 +77,21 @@
this._hidden = flag;
- if (flag)
- this._element.classList.add(WebInspector.NavigationItem.HiddenStyleClassName);
- else
- this._element.classList.remove(WebInspector.NavigationItem.HiddenStyleClassName);
+ this._element.classList.toggle("hidden", flag);
if (this._parentNavigationBar)
this._parentNavigationBar.updateLayoutSoon();
- },
+ }
// Private
get _classNames()
{
- var classNames = [WebInspector.NavigationItem.StyleClassName];
+ var classNames = ["item"];
if (this._identifier)
classNames.push(this._identifier);
- if (this._additionalClassNames instanceof Array)
- classNames = classNames.concat(this._additionalClassNames);
+ if (this.additionalClassNames instanceof Array)
+ classNames = classNames.concat(this.additionalClassNames);
return classNames;
}
};
-
-WebInspector.NavigationItem.prototype.__proto__ = WebInspector.Object.prototype;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/RadioButtonNavigationItem.js (187518 => 187519)
--- trunk/Source/WebInspectorUI/UserInterface/Views/RadioButtonNavigationItem.js 2015-07-28 21:50:46 UTC (rev 187518)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/RadioButtonNavigationItem.js 2015-07-28 21:53:10 UTC (rev 187519)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,23 +23,19 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.RadioButtonNavigationItem = function(identifier, toolTip, image, imageWidth, imageHeight) {
- WebInspector.ButtonNavigationItem.call(this, identifier, toolTip, image, imageWidth, imageHeight, null, "tab");
-};
+WebInspector.RadioButtonNavigationItem = class RadioButtonNavigationItem extends WebInspector.ButtonNavigationItem
+{
+ constructor(identifier, toolTip, image, imageWidth, imageHeight)
+ {
+ super(identifier, toolTip, image, imageWidth, imageHeight, null, "tab");
+ }
-WebInspector.RadioButtonNavigationItem.StyleClassName = "radio";
-WebInspector.RadioButtonNavigationItem.ActiveStyleClassName = "active";
-WebInspector.RadioButtonNavigationItem.SelectedStyleClassName = "selected";
-
-WebInspector.RadioButtonNavigationItem.prototype = {
- constructor: WebInspector.RadioButtonNavigationItem,
-
// Public
get selected()
{
return this.element.classList.contains(WebInspector.RadioButtonNavigationItem.SelectedStyleClassName);
- },
+ }
set selected(flag)
{
@@ -50,12 +46,12 @@
this.element.classList.remove(WebInspector.RadioButtonNavigationItem.SelectedStyleClassName);
this.element.setAttribute("aria-selected", "false");
}
- },
+ }
get active()
{
return this.element.classList.contains(WebInspector.RadioButtonNavigationItem.ActiveStyleClassName);
- },
+ }
set active(flag)
{
@@ -63,9 +59,9 @@
this.element.classList.add(WebInspector.RadioButtonNavigationItem.ActiveStyleClassName);
else
this.element.classList.remove(WebInspector.RadioButtonNavigationItem.ActiveStyleClassName);
- },
+ }
- generateStyleText: function(parentSelector)
+ generateStyleText(parentSelector)
{
var classNames = this._classNames.join(".");
@@ -79,9 +75,9 @@
styleText += parentSelector + " ." + classNames + ".selected:not(.disabled):active > .glyph { background-image: -webkit-canvas(" + this._canvasIdentifier(WebInspector.ButtonNavigationItem.States.ActiveFocus) + "); }\n";
return styleText;
- },
+ }
- updateLayout: function(expandOnly)
+ updateLayout(expandOnly)
{
if (expandOnly)
return;
@@ -101,11 +97,16 @@
this.element.classList.remove(WebInspector.RadioButtonNavigationItem.SelectedStyleClassName);
this.element.setAttribute("aria-selected", "false");
}
- },
+ }
- // Private
+ // Protected
- _additionalClassNames: [WebInspector.RadioButtonNavigationItem.StyleClassName, WebInspector.ButtonNavigationItem.StyleClassName],
+ get additionalClassNames()
+ {
+ return ["radio", "button"];
+ }
};
-WebInspector.RadioButtonNavigationItem.prototype.__proto__ = WebInspector.ButtonNavigationItem.prototype;
+WebInspector.RadioButtonNavigationItem.StyleClassName = "radio";
+WebInspector.RadioButtonNavigationItem.ActiveStyleClassName = "active";
+WebInspector.RadioButtonNavigationItem.SelectedStyleClassName = "selected";
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ToggleButtonNavigationItem.js (187518 => 187519)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ToggleButtonNavigationItem.js 2015-07-28 21:50:46 UTC (rev 187518)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ToggleButtonNavigationItem.js 2015-07-28 21:53:10 UTC (rev 187519)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,32 +23,35 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.ToggleButtonNavigationItem = function(identifier, defaultToolTip, alternateToolTip, defaultImage, alternateImage, imageWidth, imageHeight, suppressEmboss) {
- WebInspector.ButtonNavigationItem.call(this, identifier, defaultToolTip, defaultImage, imageWidth, imageHeight, suppressEmboss);
+WebInspector.ToggleButtonNavigationItem = class ToggleButtonNavigationItem extends WebInspector.ButtonNavigationItem
+{
+ constructor(identifier, defaultToolTip, alternateToolTip, defaultImage, alternateImage, imageWidth, imageHeight, suppressEmboss)
+ {
+ super(identifier, defaultToolTip, defaultImage, imageWidth, imageHeight, suppressEmboss);
- this._toggled = false;
- this._defaultImage = defaultImage;
- this._alternateImage = alternateImage;
- this._defaultToolTip = defaultToolTip;
- this._alternateToolTip = alternateToolTip || defaultToolTip;
-};
+ // The image isn't cacheable because it dynamically changes and the same canvas identifier is reused.
+ // FIXME: We could try overriding _canvasIdentifier() to return different identifiers. If we did that
+ // we would also need to override generateStyleText() to use the different identifiers.
+ this._imageCacheable = false;
-WebInspector.ToggleButtonNavigationItem.StyleClassName = "toggle";
+ this._toggled = false;
+ this._defaultImage = defaultImage;
+ this._alternateImage = alternateImage;
+ this._defaultToolTip = defaultToolTip;
+ this._alternateToolTip = alternateToolTip || defaultToolTip;
+ }
-WebInspector.ToggleButtonNavigationItem.prototype = {
- constructor: WebInspector.ToggleButtonNavigationItem,
-
// Public
get defaultToolTip()
{
return this._defaultToolTip;
- },
+ }
get alternateToolTip()
{
return this._alternateToolTip;
- },
+ }
set alternateToolTip(toolTip)
{
@@ -56,17 +59,17 @@
if (this._toggled)
this.toolTip = this._alternateToolTip;
- },
+ }
get defaultImage()
{
return this._defaultImage;
- },
+ }
get alternateImage()
{
return this._alternateImage;
- },
+ }
set alternateImage(image)
{
@@ -74,12 +77,12 @@
if (this._toggled)
this.image = this._alternateImage;
- },
+ }
get toggled()
{
return this._toggled;
- },
+ }
set toggled(flag)
{
@@ -97,16 +100,12 @@
this.toolTip = this._defaultToolTip;
this.image = this._defaultImage;
}
- },
+ }
- // Private
+ // Protected
- _additionalClassNames: [WebInspector.ToggleButtonNavigationItem.StyleClassName, WebInspector.ButtonNavigationItem.StyleClassName],
-
- // The image isn't cacheable because it dynamically changes and the same canvas identifier is reused.
- // FIXME: We could try overriding _canvasIdentifier() to return different identifiers. If we did that
- // we would also need to override generateStyleText() to use the different identifiers.
- _imageCacheable: false
+ get additionalClassNames()
+ {
+ return ["toggle", "button"];
+ }
};
-
-WebInspector.ToggleButtonNavigationItem.prototype.__proto__ = WebInspector.ButtonNavigationItem.prototype;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ToggleControlToolbarItem.js (187518 => 187519)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ToggleControlToolbarItem.js 2015-07-28 21:50:46 UTC (rev 187518)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ToggleControlToolbarItem.js 2015-07-28 21:53:10 UTC (rev 187519)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,18 +23,17 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-WebInspector.ToggleControlToolbarItem = function(identifier, defaultToolTip, alternateToolTip, defaultImage, alternateImage, imageWidth, imageHeight) {
- WebInspector.ToggleButtonNavigationItem.call(this, identifier, defaultToolTip, alternateToolTip, defaultImage, alternateImage, imageWidth, imageHeight, false);
-};
+WebInspector.ToggleControlToolbarItem = class ToggleControlToolbarItem extends WebInspector.ToggleButtonNavigationItem
+{
+ constructor(identifier, defaultToolTip, alternateToolTip, defaultImage, alternateImage, imageWidth, imageHeight)
+ {
+ super(identifier, defaultToolTip, alternateToolTip, defaultImage, alternateImage, imageWidth, imageHeight, false);
+ }
-WebInspector.ToggleControlToolbarItem.StyleClassName = "toggle";
+ // Protected
-WebInspector.ToggleControlToolbarItem.prototype = {
- constructor: WebInspector.ToggleControlToolbarItem,
-
- // Private
-
- _additionalClassNames: [WebInspector.ToggleControlToolbarItem.StyleClassName, WebInspector.ControlToolbarItem.StyleClassName]
+ get additionalClassNames()
+ {
+ return ["toggle", "control"];
+ }
};
-
-WebInspector.ToggleControlToolbarItem.prototype.__proto__ = WebInspector.ToggleButtonNavigationItem.prototype;