Web Inspector: Convert miscellaneous view widgets to use ES6 classes
authorburg@cs.washington.edu <burg@cs.washington.edu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Aug 2015 18:24:20 +0000 (18:24 +0000)
committerburg@cs.washington.edu <burg@cs.washington.edu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Aug 2015 18:24:20 +0000 (18:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=147658

Reviewed by Joseph Pecoraro.

Along the way, inline a few style class names.

Elided mechanical changes from the Changelog.

* UserInterface/Base/Test.js:
* UserInterface/Views/CSSStyleDeclarationSection.js:
* UserInterface/Views/ConsolePrompt.js:
* UserInterface/Views/ContentBrowser.js:
* UserInterface/Views/ContentViewContainer.js:
* UserInterface/Views/DOMTreeDataGridNode.js:
* UserInterface/Views/IndeterminateProgressSpinner.js:
* UserInterface/Views/NavigationBar.js:
* UserInterface/Views/ProbeSetDataGridNode.js:
* UserInterface/Views/QuickConsoleNavigationBar.js:
* UserInterface/Views/Toolbar.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@187968 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/Test.js
Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationSection.js
Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js
Source/WebInspectorUI/UserInterface/Views/ConsolePrompt.js
Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js
Source/WebInspectorUI/UserInterface/Views/ContentViewContainer.js
Source/WebInspectorUI/UserInterface/Views/DOMTreeDataGridNode.js
Source/WebInspectorUI/UserInterface/Views/IndeterminateProgressSpinner.js
Source/WebInspectorUI/UserInterface/Views/NavigationBar.js
Source/WebInspectorUI/UserInterface/Views/ProbeSetDataGridNode.js
Source/WebInspectorUI/UserInterface/Views/QuickConsoleNavigationBar.js
Source/WebInspectorUI/UserInterface/Views/Toolbar.js

index 5ed15f2..aa71020 100644 (file)
@@ -1,5 +1,28 @@
 2015-08-05  Brian Burg  <bburg@apple.com>
 
+        Web Inspector: Convert miscellaneous view widgets to use ES6 classes
+        https://bugs.webkit.org/show_bug.cgi?id=147658
+
+        Reviewed by Joseph Pecoraro.
+
+        Along the way, inline a few style class names.
+
+        Elided mechanical changes from the Changelog.
+
+        * UserInterface/Base/Test.js:
+        * UserInterface/Views/CSSStyleDeclarationSection.js:
+        * UserInterface/Views/ConsolePrompt.js:
+        * UserInterface/Views/ContentBrowser.js:
+        * UserInterface/Views/ContentViewContainer.js:
+        * UserInterface/Views/DOMTreeDataGridNode.js:
+        * UserInterface/Views/IndeterminateProgressSpinner.js:
+        * UserInterface/Views/NavigationBar.js:
+        * UserInterface/Views/ProbeSetDataGridNode.js:
+        * UserInterface/Views/QuickConsoleNavigationBar.js:
+        * UserInterface/Views/Toolbar.js:
+
+2015-08-05  Brian Burg  <bburg@apple.com>
+
         Web Inspector: Convert remaining ContentViews to use ES6 classes
         https://bugs.webkit.org/show_bug.cgi?id=147534
 
index a28458c..b106749 100644 (file)
@@ -104,26 +104,18 @@ InspectorTest.dumpMessagesToConsole = false;
 
 // This is a workaround for the fact that it would be hard to set up a constructor,
 // prototype, and prototype chain for the singleton InspectorTest.
-InspectorTest.EventDispatcher = function()
+InspectorTest.EventDispatcher = class EventDispatcher extends WebInspector.Object
 {
-    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
-    // WebInspector.Object.call(this);
+    dispatchEvent(event)
+    {
+        this.dispatchEventToListeners(event);
+    }
 };
 
 InspectorTest.EventDispatcher.Event = {
     TestPageDidLoad: "inspector-test-test-page-did-load"
 };
 
-InspectorTest.EventDispatcher.prototype = {
-    __proto__: WebInspector.Object.prototype,
-    constructor: InspectorTest.EventDispatcher,
-
-    dispatchEvent: function(event)
-    {
-        this.dispatchEventToListeners(event);
-    }
-};
-
 InspectorTest.eventDispatcher = new InspectorTest.EventDispatcher;
 
 // Note: Additional InspectorTest methods are included on a per-test basis from
index 99172e0..b3e0d07 100644 (file)
@@ -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
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.CSSStyleDeclarationSection = function(delegate, style)
+WebInspector.CSSStyleDeclarationSection = class CSSStyleDeclarationSection extends WebInspector.Object
 {
-    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
-    // WebInspector.Object.call(this);
-
-    this._delegate = delegate || null;
-
-    console.assert(style);
-    this._style = style || null;
-    this._selectorElements = [];
-    this._ruleDisabled = false;
-
-    this._element = document.createElement("div");
-    this._element.className = "style-declaration-section";
-
-    this._headerElement = document.createElement("div");
-    this._headerElement.className = "header";
-
-    this._iconElement = document.createElement("img");
-    this._iconElement.className = "icon";
-    this._headerElement.appendChild(this._iconElement);
-
-    this._selectorElement = document.createElement("span");
-    this._selectorElement.className = "selector";
-    this._selectorElement.setAttribute("spellcheck", "false");
-    this._selectorElement.addEventListener("mouseover", this._handleMouseOver.bind(this));
-    this._selectorElement.addEventListener("mouseout", this._handleMouseOut.bind(this));
-    this._selectorElement.addEventListener("keydown", this._handleKeyDown.bind(this));
-    this._selectorElement.addEventListener("keyup", this._handleKeyUp.bind(this));
-    this._selectorElement.addEventListener("paste", this._handleSelectorPaste.bind(this));
-    this._headerElement.appendChild(this._selectorElement);
-
-    this._originElement = document.createElement("span");
-    this._originElement.className = "origin";
-    this._headerElement.appendChild(this._originElement);
-
-    this._propertiesElement = document.createElement("div");
-    this._propertiesElement.className = "properties";
-
-    this._editorActive = false;
-    this._propertiesTextEditor = new WebInspector.CSSStyleDeclarationTextEditor(this, style);
-    this._propertiesTextEditor.addEventListener(WebInspector.CSSStyleDeclarationTextEditor.Event.ContentChanged, this._editorContentChanged.bind(this));
-    this._propertiesTextEditor.addEventListener(WebInspector.CSSStyleDeclarationTextEditor.Event.Blurred, this._editorBlurred.bind(this));
-    this._propertiesElement.appendChild(this._propertiesTextEditor.element);
-
-    this._element.appendChild(this._headerElement);
-    this._element.appendChild(this._propertiesElement);
-
-    var iconClassName;
-    switch (style.type) {
-    case WebInspector.CSSStyleDeclaration.Type.Rule:
-        console.assert(style.ownerRule);
-
-        if (style.inherited)
-            iconClassName = WebInspector.CSSStyleDeclarationSection.InheritedStyleRuleIconStyleClassName;
-        else if (style.ownerRule.type === WebInspector.CSSRule.Type.Author)
-            iconClassName = WebInspector.CSSStyleDeclarationSection.AuthorStyleRuleIconStyleClassName;
-        else if (style.ownerRule.type === WebInspector.CSSRule.Type.User)
-            iconClassName = WebInspector.CSSStyleDeclarationSection.UserStyleRuleIconStyleClassName;
-        else if (style.ownerRule.type === WebInspector.CSSRule.Type.UserAgent)
-            iconClassName = WebInspector.CSSStyleDeclarationSection.UserAgentStyleRuleIconStyleClassName;
-        else if (style.ownerRule.type === WebInspector.CSSRule.Type.Inspector)
-            iconClassName = WebInspector.CSSStyleDeclarationSection.InspectorStyleRuleIconStyleClassName;
-        break;
-
-    case WebInspector.CSSStyleDeclaration.Type.Inline:
-    case WebInspector.CSSStyleDeclaration.Type.Attribute:
-        if (style.inherited)
-            iconClassName = WebInspector.CSSStyleDeclarationSection.InheritedElementStyleRuleIconStyleClassName;
-        else
-            iconClassName = WebInspector.DOMTreeElementPathComponent.DOMElementIconStyleClassName;
-        break;
-    }
+    constructor(delegate, style)
+    {
+        console.assert(style instanceof WebInspector.CSSStyleDeclaration, style);
 
-    // Matches all situations except for User Agent styles.
-    if (!(style.ownerRule && style.ownerRule.type === WebInspector.CSSRule.Type.UserAgent)) {
-        this._iconElement.classList.add("toggle-able");
-        this._iconElement.title = WebInspector.UIString("Comment All Properties");
-        this._iconElement.addEventListener("click", this._toggleRuleOnOff.bind(this));
-    }
+        super();
 
-    console.assert(iconClassName);
-    this._element.classList.add(iconClassName);
+        this._delegate = delegate || null;
 
-    if (!style.editable)
-        this._element.classList.add(WebInspector.CSSStyleDeclarationSection.LockedStyleClassName);
-    else if (style.ownerRule) {
-        this._style.ownerRule.addEventListener(WebInspector.CSSRule.Event.SelectorChanged, this._markSelector.bind(this));
-        this._commitSelectorKeyboardShortcut = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.Enter, this._commitSelector.bind(this), this._selectorElement);
-        this._selectorElement.addEventListener("blur", this._commitSelector.bind(this));
-    } else
-        this._element.classList.add(WebInspector.CSSStyleDeclarationSection.SelectorLockedStyleClassName);
+        this._style = style || null;
+        this._selectorElements = [];
+        this._ruleDisabled = false;
 
-    if (!WebInspector.CSSStyleDeclarationSection._generatedLockImages) {
-        WebInspector.CSSStyleDeclarationSection._generatedLockImages = true;
+        this._element = document.createElement("div");
+        this._element.classList.add("style-declaration-section");
 
-        var specifications = {"style-lock-normal": {fillColor: [0, 0, 0, 0.5]}};
-        generateColoredImagesForCSS("Images/Locked.svg", specifications, 8, 10);
-    }
+        this._headerElement = document.createElement("div");
+        this._headerElement.classList.add("header");
 
-    this.refresh();
+        this._iconElement = document.createElement("img");
+        this._iconElement.classList.add("icon");
+        this._headerElement.appendChild(this._iconElement);
 
-    this._headerElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this));
-};
+        this._selectorElement = document.createElement("span");
+        this._selectorElement.classList.add("selector");
+        this._selectorElement.setAttribute("spellcheck", "false");
+        this._selectorElement.addEventListener("mouseover", this._handleMouseOver.bind(this));
+        this._selectorElement.addEventListener("mouseout", this._handleMouseOut.bind(this));
+        this._selectorElement.addEventListener("keydown", this._handleKeyDown.bind(this));
+        this._selectorElement.addEventListener("keyup", this._handleKeyUp.bind(this));
+        this._selectorElement.addEventListener("paste", this._handleSelectorPaste.bind(this));
+        this._headerElement.appendChild(this._selectorElement);
 
-WebInspector.CSSStyleDeclarationSection.LockedStyleClassName = "locked";
-WebInspector.CSSStyleDeclarationSection.SelectorLockedStyleClassName = "selector-locked";
-WebInspector.CSSStyleDeclarationSection.SelectorInvalidClassName = "invalid-selector";
-WebInspector.CSSStyleDeclarationSection.LastInGroupStyleClassName = "last-in-group";
-WebInspector.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName = "matched";
+        this._originElement = document.createElement("span");
+        this._originElement.classList.add("origin");
+        this._headerElement.appendChild(this._originElement);
 
-WebInspector.CSSStyleDeclarationSection.AuthorStyleRuleIconStyleClassName = "author-style-rule-icon";
-WebInspector.CSSStyleDeclarationSection.UserStyleRuleIconStyleClassName = "user-style-rule-icon";
-WebInspector.CSSStyleDeclarationSection.UserAgentStyleRuleIconStyleClassName = "user-agent-style-rule-icon";
-WebInspector.CSSStyleDeclarationSection.InspectorStyleRuleIconStyleClassName = "inspector-style-rule-icon";
-WebInspector.CSSStyleDeclarationSection.InheritedStyleRuleIconStyleClassName = "inherited-style-rule-icon";
-WebInspector.CSSStyleDeclarationSection.InheritedElementStyleRuleIconStyleClassName = "inherited-element-style-rule-icon";
+        this._propertiesElement = document.createElement("div");
+        this._propertiesElement.classList.add("properties");
+
+        this._editorActive = false;
+        this._propertiesTextEditor = new WebInspector.CSSStyleDeclarationTextEditor(this, style);
+        this._propertiesTextEditor.addEventListener(WebInspector.CSSStyleDeclarationTextEditor.Event.ContentChanged, this._editorContentChanged.bind(this));
+        this._propertiesTextEditor.addEventListener(WebInspector.CSSStyleDeclarationTextEditor.Event.Blurred, this._editorBlurred.bind(this));
+        this._propertiesElement.appendChild(this._propertiesTextEditor.element);
+
+        this._element.appendChild(this._headerElement);
+        this._element.appendChild(this._propertiesElement);
 
-WebInspector.CSSStyleDeclarationSection.prototype = {
-    constructor: WebInspector.CSSStyleDeclarationSection,
+        var iconClassName;
+        switch (style.type) {
+        case WebInspector.CSSStyleDeclaration.Type.Rule:
+            console.assert(style.ownerRule);
+
+            if (style.inherited)
+                iconClassName = WebInspector.CSSStyleDeclarationSection.InheritedStyleRuleIconStyleClassName;
+            else if (style.ownerRule.type === WebInspector.CSSRule.Type.Author)
+                iconClassName = WebInspector.CSSStyleDeclarationSection.AuthorStyleRuleIconStyleClassName;
+            else if (style.ownerRule.type === WebInspector.CSSRule.Type.User)
+                iconClassName = WebInspector.CSSStyleDeclarationSection.UserStyleRuleIconStyleClassName;
+            else if (style.ownerRule.type === WebInspector.CSSRule.Type.UserAgent)
+                iconClassName = WebInspector.CSSStyleDeclarationSection.UserAgentStyleRuleIconStyleClassName;
+            else if (style.ownerRule.type === WebInspector.CSSRule.Type.Inspector)
+                iconClassName = WebInspector.CSSStyleDeclarationSection.InspectorStyleRuleIconStyleClassName;
+            break;
+
+        case WebInspector.CSSStyleDeclaration.Type.Inline:
+        case WebInspector.CSSStyleDeclaration.Type.Attribute:
+            if (style.inherited)
+                iconClassName = WebInspector.CSSStyleDeclarationSection.InheritedElementStyleRuleIconStyleClassName;
+            else
+                iconClassName = WebInspector.DOMTreeElementPathComponent.DOMElementIconStyleClassName;
+            break;
+        }
+
+        // Matches all situations except for User Agent styles.
+        if (!(style.ownerRule && style.ownerRule.type === WebInspector.CSSRule.Type.UserAgent)) {
+            this._iconElement.classList.add("toggle-able");
+            this._iconElement.title = WebInspector.UIString("Comment All Properties");
+            this._iconElement.addEventListener("click", this._toggleRuleOnOff.bind(this));
+        }
+
+        console.assert(iconClassName);
+        this._element.classList.add(iconClassName);
+
+        if (!style.editable)
+            this._element.classList.add(WebInspector.CSSStyleDeclarationSection.LockedStyleClassName);
+        else if (style.ownerRule) {
+            this._style.ownerRule.addEventListener(WebInspector.CSSRule.Event.SelectorChanged, this._markSelector.bind(this));
+            this._commitSelectorKeyboardShortcut = new WebInspector.KeyboardShortcut(null, WebInspector.KeyboardShortcut.Key.Enter, this._commitSelector.bind(this), this._selectorElement);
+            this._selectorElement.addEventListener("blur", this._commitSelector.bind(this));
+        } else
+            this._element.classList.add(WebInspector.CSSStyleDeclarationSection.SelectorLockedStyleClassName);
+
+        if (!WebInspector.CSSStyleDeclarationSection._generatedLockImages) {
+            WebInspector.CSSStyleDeclarationSection._generatedLockImages = true;
+
+            var specifications = {"style-lock-normal": {fillColor: [0, 0, 0, 0.5]}};
+            generateColoredImagesForCSS("Images/Locked.svg", specifications, 8, 10);
+        }
+
+        this.refresh();
+
+        this._headerElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this));
+    }
 
     // Public
 
     get element()
     {
         return this._element;
-    },
+    }
 
     get style()
     {
         return this._style;
-    },
+    }
 
     get lastInGroup()
     {
         return this._element.classList.contains(WebInspector.CSSStyleDeclarationSection.LastInGroupStyleClassName);
-    },
+    }
 
     set lastInGroup(last)
     {
@@ -167,19 +153,19 @@ WebInspector.CSSStyleDeclarationSection.prototype = {
             this._element.classList.add(WebInspector.CSSStyleDeclarationSection.LastInGroupStyleClassName);
         else
             this._element.classList.remove(WebInspector.CSSStyleDeclarationSection.LastInGroupStyleClassName);
-    },
+    }
 
     get focused()
     {
         return this._propertiesTextEditor.focused;
-    },
+    }
 
-    focus: function()
+    focus()
     {
         this._propertiesTextEditor.focus();
-    },
+    }
 
-    refresh: function()
+    refresh()
     {
         this._selectorElement.removeChildren();
         this._originElement.removeChildren();
@@ -195,7 +181,7 @@ WebInspector.CSSStyleDeclarationSection.prototype = {
             selectorElement.textContent = selector.text;
 
             if (matched)
-                selectorElement.className = WebInspector.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName;
+                selectorElement.classList.add(WebInspector.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName);
 
             var specificity = selector.specificity;
             if (specificity) {
@@ -223,7 +209,7 @@ WebInspector.CSSStyleDeclarationSection.prototype = {
         {
             var selectorElement = document.createElement("span");
             selectorElement.textContent = selectorText;
-            selectorElement.className = WebInspector.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName;
+            selectorElement.classList.add(WebInspector.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName);
             this._selectorElement.appendChild(selectorElement);
         }
 
@@ -283,9 +269,9 @@ WebInspector.CSSStyleDeclarationSection.prototype = {
             this._originElement.append(WebInspector.UIString("HTML Attributes"));
             break;
         }
-    },
+    }
 
-    highlightProperty: function(property)
+    highlightProperty(property)
     {
         if (this._propertiesTextEditor.highlightProperty(property)) {
             this._element.scrollIntoView();
@@ -293,9 +279,9 @@ WebInspector.CSSStyleDeclarationSection.prototype = {
         }
 
         return false;
-    },
+    }
 
-    findMatchingPropertiesAndSelectors: function(needle)
+    findMatchingPropertiesAndSelectors(needle)
     {
         this._element.classList.remove(WebInspector.CSSStyleDetailsSidebarPanel.NoFilterMatchInSectionClassName, WebInspector.CSSStyleDetailsSidebarPanel.FilterMatchingSectionHasLabelClassName);
 
@@ -323,25 +309,25 @@ WebInspector.CSSStyleDeclarationSection.prototype = {
         }
 
         return true;
-    },
+    }
 
-    updateLayout: function()
+    updateLayout()
     {
         this._propertiesTextEditor.updateLayout();
-    },
+    }
 
-    clearSelection: function()
+    clearSelection()
     {
         this._propertiesTextEditor.clearSelection();
-    },
+    }
 
-    cssStyleDeclarationTextEditorFocused: function()
+    cssStyleDeclarationTextEditorFocused()
     {
         if (typeof this._delegate.cssStyleDeclarationSectionEditorFocused === "function")
             this._delegate.cssStyleDeclarationSectionEditorFocused(this);
-    },
+    }
 
-    cssStyleDeclarationTextEditorSwitchRule: function(reverse)
+    cssStyleDeclarationTextEditorSwitchRule(reverse)
     {
         if (!this._delegate)
             return;
@@ -350,9 +336,9 @@ WebInspector.CSSStyleDeclarationSection.prototype = {
             this._delegate.cssStyleDeclarationSectionEditorPreviousRule(this);
         else if (!reverse && typeof this._delegate.cssStyleDeclarationSectionEditorNextRule === "function")
             this._delegate.cssStyleDeclarationSectionEditorNextRule(this);
-    },
+    }
 
-    focusRuleSelector: function(reverse)
+    focusRuleSelector(reverse)
     {
         if (this.selectorLocked) {
             this.focus();
@@ -372,27 +358,27 @@ WebInspector.CSSStyleDeclarationSection.prototype = {
         var range = document.createRange();
         range.selectNodeContents(this._selectorElement);
         selection.addRange(range);
-    },
+    }
 
-    selectLastProperty: function()
+    selectLastProperty()
     {
         this._propertiesTextEditor.selectLastProperty();
-    },
+    }
 
     get selectorLocked()
     {
         return !this.locked && !this._style.ownerRule;
-    },
+    }
 
     get locked()
     {
         return !this._style.editable;
-    },
+    }
 
     get editorActive()
     {
         return this._editorActive;
-    },
+    }
 
     // Private
 
@@ -407,9 +393,9 @@ WebInspector.CSSStyleDeclarationSection.prototype = {
         }
 
         return selectorText.trim();
-    },
+    }
 
-    _handleSelectorPaste: function(event)
+    _handleSelectorPaste(event)
     {
         if (this._style.type === WebInspector.CSSStyleDeclaration.Type.Inline || !this._style.ownerRule)
             return;
@@ -444,9 +430,9 @@ WebInspector.CSSStyleDeclarationSection.prototype = {
         this._selectorElement.textContent = selector;
         this._style.nodeStyles.changeRule(this._style.ownerRule, selector, match[2]);
         event.preventDefault();
-    },
+    }
 
-    _handleContextMenuEvent: function(event)
+    _handleContextMenuEvent(event)
     {
         if (window.getSelection().toString().length)
             return;
@@ -467,9 +453,9 @@ WebInspector.CSSStyleDeclarationSection.prototype = {
         }.bind(this));
 
         contextMenu.show();
-    },
+    }
 
-    _generateCSSRuleString: function()
+    _generateCSSRuleString()
     {
         var numMediaQueries = 0;
         var styleText = "";
@@ -504,9 +490,9 @@ WebInspector.CSSStyleDeclarationSection.prototype = {
         styleText += "}";
 
         return styleText;
-    },
+    }
 
-    _toggleRuleOnOff: function()
+    _toggleRuleOnOff()
     {
         if (this._hasInvalidSelector)
             return;
@@ -514,9 +500,9 @@ WebInspector.CSSStyleDeclarationSection.prototype = {
         this._ruleDisabled = this._ruleDisabled ? !this._propertiesTextEditor.uncommentAllProperties() : this._propertiesTextEditor.commentAllProperties();
         this._iconElement.title = this._ruleDisabled ? WebInspector.UIString("Uncomment All Properties") : WebInspector.UIString("Comment All Properties");
         this._element.classList.toggle("rule-disabled", this._ruleDisabled);
-    },
+    }
 
-    _highlightNodesWithSelector: function()
+    _highlightNodesWithSelector()
     {
         if (!this._style.ownerRule) {
             WebInspector.domTreeManager.highlightDOMNode(this._style.node.id);
@@ -524,24 +510,24 @@ WebInspector.CSSStyleDeclarationSection.prototype = {
         }
 
         WebInspector.domTreeManager.highlightSelector(this._currentSelectorText, this._style.node.ownerDocument.frameIdentifier);
-    },
+    }
 
-    _hideDOMNodeHighlight: function()
+    _hideDOMNodeHighlight()
     {
         WebInspector.domTreeManager.hideDOMNodeHighlight();
-    },
+    }
 
-    _handleMouseOver: function(event)
+    _handleMouseOver(event)
     {
         this._highlightNodesWithSelector();
-    },
+    }
 
-    _handleMouseOut: function(event)
+    _handleMouseOut(event)
     {
         this._hideDOMNodeHighlight();
-    },
+    }
 
-    _handleKeyDown: function(event)
+    _handleKeyDown(event)
     {
         if (event.keyCode !== 9) {
             this._highlightNodesWithSelector();
@@ -560,14 +546,14 @@ WebInspector.CSSStyleDeclarationSection.prototype = {
             this._propertiesTextEditor.selectFirstProperty();
             return;
         }
-    },
+    }
 
-    _handleKeyUp: function(event)
+    _handleKeyUp(event)
     {
         this._highlightNodesWithSelector();
-    },
+    }
 
-    _commitSelector: function(mutations)
+    _commitSelector(mutations)
     {
         console.assert(this._style.ownerRule);
         if (!this._style.ownerRule)
@@ -581,9 +567,9 @@ WebInspector.CSSStyleDeclarationSection.prototype = {
         }
 
         this._style.ownerRule.selectorText = newSelectorText;
-    },
+    }
 
-    _markSelector: function(event)
+    _markSelector(event)
     {
         var valid = event && event.data && event.data.valid;
         this._element.classList.toggle(WebInspector.CSSStyleDeclarationSection.SelectorInvalidClassName, !valid);
@@ -598,19 +584,19 @@ WebInspector.CSSStyleDeclarationSection.prototype = {
         this._selectorElement.title = WebInspector.UIString("Using the previous selector '%s'.").format(this._style.ownerRule.selectorText);
         for (var i = 0; i < this._selectorElement.children.length; ++i)
             this._selectorElement.children[i].title = null;
-    },
+    }
 
     get _hasInvalidSelector()
     {
         return this._element.classList.contains(WebInspector.CSSStyleDeclarationSection.SelectorInvalidClassName);
-    },
+    }
 
-    _editorContentChanged: function(event)
+    _editorContentChanged(event)
     {
         this._editorActive = true;
-    },
+    }
 
-    _editorBlurred: function(event)
+    _editorBlurred(event)
     {
         this._editorActive = false;
         this.dispatchEventToListeners(WebInspector.CSSStyleDeclarationSection.Event.Blurred);
@@ -621,4 +607,15 @@ WebInspector.CSSStyleDeclarationSection.Event = {
     Blurred: "css-style-declaration-sections-blurred"
 };
 
-WebInspector.CSSStyleDeclarationSection.prototype.__proto__ = WebInspector.StyleDetailsPanel.prototype;
+WebInspector.CSSStyleDeclarationSection.LockedStyleClassName = "locked";
+WebInspector.CSSStyleDeclarationSection.SelectorLockedStyleClassName = "selector-locked";
+WebInspector.CSSStyleDeclarationSection.SelectorInvalidClassName = "invalid-selector";
+WebInspector.CSSStyleDeclarationSection.LastInGroupStyleClassName = "last-in-group";
+WebInspector.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName = "matched";
+
+WebInspector.CSSStyleDeclarationSection.AuthorStyleRuleIconStyleClassName = "author-style-rule-icon";
+WebInspector.CSSStyleDeclarationSection.UserStyleRuleIconStyleClassName = "user-style-rule-icon";
+WebInspector.CSSStyleDeclarationSection.UserAgentStyleRuleIconStyleClassName = "user-agent-style-rule-icon";
+WebInspector.CSSStyleDeclarationSection.InspectorStyleRuleIconStyleClassName = "inspector-style-rule-icon";
+WebInspector.CSSStyleDeclarationSection.InheritedStyleRuleIconStyleClassName = "inherited-style-rule-icon";
+WebInspector.CSSStyleDeclarationSection.InheritedElementStyleRuleIconStyleClassName = "inherited-element-style-rule-icon";
index 5734f85..8158a69 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
  * Copyright (C) 2015 Tobias Reiss <tobi+webkit@basecode.de>
  *
  * Redistribution and use in source and binary forms, with or without
index bbdd837..3a982ab 100644 (file)
@@ -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
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ConsolePrompt = function(delegate, mimeType, element)
+WebInspector.ConsolePrompt = class ConsolePrompt extends WebInspector.Object
 {
-    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
-    // WebInspector.Object.call(this);
-
-    mimeType = parseMIMEType(mimeType).type;
-
-    this._element = element || document.createElement("div");
-    this._element.classList.add("console-prompt");
-    this._element.classList.add(WebInspector.SyntaxHighlightedStyleClassName);
-
-    this._delegate = delegate || null;
-
-    this._codeMirror = CodeMirror(this.element, {
-        lineWrapping: true,
-        mode: mimeType,
-        indentWithTabs: true,
-        indentUnit: 4,
-        matchBrackets: true
-    });
-
-    var keyMap = {
-        "Up": this._handlePreviousKey.bind(this),
-        "Down": this._handleNextKey.bind(this),
-        "Ctrl-P": this._handlePreviousKey.bind(this),
-        "Ctrl-N": this._handleNextKey.bind(this),
-        "Enter": this._handleEnterKey.bind(this),
-        "Cmd-Enter": this._handleCommandEnterKey.bind(this),
-        "Tab": this._handleTabKey.bind(this),
-        "Esc": this._handleEscapeKey.bind(this)
-    };
-
-    this._codeMirror.addKeyMap(keyMap);
-
-    this._completionController = new WebInspector.CodeMirrorCompletionController(this._codeMirror, this);
-    this._completionController.addExtendedCompletionProvider("javascript", WebInspector.javaScriptRuntimeCompletionProvider);
-
-    this._history = [{}];
-    this._historyIndex = 0;
-};
+    constructor(delegate, mimeType, element)
+    {
+        super();
 
-WebInspector.ConsolePrompt.MaximumHistorySize = 30;
+        mimeType = parseMIMEType(mimeType).type;
+
+        this._element = element || document.createElement("div");
+        this._element.classList.add("console-prompt", WebInspector.SyntaxHighlightedStyleClassName);
+
+        this._delegate = delegate || null;
+
+        this._codeMirror = CodeMirror(this.element, {
+            lineWrapping: true,
+            mode: mimeType,
+            indentWithTabs: true,
+            indentUnit: 4,
+            matchBrackets: true
+        });
+
+        var keyMap = {
+            "Up": this._handlePreviousKey.bind(this),
+            "Down": this._handleNextKey.bind(this),
+            "Ctrl-P": this._handlePreviousKey.bind(this),
+            "Ctrl-N": this._handleNextKey.bind(this),
+            "Enter": this._handleEnterKey.bind(this),
+            "Cmd-Enter": this._handleCommandEnterKey.bind(this),
+            "Tab": this._handleTabKey.bind(this),
+            "Esc": this._handleEscapeKey.bind(this)
+        };
+
+        this._codeMirror.addKeyMap(keyMap);
 
-WebInspector.ConsolePrompt.prototype = {
-    constructor: WebInspector.ConsolePrompt,
+        this._completionController = new WebInspector.CodeMirrorCompletionController(this._codeMirror, this);
+        this._completionController.addExtendedCompletionProvider("javascript", WebInspector.javaScriptRuntimeCompletionProvider);
+
+        this._history = [{}];
+        this._historyIndex = 0;
+    }
 
     // Public
 
     get element()
     {
         return this._element;
-    },
+    }
 
     get delegate()
     {
         return this._delegate;
-    },
+    }
 
     set delegate(delegate)
     {
         this._delegate = delegate || null;
-    },
+    }
 
     set escapeKeyHandlerWhenEmpty(handler)
     {
         this._escapeKeyHandlerWhenEmpty = handler;
-    },
+    }
 
     get text()
     {
         return this._codeMirror.getValue();
-    },
+    }
 
     set text(text)
     {
         this._codeMirror.setValue(text || "");
         this._codeMirror.clearHistory();
         this._codeMirror.markClean();
-    },
+    }
 
     get history()
     {
         this._history[this._historyIndex] = this._historyEntryForCurrentText();
         return this._history;
-    },
+    }
 
     set history(history)
     {
         this._history = history instanceof Array ? history.slice(0, WebInspector.ConsolePrompt.MaximumHistorySize) : [{}];
         this._historyIndex = 0;
         this._restoreHistoryEntry(0);
-    },
+    }
 
     get focused()
     {
         return this._codeMirror.getWrapperElement().classList.contains("CodeMirror-focused");
-    },
+    }
 
-    focus: function()
+    focus()
     {
         this._codeMirror.focus();
-    },
+    }
 
-    shown: function()
+    shown()
     {
         this._codeMirror.refresh();
-    },
+    }
 
-    updateLayout: function()
+    updateLayout()
     {
         this._codeMirror.refresh();
-    },
+    }
 
-    updateCompletions: function(completions, implicitSuffix)
+    updateCompletions(completions, implicitSuffix)
     {
         this._completionController.updateCompletions(completions, implicitSuffix);
-    },
+    }
 
-    pushHistoryItem: function(text)
+    pushHistoryItem(text)
     {
         this._commitHistoryEntry({text});
-    },
+    }
 
     // Protected
 
-    completionControllerCompletionsNeeded: function(completionController, prefix, defaultCompletions, base, suffix, forced)
+    completionControllerCompletionsNeeded(completionController, prefix, defaultCompletions, base, suffix, forced)
     {
         if (this.delegate && typeof this.delegate.consolePromptCompletionsNeeded === "function")
             this.delegate.consolePromptCompletionsNeeded(this, defaultCompletions, base, prefix, suffix, forced);
         else
             this._completionController.updateCompletions(defaultCompletions);
-    },
+    }
 
-    completionControllerShouldAllowEscapeCompletion: function(completionController)
+    completionControllerShouldAllowEscapeCompletion(completionController)
     {
         // Only allow escape to complete if there is text in the prompt. Otherwise allow it to pass through
         // so escape to toggle the quick console still works.
         return !!this.text;
-    },
+    }
 
     // Private
 
-    _handleTabKey: function(codeMirror)
+    _handleTabKey(codeMirror)
     {
         var cursor = codeMirror.getCursor();
         var line = codeMirror.getLine(cursor.line);
@@ -182,9 +177,9 @@ WebInspector.ConsolePrompt.prototype = {
             if (result === WebInspector.CodeMirrorCompletionController.UpdatePromise.NoCompletionsFound)
                 InspectorFrontendHost.beep();
         });
-    },
+    }
 
-    _handleEscapeKey: function(codeMirror)
+    _handleEscapeKey(codeMirror)
     {
         if (this.text)
             return CodeMirror.Pass;
@@ -193,9 +188,9 @@ WebInspector.ConsolePrompt.prototype = {
             return CodeMirror.Pass;
 
         this._escapeKeyHandlerWhenEmpty();
-    },
+    }
 
-    _handlePreviousKey: function(codeMirror)
+    _handlePreviousKey(codeMirror)
     {
         if (this._codeMirror.somethingSelected())
             return CodeMirror.Pass;
@@ -213,9 +208,9 @@ WebInspector.ConsolePrompt.prototype = {
         ++this._historyIndex;
 
         this._restoreHistoryEntry(this._historyIndex);
-    },
+    }
 
-    _handleNextKey: function(codeMirror)
+    _handleNextKey(codeMirror)
     {
         if (this._codeMirror.somethingSelected())
             return CodeMirror.Pass;
@@ -233,9 +228,9 @@ WebInspector.ConsolePrompt.prototype = {
         --this._historyIndex;
 
         this._restoreHistoryEntry(this._historyIndex);
-    },
+    }
 
-    _handleEnterKey: function(codeMirror, forceCommit)
+    _handleEnterKey(codeMirror, forceCommit)
     {
         var currentText = this.text;
 
@@ -282,9 +277,9 @@ WebInspector.ConsolePrompt.prototype = {
         }
 
         commitTextOrInsertNewLine.call(this, true);
-    },
+    }
 
-    _commitHistoryEntry: function(historyEntry)
+    _commitHistoryEntry(historyEntry)
     {
         // Replace the previous entry if it does not have text or if the text is the same.
         if (this._history[1] && (!this._history[1].text || this._history[1].text === historyEntry.text)) {
@@ -301,14 +296,14 @@ WebInspector.ConsolePrompt.prototype = {
         }
 
         this._historyIndex = 0;
-    },
+    }
 
-    _handleCommandEnterKey: function(codeMirror)
+    _handleCommandEnterKey(codeMirror)
     {
         this._handleEnterKey(codeMirror, true);
-    },
+    }
 
-    _restoreHistoryEntry: function(index)
+    _restoreHistoryEntry(index)
     {
         var historyEntry = this._history[index];
 
@@ -320,14 +315,14 @@ WebInspector.ConsolePrompt.prototype = {
             this._codeMirror.clearHistory();
 
         this._codeMirror.setCursor(historyEntry.cursor || {line: 0});
-    },
+    }
 
-    _historyEntryForCurrentText: function()
+    _historyEntryForCurrentText()
     {
         return {text: this.text, undoHistory: this._codeMirror.getHistory(), cursor: this._codeMirror.getCursor()};
-    },
+    }
 
-    _rememberCurrentTextInHistory: function()
+    _rememberCurrentTextInHistory()
     {
         this._history[this._historyIndex] = this._historyEntryForCurrentText();
 
@@ -336,4 +331,4 @@ WebInspector.ConsolePrompt.prototype = {
     }
 };
 
-WebInspector.ConsolePrompt.prototype.__proto__ = WebInspector.Object.prototype;
+WebInspector.ConsolePrompt.MaximumHistorySize = 30;
index 9f4843a..161f581 100644 (file)
@@ -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
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ContentBrowser = function(element, delegate, disableBackForward)
+WebInspector.ContentBrowser = class ContentBrowser extends WebInspector.Object
 {
-    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
-    // WebInspector.Object.call(this);
-
-    this._element = element || document.createElement("div");
-    this._element.classList.add("content-browser");
-
-    this._navigationBar = new WebInspector.NavigationBar;
-    this._element.appendChild(this._navigationBar.element);
+    constructor(element, delegate, disableBackForward)
+    {
+        super();
 
-    this._contentViewContainer = new WebInspector.ContentViewContainer;
-    this._contentViewContainer.addEventListener(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange, this._currentContentViewDidChange, this);
-    this._element.appendChild(this._contentViewContainer.element);
+        this._element = element || document.createElement("div");
+        this._element.classList.add("content-browser");
 
-    this._findBanner = new WebInspector.FindBanner(this);
-    this._findBanner.addEventListener(WebInspector.FindBanner.Event.DidShow, this._findBannerDidShow, this);
-    this._findBanner.addEventListener(WebInspector.FindBanner.Event.DidHide, this._findBannerDidHide, this);
+        this._navigationBar = new WebInspector.NavigationBar;
+        this._element.appendChild(this._navigationBar.element);
 
-    this._findKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "F", this._showFindBanner.bind(this), this._element);
-    this._saveKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "S", this._save.bind(this), this._element);
-    this._saveAsKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Shift | WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "S", this._saveAs.bind(this), this._element);
+        this._contentViewContainer = new WebInspector.ContentViewContainer;
+        this._contentViewContainer.addEventListener(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange, this._currentContentViewDidChange, this);
+        this._element.appendChild(this._contentViewContainer.element);
 
-    if (!disableBackForward) {
-        this._backKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Control, WebInspector.KeyboardShortcut.Key.Left, this._backButtonClicked.bind(this), this._element);
-        this._forwardKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Control, WebInspector.KeyboardShortcut.Key.Right, this._forwardButtonClicked.bind(this), this._element);
+        this._findBanner = new WebInspector.FindBanner(this);
+        this._findBanner.addEventListener(WebInspector.FindBanner.Event.DidShow, this._findBannerDidShow, this);
+        this._findBanner.addEventListener(WebInspector.FindBanner.Event.DidHide, this._findBannerDidHide, this);
 
-        this._backButtonNavigationItem = new WebInspector.ButtonNavigationItem("back", WebInspector.UIString("Back (%s)").format(this._backKeyboardShortcut.displayName), "Images/BackArrow.svg", 8, 13);
-        this._backButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._backButtonClicked, this);
-        this._backButtonNavigationItem.enabled = false;
-        this._navigationBar.addNavigationItem(this._backButtonNavigationItem);
+        this._findKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "F", this._showFindBanner.bind(this), this._element);
+        this._saveKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "S", this._save.bind(this), this._element);
+        this._saveAsKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Shift | WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "S", this._saveAs.bind(this), this._element);
 
-        this._forwardButtonNavigationItem = new WebInspector.ButtonNavigationItem("forward", WebInspector.UIString("Forward (%s)").format(this._forwardKeyboardShortcut.displayName), "Images/ForwardArrow.svg", 8, 13);
-        this._forwardButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._forwardButtonClicked, this);
-        this._forwardButtonNavigationItem.enabled = false;
-        this._navigationBar.addNavigationItem(this._forwardButtonNavigationItem);
+        if (!disableBackForward) {
+            this._backKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Control, WebInspector.KeyboardShortcut.Key.Left, this._backButtonClicked.bind(this), this._element);
+            this._forwardKeyboardShortcut = new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl | WebInspector.KeyboardShortcut.Modifier.Control, WebInspector.KeyboardShortcut.Key.Right, this._forwardButtonClicked.bind(this), this._element);
 
-        this._navigationBar.addNavigationItem(new WebInspector.DividerNavigationItem);
-    }
+            this._backButtonNavigationItem = new WebInspector.ButtonNavigationItem("back", WebInspector.UIString("Back (%s)").format(this._backKeyboardShortcut.displayName), "Images/BackArrow.svg", 8, 13);
+            this._backButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._backButtonClicked, this);
+            this._backButtonNavigationItem.enabled = false;
+            this._navigationBar.addNavigationItem(this._backButtonNavigationItem);
 
-    this._hierarchicalPathNavigationItem = new WebInspector.HierarchicalPathNavigationItem;
-    this._hierarchicalPathNavigationItem.addEventListener(WebInspector.HierarchicalPathNavigationItem.Event.PathComponentWasSelected, this._hierarchicalPathComponentWasSelected, this);
-    this._navigationBar.addNavigationItem(this._hierarchicalPathNavigationItem);
+            this._forwardButtonNavigationItem = new WebInspector.ButtonNavigationItem("forward", WebInspector.UIString("Forward (%s)").format(this._forwardKeyboardShortcut.displayName), "Images/ForwardArrow.svg", 8, 13);
+            this._forwardButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._forwardButtonClicked, this);
+            this._forwardButtonNavigationItem.enabled = false;
+            this._navigationBar.addNavigationItem(this._forwardButtonNavigationItem);
 
-    this._contentViewSelectionPathNavigationItem = new WebInspector.HierarchicalPathNavigationItem;
+            this._navigationBar.addNavigationItem(new WebInspector.DividerNavigationItem);
+        }
 
-    this._dividingFlexibleSpaceNavigationItem = new WebInspector.FlexibleSpaceNavigationItem;
-    this._navigationBar.addNavigationItem(this._dividingFlexibleSpaceNavigationItem);
+        this._hierarchicalPathNavigationItem = new WebInspector.HierarchicalPathNavigationItem;
+        this._hierarchicalPathNavigationItem.addEventListener(WebInspector.HierarchicalPathNavigationItem.Event.PathComponentWasSelected, this._hierarchicalPathComponentWasSelected, this);
+        this._navigationBar.addNavigationItem(this._hierarchicalPathNavigationItem);
 
-    WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange, this._contentViewSelectionPathComponentDidChange, this);
-    WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange, this._contentViewSupplementalRepresentedObjectsDidChange, this);
-    WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange, this._contentViewNumberOfSearchResultsDidChange, this);
-    WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.NavigationItemsDidChange, this._contentViewNavigationItemsDidChange, this);
+        this._contentViewSelectionPathNavigationItem = new WebInspector.HierarchicalPathNavigationItem;
 
-    this._delegate = delegate || null;
+        this._dividingFlexibleSpaceNavigationItem = new WebInspector.FlexibleSpaceNavigationItem;
+        this._navigationBar.addNavigationItem(this._dividingFlexibleSpaceNavigationItem);
 
-    this._currentContentViewNavigationItems = [];
-};
+        WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange, this._contentViewSelectionPathComponentDidChange, this);
+        WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange, this._contentViewSupplementalRepresentedObjectsDidChange, this);
+        WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange, this._contentViewNumberOfSearchResultsDidChange, this);
+        WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.NavigationItemsDidChange, this._contentViewNavigationItemsDidChange, this);
 
-// FIXME: Move to a WebInspector.Object subclass and we can remove this.
-WebInspector.Object.deprecatedAddConstructorFunctions(WebInspector.ContentBrowser);
+        this._delegate = delegate || null;
 
-WebInspector.ContentBrowser.Event = {
-    CurrentRepresentedObjectsDidChange: "content-browser-current-represented-objects-did-change",
-    CurrentContentViewDidChange: "content-browser-current-content-view-did-change"
-};
-
-WebInspector.ContentBrowser.prototype = {
-    constructor: WebInspector.ContentBrowser,
+        this._currentContentViewNavigationItems = [];
+    }
 
     // Public
 
     get element()
     {
         return this._element;
-    },
+    }
 
     get navigationBar()
     {
         return this._navigationBar;
-    },
+    }
 
     get contentViewContainer()
     {
         return this._contentViewContainer;
-    },
+    }
 
     get delegate()
     {
         return this._delegate;
-    },
+    }
 
     set delegate(newDelegate)
     {
         this._delegate = newDelegate || null;
-    },
+    }
 
     get currentContentView()
     {
         return this._contentViewContainer.currentContentView;
-    },
+    }
 
     get currentRepresentedObjects()
     {
@@ -145,53 +135,53 @@ WebInspector.ContentBrowser.prototype = {
         }
 
         return representedObjects;
-    },
+    }
 
-    updateLayout: function()
+    updateLayout()
     {
         this._navigationBar.updateLayout();
         this._contentViewContainer.updateLayout();
-    },
+    }
 
-    showContentViewForRepresentedObject: function(representedObject, cookie, extraArguments)
+    showContentViewForRepresentedObject(representedObject, cookie, extraArguments)
     {
         var contentView = this.contentViewForRepresentedObject(representedObject, false, extraArguments);
         return this._contentViewContainer.showContentView(contentView, cookie);
-    },
+    }
 
-    showContentView: function(contentView, cookie)
+    showContentView(contentView, cookie)
     {
         return this._contentViewContainer.showContentView(contentView, cookie);
-    },
+    }
 
-    contentViewForRepresentedObject: function(representedObject, onlyExisting, extraArguments)
+    contentViewForRepresentedObject(representedObject, onlyExisting, extraArguments)
     {
         return this._contentViewContainer.contentViewForRepresentedObject(representedObject, onlyExisting, extraArguments);
-    },
+    }
 
-    updateHierarchicalPathForCurrentContentView: function()
+    updateHierarchicalPathForCurrentContentView()
     {
         var currentContentView = this.currentContentView;
         this._updateHierarchicalPathNavigationItem(currentContentView ? currentContentView.representedObject : null);
-    },
+    }
 
-    canGoBack: function()
+    canGoBack()
     {
         var currentContentView = this.currentContentView;
         if (currentContentView && currentContentView.canGoBack())
             return true;
         return this._contentViewContainer.canGoBack();
-    },
+    }
 
-    canGoForward: function()
+    canGoForward()
     {
         var currentContentView = this.currentContentView;
         if (currentContentView && currentContentView.canGoForward())
             return true;
         return this._contentViewContainer.canGoForward();
-    },
+    }
 
-    goBack: function()
+    goBack()
     {
         var currentContentView = this.currentContentView;
         if (currentContentView && currentContentView.canGoBack()) {
@@ -204,9 +194,9 @@ WebInspector.ContentBrowser.prototype = {
 
         // The _updateBackForwardButtons function is called by _currentContentViewDidChange,
         // so it does not need to be called here.
-    },
+    }
 
-    goForward: function()
+    goForward()
     {
         var currentContentView = this.currentContentView;
         if (currentContentView && currentContentView.canGoForward()) {
@@ -219,133 +209,133 @@ WebInspector.ContentBrowser.prototype = {
 
         // The _updateBackForwardButtons function is called by _currentContentViewDidChange,
         // so it does not need to be called here.
-    },
+    }
 
-    findBannerPerformSearch: function(findBanner, query)
+    findBannerPerformSearch(findBanner, query)
     {
         var currentContentView = this.currentContentView;
         if (!currentContentView || !currentContentView.supportsSearch)
             return;
 
         currentContentView.performSearch(query);
-    },
+    }
 
-    findBannerSearchCleared: function(findBanner)
+    findBannerSearchCleared(findBanner)
     {
         var currentContentView = this.currentContentView;
         if (!currentContentView || !currentContentView.supportsSearch)
             return;
 
         currentContentView.searchCleared();
-    },
+    }
 
-    findBannerSearchQueryForSelection: function(findBanner)
+    findBannerSearchQueryForSelection(findBanner)
     {
         var currentContentView = this.currentContentView;
         if (!currentContentView || !currentContentView.supportsSearch)
             return null;
 
         return currentContentView.searchQueryWithSelection();
-    },
+    }
 
-    findBannerRevealPreviousResult: function(findBanner)
+    findBannerRevealPreviousResult(findBanner)
     {
         var currentContentView = this.currentContentView;
         if (!currentContentView || !currentContentView.supportsSearch)
             return;
 
         currentContentView.revealPreviousSearchResult(!findBanner.showing);
-    },
+    }
 
-    findBannerRevealNextResult: function(findBanner)
+    findBannerRevealNextResult(findBanner)
     {
         var currentContentView = this.currentContentView;
         if (!currentContentView || !currentContentView.supportsSearch)
             return;
 
         currentContentView.revealNextSearchResult(!findBanner.showing);
-    },
+    }
 
-    shown: function()
+    shown()
     {
         this._contentViewContainer.shown();
 
         this._findBanner.enableKeyboardShortcuts();
-    },
+    }
 
-    hidden: function()
+    hidden()
     {
         this._contentViewContainer.hidden();
 
         this._findBanner.disableKeyboardShortcuts();
-    },
+    }
 
     // Private
 
-    _backButtonClicked: function(event)
+    _backButtonClicked(event)
     {
         this.goBack();
-    },
+    }
 
-    _forwardButtonClicked: function(event)
+    _forwardButtonClicked(event)
     {
         this.goForward();
-    },
+    }
 
-    _save: function(event)
+    _save(event)
     {
         var currentContentView = this.currentContentView;
         if (!currentContentView || !currentContentView.supportsSave)
             return;
 
         WebInspector.saveDataToFile(currentContentView.saveData);
-    },
+    }
 
-    _saveAs: function(event)
+    _saveAs(event)
     {
         var currentContentView = this.currentContentView;
         if (!currentContentView || !currentContentView.supportsSave)
             return;
 
         WebInspector.saveDataToFile(currentContentView.saveData, true);
-    },
+    }
 
-    _showFindBanner: function(event)
+    _showFindBanner(event)
     {
         var currentContentView = this.currentContentView;
         if (!currentContentView || !currentContentView.supportsSearch)
             return;
 
         this._findBanner.show();
-    },
+    }
 
-    _findBannerDidShow: function(event)
+    _findBannerDidShow(event)
     {
         var currentContentView = this.currentContentView;
         if (!currentContentView || !currentContentView.supportsSearch)
             return;
 
         currentContentView.automaticallyRevealFirstSearchResult = true;
-    },
+    }
 
-    _findBannerDidHide: function(event)
+    _findBannerDidHide(event)
     {
         var currentContentView = this.currentContentView;
         if (!currentContentView || !currentContentView.supportsSearch)
             return;
 
         currentContentView.automaticallyRevealFirstSearchResult = false;
-    },
+    }
 
-    _contentViewNumberOfSearchResultsDidChange: function(event)
+    _contentViewNumberOfSearchResultsDidChange(event)
     {
         if (event.target !== this.currentContentView)
             return;
 
         this._findBanner.numberOfResults = this.currentContentView.numberOfSearchResults;
-    },
+    }
 
-    _updateHierarchicalPathNavigationItem: function(representedObject)
+    _updateHierarchicalPathNavigationItem(representedObject)
     {
         if (!this.delegate || typeof this.delegate.contentBrowserTreeElementForRepresentedObject !== "function")
             return;
@@ -360,9 +350,9 @@ WebInspector.ContentBrowser.prototype = {
         }
 
         this._hierarchicalPathNavigationItem.components = pathComponents;
-    },
+    }
 
-    _updateContentViewSelectionPathNavigationItem: function(contentView)
+    _updateContentViewSelectionPathNavigationItem(contentView)
     {
         var selectionPathComponents = contentView ? contentView.selectionPathComponents || [] : [];
         this._contentViewSelectionPathNavigationItem.components = selectionPathComponents;
@@ -380,18 +370,18 @@ WebInspector.ContentBrowser.prototype = {
             this._navigationBar.insertNavigationItem(this._contentViewSelectionPathNavigationItem, hierarchicalPathItemIndex + 1);
             this._hierarchicalPathNavigationItem.alwaysShowLastPathComponentSeparator = true;
         }
-    },
+    }
 
-    _updateBackForwardButtons: function()
+    _updateBackForwardButtons()
     {
         if (!this._backButtonNavigationItem || !this._forwardButtonNavigationItem)
             return;
 
         this._backButtonNavigationItem.enabled = this.canGoBack();
         this._forwardButtonNavigationItem.enabled = this.canGoForward();
-    },
+    }
 
-    _updateContentViewNavigationItems: function()
+    _updateContentViewNavigationItems()
     {
         var navigationBar = this.navigationBar;
 
@@ -427,9 +417,9 @@ WebInspector.ContentBrowser.prototype = {
         // Remember the navigation items we inserted so we can remove them
         // for the next content view.
         this._currentContentViewNavigationItems = newNavigationItems;
-    },
+    }
 
-    _updateFindBanner: function(currentContentView)
+    _updateFindBanner(currentContentView)
     {
         if (!currentContentView) {
             this._findBanner.targetElement = null;
@@ -444,16 +434,16 @@ WebInspector.ContentBrowser.prototype = {
             currentContentView.automaticallyRevealFirstSearchResult = this._findBanner.showing;
             currentContentView.performSearch(this._findBanner.searchQuery);
         }
-    },
+    }
 
-    _dispatchCurrentRepresentedObjectsDidChangeEventSoon: function()
+    _dispatchCurrentRepresentedObjectsDidChangeEventSoon()
     {
         if (this._currentRepresentedObjectsDidChangeTimeout)
             return;
         this._currentRepresentedObjectsDidChangeTimeout = setTimeout(this._dispatchCurrentRepresentedObjectsDidChangeEvent.bind(this), 0);
-    },
+    }
 
-    _dispatchCurrentRepresentedObjectsDidChangeEvent: function()
+    _dispatchCurrentRepresentedObjectsDidChangeEvent()
     {
         if (this._currentRepresentedObjectsDidChangeTimeout) {
             clearTimeout(this._currentRepresentedObjectsDidChangeTimeout);
@@ -461,9 +451,9 @@ WebInspector.ContentBrowser.prototype = {
         }
 
         this.dispatchEventToListeners(WebInspector.ContentBrowser.Event.CurrentRepresentedObjectsDidChange);
-    },
+    }
 
-    _contentViewSelectionPathComponentDidChange: function(event)
+    _contentViewSelectionPathComponentDidChange(event)
     {
         if (event.target !== this.currentContentView)
             return;
@@ -476,17 +466,17 @@ WebInspector.ContentBrowser.prototype = {
         this._navigationBar.updateLayout();
 
         this._dispatchCurrentRepresentedObjectsDidChangeEventSoon();
-    },
+    }
 
-    _contentViewSupplementalRepresentedObjectsDidChange: function(event)
+    _contentViewSupplementalRepresentedObjectsDidChange(event)
     {
         if (event.target !== this.currentContentView)
             return;
 
         this._dispatchCurrentRepresentedObjectsDidChangeEventSoon();
-    },
+    }
 
-    _currentContentViewDidChange: function(event)
+    _currentContentViewDidChange(event)
     {
         var currentContentView = this.currentContentView;
 
@@ -502,18 +492,18 @@ WebInspector.ContentBrowser.prototype = {
         this.dispatchEventToListeners(WebInspector.ContentBrowser.Event.CurrentContentViewDidChange);
 
         this._dispatchCurrentRepresentedObjectsDidChangeEvent();
-    },
+    }
 
-    _contentViewNavigationItemsDidChange: function(event)
+    _contentViewNavigationItemsDidChange(event)
     {
         if (event.target !== this.currentContentView)
             return;
 
         this._updateContentViewNavigationItems();
         this._navigationBar.updateLayout();
-    },
+    }
 
-    _hierarchicalPathComponentWasSelected: function(event)
+    _hierarchicalPathComponentWasSelected(event)
     {
         console.assert(event.data.pathComponent instanceof WebInspector.GeneralTreeElementPathComponent);
 
@@ -531,4 +521,7 @@ WebInspector.ContentBrowser.prototype = {
     }
 };
 
-WebInspector.ContentBrowser.prototype.__proto__ = WebInspector.Object.prototype;
+WebInspector.ContentBrowser.Event = {
+    CurrentRepresentedObjectsDidChange: "content-browser-current-represented-objects-did-change",
+    CurrentContentViewDidChange: "content-browser-current-content-view-did-change"
+};
index 1fd15af..368588d 100644 (file)
@@ -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
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ContentViewContainer = function(element)
+WebInspector.ContentViewContainer = class ContentViewContainer extends WebInspector.Object
 {
-    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
-    // WebInspector.Object.call(this);
-
-    this._element = element || document.createElement("div");
-    this._element.classList.add("content-view-container");
-
-    this._backForwardList = [];
-    this._currentIndex = -1;
-};
+    constructor(element)
+    {
+        super();
 
-WebInspector.ContentViewContainer.Event = {
-    CurrentContentViewDidChange: "content-view-container-current-content-view-did-change"
-};
+        this._element = element || document.createElement("div");
+        this._element.classList.add("content-view-container");
 
-WebInspector.ContentViewContainer.prototype = {
-    constructor: WebInspector.ContentViewContainer,
+        this._backForwardList = [];
+        this._currentIndex = -1;
+    }
 
     // Public
 
     get element()
     {
         return this._element;
-    },
+    }
 
     get currentIndex()
     {
         return this._currentIndex;
-    },
+    }
 
     get backForwardList()
     {
         return this._backForwardList;
-    },
+    }
 
     get currentContentView()
     {
         if (this._currentIndex < 0 || this._currentIndex > this._backForwardList.length - 1)
             return null;
         return this._backForwardList[this._currentIndex].contentView;
-    },
+    }
 
     get currentBackForwardEntry()
     {
         if (this._currentIndex < 0 || this._currentIndex > this._backForwardList.length - 1)
             return null;
         return this._backForwardList[this._currentIndex];
-    },
+    }
 
-    updateLayout: function()
+    updateLayout()
     {
         var currentContentView = this.currentContentView;
         if (currentContentView)
             currentContentView.updateLayout();
-    },
+    }
 
-    contentViewForRepresentedObject: function(representedObject, onlyExisting, extraArguments)
+    contentViewForRepresentedObject(representedObject, onlyExisting, extraArguments)
     {
         console.assert(representedObject);
         if (!representedObject)
@@ -123,9 +117,9 @@ WebInspector.ContentViewContainer.prototype = {
         representedObject.__contentViews.push(contentView);
 
         return contentView;
-    },
+    }
 
-    showContentViewForRepresentedObject: function(representedObject, extraArguments)
+    showContentViewForRepresentedObject(representedObject, extraArguments)
     {
         var contentView = this.contentViewForRepresentedObject(representedObject, false, extraArguments);
         if (!contentView)
@@ -134,9 +128,9 @@ WebInspector.ContentViewContainer.prototype = {
         this.showContentView(contentView);
 
         return contentView;
-    },
+    }
 
-    showContentView: function(contentView, cookie)
+    showContentView(contentView, cookie)
     {
         console.assert(contentView instanceof WebInspector.ContentView);
         if (!(contentView instanceof WebInspector.ContentView))
@@ -186,9 +180,9 @@ WebInspector.ContentViewContainer.prototype = {
         this.showBackForwardEntryForIndex(newIndex);
 
         return contentView;
-    },
+    }
 
-    showBackForwardEntryForIndex: function(index)
+    showBackForwardEntryForIndex(index)
     {
         console.assert(index >= 0 && index <= this._backForwardList.length - 1);
         if (index < 0 || index > this._backForwardList.length - 1)
@@ -212,9 +206,9 @@ WebInspector.ContentViewContainer.prototype = {
             this._showEntry(currentEntry, false);
 
         this.dispatchEventToListeners(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange);
-    },
+    }
 
-    replaceContentView: function(oldContentView, newContentView)
+    replaceContentView(oldContentView, newContentView)
     {
         console.assert(oldContentView instanceof WebInspector.ContentView);
         if (!(oldContentView instanceof WebInspector.ContentView))
@@ -253,9 +247,9 @@ WebInspector.ContentViewContainer.prototype = {
             this._showEntry(this.currentBackForwardEntry, true);
             this.dispatchEventToListeners(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange);
         }
-    },
+    }
 
-    closeAllContentViewsOfPrototype: function(constructor)
+    closeAllContentViewsOfPrototype(constructor)
     {
         if (!this._backForwardList.length) {
             console.assert(this._currentIndex === -1);
@@ -309,9 +303,9 @@ WebInspector.ContentViewContainer.prototype = {
             this._showEntry(currentEntry, true);
             this.dispatchEventToListeners(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange);
         }
-    },
+    }
 
-    closeContentView: function(contentViewToClose)
+    closeContentView(contentViewToClose)
     {
         if (!this._backForwardList.length) {
             console.assert(this._currentIndex === -1);
@@ -365,9 +359,9 @@ WebInspector.ContentViewContainer.prototype = {
             this._showEntry(currentEntry, true);
             this.dispatchEventToListeners(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange);
         }
-    },
+    }
 
-    closeAllContentViews: function()
+    closeAllContentViews()
     {
         if (!this._backForwardList.length) {
             console.assert(this._currentIndex === -1);
@@ -388,65 +382,65 @@ WebInspector.ContentViewContainer.prototype = {
         this._currentIndex = -1;
 
         this.dispatchEventToListeners(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange);
-    },
+    }
 
-    canGoBack: function()
+    canGoBack()
     {
         return this._currentIndex > 0;
-    },
+    }
 
-    canGoForward: function()
+    canGoForward()
     {
         return this._currentIndex < this._backForwardList.length - 1;
-    },
+    }
 
-    goBack: function()
+    goBack()
     {
         if (!this.canGoBack())
             return;
         this.showBackForwardEntryForIndex(this._currentIndex - 1);
-    },
+    }
 
-    goForward: function()
+    goForward()
     {
         if (!this.canGoForward())
             return;
         this.showBackForwardEntryForIndex(this._currentIndex + 1);
-    },
+    }
 
-    shown: function()
+    shown()
     {
         var currentEntry = this.currentBackForwardEntry;
         if (!currentEntry)
             return;
 
         this._showEntry(currentEntry, true);
-    },
+    }
 
-    hidden: function()
+    hidden()
     {
         var currentEntry = this.currentBackForwardEntry;
         if (!currentEntry)
             return;
 
         this._hideEntry(currentEntry);
-    },
+    }
 
     // Private
 
-    _addContentViewElement: function(contentView)
+    _addContentViewElement(contentView)
     {
         if (contentView.element.parentNode !== this._element)
             this._element.appendChild(contentView.element);
-    },
+    }
 
-    _removeContentViewElement: function(contentView)
+    _removeContentViewElement(contentView)
     {
         if (contentView.element.parentNode)
             contentView.element.parentNode.removeChild(contentView.element);
-    },
+    }
 
-    _disassociateFromContentView: function(contentView)
+    _disassociateFromContentView(contentView)
     {
         console.assert(!contentView.visible);
 
@@ -460,17 +454,17 @@ WebInspector.ContentViewContainer.prototype = {
             representedObject.__contentViews.remove(contentView);
 
         contentView.closed();
-    },
+    }
 
-    _showEntry: function(entry, shouldCallShown)
+    _showEntry(entry, shouldCallShown)
     {
         console.assert(entry instanceof WebInspector.BackForwardEntry);
 
         this._addContentViewElement(entry.contentView);
         entry.prepareToShow(shouldCallShown);
-    },
+    }
 
-    _hideEntry: function(entry)
+    _hideEntry(entry)
     {
         console.assert(entry instanceof WebInspector.BackForwardEntry);
 
@@ -479,4 +473,6 @@ WebInspector.ContentViewContainer.prototype = {
     }
 };
 
-WebInspector.ContentViewContainer.prototype.__proto__ = WebInspector.Object.prototype;
+WebInspector.ContentViewContainer.Event = {
+    CurrentContentViewDidChange: "content-view-container-current-content-view-did-change"
+};
index 079a8cb..1434028 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2013 Adobe Systems Inc. All rights reserved.
+ * Copyright (C) 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
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DOMTreeDataGridNode = function(domNode)
+WebInspector.DOMTreeDataGridNode = class DOMTreeDataGridNode extends WebInspector.DataGridNode
 {
-    WebInspector.DataGridNode.call(this);
-
-    this._nameLabel = null;
-    this._domNode = domNode;
-    this._updateNodeName();
-};
+    constructor(domNode)
+    {
+        super();
 
-WebInspector.DOMTreeDataGridNode.prototype = {
-    constructor: WebInspector.DOMTreeDataGridNode,
-    __proto__: WebInspector.DataGridNode.prototype,
+        this._nameLabel = null;
+        this._domNode = domNode;
+        this._updateNodeName();
+    }
 
     get domNode()
     {
         return this._domNode;
-    },
+    }
 
     // DataGridNode Overrides.
 
-    createCellContent: function(columnIdentifier, cell)
+    createCellContent(columnIdentifier, cell)
     {
         if (columnIdentifier !== "name")
-            return WebInspector.DataGridNode.prototype.createCellContent.call(this, columnIdentifier, cell);
+            return super.createCellContent(columnIdentifier, cell);
 
         var cell = this._makeNameCell();
         this._updateNameCellData();
         return cell;
-    },
+    }
 
     // Private
 
-    _updateNodeName: function()
+    _updateNodeName()
     {
         this.data = {name: WebInspector.displayNameForNode(this._domNode)};
-    },
+    }
 
-    _makeNameCell: function()
+    _makeNameCell()
     {
         var fragment = document.createDocumentFragment();
 
-        fragment.appendChild(document.createElement("img")).className = "icon";
+        fragment.appendChild(document.createElement("img")).classList.add("icon");
 
         this._nameLabel = document.createElement("div");
-        this._nameLabel.className = "label";
+        this._nameLabel.classList.add("label");
         fragment.appendChild(this._nameLabel);
 
         var goToButton = fragment.appendChild(WebInspector.createGoToArrowButton());
         goToButton.addEventListener("click", this._goToArrowWasClicked.bind(this), false);
 
         return fragment;
-    },
+    }
 
-    _updateNameCellData: function()
+    _updateNameCellData()
     {
         this._nameLabel.textContent = this.data.name;
-    },
+    }
 
-    _goToArrowWasClicked: function()
+    _goToArrowWasClicked()
     {
         WebInspector.showMainFrameDOMTree(this._domNode);
     }
index 5bf2d76..22e156a 100644 (file)
@@ -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
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.IndeterminateProgressSpinner = function()
+WebInspector.IndeterminateProgressSpinner = class IndeterminateProgressSpinner extends WebInspector.Object
 {
-    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
-    // WebInspector.Object.call(this);
-
-    this._element = document.createElement("div");
-    this._element.className = WebInspector.IndeterminateProgressSpinner.StyleClassName;
-};
-
-WebInspector.IndeterminateProgressSpinner.StyleClassName = "indeterminate-progress-spinner";
+    constructor()
+    {
+        super();
 
-WebInspector.IndeterminateProgressSpinner.prototype = {
-    constructor: WebInspector.IndeterminateProgressSpinner,
+        this._element = document.createElement("div");
+        this._element.classList.add("indeterminate-progress-spinner");
+    }
 
     // Public
 
@@ -44,5 +40,3 @@ WebInspector.IndeterminateProgressSpinner.prototype = {
         return this._element;
     }
 };
-
-WebInspector.IndeterminateProgressSpinner.prototype.__proto__ = WebInspector.Object.prototype;
index b0db042..5b35f23 100644 (file)
@@ -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
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.NavigationBar = function(element, navigationItems, role, label) {
-    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
-    // WebInspector.Object.call(this);
-
-    this._element = element || document.createElement("div");
-    this._element.classList.add(this.constructor.StyleClassName || WebInspector.NavigationBar.StyleClassName);
-    this._element.tabIndex = 0;
-
-    if (role)
-        this._element.setAttribute("role", role);
-    if (label)
-        this._element.setAttribute("aria-label", label);
-
-    this._element.addEventListener("focus", this._focus.bind(this), false);
-    this._element.addEventListener("blur", this._blur.bind(this), false);
-    this._element.addEventListener("keydown", this._keyDown.bind(this), false);
-    this._element.addEventListener("mousedown", this._mouseDown.bind(this), false);
-
-    document.addEventListener("load", this.updateLayout.bind(this), false);
+WebInspector.NavigationBar = class NavigationBar extends WebInspector.Object
+{
+    constructor(element, navigationItems, role, label)
+    {
+        super();
 
-    this._styleElement = document.createElement("style");
+        this._element = element || document.createElement("div");
+        this._element.classList.add(this.constructor.StyleClassName || "navigation-bar");
+        this._element.tabIndex = 0;
 
-    this._navigationItems = [];
+        if (role)
+            this._element.setAttribute("role", role);
+        if (label)
+            this._element.setAttribute("aria-label", label);
 
-    if (navigationItems) {
-        for (var i = 0; i < navigationItems.length; ++i)
-            this.addNavigationItem(navigationItems[i]);
-    }
+        this._element.addEventListener("focus", this._focus.bind(this), false);
+        this._element.addEventListener("blur", this._blur.bind(this), false);
+        this._element.addEventListener("keydown", this._keyDown.bind(this), false);
+        this._element.addEventListener("mousedown", this._mouseDown.bind(this), false);
 
-    document.head.appendChild(this._styleElement);
-};
+        document.addEventListener("load", this.updateLayout.bind(this), false);
 
-// FIXME: Move to a WebInspector.Object subclass and we can remove this.
-WebInspector.Object.deprecatedAddConstructorFunctions(WebInspector.NavigationBar);
+        this._styleElement = document.createElement("style");
 
-WebInspector.NavigationBar.StyleClassName = "navigation-bar";
-WebInspector.NavigationBar.CollapsedStyleClassName = "collapsed";
+        this._navigationItems = [];
 
-WebInspector.NavigationBar.Event = {
-    NavigationItemSelected: "navigation-bar-navigation-item-selected"
-};
+        if (navigationItems) {
+            for (var i = 0; i < navigationItems.length; ++i)
+                this.addNavigationItem(navigationItems[i]);
+        }
 
-WebInspector.NavigationBar.prototype = {
-    constructor: WebInspector.NavigationBar,
+        document.head.appendChild(this._styleElement);
+    }
 
     // Public
 
-    addNavigationItem: function(navigationItem, parentElement)
+    addNavigationItem(navigationItem, parentElement)
     {
         return this.insertNavigationItem(navigationItem, this._navigationItems.length, parentElement);
-    },
+    }
 
-    insertNavigationItem: function(navigationItem, index, parentElement)
+    insertNavigationItem(navigationItem, index, parentElement)
     {
         console.assert(navigationItem instanceof WebInspector.NavigationItem);
         if (!(navigationItem instanceof WebInspector.NavigationItem))
@@ -107,9 +96,9 @@ WebInspector.NavigationBar.prototype = {
         this.updateLayoutSoon();
 
         return navigationItem;
-    },
+    }
 
-    removeNavigationItem: function(navigationItemOrIdentifierOrIndex)
+    removeNavigationItem(navigationItemOrIdentifierOrIndex)
     {
         var navigationItem = this._findNavigationItem(navigationItemOrIdentifierOrIndex);
         if (!navigationItem)
@@ -129,9 +118,9 @@ WebInspector.NavigationBar.prototype = {
         this.updateLayoutSoon();
 
         return navigationItem;
-    },
+    }
 
-    updateLayoutSoon: function()
+    updateLayoutSoon()
     {
         if (this._updateLayoutTimeout)
             return;
@@ -147,9 +136,9 @@ WebInspector.NavigationBar.prototype = {
         }
 
         this._updateLayoutTimeout = setTimeout(update.bind(this), 0);
-    },
+    }
 
-    updateLayout: function()
+    updateLayout()
     {
         if (this._updateLayoutTimeout) {
             clearTimeout(this._updateLayoutTimeout);
@@ -191,12 +180,12 @@ WebInspector.NavigationBar.prototype = {
         // Give each navigation item the opportunity to collapse further.
         for (var i = 0; i < this._navigationItems.length; ++i)
             this._navigationItems[i].updateLayout();
-    },
+    }
 
     get selectedNavigationItem()
     {
         return this._selectedNavigationItem || null;
-    },
+    }
 
     set selectedNavigationItem(navigationItemOrIdentifierOrIndex)
     {
@@ -221,17 +210,17 @@ WebInspector.NavigationBar.prototype = {
         // This prevents sending the event while the user is scrubbing the bar.
         if (!this._mouseIsDown)
             this.dispatchEventToListeners(WebInspector.NavigationBar.Event.NavigationItemSelected);
-    },
+    }
 
     get navigationItems()
     {
         return this._navigationItems;
-    },
+    }
 
     get element()
     {
         return this._element;
-    },
+    }
 
     get minimumWidth()
     {
@@ -241,17 +230,17 @@ WebInspector.NavigationBar.prototype = {
         }
 
         return this._minimumWidth;
-    },
+    }
 
     get sizesToFit()
     {
         // Can be overriden by subclasses.
         return false;
-    },
+    }
 
     // Private
 
-    _findNavigationItem: function(navigationItemOrIdentifierOrIndex)
+    _findNavigationItem(navigationItemOrIdentifierOrIndex)
     {
         var navigationItem = null;
 
@@ -270,9 +259,9 @@ WebInspector.NavigationBar.prototype = {
         }
 
         return navigationItem;
-    },
+    }
 
-    _mouseDown: function(event)
+    _mouseDown(event)
     {
         // Only handle left mouse clicks.
         if (event.button !== 0)
@@ -306,9 +295,9 @@ WebInspector.NavigationBar.prototype = {
 
         event.preventDefault();
         event.stopPropagation();
-    },
+    }
 
-    _mouseMoved: function(event)
+    _mouseMoved(event)
     {
         console.assert(event.button === 0);
         console.assert(this._mouseIsDown);
@@ -337,9 +326,9 @@ WebInspector.NavigationBar.prototype = {
         this.selectedNavigationItem = itemElement.navigationItem;
 
         this.selectedNavigationItem.active = true;
-    },
+    }
 
-    _mouseUp: function(event)
+    _mouseUp(event)
     {
         console.assert(event.button === 0);
         console.assert(this._mouseIsDown);
@@ -369,9 +358,9 @@ WebInspector.NavigationBar.prototype = {
 
         event.preventDefault();
         event.stopPropagation();
-    },
+    }
 
-    _keyDown: function(event)
+    _keyDown(event)
     {
         if (!this._focused)
             return;
@@ -401,23 +390,23 @@ WebInspector.NavigationBar.prototype = {
             return;
 
         this.selectedNavigationItem = this._navigationItems[selectedNavigationItemIndex];
-    },
+    }
 
-    _focus: function(event)
+    _focus(event)
     {
         this._focused = true;
-    },
+    }
 
-    _blur: function(event)
+    _blur(event)
     {
         this._focused = false;
-    },
+    }
 
-    _updateStyle: function()
+    _updateStyle()
     {
         this._needsStyleUpdated = false;
 
-        var parentSelector = "." + (this.constructor.StyleClassName || WebInspector.NavigationBar.StyleClassName);
+        var parentSelector = "." + (this.constructor.StyleClassName || "navigation-bar");
 
         var styleText = "";
         for (var i = 0; i < this._navigationItems.length; ++i) {
@@ -429,9 +418,9 @@ WebInspector.NavigationBar.prototype = {
         }
 
         this._styleElement.textContent = styleText;
-    },
+    }
 
-    _calculateMinimumWidth: function()
+    _calculateMinimumWidth()
     {
         var wasCollapsed = this._element.classList.contains(WebInspector.NavigationBar.CollapsedStyleClassName);
 
@@ -455,4 +444,8 @@ WebInspector.NavigationBar.prototype = {
     }
 };
 
-WebInspector.NavigationBar.prototype.__proto__ = WebInspector.Object.prototype;
+WebInspector.NavigationBar.CollapsedStyleClassName = "collapsed";
+
+WebInspector.NavigationBar.Event = {
+    NavigationItemSelected: "navigation-bar-navigation-item-selected"
+};
index 3b5b1ba..97d45a6 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2013 University of Washington. All rights reserved.
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014, 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
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ProbeSetDataGridNode = function(dataGrid)
+WebInspector.ProbeSetDataGridNode = class ProbeSetDataGridNode extends WebInspector.DataGridNode
 {
-    console.assert(dataGrid instanceof WebInspector.ProbeSetDataGrid, "Invalid ProbeSetDataGrid argument:", dataGrid);
-
-    WebInspector.DataGridNode.call(this, this.data);
-    this.dataGrid = dataGrid; // This is set to null in DataGridNode's constructor.
-    this._data = {};
-
-    this._element = document.createElement("tr");
-    this._element.dataGridNode = this;
-    this._element.classList.add("revealed");
-};
+    constructor(dataGrid)
+    {
+        console.assert(dataGrid instanceof WebInspector.ProbeSetDataGrid, "Invalid ProbeSetDataGrid argument:", dataGrid);
 
-WebInspector.ProbeSetDataGridNode.SeparatorStyleClassName = "separator";
-WebInspector.ProbeSetDataGridNode.UnknownValueStyleClassName = "unknown-value";
+        super();
+        this.dataGrid = dataGrid; // This is set to null in DataGridNode's constructor.
+        this._data = {};
 
-WebInspector.ProbeSetDataGridNode.prototype = {
-    constructor: WebInspector.ProbeSetDataGridNode,
-    __proto__: WebInspector.DataGridNode.prototype,
+        this._element = document.createElement("tr");
+        this._element.dataGridNode = this;
+        this._element.classList.add("revealed");
+    }
 
     // Public
 
     get element()
     {
         return this._element;
-    },
+    }
 
     get data()
     {
         return this._data;
-    },
+    }
 
     set frame(value)
     {
@@ -70,18 +65,18 @@ WebInspector.ProbeSetDataGridNode.prototype = {
                 data[probe.id] = sample.object;
         }
         this._data = data;
-    },
+    }
 
     get frame()
     {
         return this._frame;
-    },
+    }
 
-    createCellContent: function(columnIdentifier, cell)
+    createCellContent(columnIdentifier, cell)
     {
         var sample = this.data[columnIdentifier];
         if (sample === WebInspector.ProbeSetDataFrame.MissingValue) {
-            cell.classList.add(WebInspector.ProbeSetDataGridNode.UnknownValueStyleClassName);
+            cell.classList.add("unknown-value");
             return sample;
         }
 
@@ -89,14 +84,14 @@ WebInspector.ProbeSetDataGridNode.prototype = {
             return WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(sample, null);
 
         return sample;
-    },
+    }
 
-    updateCellsFromFrame: function(frame, probeSet)
+    updateCellsFromFrame(frame, probeSet)
     {
-    },
+    }
 
-    updateCellsForSeparator: function(frame, probeSet)
+    updateCellsForSeparator(frame, probeSet)
     {
-        this._element.classList.add(WebInspector.ProbeSetDataGridNode.SeparatorStyleClassName);
+        this._element.classList.add("separator");
     }
 };
index 29108e7..73eac72 100644 (file)
@@ -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
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.QuickConsoleNavigationBar = function(element, navigationItems)
+WebInspector.QuickConsoleNavigationBar = class QuickConsoleNavigationBar extends WebInspector.NavigationBar
 {
-    WebInspector.NavigationBar.call(this, element, navigationItems);
-};
-
-WebInspector.QuickConsoleNavigationBar.prototype = {
-    constructor: WebInspector.QuickConsoleNavigationBar,
-
     get sizesToFit()
     {
         return true;
-    },
+    }
 
-    addNavigationItem: function(navigationItem)
+    addNavigationItem(navigationItem)
     {
         // Add new navigation items to the left.
         return this.insertNavigationItem(navigationItem, 0);
     }
 };
-
-WebInspector.QuickConsoleNavigationBar.prototype.__proto__ = WebInspector.NavigationBar.prototype;
index 20c983a..213e320 100644 (file)
@@ -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
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.Toolbar = function(element, navigationItems, dontAllowModeChanges) {
-    WebInspector.NavigationBar.call(this, element, navigationItems, "toolbar");
-
-    this.displayMode = WebInspector.Toolbar.DisplayMode.IconAndLabelVertical;
-    this.sizeMode = WebInspector.Toolbar.SizeMode.Normal;
-
-    this._controlSectionElement = document.createElement("div");
-    this._controlSectionElement.className = WebInspector.Toolbar.ControlSectionStyleClassName;
-    this._element.appendChild(this._controlSectionElement);
+WebInspector.Toolbar = class Toolbar extends WebInspector.NavigationBar
+{
+    constructor(element, navigationItems, dontAllowModeChanges)
+    {
+        super(element, navigationItems, "toolbar");
 
-    this._leftSectionElement = document.createElement("div");
-    this._leftSectionElement.className = WebInspector.Toolbar.ItemSectionStyleClassName + " " + WebInspector.Toolbar.LeftItemSectionStyleClassName;
-    this._element.appendChild(this._leftSectionElement);
+        this.displayMode = WebInspector.Toolbar.DisplayMode.IconAndLabelVertical;
+        this.sizeMode = WebInspector.Toolbar.SizeMode.Normal;
 
-    this._centerLeftSectionElement = document.createElement("div");
-    this._centerLeftSectionElement.className = WebInspector.Toolbar.ItemSectionStyleClassName + " " + WebInspector.Toolbar.CenterLeftItemSectionStyleClassName;
-    this._element.appendChild(this._centerLeftSectionElement);
+        this._controlSectionElement = document.createElement("div");
+        this._controlSectionElement.className = WebInspector.Toolbar.ControlSectionStyleClassName;
+        this._element.appendChild(this._controlSectionElement);
 
-    this._centerSectionElement = document.createElement("div");
-    this._centerSectionElement.className = WebInspector.Toolbar.ItemSectionStyleClassName + " " + WebInspector.Toolbar.CenterItemSectionStyleClassName;
-    this._element.appendChild(this._centerSectionElement);
+        this._leftSectionElement = document.createElement("div");
+        this._leftSectionElement.className = WebInspector.Toolbar.ItemSectionStyleClassName + " " + WebInspector.Toolbar.LeftItemSectionStyleClassName;
+        this._element.appendChild(this._leftSectionElement);
 
-    this._centerRightSectionElement = document.createElement("div");
-    this._centerRightSectionElement.className = WebInspector.Toolbar.ItemSectionStyleClassName + " " + WebInspector.Toolbar.CenterRightItemSectionStyleClassName;
-    this._element.appendChild(this._centerRightSectionElement);
+        this._centerLeftSectionElement = document.createElement("div");
+        this._centerLeftSectionElement.className = WebInspector.Toolbar.ItemSectionStyleClassName + " " + WebInspector.Toolbar.CenterLeftItemSectionStyleClassName;
+        this._element.appendChild(this._centerLeftSectionElement);
 
-    this._rightSectionElement = document.createElement("div");
-    this._rightSectionElement.className = WebInspector.Toolbar.ItemSectionStyleClassName + " " + WebInspector.Toolbar.RightItemSectionStyleClassName;
-    this._element.appendChild(this._rightSectionElement);
+        this._centerSectionElement = document.createElement("div");
+        this._centerSectionElement.className = WebInspector.Toolbar.ItemSectionStyleClassName + " " + WebInspector.Toolbar.CenterItemSectionStyleClassName;
+        this._element.appendChild(this._centerSectionElement);
 
-    if (!dontAllowModeChanges)
-        this._element.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), false);
-};
+        this._centerRightSectionElement = document.createElement("div");
+        this._centerRightSectionElement.className = WebInspector.Toolbar.ItemSectionStyleClassName + " " + WebInspector.Toolbar.CenterRightItemSectionStyleClassName;
+        this._element.appendChild(this._centerRightSectionElement);
 
-// FIXME: Move to a WebInspector.Object subclass and we can remove this.
-WebInspector.Object.deprecatedAddConstructorFunctions(WebInspector.Toolbar);
+        this._rightSectionElement = document.createElement("div");
+        this._rightSectionElement.className = WebInspector.Toolbar.ItemSectionStyleClassName + " " + WebInspector.Toolbar.RightItemSectionStyleClassName;
+        this._element.appendChild(this._rightSectionElement);
 
-WebInspector.Toolbar.StyleClassName = "toolbar";
-WebInspector.Toolbar.ControlSectionStyleClassName = "control-section";
-WebInspector.Toolbar.ItemSectionStyleClassName = "item-section";
-WebInspector.Toolbar.LeftItemSectionStyleClassName = "left";
-WebInspector.Toolbar.CenterLeftItemSectionStyleClassName = "center-left";
-WebInspector.Toolbar.CenterItemSectionStyleClassName = "center";
-WebInspector.Toolbar.CenterRightItemSectionStyleClassName = "center-right";
-WebInspector.Toolbar.RightItemSectionStyleClassName = "right";
-
-WebInspector.Toolbar.Event = {
-    DisplayModeDidChange: "toolbar-display-mode-did-change",
-    SizeModeDidChange: "toolbar-size-mode-did-change"
-};
-
-WebInspector.Toolbar.Section = {
-    Control: "control",
-    Left: "left",
-    CenterLeft: "center-left",
-    Center: "center",
-    CenterRight: "center-right",
-    Right: "right"
-};
-
-WebInspector.Toolbar.DisplayMode = {
-    IconAndLabelVertical: "icon-and-label-vertical",
-    IconAndLabelHorizontal: "icon-and-label-horizontal",
-    IconOnly: "icon-only",
-    LabelOnly: "label-only"
-};
-
-WebInspector.Toolbar.SizeMode = {
-    Normal: "normal-size",
-    Small: "small-size"
-};
-
-WebInspector.Toolbar.prototype = {
-    constructor: WebInspector.Toolbar,
+        if (!dontAllowModeChanges)
+            this._element.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), false);
+    }
 
     // Public
 
     get displayMode()
     {
         return this._displayMode;
-    },
+    }
 
     set displayMode(mode)
     {
@@ -124,12 +86,12 @@ WebInspector.Toolbar.prototype = {
         this.updateLayout();
 
         this.dispatchEventToListeners(WebInspector.Toolbar.Event.DisplayModeDidChange);
-    },
+    }
 
     get sizeMode()
     {
         return this._sizeMode;
-    },
+    }
 
     set sizeMode(mode)
     {
@@ -146,9 +108,9 @@ WebInspector.Toolbar.prototype = {
         this.updateLayout();
 
         this.dispatchEventToListeners(WebInspector.Toolbar.Event.SizeModeDidChange);
-    },
+    }
 
-    customUpdateLayout: function()
+    customUpdateLayout()
     {
         // Bail early if our sections are not created yet. This means we are being called during construction.
         if (!this._leftSectionElement || !this._centerSectionElement || !this._rightSectionElement)
@@ -193,9 +155,9 @@ WebInspector.Toolbar.prototype = {
             return;
 
         this._element.classList.add(WebInspector.NavigationBar.CollapsedStyleClassName);
-    },
+    }
 
-    addToolbarItem: function(toolbarItem, sectionIdentifier)
+    addToolbarItem(toolbarItem, sectionIdentifier)
     {
         var sectionElement;
 
@@ -229,11 +191,11 @@ WebInspector.Toolbar.prototype = {
         console.assert(sectionElement);
 
         this.addNavigationItem(toolbarItem, sectionElement);
-    },
+    }
 
     // Private
 
-    _handleContextMenuEvent: function(event)
+    _handleContextMenuEvent(event)
     {
         var contextMenu = new WebInspector.ContextMenu(event);
 
@@ -248,17 +210,50 @@ WebInspector.Toolbar.prototype = {
         }
 
         contextMenu.show();
-    },
+    }
 
-    _changeDisplayMode: function(displayMode)
+    _changeDisplayMode(displayMode)
     {
         this.displayMode = displayMode;
-    },
+    }
 
-    _toggleSmallIcons: function()
+    _toggleSmallIcons()
     {
         this.sizeMode = this._sizeMode === WebInspector.Toolbar.SizeMode.Normal ? WebInspector.Toolbar.SizeMode.Small : WebInspector.Toolbar.SizeMode.Normal;
     }
 };
 
-WebInspector.Toolbar.prototype.__proto__ = WebInspector.NavigationBar.prototype;
+WebInspector.Toolbar.StyleClassName = "toolbar";
+WebInspector.Toolbar.ControlSectionStyleClassName = "control-section";
+WebInspector.Toolbar.ItemSectionStyleClassName = "item-section";
+WebInspector.Toolbar.LeftItemSectionStyleClassName = "left";
+WebInspector.Toolbar.CenterLeftItemSectionStyleClassName = "center-left";
+WebInspector.Toolbar.CenterItemSectionStyleClassName = "center";
+WebInspector.Toolbar.CenterRightItemSectionStyleClassName = "center-right";
+WebInspector.Toolbar.RightItemSectionStyleClassName = "right";
+
+WebInspector.Toolbar.Event = {
+    DisplayModeDidChange: "toolbar-display-mode-did-change",
+    SizeModeDidChange: "toolbar-size-mode-did-change"
+};
+
+WebInspector.Toolbar.Section = {
+    Control: "control",
+    Left: "left",
+    CenterLeft: "center-left",
+    Center: "center",
+    CenterRight: "center-right",
+    Right: "right"
+};
+
+WebInspector.Toolbar.DisplayMode = {
+    IconAndLabelVertical: "icon-and-label-vertical",
+    IconAndLabelHorizontal: "icon-and-label-horizontal",
+    IconOnly: "icon-only",
+    LabelOnly: "label-only"
+};
+
+WebInspector.Toolbar.SizeMode = {
+    Normal: "normal-size",
+    Small: "small-size"
+};