Title: [182054] trunk/Source/WebInspectorUI
Revision
182054
Author
[email protected]
Date
2015-03-27 00:26:27 -0700 (Fri, 27 Mar 2015)

Log Message

Web Inspector: Convert TextEditor classes to ES6
https://bugs.webkit.org/show_bug.cgi?id=143127

Reviewed by Joseph Pecoraro.

* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
Removed a comment about const, we can't use it in strict mode / classes.

* UserInterface/Views/SourceCodeTextEditor.js:
* UserInterface/Views/TextEditor.js:
Converted to ES6 classes.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (182053 => 182054)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-03-27 06:48:10 UTC (rev 182053)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-03-27 07:26:27 UTC (rev 182054)
@@ -1,3 +1,17 @@
+2015-03-26  Timothy Hatcher  <[email protected]>
+
+        Web Inspector: Convert TextEditor classes to ES6
+        https://bugs.webkit.org/show_bug.cgi?id=143127
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
+        Removed a comment about const, we can't use it in strict mode / classes.
+
+        * UserInterface/Views/SourceCodeTextEditor.js:
+        * UserInterface/Views/TextEditor.js:
+        Converted to ES6 classes.
+
 2015-03-26  Nikita Vasilyev  <[email protected]>
 
         Web Inspector: clicking on console record while REPL is focused does not select a new record

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js (182053 => 182054)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2015-03-27 06:48:10 UTC (rev 182053)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2015-03-27 07:26:27 UTC (rev 182054)
@@ -296,7 +296,6 @@
         // Use a short delay for user input to coalesce more changes before committing. Other actions like
         // undo, redo and paste are atomic and work better with a zero delay. CodeMirror identifies changes that
         // get coalesced in the undo stack with a "+" prefix on the origin. Use that to set the delay for our coalescing.
-        // FIXME: use const or let
         var delay = change.origin && change.origin.charAt(0) === "+" ? WebInspector.CSSStyleDeclarationTextEditor.CommitCoalesceDelay : 0;
 
         // Reset the timeout so rapid changes coalesce after a short delay.
@@ -337,7 +336,6 @@
 
             if (!this._codeMirror.getOption("readOnly")) {
                 // Matches a comment like: /* -webkit-foo: bar; */
-                // FIXME: use const or let
                 var commentedPropertyRegex = /\/\*\s*[-\w]+\s*:\s*[^;]+;?\s*\*\//g;
 
                 // Look for comments that look like properties and add checkboxes in front of them.

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js (182053 => 182054)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js	2015-03-27 06:48:10 UTC (rev 182053)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js	2015-03-27 07:26:27 UTC (rev 182054)
@@ -23,94 +23,76 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.SourceCodeTextEditor = function(sourceCode)
+WebInspector.SourceCodeTextEditor = class SourceCodeTextEditor extends WebInspector.TextEditor
 {
-    console.assert(sourceCode instanceof WebInspector.SourceCode);
+    constructor(sourceCode)
+    {
+        console.assert(sourceCode instanceof WebInspector.SourceCode);
 
-    this._sourceCode = sourceCode;
-    this._breakpointMap = {};
-    this._issuesLineNumberMap = new Map;
-    this._widgetMap = new Map;
-    this._contentPopulated = false;
-    this._invalidLineNumbers = {0: true};
-    this._ignoreContentDidChange = 0;
+        super();
 
-    WebInspector.TextEditor.call(this, null, null, this);
+        this.delegate = this;
 
-    this._typeTokenScrollHandler = null;
-    this._typeTokenAnnotator = null;
-    this._basicBlockAnnotator = null;
-    
-    this._isProbablyMinified = false;
+        this._sourceCode = sourceCode;
+        this._breakpointMap = {};
+        this._issuesLineNumberMap = new Map;
+        this._widgetMap = new Map;
+        this._contentPopulated = false;
+        this._invalidLineNumbers = {0: true};
+        this._ignoreContentDidChange = 0;
 
-    // FIXME: Currently this just jumps between resources and related source map resources. It doesn't "jump to symbol" yet.
-    this._updateTokenTrackingControllerState();
+        this._typeTokenScrollHandler = null;
+        this._typeTokenAnnotator = null;
+        this._basicBlockAnnotator = null;
 
-    this.element.classList.add(WebInspector.SourceCodeTextEditor.StyleClassName);
+        this._isProbablyMinified = false;
 
-    if (this._supportsDebugging) {
-        WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.DisabledStateDidChange, this._breakpointStatusDidChange, this);
-        WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.AutoContinueDidChange, this._breakpointStatusDidChange, this);
-        WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ResolvedStateDidChange, this._breakpointStatusDidChange, this);
-        WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.LocationDidChange, this._updateBreakpointLocation, this);
+        // FIXME: Currently this just jumps between resources and related source map resources. It doesn't "jump to symbol" yet.
+        this._updateTokenTrackingControllerState();
 
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointsEnabledDidChange, this._breakpointsEnabledDidChange, this);
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointAdded, this._breakpointAdded, this);
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointRemoved, this._breakpointRemoved, this);
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, this._activeCallFrameDidChange, this);
+        this.element.classList.add("source-code");
 
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Paused, this._debuggerDidPause, this);
-        WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, this._debuggerDidResume, this);
-        if (WebInspector.debuggerManager.activeCallFrame)
-            this._debuggerDidPause();
+        if (this._supportsDebugging) {
+            WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.DisabledStateDidChange, this._breakpointStatusDidChange, this);
+            WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.AutoContinueDidChange, this._breakpointStatusDidChange, this);
+            WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ResolvedStateDidChange, this._breakpointStatusDidChange, this);
+            WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.LocationDidChange, this._updateBreakpointLocation, this);
 
-        this._activeCallFrameDidChange();
-    }
+            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointsEnabledDidChange, this._breakpointsEnabledDidChange, this);
+            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointAdded, this._breakpointAdded, this);
+            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointRemoved, this._breakpointRemoved, this);
+            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, this._activeCallFrameDidChange, this);
 
-    WebInspector.issueManager.addEventListener(WebInspector.IssueManager.Event.IssueWasAdded, this._issueWasAdded, this);
+            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Paused, this._debuggerDidPause, this);
+            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, this._debuggerDidResume, this);
+            if (WebInspector.debuggerManager.activeCallFrame)
+                this._debuggerDidPause();
 
-    if (this._sourceCode instanceof WebInspector.SourceMapResource || this._sourceCode.sourceMaps.length > 0)
-        WebInspector.notifications.addEventListener(WebInspector.Notification.GlobalModifierKeysDidChange, this._updateTokenTrackingControllerState, this);
-    else
-        this._sourceCode.addEventListener(WebInspector.SourceCode.Event.SourceMapAdded, this._sourceCodeSourceMapAdded, this);
+            this._activeCallFrameDidChange();
+        }
 
-    sourceCode.requestContent().then(this._contentAvailable.bind(this));
+        WebInspector.issueManager.addEventListener(WebInspector.IssueManager.Event.IssueWasAdded, this._issueWasAdded, this);
 
-    // FIXME: Cmd+L shorcut doesn't actually work.
-    new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Command, "L", this.showGoToLineDialog.bind(this), this.element);
-    new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Control, "G", this.showGoToLineDialog.bind(this), this.element);
-};
+        if (this._sourceCode instanceof WebInspector.SourceMapResource || this._sourceCode.sourceMaps.length > 0)
+            WebInspector.notifications.addEventListener(WebInspector.Notification.GlobalModifierKeysDidChange, this._updateTokenTrackingControllerState, this);
+        else
+            this._sourceCode.addEventListener(WebInspector.SourceCode.Event.SourceMapAdded, this._sourceCodeSourceMapAdded, this);
 
-// FIXME: Move to a WebInspector.Object subclass and we can remove this.
-WebInspector.Object.deprecatedAddConstructorFunctions(WebInspector.SourceCodeTextEditor);
+        sourceCode.requestContent().then(this._contentAvailable.bind(this));
 
-WebInspector.SourceCodeTextEditor.StyleClassName = "source-code";
-WebInspector.SourceCodeTextEditor.LineErrorStyleClassName = "error";
-WebInspector.SourceCodeTextEditor.LineWarningStyleClassName = "warning";
-WebInspector.SourceCodeTextEditor.PopoverDebuggerContentStyleClassName = "debugger-popover-content";
-WebInspector.SourceCodeTextEditor.HoveredExpressionHighlightStyleClassName = "hovered-_expression_-highlight";
-WebInspector.SourceCodeTextEditor.DurationToMouseOverTokenToMakeHoveredToken = 500;
-WebInspector.SourceCodeTextEditor.DurationToMouseOutOfHoveredTokenToRelease = 1000;
-WebInspector.SourceCodeTextEditor.DurationToUpdateTypeTokensAfterScrolling = 100;
-WebInspector.SourceCodeTextEditor.AutoFormatMinimumLineLength = 500;
-WebInspector.SourceCodeTextEditor.WidgetContainsMultipleIssuesSymbol = Symbol("source-code-widget-contains-multiple-issues");
+        // FIXME: Cmd+L shorcut doesn't actually work.
+        new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Command, "L", this.showGoToLineDialog.bind(this), this.element);
+        new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Control, "G", this.showGoToLineDialog.bind(this), this.element);
+    }
 
-WebInspector.SourceCodeTextEditor.Event = {
-    ContentWillPopulate: "source-code-text-editor-content-will-populate",
-    ContentDidPopulate: "source-code-text-editor-content-did-populate"
-};
-
-WebInspector.SourceCodeTextEditor.prototype = {
-    constructor: WebInspector.SourceCodeTextEditor,
-
     // Public
 
     get sourceCode()
     {
         return this._sourceCode;
-    },
+    }
 
-    shown: function()
+    shown()
     {
         WebInspector.TextEditor.prototype.shown.call(this);
 
@@ -125,9 +107,9 @@
             if (this._typeTokenAnnotator || this._basicBlockAnnotator)
                 this._setTypeTokenAnnotatorEnabledState(false);
         }
-    },
+    }
 
-    hidden: function()
+    hidden()
     {
         WebInspector.TextEditor.prototype.hidden.call(this);
 
@@ -141,9 +123,9 @@
             this._typeTokenAnnotator.pause();
         if (this._basicBlockAnnotator)
             this._basicBlockAnnotator.pause();
-    },
+    }
 
-    close: function()
+    close()
     {
         if (this._supportsDebugging) {
             WebInspector.Breakpoint.removeEventListener(WebInspector.Breakpoint.Event.DisabledStateDidChange, this._breakpointStatusDidChange, this);
@@ -166,9 +148,9 @@
 
         WebInspector.notifications.removeEventListener(WebInspector.Notification.GlobalModifierKeysDidChange, this._updateTokenTrackingControllerState, this);
         this._sourceCode.removeEventListener(WebInspector.SourceCode.Event.SourceMapAdded, this._sourceCodeSourceMapAdded, this);
-    },
+    }
 
-    canBeFormatted: function()
+    canBeFormatted()
     {
         // Currently we assume that source map resources are formatted how the author wants it.
         // We could allow source map resources to be formatted, we would then need to make
@@ -178,14 +160,14 @@
             return false;
 
         return WebInspector.TextEditor.prototype.canBeFormatted.call(this);
-    },
+    }
 
-    canShowTypeAnnotations: function()
+    canShowTypeAnnotations()
     {
         return !!this._typeTokenAnnotator;
-    },
+    }
 
-    customPerformSearch: function(query)
+    customPerformSearch(query)
     {
         function searchResultCallback(error, matches)
         {
@@ -233,9 +215,9 @@
         else if (this._sourceCode instanceof WebInspector.Script)
             DebuggerAgent.searchInContent(this._sourceCode.id, query, false, false, searchResultCallback.bind(this));
         return true;
-    },
+    }
 
-    showGoToLineDialog: function()
+    showGoToLineDialog()
     {
         if (!this._goToLineDialog) {
             this._goToLineDialog = new WebInspector.GoToLineDialog;
@@ -243,28 +225,28 @@
         }
 
         this._goToLineDialog.present(this.element);
-    },
+    }
 
-    isGoToLineDialogValueValid: function(goToLineDialog, lineNumber)
+    isGoToLineDialogValueValid(goToLineDialog, lineNumber)
     {
         return !isNaN(lineNumber) && lineNumber > 0 && lineNumber <= this.lineCount;
-    },
+    }
 
-    goToLineDialogValueWasValidated: function(goToLineDialog, lineNumber)
+    goToLineDialogValueWasValidated(goToLineDialog, lineNumber)
     {
         var position = new WebInspector.SourceCodePosition(lineNumber - 1, 0);
         var range = new WebInspector.TextRange(lineNumber - 1, 0, lineNumber, 0);
         this.revealPosition(position, range, false, true);
-    },
+    }
 
-    goToLineDialogWasDismissed: function()
+    goToLineDialogWasDismissed()
     {
         this.focus();
-    },
+    }
 
-    contentDidChange: function(replacedRanges, newRanges)
+    contentDidChange(replacedRanges, newRanges)
     {
-        WebInspector.TextEditor.prototype.contentDidChange.call(this, replacedRanges, newRanges);
+        super.contentDidChange(replacedRanges, newRanges);
 
         if (this._ignoreContentDidChange > 0)
             return;
@@ -277,9 +259,9 @@
             this._typeTokenAnnotator = null;
             this._basicBlockAnnotator = null;
         }
-    },
+    }
 
-    toggleTypeAnnotations: function()
+    toggleTypeAnnotations()
     {
         if (!this._typeTokenAnnotator)
             return false;
@@ -290,9 +272,9 @@
 
         this._setTypeTokenAnnotatorEnabledState(newActivatedState);
         return newActivatedState;
-    },
+    }
 
-    showPopoverForTypes: function(types, bounds, title)
+    showPopoverForTypes(types, bounds, title)
     {
         var content = document.createElement("div");
         content.className = "object expandable";
@@ -308,11 +290,11 @@
         content.appendChild(section.element);
 
         this._showPopover(content, bounds);
-    },
+    }
 
     // Protected
 
-    prettyPrint: function(pretty)
+    prettyPrint(pretty)
     {
         // The annotators must be cleared before pretty printing takes place and resumed 
         // after so that they clear their annotations in a known state and insert new annotations 
@@ -322,7 +304,7 @@
         if (shouldResumeTypeTokenAnnotator || shouldResumeBasicBlockAnnotator)
             this._setTypeTokenAnnotatorEnabledState(false);
 
-        WebInspector.TextEditor.prototype.prettyPrint.call(this, pretty);
+        super.prettyPrint(pretty);
 
         if (pretty || !this._isProbablyMinified) {
             if (shouldResumeTypeTokenAnnotator || shouldResumeBasicBlockAnnotator)
@@ -332,47 +314,47 @@
             if (this._typeTokenAnnotator || this._basicBlockAnnotator)
                 this._setTypeTokenAnnotatorEnabledState(false);
         }
-    },
+    }
 
     // Private
 
-    _unformattedLineInfoForEditorLineInfo: function(lineInfo)
+    _unformattedLineInfoForEditorLineInfo(lineInfo)
     {
         if (this.formatterSourceMap)
             return this.formatterSourceMap.formattedToOriginal(lineInfo.lineNumber, lineInfo.columnNumber);
         return lineInfo;
-    },
+    }
 
-    _sourceCodeLocationForEditorPosition: function(position)
+    _sourceCodeLocationForEditorPosition(position)
     {
         var lineInfo = {lineNumber: position.line, columnNumber: position.ch};
         var unformattedLineInfo = this._unformattedLineInfoForEditorLineInfo(lineInfo);
         return this.sourceCode.createSourceCodeLocation(unformattedLineInfo.lineNumber, unformattedLineInfo.columnNumber);
-    },
+    }
 
-    _editorLineInfoForSourceCodeLocation: function(sourceCodeLocation)
+    _editorLineInfoForSourceCodeLocation(sourceCodeLocation)
     {
         if (this._sourceCode instanceof WebInspector.SourceMapResource)
             return {lineNumber: sourceCodeLocation.displayLineNumber, columnNumber: sourceCodeLocation.displayColumnNumber};
         return {lineNumber: sourceCodeLocation.formattedLineNumber, columnNumber: sourceCodeLocation.formattedColumnNumber};
-    },
+    }
 
-    _breakpointForEditorLineInfo: function(lineInfo)
+    _breakpointForEditorLineInfo(lineInfo)
     {
         if (!this._breakpointMap[lineInfo.lineNumber])
             return null;
         return this._breakpointMap[lineInfo.lineNumber][lineInfo.columnNumber];
-    },
+    }
 
-    _addBreakpointWithEditorLineInfo: function(breakpoint, lineInfo)
+    _addBreakpointWithEditorLineInfo(breakpoint, lineInfo)
     {
         if (!this._breakpointMap[lineInfo.lineNumber])
             this._breakpointMap[lineInfo.lineNumber] = {};
 
         this._breakpointMap[lineInfo.lineNumber][lineInfo.columnNumber] = breakpoint;
-    },
+    }
 
-    _removeBreakpointWithEditorLineInfo: function(breakpoint, lineInfo)
+    _removeBreakpointWithEditorLineInfo(breakpoint, lineInfo)
     {
         console.assert(breakpoint === this._breakpointMap[lineInfo.lineNumber][lineInfo.columnNumber]);
 
@@ -380,9 +362,9 @@
 
         if (isEmptyObject(this._breakpointMap[lineInfo.lineNumber]))
             delete this._breakpointMap[lineInfo.lineNumber];
-    },
+    }
 
-    _contentWillPopulate: function(content)
+    _contentWillPopulate(content)
     {
         this.dispatchEventToListeners(WebInspector.SourceCodeTextEditor.Event.ContentWillPopulate);
 
@@ -431,9 +413,9 @@
                 lastNewlineIndex = nextNewlineIndex + 1;
             }
         }
-    },
+    }
 
-    _contentDidPopulate: function()
+    _contentDidPopulate()
     {
         this._contentPopulated = true;
 
@@ -446,9 +428,9 @@
         this._reinsertAllIssues();
 
         this._updateEditableMarkers();
-    },
+    }
 
-    _populateWithContent: function(content)
+    _populateWithContent(content)
     {
         content = content || "";
 
@@ -464,9 +446,9 @@
         }
 
         this._contentDidPopulate();
-    },
+    }
 
-    _contentAvailable: function(parameters)
+    _contentAvailable(parameters)
     {
         // Return if resource is not available.
         if (parameters.error)
@@ -487,23 +469,23 @@
         this._invalidLineNumbers = {};
 
         this._populateWithContent(content);
-    },
+    }
 
-    _breakpointStatusDidChange: function(event)
+    _breakpointStatusDidChange(event)
     {
         this._updateBreakpointStatus(event.target);
-    },
+    }
 
-    _breakpointsEnabledDidChange: function()
+    _breakpointsEnabledDidChange()
     {
         console.assert(this._supportsDebugging);
 
         var breakpoints = WebInspector.debuggerManager.breakpointsForSourceCode(this._sourceCode);
         for (var breakpoint of breakpoints)
             this._updateBreakpointStatus(breakpoint);
-    },
+    }
 
-    _updateBreakpointStatus: function(breakpoint)
+    _updateBreakpointStatus(breakpoint)
     {
         console.assert(this._supportsDebugging);
 
@@ -515,9 +497,9 @@
 
         var lineInfo = this._editorLineInfoForSourceCodeLocation(breakpoint.sourceCodeLocation);
         this.setBreakpointInfoForLineAndColumn(lineInfo.lineNumber, lineInfo.columnNumber, this._breakpointInfoForBreakpoint(breakpoint));
-    },
+    }
 
-    _updateBreakpointLocation: function(event)
+    _updateBreakpointLocation(event)
     {
         console.assert(this._supportsDebugging);
 
@@ -561,9 +543,9 @@
 
         this._removeBreakpointWithEditorLineInfo(breakpoint, oldLineInfo);
         this._addBreakpointWithEditorLineInfo(breakpoint, newLineInfo);
-    },
+    }
 
-    _breakpointAdded: function(event)
+    _breakpointAdded(event)
     {
         console.assert(this._supportsDebugging);
 
@@ -580,9 +562,9 @@
         var lineInfo = this._editorLineInfoForSourceCodeLocation(breakpoint.sourceCodeLocation);
         this._addBreakpointWithEditorLineInfo(breakpoint, lineInfo);
         this.setBreakpointInfoForLineAndColumn(lineInfo.lineNumber, lineInfo.columnNumber, this._breakpointInfoForBreakpoint(breakpoint));
-    },
+    }
 
-    _breakpointRemoved: function(event)
+    _breakpointRemoved(event)
     {
         console.assert(this._supportsDebugging);
 
@@ -599,9 +581,9 @@
         var lineInfo = this._editorLineInfoForSourceCodeLocation(breakpoint.sourceCodeLocation);
         this._removeBreakpointWithEditorLineInfo(breakpoint, lineInfo);
         this.setBreakpointInfoForLineAndColumn(lineInfo.lineNumber, lineInfo.columnNumber, null);
-    },
+    }
 
-    _activeCallFrameDidChange: function()
+    _activeCallFrameDidChange()
     {
         console.assert(this._supportsDebugging);
 
@@ -642,9 +624,9 @@
             this._populateWithInlineScriptContent();
         else
             this._populateWithScriptContent();
-    },
+    }
 
-    _activeCallFrameSourceCodeLocationChanged: function(event)
+    _activeCallFrameSourceCodeLocationChanged(event)
     {
         console.assert(!isNaN(this.executionLineNumber));
         if (isNaN(this.executionLineNumber))
@@ -656,9 +638,9 @@
         var lineInfo = this._editorLineInfoForSourceCodeLocation(this._activeCallFrameSourceCodeLocation);
         this.executionLineNumber = lineInfo.lineNumber;
         this.executionColumnNumber = lineInfo.columnNumber;
-    },
+    }
 
-    _populateWithInlineScriptContent: function()
+    _populateWithInlineScriptContent()
     {
         console.assert(this._sourceCode instanceof WebInspector.Resource);
         console.assert(!this._fullContentPopulated);
@@ -689,8 +671,8 @@
             if (this._fullContentPopulated)
                 return;
 
-            const scriptOpenTag = "<script>";
-            const scriptCloseTag = "</script>";
+            var scriptOpenTag = "<script>";
+            var scriptCloseTag = "</script>";
 
             var content = "";
             var lineNumber = 0;
@@ -728,9 +710,9 @@
         var boundScriptContentAvailable = scriptContentAvailable.bind(this);
         for (var i = 0; i < scripts.length; ++i)
             scripts[i].requestContent().then(boundScriptContentAvailable);
-    },
+    }
 
-    _populateWithScriptContent: function()
+    _populateWithScriptContent()
     {
         console.assert(this._sourceCode instanceof WebInspector.Resource);
         console.assert(!this._fullContentPopulated);
@@ -763,9 +745,9 @@
         this._requestingScriptContent = true;
 
         scripts[0].requestContent().then(scriptContentAvailable.bind(this));
-    },
+    }
 
-    _matchesSourceCodeLocation: function(sourceCodeLocation)
+    _matchesSourceCodeLocation(sourceCodeLocation)
     {
         if (this._sourceCode instanceof WebInspector.SourceMapResource)
             return sourceCodeLocation.displaySourceCode === this._sourceCode;
@@ -774,9 +756,9 @@
         if (this._sourceCode instanceof WebInspector.Script)
             return sourceCodeLocation.sourceCode === this._sourceCode;
         return false;
-    },
+    }
 
-    _matchesBreakpoint: function(breakpoint)
+    _matchesBreakpoint(breakpoint)
     {
         console.assert(this._supportsDebugging);
         if (this._sourceCode instanceof WebInspector.SourceMapResource)
@@ -786,9 +768,9 @@
         if (this._sourceCode instanceof WebInspector.Script)
             return breakpoint.url ="" this._sourceCode.url || breakpoint.scriptIdentifier === this._sourceCode.id;
         return false;
-    },
+    }
 
-    _matchesIssue: function(issue)
+    _matchesIssue(issue)
     {
         if (this._sourceCode instanceof WebInspector.Resource)
             return issue.url ="" this._sourceCode.url;
@@ -796,18 +778,18 @@
         if (this._sourceCode instanceof WebInspector.Script)
             return issue.url ="" this._sourceCode.url;
         return false;
-    },
+    }
 
-    _issueWasAdded: function(event)
+    _issueWasAdded(event)
     {
         var issue = event.data.issue;
         if (!this._matchesIssue(issue))
             return;
 
         this._addIssue(issue);
-    },
+    }
 
-    _addIssue: function(issue)
+    _addIssue(issue)
     {
         // FIXME: Issue should have a SourceCodeLocation.
         var sourceCodeLocation = this._sourceCode.createSourceCodeLocation(issue.lineNumber, issue.columnNumber);
@@ -843,9 +825,9 @@
 
             this._updateIssueWidgetForIssues(widget, lineNumberIssues);
         }
-    },
+    }
 
-    _issueWidgetForLine: function(lineNumber)
+    _issueWidgetForLine(lineNumber)
     {
         var widget = this._widgetMap.get(lineNumber);
         if (widget)
@@ -863,18 +845,18 @@
         this._widgetMap.set(lineNumber, widget);
 
         return widget;
-    },
+    }
 
-    _iconClassNameForIssueLevel: function(level)
+    _iconClassNameForIssueLevel(level)
     {
         if (level === WebInspector.IssueMessage.Level.Warning)
             return "icon-warning";
 
         console.assert(level === WebInspector.IssueMessage.Level.Error);
         return "icon-error";
-    },
+    }
 
-    _updateIssueWidgetForIssues: function(widget, issues)
+    _updateIssueWidgetForIssues(widget, issues)
     {
         var widgetElement = widget.widgetElement;
         widgetElement.removeChildren();
@@ -930,9 +912,9 @@
         }
 
         widget.update();
-    },
+    }
 
-    _isWidgetToggleable: function(widget)
+    _isWidgetToggleable(widget)
     {
         if (widget[WebInspector.SourceCodeTextEditor.WidgetContainsMultipleIssuesSymbol])
             return true;
@@ -945,9 +927,9 @@
             return true;
         
         return false;
-    },
+    }
 
-    _handleWidgetClick: function(widget, lineNumber, event)
+    _handleWidgetClick(widget, lineNumber, event)
     {
         if (!this._isWidgetToggleable(widget))
             return;
@@ -956,12 +938,12 @@
 
         var lineNumberIssues = this._issuesLineNumberMap.get(lineNumber);
         this._updateIssueWidgetForIssues(widget, lineNumberIssues);
-    },
+    }
 
-    _breakpointInfoForBreakpoint: function(breakpoint)
+    _breakpointInfoForBreakpoint(breakpoint)
     {
         return {resolved: breakpoint.resolved, disabled: breakpoint.disabled, autoContinue: breakpoint.autoContinue};
-    },
+    }
 
     get _supportsDebugging()
     {
@@ -970,27 +952,46 @@
         if (this._sourceCode instanceof WebInspector.Script)
             return true;
         return false;
-    },
+    }
 
     // TextEditor Delegate
 
-    textEditorBaseURL: function(textEditor)
+    textEditorBaseURL(textEditor)
     {
         return this._sourceCode.url;
-    },
+    }
 
-    textEditorShouldHideLineNumber: function(textEditor, lineNumber)
+    textEditorShouldHideLineNumber(textEditor, lineNumber)
     {
         return lineNumber in this._invalidLineNumbers;
-    },
+    }
 
-    textEditorGutterContextMenu: function(textEditor, lineNumber, columnNumber, editorBreakpoints, event)
+    textEditorGutterContextMenu(textEditor, lineNumber, columnNumber, editorBreakpoints, event)
     {
         if (!this._supportsDebugging)
             return;
 
         event.preventDefault();
 
+        function continueToLocation()
+        {
+            WebInspector.debuggerManager.continueToLocation(script.id, sourceCodeLocation.lineNumber, sourceCodeLocation.columnNumber);
+        }
+
+        function addBreakpoint()
+        {
+            var data = "" lineNumber, columnNumber);
+            this.setBreakpointInfoForLineAndColumn(data.lineNumber, data.columnNumber, data.breakpointInfo);
+        }
+
+        function revealInSidebar()
+        {
+            WebInspector.debuggerSidebarPanel.show();
+            var treeElement = WebInspector.debuggerSidebarPanel.treeElementForRepresentedObject(breakpoint);
+            if (treeElement)
+                treeElement.revealAndSelect();
+        }
+
         var contextMenu = new WebInspector.ContextMenu(event);
 
         // Paused. Add Continue to Here option only if we have a script identifier for the location.
@@ -1005,10 +1006,6 @@
                 var script = sourceCodeLocation.sourceCode.scriptForLocation(sourceCodeLocation);
 
             if (script) {
-                function continueToLocation()
-                {
-                    WebInspector.debuggerManager.continueToLocation(script.id, sourceCodeLocation.lineNumber, sourceCodeLocation.columnNumber);
-                }
 
                 contextMenu.appendItem(WebInspector.UIString("Continue to Here"), continueToLocation);
                 contextMenu.appendSeparator();
@@ -1026,11 +1023,6 @@
 
         // No breakpoints.
         if (!breakpoints.length) {
-            function addBreakpoint()
-            {
-                var data = "" lineNumber, columnNumber);
-                this.setBreakpointInfoForLineAndColumn(data.lineNumber, data.columnNumber, data.breakpointInfo);
-            }
 
             contextMenu.appendItem(WebInspector.UIString("Add Breakpoint"), addBreakpoint.bind(this));
             contextMenu.show();
@@ -1040,13 +1032,6 @@
         // Single breakpoint.
         if (breakpoints.length === 1) {
             var breakpoint = breakpoints[0];
-            function revealInSidebar()
-            {
-                WebInspector.debuggerSidebarPanel.show();
-                var treeElement = WebInspector.debuggerSidebarPanel.treeElementForRepresentedObject(breakpoint);
-                if (treeElement)
-                    treeElement.revealAndSelect();
-            }
 
             breakpoint.appendContextMenuItems(contextMenu, event.target);
             contextMenu.appendSeparator();
@@ -1085,9 +1070,9 @@
             contextMenu.appendItem(WebInspector.UIString("Enable Breakpoints"), toggleBreakpoints.bind(this));
         contextMenu.appendItem(WebInspector.UIString("Delete Breakpoints"), removeBreakpoints.bind(this));
         contextMenu.show();
-    },
+    }
 
-    textEditorBreakpointAdded: function(textEditor, lineNumber, columnNumber)
+    textEditorBreakpointAdded(textEditor, lineNumber, columnNumber)
     {
         if (!this._supportsDebugging)
             return null;
@@ -1113,9 +1098,9 @@
             lineNumber: lineInfo.lineNumber,
             columnNumber: lineInfo.columnNumber
         };
-    },
+    }
 
-    textEditorBreakpointRemoved: function(textEditor, lineNumber, columnNumber)
+    textEditorBreakpointRemoved(textEditor, lineNumber, columnNumber)
     {
         console.assert(this._supportsDebugging);
         if (!this._supportsDebugging)
@@ -1132,9 +1117,9 @@
         this._ignoreBreakpointRemovedBreakpoint = breakpoint;
         WebInspector.debuggerManager.removeBreakpoint(breakpoint);
         delete this._ignoreBreakpointAddedBreakpoint;
-    },
+    }
 
-    textEditorBreakpointMoved: function(textEditor, oldLineNumber, oldColumnNumber, newLineNumber, newColumnNumber)
+    textEditorBreakpointMoved(textEditor, oldLineNumber, oldColumnNumber, newLineNumber, newColumnNumber)
     {
         console.assert(this._supportsDebugging);
         if (!this._supportsDebugging)
@@ -1159,9 +1144,9 @@
 
         if (accurateNewLineInfo.lineNumber !== newLineInfo.lineNumber || accurateNewLineInfo.columnNumber !== newLineInfo.columnNumber)
             this.updateBreakpointLineAndColumn(newLineInfo.lineNumber, newLineInfo.columnNumber, accurateNewLineInfo.lineNumber, accurateNewLineInfo.columnNumber);
-    },
+    }
 
-    textEditorBreakpointClicked: function(textEditor, lineNumber, columnNumber)
+    textEditorBreakpointClicked(textEditor, lineNumber, columnNumber)
     {
         console.assert(this._supportsDebugging);
         if (!this._supportsDebugging)
@@ -1173,9 +1158,9 @@
             return;
 
         breakpoint.cycleToNextMode();
-    },
+    }
 
-    textEditorUpdatedFormatting: function(textEditor)
+    textEditorUpdatedFormatting(textEditor)
     {
         this._ignoreAllBreakpointLocationUpdates = true;
         this._sourceCode.formatterSourceMap = this.formatterSourceMap;
@@ -1211,17 +1196,17 @@
         }
 
         this._reinsertAllIssues();
-    },
+    }
 
-    _clearWidgets: function()
+    _clearWidgets()
     {
         for (var widget of this._widgetMap.values())
             widget.clear();
 
         this._widgetMap.clear();
-    },
+    }
 
-    _reinsertAllIssues: function()
+    _reinsertAllIssues()
     {
         this._issuesLineNumberMap.clear();
         this._clearWidgets();
@@ -1231,18 +1216,18 @@
             console.assert(this._matchesIssue(issue));
             this._addIssue(issue);
         }
-    },
+    }
 
-    _debuggerDidPause: function(event)
+    _debuggerDidPause(event)
     {
         this._updateTokenTrackingControllerState();
         if (this._typeTokenAnnotator && this._typeTokenAnnotator.isActive())
             this._typeTokenAnnotator.refresh();
         if (this._basicBlockAnnotator && this._basicBlockAnnotator.isActive())
             this._basicBlockAnnotator.refresh();
-    },
+    }
 
-    _debuggerDidResume: function(event)
+    _debuggerDidResume(event)
     {
         this._updateTokenTrackingControllerState();
         this._dismissPopover();
@@ -1250,17 +1235,17 @@
             this._typeTokenAnnotator.refresh();
         if (this._basicBlockAnnotator && this._basicBlockAnnotator.isActive())
             this._basicBlockAnnotator.refresh();
-    },
+    }
 
-    _sourceCodeSourceMapAdded: function(event)
+    _sourceCodeSourceMapAdded(event)
     {
         WebInspector.notifications.addEventListener(WebInspector.Notification.GlobalModifierKeysDidChange, this._updateTokenTrackingControllerState, this);
         this._sourceCode.removeEventListener(WebInspector.SourceCode.Event.SourceMapAdded, this._sourceCodeSourceMapAdded, this);
 
         this._updateTokenTrackingControllerState();
-    },
+    }
 
-    _updateTokenTrackingControllerState: function()
+    _updateTokenTrackingControllerState()
     {
         var mode = WebInspector.CodeMirrorTokenTrackingController.Mode.None;
         if (WebInspector.debuggerManager.paused)
@@ -1297,20 +1282,20 @@
         }
 
         this.tokenTrackingController.mode = mode;
-    },
+    }
 
-    _hasColorMarkers: function()
+    _hasColorMarkers()
     {
         for (var marker of this.markers) {
             if (marker.type === WebInspector.TextMarker.Type.Color)
                 return true;
         }
         return false;
-    },
+    }
 
     // CodeMirrorTokenTrackingController Delegate
 
-    tokenTrackingControllerCanReleaseHighlightedRange: function(tokenTrackingController, element)
+    tokenTrackingControllerCanReleaseHighlightedRange(tokenTrackingController, element)
     {
         if (!this._popover)
             return true;
@@ -1319,15 +1304,15 @@
             return false;
 
         return true;
-    },
+    }
 
-    tokenTrackingControllerHighlightedRangeReleased: function(tokenTrackingController)
+    tokenTrackingControllerHighlightedRangeReleased(tokenTrackingController)
     {
         if (!this._mouseIsOverPopover)
             this._dismissPopover();
-    },
+    }
 
-    tokenTrackingControllerHighlightedRangeWasClicked: function(tokenTrackingController)
+    tokenTrackingControllerHighlightedRangeWasClicked(tokenTrackingController)
     {
         if (this.tokenTrackingController.mode !== WebInspector.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens)
             return;
@@ -1341,9 +1326,9 @@
             WebInspector.resourceSidebarPanel.showOriginalOrFormattedSourceCodeLocation(sourceCodeLocation);
         else
             WebInspector.resourceSidebarPanel.showSourceCodeLocation(sourceCodeLocation);
-    },
+    }
 
-    tokenTrackingControllerNewHighlightCandidate: function(tokenTrackingController, candidate)
+    tokenTrackingControllerNewHighlightCandidate(tokenTrackingController, candidate)
     {
         if (this.tokenTrackingController.mode === WebInspector.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens) {
             this.tokenTrackingController.highlightRange(candidate.hoveredTokenRange);
@@ -1367,14 +1352,14 @@
             else
                 this._dismissEditingController();
         }
-    },
+    }
 
-    tokenTrackingControllerMouseOutOfHoveredMarker: function(tokenTrackingController, hoveredMarker)
+    tokenTrackingControllerMouseOutOfHoveredMarker(tokenTrackingController, hoveredMarker)
     {
         this._dismissEditingController();
-    },
+    }
 
-    _tokenTrackingControllerHighlightedJavaScriptExpression: function(candidate)
+    _tokenTrackingControllerHighlightedJavaScriptExpression(candidate)
     {
         console.assert(candidate._expression_);
 
@@ -1414,9 +1399,9 @@
 
         // No call frame available. Use the main page's context.
         RuntimeAgent.evaluate.invoke({_expression_: candidate._expression_, objectGroup: "popover", doNotPauseOnExceptionsAndMuteConsole: true}, populate.bind(this));
-    },
+    }
 
-    _tokenTrackingControllerHighlightedJavaScriptTypeInformation: function(candidate)
+    _tokenTrackingControllerHighlightedJavaScriptTypeInformation(candidate)
     {
         console.assert(candidate._expression_);
 
@@ -1449,9 +1434,9 @@
         }
 
         RuntimeAgent.getRuntimeTypesForVariablesAtOffsets(allRequests, handler.bind(this));
-    },
+    }
 
-    _showPopover: function(content, bounds)
+    _showPopover(content, bounds)
     {
         console.assert(this.tokenTrackingController.candidate || bounds);
 
@@ -1477,9 +1462,9 @@
             this.tokenTrackingController.highlightRange(candidate.expressionRange);
 
         this._trackPopoverEvents();
-    },
+    }
 
-    _showPopoverForFunction: function(data)
+    _showPopoverForFunction(data)
     {
         var candidate = this.tokenTrackingController.candidate;
 
@@ -1512,9 +1497,9 @@
             this._showPopover(content);
         }
         DebuggerAgent.getFunctionDetails(data.objectId, didGetDetails.bind(this));
-    },
+    }
 
-    _showPopoverForObject: function(data)
+    _showPopoverForObject(data)
     {
         var content = document.createElement("div");
         content.className = "object expandable";
@@ -1534,22 +1519,22 @@
         bodyElement.appendChild(objectTree.element);
 
         this._showPopover(content);
-    },
+    }
 
-    _showPopoverWithFormattedValue: function(remoteObject)
+    _showPopoverWithFormattedValue(remoteObject)
     {
         var content = WebInspector.FormattedValue.createElementForRemoteObject(remoteObject);
         this._showPopover(content);
-    },
+    }
 
-    willDismissPopover: function(popover)
+    willDismissPopover(popover)
     {
         this.tokenTrackingController.removeHighlightedRange();
 
         RuntimeAgent.releaseObjectGroup("popover");
-    },
+    }
 
-    _dismissPopover: function()
+    _dismissPopover()
     {
         if (!this._popover)
             return;
@@ -1560,9 +1545,9 @@
             this._popoverEventListenersAreRegistered = false;
             this._popoverEventListeners.unregister();
         }
-    },
+    }
 
-    _trackPopoverEvents: function()
+    _trackPopoverEvents()
     {
         if (!this._popoverEventListeners) 
             this._popoverEventListeners = new WebInspector.EventListenerSet(this, "Popover listeners");
@@ -1572,27 +1557,27 @@
             this._popoverEventListeners.register(this._popover.element, "mouseout", this._popoverMouseout);
             this._popoverEventListeners.install();
         }
-    },
+    }
 
-    _popoverMouseover: function(event)
+    _popoverMouseover(event)
     {
         this._mouseIsOverPopover = true;
-    },
+    }
 
-    _popoverMouseout: function(event)
+    _popoverMouseout(event)
     {
         this._mouseIsOverPopover = this._popover.element.contains(event.relatedTarget);
-    },
+    }
 
-    _updateEditableMarkers: function(range)
+    _updateEditableMarkers(range)
     {
         this.createColorMarkers(range);
         this.createGradientMarkers(range);
 
         this._updateTokenTrackingControllerState();
-    },
+    }
 
-    _tokenTrackingControllerHighlightedMarkedExpression: function(candidate, markers)
+    _tokenTrackingControllerHighlightedMarkedExpression(candidate, markers)
     {
         // Look for the outermost editable marker.
         var editableMarker;
@@ -1629,20 +1614,20 @@
 
         this._editingController.delegate = this;
         this._editingController.presentHoverMenu();
-    },
+    }
 
-    _dismissEditingController: function(discrete)
+    _dismissEditingController(discrete)
     {
         if (this._editingController)
             this._editingController.dismissHoverMenu(discrete);
         
         this.tokenTrackingController.hoveredMarker = null;
         delete this._editingController;
-    },
+    }
 
     // CodeMirrorEditingController Delegate
     
-    editingControllerDidStartEditing: function(editingController)
+    editingControllerDidStartEditing(editingController)
     {
         // We can pause the token tracking controller during editing, it will be reset
         // to the expected state by calling _updateEditableMarkers() in the
@@ -1654,18 +1639,18 @@
         
         // We ignore content changes made as a result of color editing.
         this._ignoreContentDidChange++;
-    },
+    }
     
-    editingControllerDidFinishEditing: function(editingController)
+    editingControllerDidFinishEditing(editingController)
     {
         this._updateEditableMarkers(editingController.range);
 
         this._ignoreContentDidChange--;
 
         delete this._editingController;
-    },
+    }
 
-    _setTypeTokenAnnotatorEnabledState: function(shouldActivate)
+    _setTypeTokenAnnotatorEnabledState(shouldActivate)
     {
         console.assert(this._typeTokenAnnotator);
         if (!this._typeTokenAnnotator)
@@ -1700,9 +1685,9 @@
         WebInspector.showJavaScriptTypeInformationSetting.value = shouldActivate;
 
         this._updateTokenTrackingControllerState();
-    },
+    }
 
-    _getAssociatedScript: function()
+    _getAssociatedScript()
     {
         var script = null;
         // FIXME: This needs to me modified to work with HTML files with inline script tags.
@@ -1711,9 +1696,9 @@
         else if (this._sourceCode instanceof WebInspector.Resource && this._sourceCode.type === WebInspector.Resource.Type.Script && this._sourceCode.scripts.length)
             script = this._sourceCode.scripts[0];
         return script;
-    },
+    }
 
-    _makeTypeTokenAnnotator: function()
+    _makeTypeTokenAnnotator()
     {
         if (!RuntimeAgent.getRuntimeTypesForVariablesAtOffsets)
             return;
@@ -1723,9 +1708,9 @@
             return;
 
         this._typeTokenAnnotator = new WebInspector.TypeTokenAnnotator(this, script);
-    },
+    }
 
-    _makeBasicBlockAnnotator: function()
+    _makeBasicBlockAnnotator()
     {
         if (!RuntimeAgent.getBasicBlocks)
             return;
@@ -1735,24 +1720,24 @@
             return;
 
         this._basicBlockAnnotator = new WebInspector.BasicBlockAnnotator(this, script);
-    },
+    }
 
-    _enableScrollEventsForTypeTokenAnnotator: function()
+    _enableScrollEventsForTypeTokenAnnotator()
     {
         // Pause updating type tokens while scrolling to prevent frame loss.
         console.assert(!this._typeTokenScrollHandler);
         this._typeTokenScrollHandler = this._makeTypeTokenScrollEventHandler();
         this.addScrollHandler(this._typeTokenScrollHandler);
-    },
+    }
 
-    _disableScrollEventsForTypeTokenAnnotator: function()
+    _disableScrollEventsForTypeTokenAnnotator()
     {
         console.assert(this._typeTokenScrollHandler);
         this.removeScrollHandler(this._typeTokenScrollHandler);
         this._typeTokenScrollHandler = null;
-    },
+    }
 
-    _makeTypeTokenScrollEventHandler: function()
+    _makeTypeTokenScrollEventHandler()
     {
         var timeoutIdentifier = null;
         function scrollHandler()
@@ -1779,4 +1764,17 @@
     }
 };
 
-WebInspector.SourceCodeTextEditor.prototype.__proto__ = WebInspector.TextEditor.prototype;
+WebInspector.SourceCodeTextEditor.LineErrorStyleClassName = "error";
+WebInspector.SourceCodeTextEditor.LineWarningStyleClassName = "warning";
+WebInspector.SourceCodeTextEditor.PopoverDebuggerContentStyleClassName = "debugger-popover-content";
+WebInspector.SourceCodeTextEditor.HoveredExpressionHighlightStyleClassName = "hovered-_expression_-highlight";
+WebInspector.SourceCodeTextEditor.DurationToMouseOverTokenToMakeHoveredToken = 500;
+WebInspector.SourceCodeTextEditor.DurationToMouseOutOfHoveredTokenToRelease = 1000;
+WebInspector.SourceCodeTextEditor.DurationToUpdateTypeTokensAfterScrolling = 100;
+WebInspector.SourceCodeTextEditor.AutoFormatMinimumLineLength = 500;
+WebInspector.SourceCodeTextEditor.WidgetContainsMultipleIssuesSymbol = Symbol("source-code-widget-contains-multiple-issues");
+
+WebInspector.SourceCodeTextEditor.Event = {
+    ContentWillPopulate: "source-code-text-editor-content-will-populate",
+    ContentDidPopulate: "source-code-text-editor-content-did-populate"
+};

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js (182053 => 182054)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2015-03-27 06:48:10 UTC (rev 182053)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js	2015-03-27 07:26:27 UTC (rev 182054)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -23,90 +23,65 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.TextEditor = function(element, mimeType, delegate)
+WebInspector.TextEditor = class TextEditor extends WebInspector.Object
 {
-    // FIXME: Convert this to a WebInspector.Object subclass, and call super().
-    // WebInspector.Object.call(this);
+    constructor(element, mimeType, delegate)
+    {
+        super();
 
-    var text = (element ? element.textContent : "");
-    this._element = element || document.createElement("div");
-    this._element.classList.add(WebInspector.TextEditor.StyleClassName);
-    this._element.classList.add(WebInspector.SyntaxHighlightedStyleClassName);
+        var text = (element ? element.textContent : "");
+        this._element = element || document.createElement("div");
+        this._element.classList.add("text-editor");
+        this._element.classList.add(WebInspector.SyntaxHighlightedStyleClassName);
 
-    this._codeMirror = CodeMirror(this.element, {
-        readOnly: true,
-        indentWithTabs: true,
-        indentUnit: 4,
-        lineNumbers: true,
-        lineWrapping: true,
-        matchBrackets: true,
-        autoCloseBrackets: true
-    });
+        this._codeMirror = CodeMirror(this.element, {
+            readOnly: true,
+            indentWithTabs: true,
+            indentUnit: 4,
+            lineNumbers: true,
+            lineWrapping: true,
+            matchBrackets: true,
+            autoCloseBrackets: true
+        });
 
-    this._codeMirror.on("change", this._contentChanged.bind(this));
-    this._codeMirror.on("gutterClick", this._gutterMouseDown.bind(this));
-    this._codeMirror.on("gutterContextMenu", this._gutterContextMenu.bind(this));
-    this._codeMirror.getScrollerElement().addEventListener("click", this._openClickedLinks.bind(this), true);
+        this._codeMirror.on("change", this._contentChanged.bind(this));
+        this._codeMirror.on("gutterClick", this._gutterMouseDown.bind(this));
+        this._codeMirror.on("gutterContextMenu", this._gutterContextMenu.bind(this));
+        this._codeMirror.getScrollerElement().addEventListener("click", this._openClickedLinks.bind(this), true);
 
-    this._completionController = new WebInspector.CodeMirrorCompletionController(this._codeMirror, this);
-    this._tokenTrackingController = new WebInspector.CodeMirrorTokenTrackingController(this._codeMirror, this);
+        this._completionController = new WebInspector.CodeMirrorCompletionController(this._codeMirror, this);
+        this._tokenTrackingController = new WebInspector.CodeMirrorTokenTrackingController(this._codeMirror, this);
 
-    this._initialStringNotSet = true;
+        this._initialStringNotSet = true;
 
-    this.mimeType = mimeType;
+        this.mimeType = mimeType;
 
-    this._breakpoints = {};
-    this._executionLineNumber = NaN;
-    this._executionColumnNumber = NaN;
+        this._breakpoints = {};
+        this._executionLineNumber = NaN;
+        this._executionColumnNumber = NaN;
 
-    this._searchQuery = null;
-    this._searchResults = [];
-    this._currentSearchResultIndex = -1;
-    this._ignoreCodeMirrorContentDidChangeEvent = 0;
+        this._searchQuery = null;
+        this._searchResults = [];
+        this._currentSearchResultIndex = -1;
+        this._ignoreCodeMirrorContentDidChangeEvent = 0;
 
-    this._formatted = false;
-    this._formatterSourceMap = null;
+        this._formatted = false;
+        this._formatterSourceMap = null;
 
-    this._delegate = delegate || null;
-};
+        this._delegate = delegate || null;
+    }
 
-// FIXME: Move to a WebInspector.Object subclass and we can remove this.
-WebInspector.Object.deprecatedAddConstructorFunctions(WebInspector.TextEditor);
-
-WebInspector.TextEditor.StyleClassName = "text-editor";
-WebInspector.TextEditor.HighlightedStyleClassName = "highlighted";
-WebInspector.TextEditor.SearchResultStyleClassName = "search-result";
-WebInspector.TextEditor.HasBreakpointStyleClassName = "has-breakpoint";
-WebInspector.TextEditor.BreakpointResolvedStyleClassName = "breakpoint-resolved";
-WebInspector.TextEditor.BreakpointAutoContinueStyleClassName = "breakpoint-auto-continue";
-WebInspector.TextEditor.BreakpointDisabledStyleClassName = "breakpoint-disabled";
-WebInspector.TextEditor.MultipleBreakpointsStyleClassName = "multiple-breakpoints";
-WebInspector.TextEditor.ExecutionLineStyleClassName = "execution-line";
-WebInspector.TextEditor.BouncyHighlightStyleClassName = "bouncy-highlight";
-WebInspector.TextEditor.NumberOfFindsPerSearchBatch = 10;
-WebInspector.TextEditor.HighlightAnimationDuration = 2000;
-
-WebInspector.TextEditor.Event = {
-    ExecutionLineNumberDidChange: "text-editor-execution-line-number-did-change",
-    NumberOfSearchResultsDidChange: "text-editor-number-of-search-results-did-change",
-    ContentDidChange: "text-editor-content-did-change",
-    FormattingDidChange: "text-editor-formatting-did-change"
-};
-
-WebInspector.TextEditor.prototype = {
-    constructor: WebInspector.TextEditor,
-
     // Public
 
     get element()
     {
         return this._element;
-    },
+    }
 
     get string()
     {
         return this._codeMirror.getValue();
-    },
+    }
 
     set string(newString)
     {
@@ -146,22 +121,22 @@
         this._codeMirror.operation(update.bind(this));
         this._ignoreCodeMirrorContentDidChangeEvent--;
         console.assert(this._ignoreCodeMirrorContentDidChangeEvent >= 0);
-    },
+    }
 
     get readOnly()
     {
         return this._codeMirror.getOption("readOnly") || false;
-    },
+    }
 
     set readOnly(readOnly)
     {
         this._codeMirror.setOption("readOnly", readOnly);
-    },
+    }
 
     get formatted()
     {
         return this._formatted;
-    },
+    }
 
     set formatted(formatted)
     {
@@ -180,52 +155,52 @@
         this._formatted = formatted;
 
         this.dispatchEventToListeners(WebInspector.TextEditor.Event.FormattingDidChange);
-    },
+    }
 
     set autoFormat(auto)
     {
         this._autoFormat = auto;
-    },
+    }
 
-    hasFormatter: function()
+    hasFormatter()
     {
-        const supportedModes = {
+        var supportedModes = {
             "_javascript_": true,
             "css": true,
         };
 
         var mode = this._codeMirror.getMode();
         return mode.name in supportedModes;
-    },
+    }
 
-    canBeFormatted: function()
+    canBeFormatted()
     {
         // Can be overriden by subclasses.
         return this.hasFormatter();
-    },
+    }
 
-    canShowTypeAnnotations: function()
+    canShowTypeAnnotations()
     {
         return false;
-    },
+    }
 
     get selectedTextRange()
     {
         var start = this._codeMirror.getCursor(true);
         var end = this._codeMirror.getCursor(false);
         return this._textRangeFromCodeMirrorPosition(start, end);
-    },
+    }
 
     set selectedTextRange(textRange)
     {
         var position = this._codeMirrorPositionFromTextRange(textRange);
         this._codeMirror.setSelection(position.start, position.end);
-    },
+    }
 
     get mimeType()
     {
         return this._mimeType;
-    },
+    }
 
     set mimeType(newMIMEType)
     {
@@ -233,12 +208,12 @@
 
         this._mimeType = newMIMEType;
         this._codeMirror.setOption("mode", newMIMEType);
-    },
+    }
 
     get executionLineNumber()
     {
         return this._executionLineNumber;
-    },
+    }
 
     set executionLineNumber(lineNumber)
     {
@@ -252,47 +227,47 @@
         // Still dispatch the event even if the number didn't change. The execution state still
         // could have changed (e.g. continuing in a loop with a breakpoint inside).
         this.dispatchEventToListeners(WebInspector.TextEditor.Event.ExecutionLineNumberDidChange);
-    },
+    }
 
     get executionColumnNumber()
     {
         return this._executionColumnNumber;
-    },
+    }
 
     set executionColumnNumber(columnNumber)
     {
         this._executionColumnNumber = columnNumber;
-    },
+    }
 
     get formatterSourceMap()
     {
         return this._formatterSourceMap;
-    },
+    }
 
     get tokenTrackingController()
     {
         return this._tokenTrackingController;
-    },
+    }
 
     get delegate()
     {
         return this._delegate;
-    },
+    }
 
     set delegate(newDelegate)
     {
         this._delegate = newDelegate || null;
-    },
+    }
 
     get numberOfSearchResults()
     {
         return this._searchResults.length;
-    },
+    }
 
     get currentSearchQuery()
     {
         return this._searchQuery;
-    },
+    }
 
     set automaticallyRevealFirstSearchResult(reveal)
     {
@@ -303,9 +278,9 @@
             if (this._currentSearchResultIndex === -1)
                 this._revealFirstSearchResultAfterCursor();
         }
-    },
+    }
 
-    performSearch: function(query)
+    performSearch(query)
     {
         if (this._searchQuery === query)
             return;
@@ -367,9 +342,9 @@
 
         // Start the search.
         boundBatchSearch();
-    },
+    }
 
-    addSearchResults: function(textRanges)
+    addSearchResults(textRanges)
     {
         console.assert(textRanges);
         if (!textRanges || !textRanges.length)
@@ -391,9 +366,9 @@
         }
 
         this._codeMirror.operation(markRanges.bind(this));
-    },
+    }
 
-    searchCleared: function()
+    searchCleared()
     {
         function clearResults() {
             for (var i = 0; i < this._searchResults.length; ++i)
@@ -405,17 +380,17 @@
         this._searchQuery = null;
         this._searchResults = [];
         this._currentSearchResultIndex = -1;
-    },
+    }
 
-    searchQueryWithSelection: function()
+    searchQueryWithSelection()
     {
         if (!this._codeMirror.somethingSelected())
             return null;
 
         return this._codeMirror.getSelection();
-    },
+    }
 
-    revealPreviousSearchResult: function(changeFocus)
+    revealPreviousSearchResult(changeFocus)
     {
         if (!this._searchResults.length)
             return;
@@ -431,9 +406,9 @@
             this._currentSearchResultIndex = this._searchResults.length - 1;
 
         this._revealSearchResult(this._searchResults[this._currentSearchResultIndex], changeFocus, -1);
-    },
+    }
 
-    revealNextSearchResult: function(changeFocus)
+    revealNextSearchResult(changeFocus)
     {
         if (!this._searchResults.length)
             return;
@@ -449,25 +424,25 @@
             this._currentSearchResultIndex = 0;
 
         this._revealSearchResult(this._searchResults[this._currentSearchResultIndex], changeFocus, 1);
-    },
+    }
 
-    line: function(lineNumber)
+    line(lineNumber)
     {
         return this._codeMirror.getLine(lineNumber);
-    },
+    }
 
-    getTextInRange: function(startPosition, endPosition)
+    getTextInRange(startPosition, endPosition)
     {
         return this._codeMirror.getRange(startPosition, endPosition);
-    },
+    }
 
-    addStyleToTextRange: function(startPosition, endPosition, styleClassName)
+    addStyleToTextRange(startPosition, endPosition, styleClassName)
     {
         endPosition.ch += 1;
         return this._codeMirror.getDoc().markText(startPosition, endPosition, {className: styleClassName, inclusiveLeft: true, inclusiveRight: true});
-    },
+    }
 
-    revealPosition: function(position, textRangeToSelect, forceUnformatted, noHighlight)
+    revealPosition(position, textRangeToSelect, forceUnformatted, noHighlight)
     {
         console.assert(position === undefined || position instanceof WebInspector.SourceCodePosition, "revealPosition called without a SourceCodePosition");
         if (!(position instanceof WebInspector.SourceCodePosition))
@@ -524,14 +499,14 @@
         }
 
         this._codeMirror.operation(revealAndHighlightLine.bind(this));
-    },
+    }
 
-    updateLayout: function(force)
+    updateLayout(force)
     {
         this._codeMirror.refresh();
-    },
+    }
 
-    shown: function()
+    shown()
     {
         this._visible = true;
 
@@ -542,14 +517,14 @@
         // This needs to be done as a separate operation from the refresh
         // so that the scrollInfo coordinates are correct.
         this._revealPendingPositionIfPossible();
-    },
+    }
 
-    hidden: function()
+    hidden()
     {
         this._visible = false;
-    },
+    }
 
-    setBreakpointInfoForLineAndColumn: function(lineNumber, columnNumber, breakpointInfo)
+    setBreakpointInfoForLineAndColumn(lineNumber, columnNumber, breakpointInfo)
     {
         if (this._ignoreSetBreakpointInfoCalls)
             return;
@@ -558,9 +533,9 @@
             this._addBreakpointToLineAndColumnWithInfo(lineNumber, columnNumber, breakpointInfo);
         else
             this._removeBreakpointFromLineAndColumn(lineNumber, columnNumber);
-    },
+    }
 
-    updateBreakpointLineAndColumn: function(oldLineNumber, oldColumnNumber, newLineNumber, newColumnNumber)
+    updateBreakpointLineAndColumn(oldLineNumber, oldColumnNumber, newLineNumber, newColumnNumber)
     {
         console.assert(this._breakpoints[oldLineNumber]);
         if (!this._breakpoints[oldLineNumber])
@@ -573,18 +548,18 @@
         var breakpointInfo = this._breakpoints[oldLineNumber][oldColumnNumber];
         this._removeBreakpointFromLineAndColumn(oldLineNumber, oldColumnNumber);
         this._addBreakpointToLineAndColumnWithInfo(newLineNumber, newColumnNumber, breakpointInfo);
-    },
+    }
 
-    addStyleClassToLine: function(lineNumber, styleClassName)
+    addStyleClassToLine(lineNumber, styleClassName)
     {
         var lineHandle = this._codeMirror.getLineHandle(lineNumber);
         if (!lineHandle)
             return null;
 
         return this._codeMirror.addLineClass(lineHandle, "wrap", styleClassName);
-    },
+    }
 
-    removeStyleClassFromLine: function(lineNumber, styleClassName)
+    removeStyleClassFromLine(lineNumber, styleClassName)
     {
         var lineHandle = this._codeMirror.getLineHandle(lineNumber);
         console.assert(lineHandle);
@@ -592,9 +567,9 @@
             return null;
 
         return this._codeMirror.removeLineClass(lineHandle, "wrap", styleClassName);
-    },
+    }
 
-    toggleStyleClassForLine: function(lineNumber, styleClassName)
+    toggleStyleClassForLine(lineNumber, styleClassName)
     {
         var lineHandle = this._codeMirror.getLineHandle(lineNumber);
         console.assert(lineHandle);
@@ -602,9 +577,9 @@
             return false;
 
         return this._codeMirror.toggleLineClass(lineHandle, "wrap", styleClassName);
-    },
+    }
 
-    createWidgetForLine: function(lineNumber)
+    createWidgetForLine(lineNumber)
     {
         var lineHandle = this._codeMirror.getLineHandle(lineNumber);
         if (!lineHandle)
@@ -613,53 +588,53 @@
         var widgetElement = document.createElement("div");
         var lineWidget = this._codeMirror.addLineWidget(lineHandle, widgetElement, {coverGutter: false, noHScroll: true, handleMouseEvents: true});
         return new WebInspector.LineWidget(lineWidget, widgetElement);
-    },
+    }
 
     get lineCount()
     {
         return this._codeMirror.lineCount();
-    },
+    }
 
-    focus: function()
+    focus()
     {
         this._codeMirror.focus();
-    },
+    }
 
-    contentDidChange: function(replacedRanges, newRanges)
+    contentDidChange(replacedRanges, newRanges)
     {
         // Implemented by subclasses.
-    },
+    }
 
-    rectsForRange: function(range)
+    rectsForRange(range)
     {
         return this._codeMirror.rectsForRange(range);
-    },
+    }
 
     get markers()
     {
         return this._codeMirror.getAllMarks().map(function(codeMirrorTextMarker) {
             return WebInspector.TextMarker.textMarkerForCodeMirrorTextMarker(codeMirrorTextMarker);
         });
-    },
+    }
 
-    markersAtPosition: function(position)
+    markersAtPosition(position)
     {
         return this._codeMirror.findMarksAt(position).map(function(codeMirrorTextMarker) {
             return WebInspector.TextMarker.textMarkerForCodeMirrorTextMarker(codeMirrorTextMarker);
         });
-    },
+    }
 
-    createColorMarkers: function(range)
+    createColorMarkers(range)
     {
         return this._codeMirror.createColorMarkers(range);
-    },
+    }
 
-    createGradientMarkers: function(range)
+    createGradientMarkers(range)
     {
         return this._codeMirror.createGradientMarkers(range);
-    },
+    }
 
-    editingControllerForMarker: function(editableMarker)
+    editingControllerForMarker(editableMarker)
     {
         switch (editableMarker.type) {
         case WebInspector.TextMarker.Type.Color:
@@ -669,9 +644,9 @@
         default:
             return new WebInspector.CodeMirrorEditingController(this._codeMirror, editableMarker);
         }
-    },
+    }
 
-    visibleRangeOffsets: function()
+    visibleRangeOffsets()
     {
         var startOffset = null;
         var endOffset = null;
@@ -686,9 +661,9 @@
         }
 
         return {startOffset, endOffset};
-    },
+    }
 
-    originalOffsetToCurrentPosition: function(offset)
+    originalOffsetToCurrentPosition(offset)
     {
         var position = null;
         if (this._formatterSourceMap) {
@@ -698,14 +673,14 @@
             position = this._codeMirror.getDoc().posFromIndex(offset);
 
         return position;
-    },
+    }
 
-    currentOffsetToCurrentPosition: function(offset)
+    currentOffsetToCurrentPosition(offset)
     {
         return this._codeMirror.getDoc().posFromIndex(offset);
-    },
+    }
 
-    currentPositionToOriginalOffset: function(position)
+    currentPositionToOriginalOffset(position)
     {
         var offset = null;
         if (this._formatterSourceMap)
@@ -714,36 +689,36 @@
             offset = this.tokenTrackingController._codeMirror.getDoc().indexFromPos(position);
 
         return offset;
-    },
+    }
 
-    currentPositionToCurrentOffset: function(position)
+    currentPositionToCurrentOffset(position)
     {
         return this._codeMirror.getDoc().indexFromPos(position);
-    },
+    }
 
-    setInlineWidget: function(position, inlineElement)
+    setInlineWidget(position, inlineElement)
     {
         return this._codeMirror.setUniqueBookmark(position, {widget: inlineElement});
-    },
+    }
 
-    addScrollHandler: function(handler)
+    addScrollHandler(handler)
     {
         this._codeMirror.on("scroll", handler);
-    },
+    }
 
-    removeScrollHandler: function(handler)
+    removeScrollHandler(handler)
     {
         this._codeMirror.off("scroll", handler);
-    },
+    }
 
     // Protected
 
-    prettyPrint: function(pretty)
+    prettyPrint(pretty)
     {
         function prettyPrintAndUpdateEditor()
         {
-            const start = {line: 0, ch: 0};
-            const end = {line: this._codeMirror.lineCount() - 1};
+            var start = {line: 0, ch: 0};
+            var end = {line: this._codeMirror.lineCount() - 1};
 
             var oldSelectionAnchor = this._codeMirror.getCursor("anchor");
             var oldSelectionHead = this._codeMirror.getCursor("head");
@@ -752,7 +727,7 @@
 
             if (pretty) {
                 // <rdar://problem/10593948> Provide a way to change the tab width in the Web Inspector
-                const indentString = "    ";
+                var indentString = "    ";
                 var originalLineEndings = [];
                 var formattedLineEndings = [];
                 var mapping = {original: [0], formatted: [0]};
@@ -836,16 +811,16 @@
         }
 
         this._codeMirror.operation(prettyPrintAndUpdateEditor.bind(this));
-    },
+    }
 
     // Private
 
-    hasEdits: function()
+    hasEdits()
     {
         return !this._codeMirror.isClean();
-    },
+    }
 
-    _contentChanged: function(codeMirror, change)
+    _contentChanged(codeMirror, change)
     {
         if (this._ignoreCodeMirrorContentDidChangeEvent > 0)
             return;
@@ -880,26 +855,26 @@
         }
 
         this.dispatchEventToListeners(WebInspector.TextEditor.Event.ContentDidChange);
-    },
+    }
 
-    _textRangeFromCodeMirrorPosition: function(start, end)
+    _textRangeFromCodeMirrorPosition(start, end)
     {
         console.assert(start);
         console.assert(end);
 
         return new WebInspector.TextRange(start.line, start.ch, end.line, end.ch);
-    },
+    }
 
-    _codeMirrorPositionFromTextRange: function(textRange)
+    _codeMirrorPositionFromTextRange(textRange)
     {
         console.assert(textRange);
 
         var start = {line: textRange.startLine, ch: textRange.startColumn};
         var end = {line: textRange.endLine, ch: textRange.endColumn};
         return {start, end};
-    },
+    }
 
-    _revealPendingPositionIfPossible: function()
+    _revealPendingPositionIfPossible()
     {
         // Nothing to do if we don't have a pending position.
         if (!this._positionToReveal)
@@ -910,9 +885,9 @@
             return;
 
         this.revealPosition(this._positionToReveal, this._textRangeToSelect, this._forceUnformatted);
-    },
+    }
 
-    _revealSearchResult: function(result, changeFocus, directionInCaseOfRevalidation)
+    _revealSearchResult(result, changeFocus, directionInCaseOfRevalidation)
     {
         var position = result.find();
 
@@ -972,9 +947,9 @@
 
         // Listen for the end of the animation so we can remove the element.
         this._bouncyHighlightElement.addEventListener("webkitAnimationEnd", animationEnded.bind(this));
-    },
+    }
 
-    _binarySearchInsertionIndexInSearchResults: function(object, comparator)
+    _binarySearchInsertionIndexInSearchResults(object, comparator)
     {
         // It is possible that markers in the search results array may have been deleted.
         // In those cases the comparator will return "null" and we immediately stop
@@ -998,9 +973,9 @@
         }
 
         return first - 1;
-    },
+    }
 
-    _revealFirstSearchResultBeforeCursor: function(changeFocus)
+    _revealFirstSearchResultBeforeCursor(changeFocus)
     {
         console.assert(this._searchResults.length);
 
@@ -1025,9 +1000,9 @@
 
         this._currentSearchResultIndex = index;
         this._revealSearchResult(this._searchResults[this._currentSearchResultIndex], changeFocus);
-    },
+    }
 
-    _revealFirstSearchResultAfterCursor: function(changeFocus)
+    _revealFirstSearchResultAfterCursor(changeFocus)
     {
         console.assert(this._searchResults.length);
 
@@ -1057,9 +1032,9 @@
 
         this._currentSearchResultIndex = index;
         this._revealSearchResult(this._searchResults[this._currentSearchResultIndex], changeFocus);
-    },
+    }
 
-    _cursorDoesNotMatchLastRevealedSearchResult: function()
+    _cursorDoesNotMatchLastRevealedSearchResult()
     {
         console.assert(this._currentSearchResultIndex !== -1);
         console.assert(this._searchResults.length);
@@ -1072,9 +1047,9 @@
         var lastRevealedSearchResultPosition = lastRevealedSearchResultMarker.from;
 
         return WebInspector.compareCodeMirrorPositions(currentCursorPosition, lastRevealedSearchResultPosition) !== 0;
-    },
+    }
 
-    _revalidateSearchResults: function(direction)
+    _revalidateSearchResults(direction)
     {
         console.assert(direction !== undefined);
 
@@ -1097,9 +1072,9 @@
             else
                 this._revealFirstSearchResultBeforeCursor();
         }
-    },
+    }
 
-    _updateExecutionLine: function()
+    _updateExecutionLine()
     {
         function update()
         {
@@ -1113,9 +1088,9 @@
         }
 
         this._codeMirror.operation(update.bind(this));
-    },
+    }
 
-    _setBreakpointStylesOnLine: function(lineNumber)
+    _setBreakpointStylesOnLine(lineNumber)
     {
         var columnBreakpoints = this._breakpoints[lineNumber];
         console.assert(columnBreakpoints);
@@ -1170,18 +1145,18 @@
         }
 
         this._codeMirror.operation(updateStyles.bind(this));
-    },
+    }
 
-    _addBreakpointToLineAndColumnWithInfo: function(lineNumber, columnNumber, breakpointInfo)
+    _addBreakpointToLineAndColumnWithInfo(lineNumber, columnNumber, breakpointInfo)
     {
         if (!this._breakpoints[lineNumber])
             this._breakpoints[lineNumber] = {};
         this._breakpoints[lineNumber][columnNumber] = breakpointInfo;
 
         this._setBreakpointStylesOnLine(lineNumber);
-    },
+    }
 
-    _removeBreakpointFromLineAndColumn: function(lineNumber, columnNumber)
+    _removeBreakpointFromLineAndColumn(lineNumber, columnNumber)
     {
         console.assert(columnNumber in this._breakpoints[lineNumber]);
         delete this._breakpoints[lineNumber][columnNumber];
@@ -1208,21 +1183,21 @@
         }
 
         this._codeMirror.operation(updateStyles.bind(this));
-    },
+    }
 
-    _allColumnBreakpointInfoForLine: function(lineNumber)
+    _allColumnBreakpointInfoForLine(lineNumber)
     {
         return this._breakpoints[lineNumber];
-    },
+    }
 
-    _setColumnBreakpointInfoForLine: function(lineNumber, columnBreakpointInfo)
+    _setColumnBreakpointInfoForLine(lineNumber, columnBreakpointInfo)
     {
         console.assert(columnBreakpointInfo);
         this._breakpoints[lineNumber] = columnBreakpointInfo;
         this._setBreakpointStylesOnLine(lineNumber);
-    },
+    }
 
-    _gutterMouseDown: function(codeMirror, lineNumber, gutterElement, event)
+    _gutterMouseDown(codeMirror, lineNumber, gutterElement, event)
     {
         if (event.button !== 0 || event.ctrlKey)
             return;
@@ -1265,9 +1240,9 @@
         // Register these listeners on the document so we can track the mouse if it leaves the gutter.
         document.addEventListener("mousemove", this._documentMouseMovedEventListener, true);
         document.addEventListener("mouseup", this._documentMouseUpEventListener, true);
-    },
+    }
 
-    _gutterContextMenu: function(codeMirror, lineNumber, gutterElement, event)
+    _gutterContextMenu(codeMirror, lineNumber, gutterElement, event)
     {
         if (this._delegate && typeof this._delegate.textEditorGutterContextMenu === "function") {
             var breakpoints = [];
@@ -1276,9 +1251,9 @@
 
             this._delegate.textEditorGutterContextMenu(this, lineNumber, 0, breakpoints, event);
         }
-    },
+    }
 
-    _documentMouseMoved: function(event)
+    _documentMouseMoved(event)
     {
         console.assert("_lineNumberWithMousedDownBreakpoint" in this);
         if (!("_lineNumberWithMousedDownBreakpoint" in this))
@@ -1332,9 +1307,9 @@
             this._lineNumberWithDraggedBreakpoint = lineNumber;
             this._columnNumberWithDraggedBreakpoint = columnNumber;
         }
-    },
+    }
 
-    _documentMouseUp: function(event)
+    _documentMouseUp(event)
     {
         console.assert("_lineNumberWithMousedDownBreakpoint" in this);
         if (!("_lineNumberWithMousedDownBreakpoint" in this))
@@ -1345,9 +1320,9 @@
         document.removeEventListener("mousemove", this._documentMouseMovedEventListener, true);
         document.removeEventListener("mouseup", this._documentMouseUpEventListener, true);
 
-        const delegateImplementsBreakpointClicked = this._delegate && typeof this._delegate.textEditorBreakpointClicked === "function";
-        const delegateImplementsBreakpointRemoved = this._delegate && typeof this._delegate.textEditorBreakpointRemoved === "function";
-        const delegateImplementsBreakpointMoved = this._delegate && typeof this._delegate.textEditorBreakpointMoved === "function";
+        var delegateImplementsBreakpointClicked = this._delegate && typeof this._delegate.textEditorBreakpointClicked === "function";
+        var delegateImplementsBreakpointRemoved = this._delegate && typeof this._delegate.textEditorBreakpointRemoved === "function";
+        var delegateImplementsBreakpointMoved = this._delegate && typeof this._delegate.textEditorBreakpointMoved === "function";
 
         if (this._mouseDragged) {
             if (!("_lineNumberWithDraggedBreakpoint" in this)) {
@@ -1393,9 +1368,9 @@
         delete this._columnNumberWithDraggedBreakpoint;
         delete this._previousColumnBreakpointInfo;
         delete this._mouseDragged;
-    },
+    }
 
-    _openClickedLinks: function(event)
+    _openClickedLinks(event)
     {
         // Get the position in the text and the token at that position.
         var position = this._codeMirror.coordsChar({left: event.pageX, top: event.pageY});
@@ -1421,9 +1396,9 @@
         // Stop processing the event.
         event.preventDefault();
         event.stopPropagation();
-    },
+    }
 
-    _isPositionVisible: function(position)
+    _isPositionVisible(position)
     {
         var scrollInfo = this._codeMirror.getScrollInfo();
         var visibleRangeStart = scrollInfo.top;
@@ -1431,9 +1406,9 @@
         var coords = this._codeMirror.charCoords(position, "local");
 
         return coords.top >= visibleRangeStart && coords.bottom <= visibleRangeEnd;
-    },
+    }
 
-    _scrollIntoViewCentered: function(position)
+    _scrollIntoViewCentered(position)
     {
         var scrollInfo = this._codeMirror.getScrollInfo();
         var lineHeight = Math.ceil(this._codeMirror.defaultTextHeight());
@@ -1442,4 +1417,21 @@
     }
 };
 
-WebInspector.TextEditor.prototype.__proto__ = WebInspector.Object.prototype;
+WebInspector.TextEditor.HighlightedStyleClassName = "highlighted";
+WebInspector.TextEditor.SearchResultStyleClassName = "search-result";
+WebInspector.TextEditor.HasBreakpointStyleClassName = "has-breakpoint";
+WebInspector.TextEditor.BreakpointResolvedStyleClassName = "breakpoint-resolved";
+WebInspector.TextEditor.BreakpointAutoContinueStyleClassName = "breakpoint-auto-continue";
+WebInspector.TextEditor.BreakpointDisabledStyleClassName = "breakpoint-disabled";
+WebInspector.TextEditor.MultipleBreakpointsStyleClassName = "multiple-breakpoints";
+WebInspector.TextEditor.ExecutionLineStyleClassName = "execution-line";
+WebInspector.TextEditor.BouncyHighlightStyleClassName = "bouncy-highlight";
+WebInspector.TextEditor.NumberOfFindsPerSearchBatch = 10;
+WebInspector.TextEditor.HighlightAnimationDuration = 2000;
+
+WebInspector.TextEditor.Event = {
+    ExecutionLineNumberDidChange: "text-editor-execution-line-number-did-change",
+    NumberOfSearchResultsDidChange: "text-editor-number-of-search-results-did-change",
+    ContentDidChange: "text-editor-content-did-change",
+    FormattingDidChange: "text-editor-formatting-did-change"
+};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to