Changeset 182054 in webkit


Ignore:
Timestamp:
Mar 27, 2015 12:26:27 AM (9 years ago)
Author:
timothy@apple.com
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.

Location:
trunk/Source/WebInspectorUI
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r182053 r182054  
     12015-03-26  Timothy Hatcher  <timothy@apple.com>
     2
     3        Web Inspector: Convert TextEditor classes to ES6
     4        https://bugs.webkit.org/show_bug.cgi?id=143127
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
     9        Removed a comment about const, we can't use it in strict mode / classes.
     10
     11        * UserInterface/Views/SourceCodeTextEditor.js:
     12        * UserInterface/Views/TextEditor.js:
     13        Converted to ES6 classes.
     14
    1152015-03-26  Nikita Vasilyev  <nvasilyev@apple.com>
    216
  • trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js

    r181912 r182054  
    297297        // undo, redo and paste are atomic and work better with a zero delay. CodeMirror identifies changes that
    298298        // get coalesced in the undo stack with a "+" prefix on the origin. Use that to set the delay for our coalescing.
    299         // FIXME: use const or let
    300299        var delay = change.origin && change.origin.charAt(0) === "+" ? WebInspector.CSSStyleDeclarationTextEditor.CommitCoalesceDelay : 0;
    301300
     
    338337            if (!this._codeMirror.getOption("readOnly")) {
    339338                // Matches a comment like: /* -webkit-foo: bar; */
    340                 // FIXME: use const or let
    341339                var commentedPropertyRegex = /\/\*\s*[-\w]+\s*:\s*[^;]+;?\s*\*\//g;
    342340
  • trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js

    r182047 r182054  
    2424 */
    2525
    26 WebInspector.SourceCodeTextEditor = function(sourceCode)
     26WebInspector.SourceCodeTextEditor = class SourceCodeTextEditor extends WebInspector.TextEditor
    2727{
    28     console.assert(sourceCode instanceof WebInspector.SourceCode);
    29 
    30     this._sourceCode = sourceCode;
    31     this._breakpointMap = {};
    32     this._issuesLineNumberMap = new Map;
    33     this._widgetMap = new Map;
    34     this._contentPopulated = false;
    35     this._invalidLineNumbers = {0: true};
    36     this._ignoreContentDidChange = 0;
    37 
    38     WebInspector.TextEditor.call(this, null, null, this);
    39 
    40     this._typeTokenScrollHandler = null;
    41     this._typeTokenAnnotator = null;
    42     this._basicBlockAnnotator = null;
    43    
    44     this._isProbablyMinified = false;
    45 
    46     // FIXME: Currently this just jumps between resources and related source map resources. It doesn't "jump to symbol" yet.
    47     this._updateTokenTrackingControllerState();
    48 
    49     this.element.classList.add(WebInspector.SourceCodeTextEditor.StyleClassName);
    50 
    51     if (this._supportsDebugging) {
    52         WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.DisabledStateDidChange, this._breakpointStatusDidChange, this);
    53         WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.AutoContinueDidChange, this._breakpointStatusDidChange, this);
    54         WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ResolvedStateDidChange, this._breakpointStatusDidChange, this);
    55         WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.LocationDidChange, this._updateBreakpointLocation, this);
    56 
    57         WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointsEnabledDidChange, this._breakpointsEnabledDidChange, this);
    58         WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointAdded, this._breakpointAdded, this);
    59         WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointRemoved, this._breakpointRemoved, this);
    60         WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, this._activeCallFrameDidChange, this);
    61 
    62         WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Paused, this._debuggerDidPause, this);
    63         WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, this._debuggerDidResume, this);
    64         if (WebInspector.debuggerManager.activeCallFrame)
    65             this._debuggerDidPause();
    66 
    67         this._activeCallFrameDidChange();
    68     }
    69 
    70     WebInspector.issueManager.addEventListener(WebInspector.IssueManager.Event.IssueWasAdded, this._issueWasAdded, this);
    71 
    72     if (this._sourceCode instanceof WebInspector.SourceMapResource || this._sourceCode.sourceMaps.length > 0)
    73         WebInspector.notifications.addEventListener(WebInspector.Notification.GlobalModifierKeysDidChange, this._updateTokenTrackingControllerState, this);
    74     else
    75         this._sourceCode.addEventListener(WebInspector.SourceCode.Event.SourceMapAdded, this._sourceCodeSourceMapAdded, this);
    76 
    77     sourceCode.requestContent().then(this._contentAvailable.bind(this));
    78 
    79     // FIXME: Cmd+L shorcut doesn't actually work.
    80     new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Command, "L", this.showGoToLineDialog.bind(this), this.element);
    81     new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Control, "G", this.showGoToLineDialog.bind(this), this.element);
    82 };
    83 
    84 // FIXME: Move to a WebInspector.Object subclass and we can remove this.
    85 WebInspector.Object.deprecatedAddConstructorFunctions(WebInspector.SourceCodeTextEditor);
    86 
    87 WebInspector.SourceCodeTextEditor.StyleClassName = "source-code";
    88 WebInspector.SourceCodeTextEditor.LineErrorStyleClassName = "error";
    89 WebInspector.SourceCodeTextEditor.LineWarningStyleClassName = "warning";
    90 WebInspector.SourceCodeTextEditor.PopoverDebuggerContentStyleClassName = "debugger-popover-content";
    91 WebInspector.SourceCodeTextEditor.HoveredExpressionHighlightStyleClassName = "hovered-expression-highlight";
    92 WebInspector.SourceCodeTextEditor.DurationToMouseOverTokenToMakeHoveredToken = 500;
    93 WebInspector.SourceCodeTextEditor.DurationToMouseOutOfHoveredTokenToRelease = 1000;
    94 WebInspector.SourceCodeTextEditor.DurationToUpdateTypeTokensAfterScrolling = 100;
    95 WebInspector.SourceCodeTextEditor.AutoFormatMinimumLineLength = 500;
    96 WebInspector.SourceCodeTextEditor.WidgetContainsMultipleIssuesSymbol = Symbol("source-code-widget-contains-multiple-issues");
    97 
    98 WebInspector.SourceCodeTextEditor.Event = {
    99     ContentWillPopulate: "source-code-text-editor-content-will-populate",
    100     ContentDidPopulate: "source-code-text-editor-content-did-populate"
    101 };
    102 
    103 WebInspector.SourceCodeTextEditor.prototype = {
    104     constructor: WebInspector.SourceCodeTextEditor,
     28    constructor(sourceCode)
     29    {
     30        console.assert(sourceCode instanceof WebInspector.SourceCode);
     31
     32        super();
     33
     34        this.delegate = this;
     35
     36        this._sourceCode = sourceCode;
     37        this._breakpointMap = {};
     38        this._issuesLineNumberMap = new Map;
     39        this._widgetMap = new Map;
     40        this._contentPopulated = false;
     41        this._invalidLineNumbers = {0: true};
     42        this._ignoreContentDidChange = 0;
     43
     44        this._typeTokenScrollHandler = null;
     45        this._typeTokenAnnotator = null;
     46        this._basicBlockAnnotator = null;
     47
     48        this._isProbablyMinified = false;
     49
     50        // FIXME: Currently this just jumps between resources and related source map resources. It doesn't "jump to symbol" yet.
     51        this._updateTokenTrackingControllerState();
     52
     53        this.element.classList.add("source-code");
     54
     55        if (this._supportsDebugging) {
     56            WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.DisabledStateDidChange, this._breakpointStatusDidChange, this);
     57            WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.AutoContinueDidChange, this._breakpointStatusDidChange, this);
     58            WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ResolvedStateDidChange, this._breakpointStatusDidChange, this);
     59            WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.LocationDidChange, this._updateBreakpointLocation, this);
     60
     61            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointsEnabledDidChange, this._breakpointsEnabledDidChange, this);
     62            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointAdded, this._breakpointAdded, this);
     63            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointRemoved, this._breakpointRemoved, this);
     64            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, this._activeCallFrameDidChange, this);
     65
     66            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Paused, this._debuggerDidPause, this);
     67            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed, this._debuggerDidResume, this);
     68            if (WebInspector.debuggerManager.activeCallFrame)
     69                this._debuggerDidPause();
     70
     71            this._activeCallFrameDidChange();
     72        }
     73
     74        WebInspector.issueManager.addEventListener(WebInspector.IssueManager.Event.IssueWasAdded, this._issueWasAdded, this);
     75
     76        if (this._sourceCode instanceof WebInspector.SourceMapResource || this._sourceCode.sourceMaps.length > 0)
     77            WebInspector.notifications.addEventListener(WebInspector.Notification.GlobalModifierKeysDidChange, this._updateTokenTrackingControllerState, this);
     78        else
     79            this._sourceCode.addEventListener(WebInspector.SourceCode.Event.SourceMapAdded, this._sourceCodeSourceMapAdded, this);
     80
     81        sourceCode.requestContent().then(this._contentAvailable.bind(this));
     82
     83        // FIXME: Cmd+L shorcut doesn't actually work.
     84        new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Command, "L", this.showGoToLineDialog.bind(this), this.element);
     85        new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Control, "G", this.showGoToLineDialog.bind(this), this.element);
     86    }
    10587
    10688    // Public
     
    10991    {
    11092        return this._sourceCode;
    111     },
    112 
    113     shown: function()
     93    }
     94
     95    shown()
    11496    {
    11597        WebInspector.TextEditor.prototype.shown.call(this);
     
    126108                this._setTypeTokenAnnotatorEnabledState(false);
    127109        }
    128     },
    129 
    130     hidden: function()
     110    }
     111
     112    hidden()
    131113    {
    132114        WebInspector.TextEditor.prototype.hidden.call(this);
     
    142124        if (this._basicBlockAnnotator)
    143125            this._basicBlockAnnotator.pause();
    144     },
    145 
    146     close: function()
     126    }
     127
     128    close()
    147129    {
    148130        if (this._supportsDebugging) {
     
    167149        WebInspector.notifications.removeEventListener(WebInspector.Notification.GlobalModifierKeysDidChange, this._updateTokenTrackingControllerState, this);
    168150        this._sourceCode.removeEventListener(WebInspector.SourceCode.Event.SourceMapAdded, this._sourceCodeSourceMapAdded, this);
    169     },
    170 
    171     canBeFormatted: function()
     151    }
     152
     153    canBeFormatted()
    172154    {
    173155        // Currently we assume that source map resources are formatted how the author wants it.
     
    179161
    180162        return WebInspector.TextEditor.prototype.canBeFormatted.call(this);
    181     },
    182 
    183     canShowTypeAnnotations: function()
     163    }
     164
     165    canShowTypeAnnotations()
    184166    {
    185167        return !!this._typeTokenAnnotator;
    186     },
    187 
    188     customPerformSearch: function(query)
     168    }
     169
     170    customPerformSearch(query)
    189171    {
    190172        function searchResultCallback(error, matches)
     
    234216            DebuggerAgent.searchInContent(this._sourceCode.id, query, false, false, searchResultCallback.bind(this));
    235217        return true;
    236     },
    237 
    238     showGoToLineDialog: function()
     218    }
     219
     220    showGoToLineDialog()
    239221    {
    240222        if (!this._goToLineDialog) {
     
    244226
    245227        this._goToLineDialog.present(this.element);
    246     },
    247 
    248     isGoToLineDialogValueValid: function(goToLineDialog, lineNumber)
     228    }
     229
     230    isGoToLineDialogValueValid(goToLineDialog, lineNumber)
    249231    {
    250232        return !isNaN(lineNumber) && lineNumber > 0 && lineNumber <= this.lineCount;
    251     },
    252 
    253     goToLineDialogValueWasValidated: function(goToLineDialog, lineNumber)
     233    }
     234
     235    goToLineDialogValueWasValidated(goToLineDialog, lineNumber)
    254236    {
    255237        var position = new WebInspector.SourceCodePosition(lineNumber - 1, 0);
    256238        var range = new WebInspector.TextRange(lineNumber - 1, 0, lineNumber, 0);
    257239        this.revealPosition(position, range, false, true);
    258     },
    259 
    260     goToLineDialogWasDismissed: function()
     240    }
     241
     242    goToLineDialogWasDismissed()
    261243    {
    262244        this.focus();
    263     },
    264 
    265     contentDidChange: function(replacedRanges, newRanges)
    266     {
    267         WebInspector.TextEditor.prototype.contentDidChange.call(this, replacedRanges, newRanges);
     245    }
     246
     247    contentDidChange(replacedRanges, newRanges)
     248    {
     249        super.contentDidChange(replacedRanges, newRanges);
    268250
    269251        if (this._ignoreContentDidChange > 0)
     
    278260            this._basicBlockAnnotator = null;
    279261        }
    280     },
    281 
    282     toggleTypeAnnotations: function()
     262    }
     263
     264    toggleTypeAnnotations()
    283265    {
    284266        if (!this._typeTokenAnnotator)
     
    291273        this._setTypeTokenAnnotatorEnabledState(newActivatedState);
    292274        return newActivatedState;
    293     },
    294 
    295     showPopoverForTypes: function(types, bounds, title)
     275    }
     276
     277    showPopoverForTypes(types, bounds, title)
    296278    {
    297279        var content = document.createElement("div");
     
    309291
    310292        this._showPopover(content, bounds);
    311     },
     293    }
    312294
    313295    // Protected
    314296
    315     prettyPrint: function(pretty)
     297    prettyPrint(pretty)
    316298    {
    317299        // The annotators must be cleared before pretty printing takes place and resumed
     
    323305            this._setTypeTokenAnnotatorEnabledState(false);
    324306
    325         WebInspector.TextEditor.prototype.prettyPrint.call(this, pretty);
     307        super.prettyPrint(pretty);
    326308
    327309        if (pretty || !this._isProbablyMinified) {
     
    333315                this._setTypeTokenAnnotatorEnabledState(false);
    334316        }
    335     },
     317    }
    336318
    337319    // Private
    338320
    339     _unformattedLineInfoForEditorLineInfo: function(lineInfo)
     321    _unformattedLineInfoForEditorLineInfo(lineInfo)
    340322    {
    341323        if (this.formatterSourceMap)
    342324            return this.formatterSourceMap.formattedToOriginal(lineInfo.lineNumber, lineInfo.columnNumber);
    343325        return lineInfo;
    344     },
    345 
    346     _sourceCodeLocationForEditorPosition: function(position)
     326    }
     327
     328    _sourceCodeLocationForEditorPosition(position)
    347329    {
    348330        var lineInfo = {lineNumber: position.line, columnNumber: position.ch};
    349331        var unformattedLineInfo = this._unformattedLineInfoForEditorLineInfo(lineInfo);
    350332        return this.sourceCode.createSourceCodeLocation(unformattedLineInfo.lineNumber, unformattedLineInfo.columnNumber);
    351     },
    352 
    353     _editorLineInfoForSourceCodeLocation: function(sourceCodeLocation)
     333    }
     334
     335    _editorLineInfoForSourceCodeLocation(sourceCodeLocation)
    354336    {
    355337        if (this._sourceCode instanceof WebInspector.SourceMapResource)
    356338            return {lineNumber: sourceCodeLocation.displayLineNumber, columnNumber: sourceCodeLocation.displayColumnNumber};
    357339        return {lineNumber: sourceCodeLocation.formattedLineNumber, columnNumber: sourceCodeLocation.formattedColumnNumber};
    358     },
    359 
    360     _breakpointForEditorLineInfo: function(lineInfo)
     340    }
     341
     342    _breakpointForEditorLineInfo(lineInfo)
    361343    {
    362344        if (!this._breakpointMap[lineInfo.lineNumber])
    363345            return null;
    364346        return this._breakpointMap[lineInfo.lineNumber][lineInfo.columnNumber];
    365     },
    366 
    367     _addBreakpointWithEditorLineInfo: function(breakpoint, lineInfo)
     347    }
     348
     349    _addBreakpointWithEditorLineInfo(breakpoint, lineInfo)
    368350    {
    369351        if (!this._breakpointMap[lineInfo.lineNumber])
     
    371353
    372354        this._breakpointMap[lineInfo.lineNumber][lineInfo.columnNumber] = breakpoint;
    373     },
    374 
    375     _removeBreakpointWithEditorLineInfo: function(breakpoint, lineInfo)
     355    }
     356
     357    _removeBreakpointWithEditorLineInfo(breakpoint, lineInfo)
    376358    {
    377359        console.assert(breakpoint === this._breakpointMap[lineInfo.lineNumber][lineInfo.columnNumber]);
     
    381363        if (isEmptyObject(this._breakpointMap[lineInfo.lineNumber]))
    382364            delete this._breakpointMap[lineInfo.lineNumber];
    383     },
    384 
    385     _contentWillPopulate: function(content)
     365    }
     366
     367    _contentWillPopulate(content)
    386368    {
    387369        this.dispatchEventToListeners(WebInspector.SourceCodeTextEditor.Event.ContentWillPopulate);
     
    432414            }
    433415        }
    434     },
    435 
    436     _contentDidPopulate: function()
     416    }
     417
     418    _contentDidPopulate()
    437419    {
    438420        this._contentPopulated = true;
     
    447429
    448430        this._updateEditableMarkers();
    449     },
    450 
    451     _populateWithContent: function(content)
     431    }
     432
     433    _populateWithContent(content)
    452434    {
    453435        content = content || "";
     
    465447
    466448        this._contentDidPopulate();
    467     },
    468 
    469     _contentAvailable: function(parameters)
     449    }
     450
     451    _contentAvailable(parameters)
    470452    {
    471453        // Return if resource is not available.
     
    488470
    489471        this._populateWithContent(content);
    490     },
    491 
    492     _breakpointStatusDidChange: function(event)
     472    }
     473
     474    _breakpointStatusDidChange(event)
    493475    {
    494476        this._updateBreakpointStatus(event.target);
    495     },
    496 
    497     _breakpointsEnabledDidChange: function()
     477    }
     478
     479    _breakpointsEnabledDidChange()
    498480    {
    499481        console.assert(this._supportsDebugging);
     
    502484        for (var breakpoint of breakpoints)
    503485            this._updateBreakpointStatus(breakpoint);
    504     },
    505 
    506     _updateBreakpointStatus: function(breakpoint)
     486    }
     487
     488    _updateBreakpointStatus(breakpoint)
    507489    {
    508490        console.assert(this._supportsDebugging);
     
    516498        var lineInfo = this._editorLineInfoForSourceCodeLocation(breakpoint.sourceCodeLocation);
    517499        this.setBreakpointInfoForLineAndColumn(lineInfo.lineNumber, lineInfo.columnNumber, this._breakpointInfoForBreakpoint(breakpoint));
    518     },
    519 
    520     _updateBreakpointLocation: function(event)
     500    }
     501
     502    _updateBreakpointLocation(event)
    521503    {
    522504        console.assert(this._supportsDebugging);
     
    562544        this._removeBreakpointWithEditorLineInfo(breakpoint, oldLineInfo);
    563545        this._addBreakpointWithEditorLineInfo(breakpoint, newLineInfo);
    564     },
    565 
    566     _breakpointAdded: function(event)
     546    }
     547
     548    _breakpointAdded(event)
    567549    {
    568550        console.assert(this._supportsDebugging);
     
    581563        this._addBreakpointWithEditorLineInfo(breakpoint, lineInfo);
    582564        this.setBreakpointInfoForLineAndColumn(lineInfo.lineNumber, lineInfo.columnNumber, this._breakpointInfoForBreakpoint(breakpoint));
    583     },
    584 
    585     _breakpointRemoved: function(event)
     565    }
     566
     567    _breakpointRemoved(event)
    586568    {
    587569        console.assert(this._supportsDebugging);
     
    600582        this._removeBreakpointWithEditorLineInfo(breakpoint, lineInfo);
    601583        this.setBreakpointInfoForLineAndColumn(lineInfo.lineNumber, lineInfo.columnNumber, null);
    602     },
    603 
    604     _activeCallFrameDidChange: function()
     584    }
     585
     586    _activeCallFrameDidChange()
    605587    {
    606588        console.assert(this._supportsDebugging);
     
    643625        else
    644626            this._populateWithScriptContent();
    645     },
    646 
    647     _activeCallFrameSourceCodeLocationChanged: function(event)
     627    }
     628
     629    _activeCallFrameSourceCodeLocationChanged(event)
    648630    {
    649631        console.assert(!isNaN(this.executionLineNumber));
     
    657639        this.executionLineNumber = lineInfo.lineNumber;
    658640        this.executionColumnNumber = lineInfo.columnNumber;
    659     },
    660 
    661     _populateWithInlineScriptContent: function()
     641    }
     642
     643    _populateWithInlineScriptContent()
    662644    {
    663645        console.assert(this._sourceCode instanceof WebInspector.Resource);
     
    690672                return;
    691673
    692             const scriptOpenTag = "<script>";
    693             const scriptCloseTag = "</script>";
     674            var scriptOpenTag = "<script>";
     675            var scriptCloseTag = "</script>";
    694676
    695677            var content = "";
     
    729711        for (var i = 0; i < scripts.length; ++i)
    730712            scripts[i].requestContent().then(boundScriptContentAvailable);
    731     },
    732 
    733     _populateWithScriptContent: function()
     713    }
     714
     715    _populateWithScriptContent()
    734716    {
    735717        console.assert(this._sourceCode instanceof WebInspector.Resource);
     
    764746
    765747        scripts[0].requestContent().then(scriptContentAvailable.bind(this));
    766     },
    767 
    768     _matchesSourceCodeLocation: function(sourceCodeLocation)
     748    }
     749
     750    _matchesSourceCodeLocation(sourceCodeLocation)
    769751    {
    770752        if (this._sourceCode instanceof WebInspector.SourceMapResource)
     
    775757            return sourceCodeLocation.sourceCode === this._sourceCode;
    776758        return false;
    777     },
    778 
    779     _matchesBreakpoint: function(breakpoint)
     759    }
     760
     761    _matchesBreakpoint(breakpoint)
    780762    {
    781763        console.assert(this._supportsDebugging);
     
    787769            return breakpoint.url === this._sourceCode.url || breakpoint.scriptIdentifier === this._sourceCode.id;
    788770        return false;
    789     },
    790 
    791     _matchesIssue: function(issue)
     771    }
     772
     773    _matchesIssue(issue)
    792774    {
    793775        if (this._sourceCode instanceof WebInspector.Resource)
     
    797779            return issue.url === this._sourceCode.url;
    798780        return false;
    799     },
    800 
    801     _issueWasAdded: function(event)
     781    }
     782
     783    _issueWasAdded(event)
    802784    {
    803785        var issue = event.data.issue;
     
    806788
    807789        this._addIssue(issue);
    808     },
    809 
    810     _addIssue: function(issue)
     790    }
     791
     792    _addIssue(issue)
    811793    {
    812794        // FIXME: Issue should have a SourceCodeLocation.
     
    844826            this._updateIssueWidgetForIssues(widget, lineNumberIssues);
    845827        }
    846     },
    847 
    848     _issueWidgetForLine: function(lineNumber)
     828    }
     829
     830    _issueWidgetForLine(lineNumber)
    849831    {
    850832        var widget = this._widgetMap.get(lineNumber);
     
    864846
    865847        return widget;
    866     },
    867 
    868     _iconClassNameForIssueLevel: function(level)
     848    }
     849
     850    _iconClassNameForIssueLevel(level)
    869851    {
    870852        if (level === WebInspector.IssueMessage.Level.Warning)
     
    873855        console.assert(level === WebInspector.IssueMessage.Level.Error);
    874856        return "icon-error";
    875     },
    876 
    877     _updateIssueWidgetForIssues: function(widget, issues)
     857    }
     858
     859    _updateIssueWidgetForIssues(widget, issues)
    878860    {
    879861        var widgetElement = widget.widgetElement;
     
    931913
    932914        widget.update();
    933     },
    934 
    935     _isWidgetToggleable: function(widget)
     915    }
     916
     917    _isWidgetToggleable(widget)
    936918    {
    937919        if (widget[WebInspector.SourceCodeTextEditor.WidgetContainsMultipleIssuesSymbol])
     
    946928       
    947929        return false;
    948     },
    949 
    950     _handleWidgetClick: function(widget, lineNumber, event)
     930    }
     931
     932    _handleWidgetClick(widget, lineNumber, event)
    951933    {
    952934        if (!this._isWidgetToggleable(widget))
     
    957939        var lineNumberIssues = this._issuesLineNumberMap.get(lineNumber);
    958940        this._updateIssueWidgetForIssues(widget, lineNumberIssues);
    959     },
    960 
    961     _breakpointInfoForBreakpoint: function(breakpoint)
     941    }
     942
     943    _breakpointInfoForBreakpoint(breakpoint)
    962944    {
    963945        return {resolved: breakpoint.resolved, disabled: breakpoint.disabled, autoContinue: breakpoint.autoContinue};
    964     },
     946    }
    965947
    966948    get _supportsDebugging()
     
    971953            return true;
    972954        return false;
    973     },
     955    }
    974956
    975957    // TextEditor Delegate
    976958
    977     textEditorBaseURL: function(textEditor)
     959    textEditorBaseURL(textEditor)
    978960    {
    979961        return this._sourceCode.url;
    980     },
    981 
    982     textEditorShouldHideLineNumber: function(textEditor, lineNumber)
     962    }
     963
     964    textEditorShouldHideLineNumber(textEditor, lineNumber)
    983965    {
    984966        return lineNumber in this._invalidLineNumbers;
    985     },
    986 
    987     textEditorGutterContextMenu: function(textEditor, lineNumber, columnNumber, editorBreakpoints, event)
     967    }
     968
     969    textEditorGutterContextMenu(textEditor, lineNumber, columnNumber, editorBreakpoints, event)
    988970    {
    989971        if (!this._supportsDebugging)
     
    991973
    992974        event.preventDefault();
     975
     976        function continueToLocation()
     977        {
     978            WebInspector.debuggerManager.continueToLocation(script.id, sourceCodeLocation.lineNumber, sourceCodeLocation.columnNumber);
     979        }
     980
     981        function addBreakpoint()
     982        {
     983            var data = this.textEditorBreakpointAdded(this, lineNumber, columnNumber);
     984            this.setBreakpointInfoForLineAndColumn(data.lineNumber, data.columnNumber, data.breakpointInfo);
     985        }
     986
     987        function revealInSidebar()
     988        {
     989            WebInspector.debuggerSidebarPanel.show();
     990            var treeElement = WebInspector.debuggerSidebarPanel.treeElementForRepresentedObject(breakpoint);
     991            if (treeElement)
     992                treeElement.revealAndSelect();
     993        }
    993994
    994995        var contextMenu = new WebInspector.ContextMenu(event);
     
    10061007
    10071008            if (script) {
    1008                 function continueToLocation()
    1009                 {
    1010                     WebInspector.debuggerManager.continueToLocation(script.id, sourceCodeLocation.lineNumber, sourceCodeLocation.columnNumber);
    1011                 }
    10121009
    10131010                contextMenu.appendItem(WebInspector.UIString("Continue to Here"), continueToLocation);
     
    10271024        // No breakpoints.
    10281025        if (!breakpoints.length) {
    1029             function addBreakpoint()
    1030             {
    1031                 var data = this.textEditorBreakpointAdded(this, lineNumber, columnNumber);
    1032                 this.setBreakpointInfoForLineAndColumn(data.lineNumber, data.columnNumber, data.breakpointInfo);
    1033             }
    10341026
    10351027            contextMenu.appendItem(WebInspector.UIString("Add Breakpoint"), addBreakpoint.bind(this));
     
    10411033        if (breakpoints.length === 1) {
    10421034            var breakpoint = breakpoints[0];
    1043             function revealInSidebar()
    1044             {
    1045                 WebInspector.debuggerSidebarPanel.show();
    1046                 var treeElement = WebInspector.debuggerSidebarPanel.treeElementForRepresentedObject(breakpoint);
    1047                 if (treeElement)
    1048                     treeElement.revealAndSelect();
    1049             }
    10501035
    10511036            breakpoint.appendContextMenuItems(contextMenu, event.target);
     
    10861071        contextMenu.appendItem(WebInspector.UIString("Delete Breakpoints"), removeBreakpoints.bind(this));
    10871072        contextMenu.show();
    1088     },
    1089 
    1090     textEditorBreakpointAdded: function(textEditor, lineNumber, columnNumber)
     1073    }
     1074
     1075    textEditorBreakpointAdded(textEditor, lineNumber, columnNumber)
    10911076    {
    10921077        if (!this._supportsDebugging)
     
    11141099            columnNumber: lineInfo.columnNumber
    11151100        };
    1116     },
    1117 
    1118     textEditorBreakpointRemoved: function(textEditor, lineNumber, columnNumber)
     1101    }
     1102
     1103    textEditorBreakpointRemoved(textEditor, lineNumber, columnNumber)
    11191104    {
    11201105        console.assert(this._supportsDebugging);
     
    11331118        WebInspector.debuggerManager.removeBreakpoint(breakpoint);
    11341119        delete this._ignoreBreakpointAddedBreakpoint;
    1135     },
    1136 
    1137     textEditorBreakpointMoved: function(textEditor, oldLineNumber, oldColumnNumber, newLineNumber, newColumnNumber)
     1120    }
     1121
     1122    textEditorBreakpointMoved(textEditor, oldLineNumber, oldColumnNumber, newLineNumber, newColumnNumber)
    11381123    {
    11391124        console.assert(this._supportsDebugging);
     
    11601145        if (accurateNewLineInfo.lineNumber !== newLineInfo.lineNumber || accurateNewLineInfo.columnNumber !== newLineInfo.columnNumber)
    11611146            this.updateBreakpointLineAndColumn(newLineInfo.lineNumber, newLineInfo.columnNumber, accurateNewLineInfo.lineNumber, accurateNewLineInfo.columnNumber);
    1162     },
    1163 
    1164     textEditorBreakpointClicked: function(textEditor, lineNumber, columnNumber)
     1147    }
     1148
     1149    textEditorBreakpointClicked(textEditor, lineNumber, columnNumber)
    11651150    {
    11661151        console.assert(this._supportsDebugging);
     
    11741159
    11751160        breakpoint.cycleToNextMode();
    1176     },
    1177 
    1178     textEditorUpdatedFormatting: function(textEditor)
     1161    }
     1162
     1163    textEditorUpdatedFormatting(textEditor)
    11791164    {
    11801165        this._ignoreAllBreakpointLocationUpdates = true;
     
    12121197
    12131198        this._reinsertAllIssues();
    1214     },
    1215 
    1216     _clearWidgets: function()
     1199    }
     1200
     1201    _clearWidgets()
    12171202    {
    12181203        for (var widget of this._widgetMap.values())
     
    12201205
    12211206        this._widgetMap.clear();
    1222     },
    1223 
    1224     _reinsertAllIssues: function()
     1207    }
     1208
     1209    _reinsertAllIssues()
    12251210    {
    12261211        this._issuesLineNumberMap.clear();
     
    12321217            this._addIssue(issue);
    12331218        }
    1234     },
    1235 
    1236     _debuggerDidPause: function(event)
     1219    }
     1220
     1221    _debuggerDidPause(event)
    12371222    {
    12381223        this._updateTokenTrackingControllerState();
     
    12411226        if (this._basicBlockAnnotator && this._basicBlockAnnotator.isActive())
    12421227            this._basicBlockAnnotator.refresh();
    1243     },
    1244 
    1245     _debuggerDidResume: function(event)
     1228    }
     1229
     1230    _debuggerDidResume(event)
    12461231    {
    12471232        this._updateTokenTrackingControllerState();
     
    12511236        if (this._basicBlockAnnotator && this._basicBlockAnnotator.isActive())
    12521237            this._basicBlockAnnotator.refresh();
    1253     },
    1254 
    1255     _sourceCodeSourceMapAdded: function(event)
     1238    }
     1239
     1240    _sourceCodeSourceMapAdded(event)
    12561241    {
    12571242        WebInspector.notifications.addEventListener(WebInspector.Notification.GlobalModifierKeysDidChange, this._updateTokenTrackingControllerState, this);
     
    12591244
    12601245        this._updateTokenTrackingControllerState();
    1261     },
    1262 
    1263     _updateTokenTrackingControllerState: function()
     1246    }
     1247
     1248    _updateTokenTrackingControllerState()
    12641249    {
    12651250        var mode = WebInspector.CodeMirrorTokenTrackingController.Mode.None;
     
    12981283
    12991284        this.tokenTrackingController.mode = mode;
    1300     },
    1301 
    1302     _hasColorMarkers: function()
     1285    }
     1286
     1287    _hasColorMarkers()
    13031288    {
    13041289        for (var marker of this.markers) {
     
    13071292        }
    13081293        return false;
    1309     },
     1294    }
    13101295
    13111296    // CodeMirrorTokenTrackingController Delegate
    13121297
    1313     tokenTrackingControllerCanReleaseHighlightedRange: function(tokenTrackingController, element)
     1298    tokenTrackingControllerCanReleaseHighlightedRange(tokenTrackingController, element)
    13141299    {
    13151300        if (!this._popover)
     
    13201305
    13211306        return true;
    1322     },
    1323 
    1324     tokenTrackingControllerHighlightedRangeReleased: function(tokenTrackingController)
     1307    }
     1308
     1309    tokenTrackingControllerHighlightedRangeReleased(tokenTrackingController)
    13251310    {
    13261311        if (!this._mouseIsOverPopover)
    13271312            this._dismissPopover();
    1328     },
    1329 
    1330     tokenTrackingControllerHighlightedRangeWasClicked: function(tokenTrackingController)
     1313    }
     1314
     1315    tokenTrackingControllerHighlightedRangeWasClicked(tokenTrackingController)
    13311316    {
    13321317        if (this.tokenTrackingController.mode !== WebInspector.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens)
     
    13421327        else
    13431328            WebInspector.resourceSidebarPanel.showSourceCodeLocation(sourceCodeLocation);
    1344     },
    1345 
    1346     tokenTrackingControllerNewHighlightCandidate: function(tokenTrackingController, candidate)
     1329    }
     1330
     1331    tokenTrackingControllerNewHighlightCandidate(tokenTrackingController, candidate)
    13471332    {
    13481333        if (this.tokenTrackingController.mode === WebInspector.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens) {
     
    13681353                this._dismissEditingController();
    13691354        }
    1370     },
    1371 
    1372     tokenTrackingControllerMouseOutOfHoveredMarker: function(tokenTrackingController, hoveredMarker)
     1355    }
     1356
     1357    tokenTrackingControllerMouseOutOfHoveredMarker(tokenTrackingController, hoveredMarker)
    13731358    {
    13741359        this._dismissEditingController();
    1375     },
    1376 
    1377     _tokenTrackingControllerHighlightedJavaScriptExpression: function(candidate)
     1360    }
     1361
     1362    _tokenTrackingControllerHighlightedJavaScriptExpression(candidate)
    13781363    {
    13791364        console.assert(candidate.expression);
     
    14151400        // No call frame available. Use the main page's context.
    14161401        RuntimeAgent.evaluate.invoke({expression: candidate.expression, objectGroup: "popover", doNotPauseOnExceptionsAndMuteConsole: true}, populate.bind(this));
    1417     },
    1418 
    1419     _tokenTrackingControllerHighlightedJavaScriptTypeInformation: function(candidate)
     1402    }
     1403
     1404    _tokenTrackingControllerHighlightedJavaScriptTypeInformation(candidate)
    14201405    {
    14211406        console.assert(candidate.expression);
     
    14501435
    14511436        RuntimeAgent.getRuntimeTypesForVariablesAtOffsets(allRequests, handler.bind(this));
    1452     },
    1453 
    1454     _showPopover: function(content, bounds)
     1437    }
     1438
     1439    _showPopover(content, bounds)
    14551440    {
    14561441        console.assert(this.tokenTrackingController.candidate || bounds);
     
    14781463
    14791464        this._trackPopoverEvents();
    1480     },
    1481 
    1482     _showPopoverForFunction: function(data)
     1465    }
     1466
     1467    _showPopoverForFunction(data)
    14831468    {
    14841469        var candidate = this.tokenTrackingController.candidate;
     
    15131498        }
    15141499        DebuggerAgent.getFunctionDetails(data.objectId, didGetDetails.bind(this));
    1515     },
    1516 
    1517     _showPopoverForObject: function(data)
     1500    }
     1501
     1502    _showPopoverForObject(data)
    15181503    {
    15191504        var content = document.createElement("div");
     
    15351520
    15361521        this._showPopover(content);
    1537     },
    1538 
    1539     _showPopoverWithFormattedValue: function(remoteObject)
     1522    }
     1523
     1524    _showPopoverWithFormattedValue(remoteObject)
    15401525    {
    15411526        var content = WebInspector.FormattedValue.createElementForRemoteObject(remoteObject);
    15421527        this._showPopover(content);
    1543     },
    1544 
    1545     willDismissPopover: function(popover)
     1528    }
     1529
     1530    willDismissPopover(popover)
    15461531    {
    15471532        this.tokenTrackingController.removeHighlightedRange();
    15481533
    15491534        RuntimeAgent.releaseObjectGroup("popover");
    1550     },
    1551 
    1552     _dismissPopover: function()
     1535    }
     1536
     1537    _dismissPopover()
    15531538    {
    15541539        if (!this._popover)
     
    15611546            this._popoverEventListeners.unregister();
    15621547        }
    1563     },
    1564 
    1565     _trackPopoverEvents: function()
     1548    }
     1549
     1550    _trackPopoverEvents()
    15661551    {
    15671552        if (!this._popoverEventListeners)
     
    15731558            this._popoverEventListeners.install();
    15741559        }
    1575     },
    1576 
    1577     _popoverMouseover: function(event)
     1560    }
     1561
     1562    _popoverMouseover(event)
    15781563    {
    15791564        this._mouseIsOverPopover = true;
    1580     },
    1581 
    1582     _popoverMouseout: function(event)
     1565    }
     1566
     1567    _popoverMouseout(event)
    15831568    {
    15841569        this._mouseIsOverPopover = this._popover.element.contains(event.relatedTarget);
    1585     },
    1586 
    1587     _updateEditableMarkers: function(range)
     1570    }
     1571
     1572    _updateEditableMarkers(range)
    15881573    {
    15891574        this.createColorMarkers(range);
     
    15911576
    15921577        this._updateTokenTrackingControllerState();
    1593     },
    1594 
    1595     _tokenTrackingControllerHighlightedMarkedExpression: function(candidate, markers)
     1578    }
     1579
     1580    _tokenTrackingControllerHighlightedMarkedExpression(candidate, markers)
    15961581    {
    15971582        // Look for the outermost editable marker.
     
    16301615        this._editingController.delegate = this;
    16311616        this._editingController.presentHoverMenu();
    1632     },
    1633 
    1634     _dismissEditingController: function(discrete)
     1617    }
     1618
     1619    _dismissEditingController(discrete)
    16351620    {
    16361621        if (this._editingController)
     
    16391624        this.tokenTrackingController.hoveredMarker = null;
    16401625        delete this._editingController;
    1641     },
     1626    }
    16421627
    16431628    // CodeMirrorEditingController Delegate
    16441629   
    1645     editingControllerDidStartEditing: function(editingController)
     1630    editingControllerDidStartEditing(editingController)
    16461631    {
    16471632        // We can pause the token tracking controller during editing, it will be reset
     
    16551640        // We ignore content changes made as a result of color editing.
    16561641        this._ignoreContentDidChange++;
    1657     },
     1642    }
    16581643   
    1659     editingControllerDidFinishEditing: function(editingController)
     1644    editingControllerDidFinishEditing(editingController)
    16601645    {
    16611646        this._updateEditableMarkers(editingController.range);
     
    16641649
    16651650        delete this._editingController;
    1666     },
    1667 
    1668     _setTypeTokenAnnotatorEnabledState: function(shouldActivate)
     1651    }
     1652
     1653    _setTypeTokenAnnotatorEnabledState(shouldActivate)
    16691654    {
    16701655        console.assert(this._typeTokenAnnotator);
     
    17011686
    17021687        this._updateTokenTrackingControllerState();
    1703     },
    1704 
    1705     _getAssociatedScript: function()
     1688    }
     1689
     1690    _getAssociatedScript()
    17061691    {
    17071692        var script = null;
     
    17121697            script = this._sourceCode.scripts[0];
    17131698        return script;
    1714     },
    1715 
    1716     _makeTypeTokenAnnotator: function()
     1699    }
     1700
     1701    _makeTypeTokenAnnotator()
    17171702    {
    17181703        if (!RuntimeAgent.getRuntimeTypesForVariablesAtOffsets)
     
    17241709
    17251710        this._typeTokenAnnotator = new WebInspector.TypeTokenAnnotator(this, script);
    1726     },
    1727 
    1728     _makeBasicBlockAnnotator: function()
     1711    }
     1712
     1713    _makeBasicBlockAnnotator()
    17291714    {
    17301715        if (!RuntimeAgent.getBasicBlocks)
     
    17361721
    17371722        this._basicBlockAnnotator = new WebInspector.BasicBlockAnnotator(this, script);
    1738     },
    1739 
    1740     _enableScrollEventsForTypeTokenAnnotator: function()
     1723    }
     1724
     1725    _enableScrollEventsForTypeTokenAnnotator()
    17411726    {
    17421727        // Pause updating type tokens while scrolling to prevent frame loss.
     
    17441729        this._typeTokenScrollHandler = this._makeTypeTokenScrollEventHandler();
    17451730        this.addScrollHandler(this._typeTokenScrollHandler);
    1746     },
    1747 
    1748     _disableScrollEventsForTypeTokenAnnotator: function()
     1731    }
     1732
     1733    _disableScrollEventsForTypeTokenAnnotator()
    17491734    {
    17501735        console.assert(this._typeTokenScrollHandler);
    17511736        this.removeScrollHandler(this._typeTokenScrollHandler);
    17521737        this._typeTokenScrollHandler = null;
    1753     },
    1754 
    1755     _makeTypeTokenScrollEventHandler: function()
     1738    }
     1739
     1740    _makeTypeTokenScrollEventHandler()
    17561741    {
    17571742        var timeoutIdentifier = null;
     
    17801765};
    17811766
    1782 WebInspector.SourceCodeTextEditor.prototype.__proto__ = WebInspector.TextEditor.prototype;
     1767WebInspector.SourceCodeTextEditor.LineErrorStyleClassName = "error";
     1768WebInspector.SourceCodeTextEditor.LineWarningStyleClassName = "warning";
     1769WebInspector.SourceCodeTextEditor.PopoverDebuggerContentStyleClassName = "debugger-popover-content";
     1770WebInspector.SourceCodeTextEditor.HoveredExpressionHighlightStyleClassName = "hovered-expression-highlight";
     1771WebInspector.SourceCodeTextEditor.DurationToMouseOverTokenToMakeHoveredToken = 500;
     1772WebInspector.SourceCodeTextEditor.DurationToMouseOutOfHoveredTokenToRelease = 1000;
     1773WebInspector.SourceCodeTextEditor.DurationToUpdateTypeTokensAfterScrolling = 100;
     1774WebInspector.SourceCodeTextEditor.AutoFormatMinimumLineLength = 500;
     1775WebInspector.SourceCodeTextEditor.WidgetContainsMultipleIssuesSymbol = Symbol("source-code-widget-contains-multiple-issues");
     1776
     1777WebInspector.SourceCodeTextEditor.Event = {
     1778    ContentWillPopulate: "source-code-text-editor-content-will-populate",
     1779    ContentDidPopulate: "source-code-text-editor-content-did-populate"
     1780};
  • trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js

    r181769 r182054  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 WebInspector.TextEditor = function(element, mimeType, delegate)
     26WebInspector.TextEditor = class TextEditor extends WebInspector.Object
    2727{
    28     // FIXME: Convert this to a WebInspector.Object subclass, and call super().
    29     // WebInspector.Object.call(this);
    30 
    31     var text = (element ? element.textContent : "");
    32     this._element = element || document.createElement("div");
    33     this._element.classList.add(WebInspector.TextEditor.StyleClassName);
    34     this._element.classList.add(WebInspector.SyntaxHighlightedStyleClassName);
    35 
    36     this._codeMirror = CodeMirror(this.element, {
    37         readOnly: true,
    38         indentWithTabs: true,
    39         indentUnit: 4,
    40         lineNumbers: true,
    41         lineWrapping: true,
    42         matchBrackets: true,
    43         autoCloseBrackets: true
    44     });
    45 
    46     this._codeMirror.on("change", this._contentChanged.bind(this));
    47     this._codeMirror.on("gutterClick", this._gutterMouseDown.bind(this));
    48     this._codeMirror.on("gutterContextMenu", this._gutterContextMenu.bind(this));
    49     this._codeMirror.getScrollerElement().addEventListener("click", this._openClickedLinks.bind(this), true);
    50 
    51     this._completionController = new WebInspector.CodeMirrorCompletionController(this._codeMirror, this);
    52     this._tokenTrackingController = new WebInspector.CodeMirrorTokenTrackingController(this._codeMirror, this);
    53 
    54     this._initialStringNotSet = true;
    55 
    56     this.mimeType = mimeType;
    57 
    58     this._breakpoints = {};
    59     this._executionLineNumber = NaN;
    60     this._executionColumnNumber = NaN;
    61 
    62     this._searchQuery = null;
    63     this._searchResults = [];
    64     this._currentSearchResultIndex = -1;
    65     this._ignoreCodeMirrorContentDidChangeEvent = 0;
    66 
    67     this._formatted = false;
    68     this._formatterSourceMap = null;
    69 
    70     this._delegate = delegate || null;
    71 };
    72 
    73 // FIXME: Move to a WebInspector.Object subclass and we can remove this.
    74 WebInspector.Object.deprecatedAddConstructorFunctions(WebInspector.TextEditor);
    75 
    76 WebInspector.TextEditor.StyleClassName = "text-editor";
    77 WebInspector.TextEditor.HighlightedStyleClassName = "highlighted";
    78 WebInspector.TextEditor.SearchResultStyleClassName = "search-result";
    79 WebInspector.TextEditor.HasBreakpointStyleClassName = "has-breakpoint";
    80 WebInspector.TextEditor.BreakpointResolvedStyleClassName = "breakpoint-resolved";
    81 WebInspector.TextEditor.BreakpointAutoContinueStyleClassName = "breakpoint-auto-continue";
    82 WebInspector.TextEditor.BreakpointDisabledStyleClassName = "breakpoint-disabled";
    83 WebInspector.TextEditor.MultipleBreakpointsStyleClassName = "multiple-breakpoints";
    84 WebInspector.TextEditor.ExecutionLineStyleClassName = "execution-line";
    85 WebInspector.TextEditor.BouncyHighlightStyleClassName = "bouncy-highlight";
    86 WebInspector.TextEditor.NumberOfFindsPerSearchBatch = 10;
    87 WebInspector.TextEditor.HighlightAnimationDuration = 2000;
    88 
    89 WebInspector.TextEditor.Event = {
    90     ExecutionLineNumberDidChange: "text-editor-execution-line-number-did-change",
    91     NumberOfSearchResultsDidChange: "text-editor-number-of-search-results-did-change",
    92     ContentDidChange: "text-editor-content-did-change",
    93     FormattingDidChange: "text-editor-formatting-did-change"
    94 };
    95 
    96 WebInspector.TextEditor.prototype = {
    97     constructor: WebInspector.TextEditor,
     28    constructor(element, mimeType, delegate)
     29    {
     30        super();
     31
     32        var text = (element ? element.textContent : "");
     33        this._element = element || document.createElement("div");
     34        this._element.classList.add("text-editor");
     35        this._element.classList.add(WebInspector.SyntaxHighlightedStyleClassName);
     36
     37        this._codeMirror = CodeMirror(this.element, {
     38            readOnly: true,
     39            indentWithTabs: true,
     40            indentUnit: 4,
     41            lineNumbers: true,
     42            lineWrapping: true,
     43            matchBrackets: true,
     44            autoCloseBrackets: true
     45        });
     46
     47        this._codeMirror.on("change", this._contentChanged.bind(this));
     48        this._codeMirror.on("gutterClick", this._gutterMouseDown.bind(this));
     49        this._codeMirror.on("gutterContextMenu", this._gutterContextMenu.bind(this));
     50        this._codeMirror.getScrollerElement().addEventListener("click", this._openClickedLinks.bind(this), true);
     51
     52        this._completionController = new WebInspector.CodeMirrorCompletionController(this._codeMirror, this);
     53        this._tokenTrackingController = new WebInspector.CodeMirrorTokenTrackingController(this._codeMirror, this);
     54
     55        this._initialStringNotSet = true;
     56
     57        this.mimeType = mimeType;
     58
     59        this._breakpoints = {};
     60        this._executionLineNumber = NaN;
     61        this._executionColumnNumber = NaN;
     62
     63        this._searchQuery = null;
     64        this._searchResults = [];
     65        this._currentSearchResultIndex = -1;
     66        this._ignoreCodeMirrorContentDidChangeEvent = 0;
     67
     68        this._formatted = false;
     69        this._formatterSourceMap = null;
     70
     71        this._delegate = delegate || null;
     72    }
    9873
    9974    // Public
     
    10277    {
    10378        return this._element;
    104     },
     79    }
    10580
    10681    get string()
    10782    {
    10883        return this._codeMirror.getValue();
    109     },
     84    }
    11085
    11186    set string(newString)
     
    147122        this._ignoreCodeMirrorContentDidChangeEvent--;
    148123        console.assert(this._ignoreCodeMirrorContentDidChangeEvent >= 0);
    149     },
     124    }
    150125
    151126    get readOnly()
    152127    {
    153128        return this._codeMirror.getOption("readOnly") || false;
    154     },
     129    }
    155130
    156131    set readOnly(readOnly)
    157132    {
    158133        this._codeMirror.setOption("readOnly", readOnly);
    159     },
     134    }
    160135
    161136    get formatted()
    162137    {
    163138        return this._formatted;
    164     },
     139    }
    165140
    166141    set formatted(formatted)
     
    181156
    182157        this.dispatchEventToListeners(WebInspector.TextEditor.Event.FormattingDidChange);
    183     },
     158    }
    184159
    185160    set autoFormat(auto)
    186161    {
    187162        this._autoFormat = auto;
    188     },
    189 
    190     hasFormatter: function()
    191     {
    192         const supportedModes = {
     163    }
     164
     165    hasFormatter()
     166    {
     167        var supportedModes = {
    193168            "javascript": true,
    194169            "css": true,
     
    197172        var mode = this._codeMirror.getMode();
    198173        return mode.name in supportedModes;
    199     },
    200 
    201     canBeFormatted: function()
     174    }
     175
     176    canBeFormatted()
    202177    {
    203178        // Can be overriden by subclasses.
    204179        return this.hasFormatter();
    205     },
    206 
    207     canShowTypeAnnotations: function()
     180    }
     181
     182    canShowTypeAnnotations()
    208183    {
    209184        return false;
    210     },
     185    }
    211186
    212187    get selectedTextRange()
     
    215190        var end = this._codeMirror.getCursor(false);
    216191        return this._textRangeFromCodeMirrorPosition(start, end);
    217     },
     192    }
    218193
    219194    set selectedTextRange(textRange)
     
    221196        var position = this._codeMirrorPositionFromTextRange(textRange);
    222197        this._codeMirror.setSelection(position.start, position.end);
    223     },
     198    }
    224199
    225200    get mimeType()
    226201    {
    227202        return this._mimeType;
    228     },
     203    }
    229204
    230205    set mimeType(newMIMEType)
     
    234209        this._mimeType = newMIMEType;
    235210        this._codeMirror.setOption("mode", newMIMEType);
    236     },
     211    }
    237212
    238213    get executionLineNumber()
    239214    {
    240215        return this._executionLineNumber;
    241     },
     216    }
    242217
    243218    set executionLineNumber(lineNumber)
     
    253228        // could have changed (e.g. continuing in a loop with a breakpoint inside).
    254229        this.dispatchEventToListeners(WebInspector.TextEditor.Event.ExecutionLineNumberDidChange);
    255     },
     230    }
    256231
    257232    get executionColumnNumber()
    258233    {
    259234        return this._executionColumnNumber;
    260     },
     235    }
    261236
    262237    set executionColumnNumber(columnNumber)
    263238    {
    264239        this._executionColumnNumber = columnNumber;
    265     },
     240    }
    266241
    267242    get formatterSourceMap()
    268243    {
    269244        return this._formatterSourceMap;
    270     },
     245    }
    271246
    272247    get tokenTrackingController()
    273248    {
    274249        return this._tokenTrackingController;
    275     },
     250    }
    276251
    277252    get delegate()
    278253    {
    279254        return this._delegate;
    280     },
     255    }
    281256
    282257    set delegate(newDelegate)
    283258    {
    284259        this._delegate = newDelegate || null;
    285     },
     260    }
    286261
    287262    get numberOfSearchResults()
    288263    {
    289264        return this._searchResults.length;
    290     },
     265    }
    291266
    292267    get currentSearchQuery()
    293268    {
    294269        return this._searchQuery;
    295     },
     270    }
    296271
    297272    set automaticallyRevealFirstSearchResult(reveal)
     
    304279                this._revealFirstSearchResultAfterCursor();
    305280        }
    306     },
    307 
    308     performSearch: function(query)
     281    }
     282
     283    performSearch(query)
    309284    {
    310285        if (this._searchQuery === query)
     
    368343        // Start the search.
    369344        boundBatchSearch();
    370     },
    371 
    372     addSearchResults: function(textRanges)
     345    }
     346
     347    addSearchResults(textRanges)
    373348    {
    374349        console.assert(textRanges);
     
    392367
    393368        this._codeMirror.operation(markRanges.bind(this));
    394     },
    395 
    396     searchCleared: function()
     369    }
     370
     371    searchCleared()
    397372    {
    398373        function clearResults() {
     
    406381        this._searchResults = [];
    407382        this._currentSearchResultIndex = -1;
    408     },
    409 
    410     searchQueryWithSelection: function()
     383    }
     384
     385    searchQueryWithSelection()
    411386    {
    412387        if (!this._codeMirror.somethingSelected())
     
    414389
    415390        return this._codeMirror.getSelection();
    416     },
    417 
    418     revealPreviousSearchResult: function(changeFocus)
     391    }
     392
     393    revealPreviousSearchResult(changeFocus)
    419394    {
    420395        if (!this._searchResults.length)
     
    432407
    433408        this._revealSearchResult(this._searchResults[this._currentSearchResultIndex], changeFocus, -1);
    434     },
    435 
    436     revealNextSearchResult: function(changeFocus)
     409    }
     410
     411    revealNextSearchResult(changeFocus)
    437412    {
    438413        if (!this._searchResults.length)
     
    450425
    451426        this._revealSearchResult(this._searchResults[this._currentSearchResultIndex], changeFocus, 1);
    452     },
    453 
    454     line: function(lineNumber)
     427    }
     428
     429    line(lineNumber)
    455430    {
    456431        return this._codeMirror.getLine(lineNumber);
    457     },
    458 
    459     getTextInRange: function(startPosition, endPosition)
     432    }
     433
     434    getTextInRange(startPosition, endPosition)
    460435    {
    461436        return this._codeMirror.getRange(startPosition, endPosition);
    462     },
    463 
    464     addStyleToTextRange: function(startPosition, endPosition, styleClassName)
     437    }
     438
     439    addStyleToTextRange(startPosition, endPosition, styleClassName)
    465440    {
    466441        endPosition.ch += 1;
    467442        return this._codeMirror.getDoc().markText(startPosition, endPosition, {className: styleClassName, inclusiveLeft: true, inclusiveRight: true});
    468     },
    469 
    470     revealPosition: function(position, textRangeToSelect, forceUnformatted, noHighlight)
     443    }
     444
     445    revealPosition(position, textRangeToSelect, forceUnformatted, noHighlight)
    471446    {
    472447        console.assert(position === undefined || position instanceof WebInspector.SourceCodePosition, "revealPosition called without a SourceCodePosition");
     
    525500
    526501        this._codeMirror.operation(revealAndHighlightLine.bind(this));
    527     },
    528 
    529     updateLayout: function(force)
     502    }
     503
     504    updateLayout(force)
    530505    {
    531506        this._codeMirror.refresh();
    532     },
    533 
    534     shown: function()
     507    }
     508
     509    shown()
    535510    {
    536511        this._visible = true;
     
    543518        // so that the scrollInfo coordinates are correct.
    544519        this._revealPendingPositionIfPossible();
    545     },
    546 
    547     hidden: function()
     520    }
     521
     522    hidden()
    548523    {
    549524        this._visible = false;
    550     },
    551 
    552     setBreakpointInfoForLineAndColumn: function(lineNumber, columnNumber, breakpointInfo)
     525    }
     526
     527    setBreakpointInfoForLineAndColumn(lineNumber, columnNumber, breakpointInfo)
    553528    {
    554529        if (this._ignoreSetBreakpointInfoCalls)
     
    559534        else
    560535            this._removeBreakpointFromLineAndColumn(lineNumber, columnNumber);
    561     },
    562 
    563     updateBreakpointLineAndColumn: function(oldLineNumber, oldColumnNumber, newLineNumber, newColumnNumber)
     536    }
     537
     538    updateBreakpointLineAndColumn(oldLineNumber, oldColumnNumber, newLineNumber, newColumnNumber)
    564539    {
    565540        console.assert(this._breakpoints[oldLineNumber]);
     
    574549        this._removeBreakpointFromLineAndColumn(oldLineNumber, oldColumnNumber);
    575550        this._addBreakpointToLineAndColumnWithInfo(newLineNumber, newColumnNumber, breakpointInfo);
    576     },
    577 
    578     addStyleClassToLine: function(lineNumber, styleClassName)
     551    }
     552
     553    addStyleClassToLine(lineNumber, styleClassName)
    579554    {
    580555        var lineHandle = this._codeMirror.getLineHandle(lineNumber);
     
    583558
    584559        return this._codeMirror.addLineClass(lineHandle, "wrap", styleClassName);
    585     },
    586 
    587     removeStyleClassFromLine: function(lineNumber, styleClassName)
     560    }
     561
     562    removeStyleClassFromLine(lineNumber, styleClassName)
    588563    {
    589564        var lineHandle = this._codeMirror.getLineHandle(lineNumber);
     
    593568
    594569        return this._codeMirror.removeLineClass(lineHandle, "wrap", styleClassName);
    595     },
    596 
    597     toggleStyleClassForLine: function(lineNumber, styleClassName)
     570    }
     571
     572    toggleStyleClassForLine(lineNumber, styleClassName)
    598573    {
    599574        var lineHandle = this._codeMirror.getLineHandle(lineNumber);
     
    603578
    604579        return this._codeMirror.toggleLineClass(lineHandle, "wrap", styleClassName);
    605     },
    606 
    607     createWidgetForLine: function(lineNumber)
     580    }
     581
     582    createWidgetForLine(lineNumber)
    608583    {
    609584        var lineHandle = this._codeMirror.getLineHandle(lineNumber);
     
    614589        var lineWidget = this._codeMirror.addLineWidget(lineHandle, widgetElement, {coverGutter: false, noHScroll: true, handleMouseEvents: true});
    615590        return new WebInspector.LineWidget(lineWidget, widgetElement);
    616     },
     591    }
    617592
    618593    get lineCount()
    619594    {
    620595        return this._codeMirror.lineCount();
    621     },
    622 
    623     focus: function()
     596    }
     597
     598    focus()
    624599    {
    625600        this._codeMirror.focus();
    626     },
    627 
    628     contentDidChange: function(replacedRanges, newRanges)
     601    }
     602
     603    contentDidChange(replacedRanges, newRanges)
    629604    {
    630605        // Implemented by subclasses.
    631     },
    632 
    633     rectsForRange: function(range)
     606    }
     607
     608    rectsForRange(range)
    634609    {
    635610        return this._codeMirror.rectsForRange(range);
    636     },
     611    }
    637612
    638613    get markers()
     
    641616            return WebInspector.TextMarker.textMarkerForCodeMirrorTextMarker(codeMirrorTextMarker);
    642617        });
    643     },
    644 
    645     markersAtPosition: function(position)
     618    }
     619
     620    markersAtPosition(position)
    646621    {
    647622        return this._codeMirror.findMarksAt(position).map(function(codeMirrorTextMarker) {
    648623            return WebInspector.TextMarker.textMarkerForCodeMirrorTextMarker(codeMirrorTextMarker);
    649624        });
    650     },
    651 
    652     createColorMarkers: function(range)
     625    }
     626
     627    createColorMarkers(range)
    653628    {
    654629        return this._codeMirror.createColorMarkers(range);
    655     },
    656 
    657     createGradientMarkers: function(range)
     630    }
     631
     632    createGradientMarkers(range)
    658633    {
    659634        return this._codeMirror.createGradientMarkers(range);
    660     },
    661 
    662     editingControllerForMarker: function(editableMarker)
     635    }
     636
     637    editingControllerForMarker(editableMarker)
    663638    {
    664639        switch (editableMarker.type) {
     
    670645            return new WebInspector.CodeMirrorEditingController(this._codeMirror, editableMarker);
    671646        }
    672     },
    673 
    674     visibleRangeOffsets: function()
     647    }
     648
     649    visibleRangeOffsets()
    675650    {
    676651        var startOffset = null;
     
    687662
    688663        return {startOffset, endOffset};
    689     },
    690 
    691     originalOffsetToCurrentPosition: function(offset)
     664    }
     665
     666    originalOffsetToCurrentPosition(offset)
    692667    {
    693668        var position = null;
     
    699674
    700675        return position;
    701     },
    702 
    703     currentOffsetToCurrentPosition: function(offset)
     676    }
     677
     678    currentOffsetToCurrentPosition(offset)
    704679    {
    705680        return this._codeMirror.getDoc().posFromIndex(offset);
    706     },
    707 
    708     currentPositionToOriginalOffset: function(position)
     681    }
     682
     683    currentPositionToOriginalOffset(position)
    709684    {
    710685        var offset = null;
     
    715690
    716691        return offset;
    717     },
    718 
    719     currentPositionToCurrentOffset: function(position)
     692    }
     693
     694    currentPositionToCurrentOffset(position)
    720695    {
    721696        return this._codeMirror.getDoc().indexFromPos(position);
    722     },
    723 
    724     setInlineWidget: function(position, inlineElement)
     697    }
     698
     699    setInlineWidget(position, inlineElement)
    725700    {
    726701        return this._codeMirror.setUniqueBookmark(position, {widget: inlineElement});
    727     },
    728 
    729     addScrollHandler: function(handler)
     702    }
     703
     704    addScrollHandler(handler)
    730705    {
    731706        this._codeMirror.on("scroll", handler);
    732     },
    733 
    734     removeScrollHandler: function(handler)
     707    }
     708
     709    removeScrollHandler(handler)
    735710    {
    736711        this._codeMirror.off("scroll", handler);
    737     },
     712    }
    738713
    739714    // Protected
    740715
    741     prettyPrint: function(pretty)
     716    prettyPrint(pretty)
    742717    {
    743718        function prettyPrintAndUpdateEditor()
    744719        {
    745             const start = {line: 0, ch: 0};
    746             const end = {line: this._codeMirror.lineCount() - 1};
     720            var start = {line: 0, ch: 0};
     721            var end = {line: this._codeMirror.lineCount() - 1};
    747722
    748723            var oldSelectionAnchor = this._codeMirror.getCursor("anchor");
     
    753728            if (pretty) {
    754729                // <rdar://problem/10593948> Provide a way to change the tab width in the Web Inspector
    755                 const indentString = "    ";
     730                var indentString = "    ";
    756731                var originalLineEndings = [];
    757732                var formattedLineEndings = [];
     
    837812
    838813        this._codeMirror.operation(prettyPrintAndUpdateEditor.bind(this));
    839     },
     814    }
    840815
    841816    // Private
    842817
    843     hasEdits: function()
     818    hasEdits()
    844819    {
    845820        return !this._codeMirror.isClean();
    846     },
    847 
    848     _contentChanged: function(codeMirror, change)
     821    }
     822
     823    _contentChanged(codeMirror, change)
    849824    {
    850825        if (this._ignoreCodeMirrorContentDidChangeEvent > 0)
     
    881856
    882857        this.dispatchEventToListeners(WebInspector.TextEditor.Event.ContentDidChange);
    883     },
    884 
    885     _textRangeFromCodeMirrorPosition: function(start, end)
     858    }
     859
     860    _textRangeFromCodeMirrorPosition(start, end)
    886861    {
    887862        console.assert(start);
     
    889864
    890865        return new WebInspector.TextRange(start.line, start.ch, end.line, end.ch);
    891     },
    892 
    893     _codeMirrorPositionFromTextRange: function(textRange)
     866    }
     867
     868    _codeMirrorPositionFromTextRange(textRange)
    894869    {
    895870        console.assert(textRange);
     
    898873        var end = {line: textRange.endLine, ch: textRange.endColumn};
    899874        return {start, end};
    900     },
    901 
    902     _revealPendingPositionIfPossible: function()
     875    }
     876
     877    _revealPendingPositionIfPossible()
    903878    {
    904879        // Nothing to do if we don't have a pending position.
     
    911886
    912887        this.revealPosition(this._positionToReveal, this._textRangeToSelect, this._forceUnformatted);
    913     },
    914 
    915     _revealSearchResult: function(result, changeFocus, directionInCaseOfRevalidation)
     888    }
     889
     890    _revealSearchResult(result, changeFocus, directionInCaseOfRevalidation)
    916891    {
    917892        var position = result.find();
     
    973948        // Listen for the end of the animation so we can remove the element.
    974949        this._bouncyHighlightElement.addEventListener("webkitAnimationEnd", animationEnded.bind(this));
    975     },
    976 
    977     _binarySearchInsertionIndexInSearchResults: function(object, comparator)
     950    }
     951
     952    _binarySearchInsertionIndexInSearchResults(object, comparator)
    978953    {
    979954        // It is possible that markers in the search results array may have been deleted.
     
    999974
    1000975        return first - 1;
    1001     },
    1002 
    1003     _revealFirstSearchResultBeforeCursor: function(changeFocus)
     976    }
     977
     978    _revealFirstSearchResultBeforeCursor(changeFocus)
    1004979    {
    1005980        console.assert(this._searchResults.length);
     
    10261001        this._currentSearchResultIndex = index;
    10271002        this._revealSearchResult(this._searchResults[this._currentSearchResultIndex], changeFocus);
    1028     },
    1029 
    1030     _revealFirstSearchResultAfterCursor: function(changeFocus)
     1003    }
     1004
     1005    _revealFirstSearchResultAfterCursor(changeFocus)
    10311006    {
    10321007        console.assert(this._searchResults.length);
     
    10581033        this._currentSearchResultIndex = index;
    10591034        this._revealSearchResult(this._searchResults[this._currentSearchResultIndex], changeFocus);
    1060     },
    1061 
    1062     _cursorDoesNotMatchLastRevealedSearchResult: function()
     1035    }
     1036
     1037    _cursorDoesNotMatchLastRevealedSearchResult()
    10631038    {
    10641039        console.assert(this._currentSearchResultIndex !== -1);
     
    10731048
    10741049        return WebInspector.compareCodeMirrorPositions(currentCursorPosition, lastRevealedSearchResultPosition) !== 0;
    1075     },
    1076 
    1077     _revalidateSearchResults: function(direction)
     1050    }
     1051
     1052    _revalidateSearchResults(direction)
    10781053    {
    10791054        console.assert(direction !== undefined);
     
    10981073                this._revealFirstSearchResultBeforeCursor();
    10991074        }
    1100     },
    1101 
    1102     _updateExecutionLine: function()
     1075    }
     1076
     1077    _updateExecutionLine()
    11031078    {
    11041079        function update()
     
    11141089
    11151090        this._codeMirror.operation(update.bind(this));
    1116     },
    1117 
    1118     _setBreakpointStylesOnLine: function(lineNumber)
     1091    }
     1092
     1093    _setBreakpointStylesOnLine(lineNumber)
    11191094    {
    11201095        var columnBreakpoints = this._breakpoints[lineNumber];
     
    11711146
    11721147        this._codeMirror.operation(updateStyles.bind(this));
    1173     },
    1174 
    1175     _addBreakpointToLineAndColumnWithInfo: function(lineNumber, columnNumber, breakpointInfo)
     1148    }
     1149
     1150    _addBreakpointToLineAndColumnWithInfo(lineNumber, columnNumber, breakpointInfo)
    11761151    {
    11771152        if (!this._breakpoints[lineNumber])
     
    11801155
    11811156        this._setBreakpointStylesOnLine(lineNumber);
    1182     },
    1183 
    1184     _removeBreakpointFromLineAndColumn: function(lineNumber, columnNumber)
     1157    }
     1158
     1159    _removeBreakpointFromLineAndColumn(lineNumber, columnNumber)
    11851160    {
    11861161        console.assert(columnNumber in this._breakpoints[lineNumber]);
     
    12091184
    12101185        this._codeMirror.operation(updateStyles.bind(this));
    1211     },
    1212 
    1213     _allColumnBreakpointInfoForLine: function(lineNumber)
     1186    }
     1187
     1188    _allColumnBreakpointInfoForLine(lineNumber)
    12141189    {
    12151190        return this._breakpoints[lineNumber];
    1216     },
    1217 
    1218     _setColumnBreakpointInfoForLine: function(lineNumber, columnBreakpointInfo)
     1191    }
     1192
     1193    _setColumnBreakpointInfoForLine(lineNumber, columnBreakpointInfo)
    12191194    {
    12201195        console.assert(columnBreakpointInfo);
    12211196        this._breakpoints[lineNumber] = columnBreakpointInfo;
    12221197        this._setBreakpointStylesOnLine(lineNumber);
    1223     },
    1224 
    1225     _gutterMouseDown: function(codeMirror, lineNumber, gutterElement, event)
     1198    }
     1199
     1200    _gutterMouseDown(codeMirror, lineNumber, gutterElement, event)
    12261201    {
    12271202        if (event.button !== 0 || event.ctrlKey)
     
    12661241        document.addEventListener("mousemove", this._documentMouseMovedEventListener, true);
    12671242        document.addEventListener("mouseup", this._documentMouseUpEventListener, true);
    1268     },
    1269 
    1270     _gutterContextMenu: function(codeMirror, lineNumber, gutterElement, event)
     1243    }
     1244
     1245    _gutterContextMenu(codeMirror, lineNumber, gutterElement, event)
    12711246    {
    12721247        if (this._delegate && typeof this._delegate.textEditorGutterContextMenu === "function") {
     
    12771252            this._delegate.textEditorGutterContextMenu(this, lineNumber, 0, breakpoints, event);
    12781253        }
    1279     },
    1280 
    1281     _documentMouseMoved: function(event)
     1254    }
     1255
     1256    _documentMouseMoved(event)
    12821257    {
    12831258        console.assert("_lineNumberWithMousedDownBreakpoint" in this);
     
    13331308            this._columnNumberWithDraggedBreakpoint = columnNumber;
    13341309        }
    1335     },
    1336 
    1337     _documentMouseUp: function(event)
     1310    }
     1311
     1312    _documentMouseUp(event)
    13381313    {
    13391314        console.assert("_lineNumberWithMousedDownBreakpoint" in this);
     
    13461321        document.removeEventListener("mouseup", this._documentMouseUpEventListener, true);
    13471322
    1348         const delegateImplementsBreakpointClicked = this._delegate && typeof this._delegate.textEditorBreakpointClicked === "function";
    1349         const delegateImplementsBreakpointRemoved = this._delegate && typeof this._delegate.textEditorBreakpointRemoved === "function";
    1350         const delegateImplementsBreakpointMoved = this._delegate && typeof this._delegate.textEditorBreakpointMoved === "function";
     1323        var delegateImplementsBreakpointClicked = this._delegate && typeof this._delegate.textEditorBreakpointClicked === "function";
     1324        var delegateImplementsBreakpointRemoved = this._delegate && typeof this._delegate.textEditorBreakpointRemoved === "function";
     1325        var delegateImplementsBreakpointMoved = this._delegate && typeof this._delegate.textEditorBreakpointMoved === "function";
    13511326
    13521327        if (this._mouseDragged) {
     
    13941369        delete this._previousColumnBreakpointInfo;
    13951370        delete this._mouseDragged;
    1396     },
    1397 
    1398     _openClickedLinks: function(event)
     1371    }
     1372
     1373    _openClickedLinks(event)
    13991374    {
    14001375        // Get the position in the text and the token at that position.
     
    14221397        event.preventDefault();
    14231398        event.stopPropagation();
    1424     },
    1425 
    1426     _isPositionVisible: function(position)
     1399    }
     1400
     1401    _isPositionVisible(position)
    14271402    {
    14281403        var scrollInfo = this._codeMirror.getScrollInfo();
     
    14321407
    14331408        return coords.top >= visibleRangeStart && coords.bottom <= visibleRangeEnd;
    1434     },
    1435 
    1436     _scrollIntoViewCentered: function(position)
     1409    }
     1410
     1411    _scrollIntoViewCentered(position)
    14371412    {
    14381413        var scrollInfo = this._codeMirror.getScrollInfo();
     
    14431418};
    14441419
    1445 WebInspector.TextEditor.prototype.__proto__ = WebInspector.Object.prototype;
     1420WebInspector.TextEditor.HighlightedStyleClassName = "highlighted";
     1421WebInspector.TextEditor.SearchResultStyleClassName = "search-result";
     1422WebInspector.TextEditor.HasBreakpointStyleClassName = "has-breakpoint";
     1423WebInspector.TextEditor.BreakpointResolvedStyleClassName = "breakpoint-resolved";
     1424WebInspector.TextEditor.BreakpointAutoContinueStyleClassName = "breakpoint-auto-continue";
     1425WebInspector.TextEditor.BreakpointDisabledStyleClassName = "breakpoint-disabled";
     1426WebInspector.TextEditor.MultipleBreakpointsStyleClassName = "multiple-breakpoints";
     1427WebInspector.TextEditor.ExecutionLineStyleClassName = "execution-line";
     1428WebInspector.TextEditor.BouncyHighlightStyleClassName = "bouncy-highlight";
     1429WebInspector.TextEditor.NumberOfFindsPerSearchBatch = 10;
     1430WebInspector.TextEditor.HighlightAnimationDuration = 2000;
     1431
     1432WebInspector.TextEditor.Event = {
     1433    ExecutionLineNumberDidChange: "text-editor-execution-line-number-did-change",
     1434    NumberOfSearchResultsDidChange: "text-editor-number-of-search-results-did-change",
     1435    ContentDidChange: "text-editor-content-did-change",
     1436    FormattingDidChange: "text-editor-formatting-did-change"
     1437};
Note: See TracChangeset for help on using the changeset viewer.