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

Unified Diff: third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilitySidebarView.js

Issue 2466123002: DevTools: reformat front-end code to match chromium style. (Closed)
Patch Set: all done Created 4 years, 1 month 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/accessibility/AccessibilitySidebarView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilitySidebarView.js b/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilitySidebarView.js
index 5cebc51c459590b1936b5f5d3917e20762e34b15..b76be955dc1b53fb3aca91cd253141c108366648 100644
--- a/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilitySidebarView.js
+++ b/third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilitySidebarView.js
@@ -1,14 +1,12 @@
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
/**
- * @constructor
- * @extends {WebInspector.ThrottledWidget}
+ * @unrestricted
*/
-WebInspector.AccessibilitySidebarView = function()
-{
- WebInspector.ThrottledWidget.call(this);
+WebInspector.AccessibilitySidebarView = class extends WebInspector.ThrottledWidget {
+ constructor() {
+ super();
this._node = null;
this._axNode = null;
this._sidebarPaneStack = WebInspector.viewManager.createStackLocation();
@@ -21,180 +19,170 @@ WebInspector.AccessibilitySidebarView = function()
this._sidebarPaneStack.widget().show(this.element);
WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this._pullNode, this);
this._pullNode();
-};
-
-WebInspector.AccessibilitySidebarView.prototype = {
- /**
- * @return {?WebInspector.DOMNode}
- */
- node: function()
- {
- return this._node;
- },
-
- /**
- * @param {?Array<!WebInspector.AccessibilityNode>} nodes
- */
- accessibilityNodeCallback: function(nodes)
- {
- if (!nodes)
- return;
-
- var currentAXNode = nodes[0];
- if (currentAXNode.ignored)
- this._sidebarPaneStack.removeView(this._ariaSubPane);
- else
- this._sidebarPaneStack.showView(this._ariaSubPane, this._axNodeSubPane);
-
- if (this._axNodeSubPane)
- this._axNodeSubPane.setAXNode(currentAXNode);
- if (this._treeSubPane)
- this._treeSubPane.setAXNodeAndAncestors(nodes);
- },
-
- /**
- * @override
- * @protected
- * @return {!Promise.<?>}
- */
- doUpdate: function()
- {
- var node = this.node();
- this._treeSubPane.setNode(node);
- this._axNodeSubPane.setNode(node);
- this._ariaSubPane.setNode(node);
- return WebInspector.AccessibilityModel.fromTarget(node.target()).getAXNodeChain(node)
- .then((nodes) => { this.accessibilityNodeCallback(nodes); });
- },
-
- /**
- * @override
- */
- wasShown: function()
- {
- WebInspector.ThrottledWidget.prototype.wasShown.call(this);
-
- this._treeSubPane.setNode(this.node());
- this._axNodeSubPane.setNode(this.node());
- this._ariaSubPane.setNode(this.node());
-
- WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspector.DOMModel.Events.AttrModified, this._onAttrChange, this);
- WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspector.DOMModel.Events.AttrRemoved, this._onAttrChange, this);
- WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this);
- WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this);
- },
-
- /**
- * @override
- */
- willHide: function()
- {
- WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, WebInspector.DOMModel.Events.AttrModified, this._onAttrChange, this);
- WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, WebInspector.DOMModel.Events.AttrRemoved, this._onAttrChange, this);
- WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, WebInspector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this);
- WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, WebInspector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this);
- },
-
- _pullNode: function()
- {
- this._node = WebInspector.context.flavor(WebInspector.DOMNode);
- this.update();
- },
-
- /**
- * @param {!WebInspector.Event} event
- */
- _onAttrChange: function(event)
- {
- if (!this.node())
- return;
- var node = event.data.node;
- if (this.node() !== node)
- return;
- this.update();
- },
-
- /**
- * @param {!WebInspector.Event} event
- */
- _onNodeChange: function(event)
- {
- if (!this.node())
- return;
- var node = event.data;
- if (this.node() !== node)
- return;
- this.update();
- },
-
-
- __proto__: WebInspector.ThrottledWidget.prototype
+ }
+
+ /**
+ * @return {?WebInspector.DOMNode}
+ */
+ node() {
+ return this._node;
+ }
+
+ /**
+ * @param {?Array<!WebInspector.AccessibilityNode>} nodes
+ */
+ accessibilityNodeCallback(nodes) {
+ if (!nodes)
+ return;
+
+ var currentAXNode = nodes[0];
+ if (currentAXNode.ignored)
+ this._sidebarPaneStack.removeView(this._ariaSubPane);
+ else
+ this._sidebarPaneStack.showView(this._ariaSubPane, this._axNodeSubPane);
+
+ if (this._axNodeSubPane)
+ this._axNodeSubPane.setAXNode(currentAXNode);
+ if (this._treeSubPane)
+ this._treeSubPane.setAXNodeAndAncestors(nodes);
+ }
+
+ /**
+ * @override
+ * @protected
+ * @return {!Promise.<?>}
+ */
+ doUpdate() {
+ var node = this.node();
+ this._treeSubPane.setNode(node);
+ this._axNodeSubPane.setNode(node);
+ this._ariaSubPane.setNode(node);
+ return WebInspector.AccessibilityModel.fromTarget(node.target()).getAXNodeChain(node).then((nodes) => {
+ this.accessibilityNodeCallback(nodes);
+ });
+ }
+
+ /**
+ * @override
+ */
+ wasShown() {
+ super.wasShown();
+
+ this._treeSubPane.setNode(this.node());
+ this._axNodeSubPane.setNode(this.node());
+ this._ariaSubPane.setNode(this.node());
+
+ WebInspector.targetManager.addModelListener(
+ WebInspector.DOMModel, WebInspector.DOMModel.Events.AttrModified, this._onAttrChange, this);
+ WebInspector.targetManager.addModelListener(
+ WebInspector.DOMModel, WebInspector.DOMModel.Events.AttrRemoved, this._onAttrChange, this);
+ WebInspector.targetManager.addModelListener(
+ WebInspector.DOMModel, WebInspector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this);
+ WebInspector.targetManager.addModelListener(
+ WebInspector.DOMModel, WebInspector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this);
+ }
+
+ /**
+ * @override
+ */
+ willHide() {
+ WebInspector.targetManager.removeModelListener(
+ WebInspector.DOMModel, WebInspector.DOMModel.Events.AttrModified, this._onAttrChange, this);
+ WebInspector.targetManager.removeModelListener(
+ WebInspector.DOMModel, WebInspector.DOMModel.Events.AttrRemoved, this._onAttrChange, this);
+ WebInspector.targetManager.removeModelListener(
+ WebInspector.DOMModel, WebInspector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this);
+ WebInspector.targetManager.removeModelListener(
+ WebInspector.DOMModel, WebInspector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this);
+ }
+
+ _pullNode() {
+ this._node = WebInspector.context.flavor(WebInspector.DOMNode);
+ this.update();
+ }
+
+ /**
+ * @param {!WebInspector.Event} event
+ */
+ _onAttrChange(event) {
+ if (!this.node())
+ return;
+ var node = event.data.node;
+ if (this.node() !== node)
+ return;
+ this.update();
+ }
+
+ /**
+ * @param {!WebInspector.Event} event
+ */
+ _onNodeChange(event) {
+ if (!this.node())
+ return;
+ var node = event.data;
+ if (this.node() !== node)
+ return;
+ this.update();
+ }
};
/**
- * @constructor
- * @extends {WebInspector.SimpleView}
- * @param {string} name
+ * @unrestricted
*/
-WebInspector.AccessibilitySubPane = function(name)
-{
- WebInspector.SimpleView.call(this, name);
+WebInspector.AccessibilitySubPane = class extends WebInspector.SimpleView {
+ /**
+ * @param {string} name
+ */
+ constructor(name) {
+ super(name);
this._axNode = null;
- this.registerRequiredCSS("accessibility/accessibilityNode.css");
-};
-
-WebInspector.AccessibilitySubPane.prototype = {
- /**
- * @param {?WebInspector.AccessibilityNode} axNode
- * @protected
- */
- setAXNode: function(axNode)
- {
- },
-
- /**
- * @return {?WebInspector.DOMNode}
- */
- node: function()
- {
- return this._node;
- },
-
- /**
- * @param {?WebInspector.DOMNode} node
- */
- setNode: function(node)
- {
- this._node = node;
- },
-
- /**
- * @param {string} textContent
- * @param {string=} className
- * @return {!Element}
- */
- createInfo: function(textContent, className)
- {
- var classNameOrDefault = className || "gray-info-message";
- var info = this.element.createChild("div", classNameOrDefault);
- info.textContent = textContent;
- return info;
- },
-
- /**
- * @return {!TreeOutline}
- */
- createTreeOutline: function()
- {
- var treeOutline = new TreeOutlineInShadow();
- treeOutline.registerRequiredCSS("accessibility/accessibilityNode.css");
- treeOutline.registerRequiredCSS("components/objectValue.css");
-
- treeOutline.element.classList.add("hidden");
- this.element.appendChild(treeOutline.element);
- return treeOutline;
- },
-
- __proto__: WebInspector.SimpleView.prototype
+ this.registerRequiredCSS('accessibility/accessibilityNode.css');
+ }
+
+ /**
+ * @param {?WebInspector.AccessibilityNode} axNode
+ * @protected
+ */
+ setAXNode(axNode) {
+ }
+
+ /**
+ * @return {?WebInspector.DOMNode}
+ */
+ node() {
+ return this._node;
+ }
+
+ /**
+ * @param {?WebInspector.DOMNode} node
+ */
+ setNode(node) {
+ this._node = node;
+ }
+
+ /**
+ * @param {string} textContent
+ * @param {string=} className
+ * @return {!Element}
+ */
+ createInfo(textContent, className) {
+ var classNameOrDefault = className || 'gray-info-message';
+ var info = this.element.createChild('div', classNameOrDefault);
+ info.textContent = textContent;
+ return info;
+ }
+
+ /**
+ * @return {!TreeOutline}
+ */
+ createTreeOutline() {
+ var treeOutline = new TreeOutlineInShadow();
+ treeOutline.registerRequiredCSS('accessibility/accessibilityNode.css');
+ treeOutline.registerRequiredCSS('components/objectValue.css');
+
+ treeOutline.element.classList.add('hidden');
+ this.element.appendChild(treeOutline.element);
+ return treeOutline;
+ }
};

Powered by Google App Engine
This is Rietveld 408576698