<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[182054] trunk/Source/WebInspectorUI</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/182054">182054</a></dd>
<dt>Author</dt> <dd>timothy@apple.com</dd>
<dt>Date</dt> <dd>2015-03-27 00:26:27 -0700 (Fri, 27 Mar 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>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.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsCSSStyleDeclarationTextEditorjs">trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsSourceCodeTextEditorjs">trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsTextEditorjs">trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (182053 => 182054)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-03-26 Timothy Hatcher <timothy@apple.com>
+
+ 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.
+
</ins><span class="cx"> 2015-03-26 Nikita Vasilyev <nvasilyev@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: clicking on console record while REPL is focused does not select a new record
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsCSSStyleDeclarationTextEditorjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js (182053 => 182054)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -296,7 +296,6 @@
</span><span class="cx"> // Use a short delay for user input to coalesce more changes before committing. Other actions like
</span><span class="cx"> // undo, redo and paste are atomic and work better with a zero delay. CodeMirror identifies changes that
</span><span class="cx"> // get coalesced in the undo stack with a "+" prefix on the origin. Use that to set the delay for our coalescing.
</span><del>- // FIXME: use const or let
</del><span class="cx"> var delay = change.origin && change.origin.charAt(0) === "+" ? WebInspector.CSSStyleDeclarationTextEditor.CommitCoalesceDelay : 0;
</span><span class="cx">
</span><span class="cx"> // Reset the timeout so rapid changes coalesce after a short delay.
</span><span class="lines">@@ -337,7 +336,6 @@
</span><span class="cx">
</span><span class="cx"> if (!this._codeMirror.getOption("readOnly")) {
</span><span class="cx"> // Matches a comment like: /* -webkit-foo: bar; */
</span><del>- // FIXME: use const or let
</del><span class="cx"> var commentedPropertyRegex = /\/\*\s*[-\w]+\s*:\s*[^;]+;?\s*\*\//g;
</span><span class="cx">
</span><span class="cx"> // Look for comments that look like properties and add checkboxes in front of them.
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsSourceCodeTextEditorjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js (182053 => 182054)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -23,94 +23,76 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-WebInspector.SourceCodeTextEditor = function(sourceCode)
</del><ins>+WebInspector.SourceCodeTextEditor = class SourceCodeTextEditor extends WebInspector.TextEditor
</ins><span class="cx"> {
</span><del>- console.assert(sourceCode instanceof WebInspector.SourceCode);
</del><ins>+ constructor(sourceCode)
+ {
+ console.assert(sourceCode instanceof WebInspector.SourceCode);
</ins><span class="cx">
</span><del>- this._sourceCode = sourceCode;
- this._breakpointMap = {};
- this._issuesLineNumberMap = new Map;
- this._widgetMap = new Map;
- this._contentPopulated = false;
- this._invalidLineNumbers = {0: true};
- this._ignoreContentDidChange = 0;
</del><ins>+ super();
</ins><span class="cx">
</span><del>- WebInspector.TextEditor.call(this, null, null, this);
</del><ins>+ this.delegate = this;
</ins><span class="cx">
</span><del>- this._typeTokenScrollHandler = null;
- this._typeTokenAnnotator = null;
- this._basicBlockAnnotator = null;
-
- this._isProbablyMinified = false;
</del><ins>+ this._sourceCode = sourceCode;
+ this._breakpointMap = {};
+ this._issuesLineNumberMap = new Map;
+ this._widgetMap = new Map;
+ this._contentPopulated = false;
+ this._invalidLineNumbers = {0: true};
+ this._ignoreContentDidChange = 0;
</ins><span class="cx">
</span><del>- // FIXME: Currently this just jumps between resources and related source map resources. It doesn't "jump to symbol" yet.
- this._updateTokenTrackingControllerState();
</del><ins>+ this._typeTokenScrollHandler = null;
+ this._typeTokenAnnotator = null;
+ this._basicBlockAnnotator = null;
</ins><span class="cx">
</span><del>- this.element.classList.add(WebInspector.SourceCodeTextEditor.StyleClassName);
</del><ins>+ this._isProbablyMinified = false;
</ins><span class="cx">
</span><del>- 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);
</del><ins>+ // FIXME: Currently this just jumps between resources and related source map resources. It doesn't "jump to symbol" yet.
+ this._updateTokenTrackingControllerState();
</ins><span class="cx">
</span><del>- 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);
</del><ins>+ this.element.classList.add("source-code");
</ins><span class="cx">
</span><del>- 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();
</del><ins>+ 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);
</ins><span class="cx">
</span><del>- this._activeCallFrameDidChange();
- }
</del><ins>+ 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);
</ins><span class="cx">
</span><del>- WebInspector.issueManager.addEventListener(WebInspector.IssueManager.Event.IssueWasAdded, this._issueWasAdded, this);
</del><ins>+ 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();
</ins><span class="cx">
</span><del>- 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);
</del><ins>+ this._activeCallFrameDidChange();
+ }
</ins><span class="cx">
</span><del>- sourceCode.requestContent().then(this._contentAvailable.bind(this));
</del><ins>+ WebInspector.issueManager.addEventListener(WebInspector.IssueManager.Event.IssueWasAdded, this._issueWasAdded, this);
</ins><span class="cx">
</span><del>- // 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);
-};
</del><ins>+ 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);
</ins><span class="cx">
</span><del>-// FIXME: Move to a WebInspector.Object subclass and we can remove this.
-WebInspector.Object.deprecatedAddConstructorFunctions(WebInspector.SourceCodeTextEditor);
</del><ins>+ sourceCode.requestContent().then(this._contentAvailable.bind(this));
</ins><span class="cx">
</span><del>-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");
</del><ins>+ // 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);
+ }
</ins><span class="cx">
</span><del>-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,
-
</del><span class="cx"> // Public
</span><span class="cx">
</span><span class="cx"> get sourceCode()
</span><span class="cx"> {
</span><span class="cx"> return this._sourceCode;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- shown: function()
</del><ins>+ shown()
</ins><span class="cx"> {
</span><span class="cx"> WebInspector.TextEditor.prototype.shown.call(this);
</span><span class="cx">
</span><span class="lines">@@ -125,9 +107,9 @@
</span><span class="cx"> if (this._typeTokenAnnotator || this._basicBlockAnnotator)
</span><span class="cx"> this._setTypeTokenAnnotatorEnabledState(false);
</span><span class="cx"> }
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- hidden: function()
</del><ins>+ hidden()
</ins><span class="cx"> {
</span><span class="cx"> WebInspector.TextEditor.prototype.hidden.call(this);
</span><span class="cx">
</span><span class="lines">@@ -141,9 +123,9 @@
</span><span class="cx"> this._typeTokenAnnotator.pause();
</span><span class="cx"> if (this._basicBlockAnnotator)
</span><span class="cx"> this._basicBlockAnnotator.pause();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- close: function()
</del><ins>+ close()
</ins><span class="cx"> {
</span><span class="cx"> if (this._supportsDebugging) {
</span><span class="cx"> WebInspector.Breakpoint.removeEventListener(WebInspector.Breakpoint.Event.DisabledStateDidChange, this._breakpointStatusDidChange, this);
</span><span class="lines">@@ -166,9 +148,9 @@
</span><span class="cx">
</span><span class="cx"> WebInspector.notifications.removeEventListener(WebInspector.Notification.GlobalModifierKeysDidChange, this._updateTokenTrackingControllerState, this);
</span><span class="cx"> this._sourceCode.removeEventListener(WebInspector.SourceCode.Event.SourceMapAdded, this._sourceCodeSourceMapAdded, this);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- canBeFormatted: function()
</del><ins>+ canBeFormatted()
</ins><span class="cx"> {
</span><span class="cx"> // Currently we assume that source map resources are formatted how the author wants it.
</span><span class="cx"> // We could allow source map resources to be formatted, we would then need to make
</span><span class="lines">@@ -178,14 +160,14 @@
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> return WebInspector.TextEditor.prototype.canBeFormatted.call(this);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- canShowTypeAnnotations: function()
</del><ins>+ canShowTypeAnnotations()
</ins><span class="cx"> {
</span><span class="cx"> return !!this._typeTokenAnnotator;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- customPerformSearch: function(query)
</del><ins>+ customPerformSearch(query)
</ins><span class="cx"> {
</span><span class="cx"> function searchResultCallback(error, matches)
</span><span class="cx"> {
</span><span class="lines">@@ -233,9 +215,9 @@
</span><span class="cx"> else if (this._sourceCode instanceof WebInspector.Script)
</span><span class="cx"> DebuggerAgent.searchInContent(this._sourceCode.id, query, false, false, searchResultCallback.bind(this));
</span><span class="cx"> return true;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- showGoToLineDialog: function()
</del><ins>+ showGoToLineDialog()
</ins><span class="cx"> {
</span><span class="cx"> if (!this._goToLineDialog) {
</span><span class="cx"> this._goToLineDialog = new WebInspector.GoToLineDialog;
</span><span class="lines">@@ -243,28 +225,28 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> this._goToLineDialog.present(this.element);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- isGoToLineDialogValueValid: function(goToLineDialog, lineNumber)
</del><ins>+ isGoToLineDialogValueValid(goToLineDialog, lineNumber)
</ins><span class="cx"> {
</span><span class="cx"> return !isNaN(lineNumber) && lineNumber > 0 && lineNumber <= this.lineCount;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- goToLineDialogValueWasValidated: function(goToLineDialog, lineNumber)
</del><ins>+ goToLineDialogValueWasValidated(goToLineDialog, lineNumber)
</ins><span class="cx"> {
</span><span class="cx"> var position = new WebInspector.SourceCodePosition(lineNumber - 1, 0);
</span><span class="cx"> var range = new WebInspector.TextRange(lineNumber - 1, 0, lineNumber, 0);
</span><span class="cx"> this.revealPosition(position, range, false, true);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- goToLineDialogWasDismissed: function()
</del><ins>+ goToLineDialogWasDismissed()
</ins><span class="cx"> {
</span><span class="cx"> this.focus();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- contentDidChange: function(replacedRanges, newRanges)
</del><ins>+ contentDidChange(replacedRanges, newRanges)
</ins><span class="cx"> {
</span><del>- WebInspector.TextEditor.prototype.contentDidChange.call(this, replacedRanges, newRanges);
</del><ins>+ super.contentDidChange(replacedRanges, newRanges);
</ins><span class="cx">
</span><span class="cx"> if (this._ignoreContentDidChange > 0)
</span><span class="cx"> return;
</span><span class="lines">@@ -277,9 +259,9 @@
</span><span class="cx"> this._typeTokenAnnotator = null;
</span><span class="cx"> this._basicBlockAnnotator = null;
</span><span class="cx"> }
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- toggleTypeAnnotations: function()
</del><ins>+ toggleTypeAnnotations()
</ins><span class="cx"> {
</span><span class="cx"> if (!this._typeTokenAnnotator)
</span><span class="cx"> return false;
</span><span class="lines">@@ -290,9 +272,9 @@
</span><span class="cx">
</span><span class="cx"> this._setTypeTokenAnnotatorEnabledState(newActivatedState);
</span><span class="cx"> return newActivatedState;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- showPopoverForTypes: function(types, bounds, title)
</del><ins>+ showPopoverForTypes(types, bounds, title)
</ins><span class="cx"> {
</span><span class="cx"> var content = document.createElement("div");
</span><span class="cx"> content.className = "object expandable";
</span><span class="lines">@@ -308,11 +290,11 @@
</span><span class="cx"> content.appendChild(section.element);
</span><span class="cx">
</span><span class="cx"> this._showPopover(content, bounds);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> // Protected
</span><span class="cx">
</span><del>- prettyPrint: function(pretty)
</del><ins>+ prettyPrint(pretty)
</ins><span class="cx"> {
</span><span class="cx"> // The annotators must be cleared before pretty printing takes place and resumed
</span><span class="cx"> // after so that they clear their annotations in a known state and insert new annotations
</span><span class="lines">@@ -322,7 +304,7 @@
</span><span class="cx"> if (shouldResumeTypeTokenAnnotator || shouldResumeBasicBlockAnnotator)
</span><span class="cx"> this._setTypeTokenAnnotatorEnabledState(false);
</span><span class="cx">
</span><del>- WebInspector.TextEditor.prototype.prettyPrint.call(this, pretty);
</del><ins>+ super.prettyPrint(pretty);
</ins><span class="cx">
</span><span class="cx"> if (pretty || !this._isProbablyMinified) {
</span><span class="cx"> if (shouldResumeTypeTokenAnnotator || shouldResumeBasicBlockAnnotator)
</span><span class="lines">@@ -332,47 +314,47 @@
</span><span class="cx"> if (this._typeTokenAnnotator || this._basicBlockAnnotator)
</span><span class="cx"> this._setTypeTokenAnnotatorEnabledState(false);
</span><span class="cx"> }
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> // Private
</span><span class="cx">
</span><del>- _unformattedLineInfoForEditorLineInfo: function(lineInfo)
</del><ins>+ _unformattedLineInfoForEditorLineInfo(lineInfo)
</ins><span class="cx"> {
</span><span class="cx"> if (this.formatterSourceMap)
</span><span class="cx"> return this.formatterSourceMap.formattedToOriginal(lineInfo.lineNumber, lineInfo.columnNumber);
</span><span class="cx"> return lineInfo;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _sourceCodeLocationForEditorPosition: function(position)
</del><ins>+ _sourceCodeLocationForEditorPosition(position)
</ins><span class="cx"> {
</span><span class="cx"> var lineInfo = {lineNumber: position.line, columnNumber: position.ch};
</span><span class="cx"> var unformattedLineInfo = this._unformattedLineInfoForEditorLineInfo(lineInfo);
</span><span class="cx"> return this.sourceCode.createSourceCodeLocation(unformattedLineInfo.lineNumber, unformattedLineInfo.columnNumber);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _editorLineInfoForSourceCodeLocation: function(sourceCodeLocation)
</del><ins>+ _editorLineInfoForSourceCodeLocation(sourceCodeLocation)
</ins><span class="cx"> {
</span><span class="cx"> if (this._sourceCode instanceof WebInspector.SourceMapResource)
</span><span class="cx"> return {lineNumber: sourceCodeLocation.displayLineNumber, columnNumber: sourceCodeLocation.displayColumnNumber};
</span><span class="cx"> return {lineNumber: sourceCodeLocation.formattedLineNumber, columnNumber: sourceCodeLocation.formattedColumnNumber};
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _breakpointForEditorLineInfo: function(lineInfo)
</del><ins>+ _breakpointForEditorLineInfo(lineInfo)
</ins><span class="cx"> {
</span><span class="cx"> if (!this._breakpointMap[lineInfo.lineNumber])
</span><span class="cx"> return null;
</span><span class="cx"> return this._breakpointMap[lineInfo.lineNumber][lineInfo.columnNumber];
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _addBreakpointWithEditorLineInfo: function(breakpoint, lineInfo)
</del><ins>+ _addBreakpointWithEditorLineInfo(breakpoint, lineInfo)
</ins><span class="cx"> {
</span><span class="cx"> if (!this._breakpointMap[lineInfo.lineNumber])
</span><span class="cx"> this._breakpointMap[lineInfo.lineNumber] = {};
</span><span class="cx">
</span><span class="cx"> this._breakpointMap[lineInfo.lineNumber][lineInfo.columnNumber] = breakpoint;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _removeBreakpointWithEditorLineInfo: function(breakpoint, lineInfo)
</del><ins>+ _removeBreakpointWithEditorLineInfo(breakpoint, lineInfo)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(breakpoint === this._breakpointMap[lineInfo.lineNumber][lineInfo.columnNumber]);
</span><span class="cx">
</span><span class="lines">@@ -380,9 +362,9 @@
</span><span class="cx">
</span><span class="cx"> if (isEmptyObject(this._breakpointMap[lineInfo.lineNumber]))
</span><span class="cx"> delete this._breakpointMap[lineInfo.lineNumber];
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _contentWillPopulate: function(content)
</del><ins>+ _contentWillPopulate(content)
</ins><span class="cx"> {
</span><span class="cx"> this.dispatchEventToListeners(WebInspector.SourceCodeTextEditor.Event.ContentWillPopulate);
</span><span class="cx">
</span><span class="lines">@@ -431,9 +413,9 @@
</span><span class="cx"> lastNewlineIndex = nextNewlineIndex + 1;
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _contentDidPopulate: function()
</del><ins>+ _contentDidPopulate()
</ins><span class="cx"> {
</span><span class="cx"> this._contentPopulated = true;
</span><span class="cx">
</span><span class="lines">@@ -446,9 +428,9 @@
</span><span class="cx"> this._reinsertAllIssues();
</span><span class="cx">
</span><span class="cx"> this._updateEditableMarkers();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _populateWithContent: function(content)
</del><ins>+ _populateWithContent(content)
</ins><span class="cx"> {
</span><span class="cx"> content = content || "";
</span><span class="cx">
</span><span class="lines">@@ -464,9 +446,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> this._contentDidPopulate();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _contentAvailable: function(parameters)
</del><ins>+ _contentAvailable(parameters)
</ins><span class="cx"> {
</span><span class="cx"> // Return if resource is not available.
</span><span class="cx"> if (parameters.error)
</span><span class="lines">@@ -487,23 +469,23 @@
</span><span class="cx"> this._invalidLineNumbers = {};
</span><span class="cx">
</span><span class="cx"> this._populateWithContent(content);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _breakpointStatusDidChange: function(event)
</del><ins>+ _breakpointStatusDidChange(event)
</ins><span class="cx"> {
</span><span class="cx"> this._updateBreakpointStatus(event.target);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _breakpointsEnabledDidChange: function()
</del><ins>+ _breakpointsEnabledDidChange()
</ins><span class="cx"> {
</span><span class="cx"> console.assert(this._supportsDebugging);
</span><span class="cx">
</span><span class="cx"> var breakpoints = WebInspector.debuggerManager.breakpointsForSourceCode(this._sourceCode);
</span><span class="cx"> for (var breakpoint of breakpoints)
</span><span class="cx"> this._updateBreakpointStatus(breakpoint);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _updateBreakpointStatus: function(breakpoint)
</del><ins>+ _updateBreakpointStatus(breakpoint)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(this._supportsDebugging);
</span><span class="cx">
</span><span class="lines">@@ -515,9 +497,9 @@
</span><span class="cx">
</span><span class="cx"> var lineInfo = this._editorLineInfoForSourceCodeLocation(breakpoint.sourceCodeLocation);
</span><span class="cx"> this.setBreakpointInfoForLineAndColumn(lineInfo.lineNumber, lineInfo.columnNumber, this._breakpointInfoForBreakpoint(breakpoint));
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _updateBreakpointLocation: function(event)
</del><ins>+ _updateBreakpointLocation(event)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(this._supportsDebugging);
</span><span class="cx">
</span><span class="lines">@@ -561,9 +543,9 @@
</span><span class="cx">
</span><span class="cx"> this._removeBreakpointWithEditorLineInfo(breakpoint, oldLineInfo);
</span><span class="cx"> this._addBreakpointWithEditorLineInfo(breakpoint, newLineInfo);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _breakpointAdded: function(event)
</del><ins>+ _breakpointAdded(event)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(this._supportsDebugging);
</span><span class="cx">
</span><span class="lines">@@ -580,9 +562,9 @@
</span><span class="cx"> var lineInfo = this._editorLineInfoForSourceCodeLocation(breakpoint.sourceCodeLocation);
</span><span class="cx"> this._addBreakpointWithEditorLineInfo(breakpoint, lineInfo);
</span><span class="cx"> this.setBreakpointInfoForLineAndColumn(lineInfo.lineNumber, lineInfo.columnNumber, this._breakpointInfoForBreakpoint(breakpoint));
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _breakpointRemoved: function(event)
</del><ins>+ _breakpointRemoved(event)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(this._supportsDebugging);
</span><span class="cx">
</span><span class="lines">@@ -599,9 +581,9 @@
</span><span class="cx"> var lineInfo = this._editorLineInfoForSourceCodeLocation(breakpoint.sourceCodeLocation);
</span><span class="cx"> this._removeBreakpointWithEditorLineInfo(breakpoint, lineInfo);
</span><span class="cx"> this.setBreakpointInfoForLineAndColumn(lineInfo.lineNumber, lineInfo.columnNumber, null);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _activeCallFrameDidChange: function()
</del><ins>+ _activeCallFrameDidChange()
</ins><span class="cx"> {
</span><span class="cx"> console.assert(this._supportsDebugging);
</span><span class="cx">
</span><span class="lines">@@ -642,9 +624,9 @@
</span><span class="cx"> this._populateWithInlineScriptContent();
</span><span class="cx"> else
</span><span class="cx"> this._populateWithScriptContent();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _activeCallFrameSourceCodeLocationChanged: function(event)
</del><ins>+ _activeCallFrameSourceCodeLocationChanged(event)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(!isNaN(this.executionLineNumber));
</span><span class="cx"> if (isNaN(this.executionLineNumber))
</span><span class="lines">@@ -656,9 +638,9 @@
</span><span class="cx"> var lineInfo = this._editorLineInfoForSourceCodeLocation(this._activeCallFrameSourceCodeLocation);
</span><span class="cx"> this.executionLineNumber = lineInfo.lineNumber;
</span><span class="cx"> this.executionColumnNumber = lineInfo.columnNumber;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _populateWithInlineScriptContent: function()
</del><ins>+ _populateWithInlineScriptContent()
</ins><span class="cx"> {
</span><span class="cx"> console.assert(this._sourceCode instanceof WebInspector.Resource);
</span><span class="cx"> console.assert(!this._fullContentPopulated);
</span><span class="lines">@@ -689,8 +671,8 @@
</span><span class="cx"> if (this._fullContentPopulated)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- const scriptOpenTag = "<script>";
- const scriptCloseTag = "</script>";
</del><ins>+ var scriptOpenTag = "<script>";
+ var scriptCloseTag = "</script>";
</ins><span class="cx">
</span><span class="cx"> var content = "";
</span><span class="cx"> var lineNumber = 0;
</span><span class="lines">@@ -728,9 +710,9 @@
</span><span class="cx"> var boundScriptContentAvailable = scriptContentAvailable.bind(this);
</span><span class="cx"> for (var i = 0; i < scripts.length; ++i)
</span><span class="cx"> scripts[i].requestContent().then(boundScriptContentAvailable);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _populateWithScriptContent: function()
</del><ins>+ _populateWithScriptContent()
</ins><span class="cx"> {
</span><span class="cx"> console.assert(this._sourceCode instanceof WebInspector.Resource);
</span><span class="cx"> console.assert(!this._fullContentPopulated);
</span><span class="lines">@@ -763,9 +745,9 @@
</span><span class="cx"> this._requestingScriptContent = true;
</span><span class="cx">
</span><span class="cx"> scripts[0].requestContent().then(scriptContentAvailable.bind(this));
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _matchesSourceCodeLocation: function(sourceCodeLocation)
</del><ins>+ _matchesSourceCodeLocation(sourceCodeLocation)
</ins><span class="cx"> {
</span><span class="cx"> if (this._sourceCode instanceof WebInspector.SourceMapResource)
</span><span class="cx"> return sourceCodeLocation.displaySourceCode === this._sourceCode;
</span><span class="lines">@@ -774,9 +756,9 @@
</span><span class="cx"> if (this._sourceCode instanceof WebInspector.Script)
</span><span class="cx"> return sourceCodeLocation.sourceCode === this._sourceCode;
</span><span class="cx"> return false;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _matchesBreakpoint: function(breakpoint)
</del><ins>+ _matchesBreakpoint(breakpoint)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(this._supportsDebugging);
</span><span class="cx"> if (this._sourceCode instanceof WebInspector.SourceMapResource)
</span><span class="lines">@@ -786,9 +768,9 @@
</span><span class="cx"> if (this._sourceCode instanceof WebInspector.Script)
</span><span class="cx"> return breakpoint.url === this._sourceCode.url || breakpoint.scriptIdentifier === this._sourceCode.id;
</span><span class="cx"> return false;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _matchesIssue: function(issue)
</del><ins>+ _matchesIssue(issue)
</ins><span class="cx"> {
</span><span class="cx"> if (this._sourceCode instanceof WebInspector.Resource)
</span><span class="cx"> return issue.url === this._sourceCode.url;
</span><span class="lines">@@ -796,18 +778,18 @@
</span><span class="cx"> if (this._sourceCode instanceof WebInspector.Script)
</span><span class="cx"> return issue.url === this._sourceCode.url;
</span><span class="cx"> return false;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _issueWasAdded: function(event)
</del><ins>+ _issueWasAdded(event)
</ins><span class="cx"> {
</span><span class="cx"> var issue = event.data.issue;
</span><span class="cx"> if (!this._matchesIssue(issue))
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> this._addIssue(issue);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _addIssue: function(issue)
</del><ins>+ _addIssue(issue)
</ins><span class="cx"> {
</span><span class="cx"> // FIXME: Issue should have a SourceCodeLocation.
</span><span class="cx"> var sourceCodeLocation = this._sourceCode.createSourceCodeLocation(issue.lineNumber, issue.columnNumber);
</span><span class="lines">@@ -843,9 +825,9 @@
</span><span class="cx">
</span><span class="cx"> this._updateIssueWidgetForIssues(widget, lineNumberIssues);
</span><span class="cx"> }
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _issueWidgetForLine: function(lineNumber)
</del><ins>+ _issueWidgetForLine(lineNumber)
</ins><span class="cx"> {
</span><span class="cx"> var widget = this._widgetMap.get(lineNumber);
</span><span class="cx"> if (widget)
</span><span class="lines">@@ -863,18 +845,18 @@
</span><span class="cx"> this._widgetMap.set(lineNumber, widget);
</span><span class="cx">
</span><span class="cx"> return widget;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _iconClassNameForIssueLevel: function(level)
</del><ins>+ _iconClassNameForIssueLevel(level)
</ins><span class="cx"> {
</span><span class="cx"> if (level === WebInspector.IssueMessage.Level.Warning)
</span><span class="cx"> return "icon-warning";
</span><span class="cx">
</span><span class="cx"> console.assert(level === WebInspector.IssueMessage.Level.Error);
</span><span class="cx"> return "icon-error";
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _updateIssueWidgetForIssues: function(widget, issues)
</del><ins>+ _updateIssueWidgetForIssues(widget, issues)
</ins><span class="cx"> {
</span><span class="cx"> var widgetElement = widget.widgetElement;
</span><span class="cx"> widgetElement.removeChildren();
</span><span class="lines">@@ -930,9 +912,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> widget.update();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _isWidgetToggleable: function(widget)
</del><ins>+ _isWidgetToggleable(widget)
</ins><span class="cx"> {
</span><span class="cx"> if (widget[WebInspector.SourceCodeTextEditor.WidgetContainsMultipleIssuesSymbol])
</span><span class="cx"> return true;
</span><span class="lines">@@ -945,9 +927,9 @@
</span><span class="cx"> return true;
</span><span class="cx">
</span><span class="cx"> return false;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _handleWidgetClick: function(widget, lineNumber, event)
</del><ins>+ _handleWidgetClick(widget, lineNumber, event)
</ins><span class="cx"> {
</span><span class="cx"> if (!this._isWidgetToggleable(widget))
</span><span class="cx"> return;
</span><span class="lines">@@ -956,12 +938,12 @@
</span><span class="cx">
</span><span class="cx"> var lineNumberIssues = this._issuesLineNumberMap.get(lineNumber);
</span><span class="cx"> this._updateIssueWidgetForIssues(widget, lineNumberIssues);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _breakpointInfoForBreakpoint: function(breakpoint)
</del><ins>+ _breakpointInfoForBreakpoint(breakpoint)
</ins><span class="cx"> {
</span><span class="cx"> return {resolved: breakpoint.resolved, disabled: breakpoint.disabled, autoContinue: breakpoint.autoContinue};
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> get _supportsDebugging()
</span><span class="cx"> {
</span><span class="lines">@@ -970,27 +952,46 @@
</span><span class="cx"> if (this._sourceCode instanceof WebInspector.Script)
</span><span class="cx"> return true;
</span><span class="cx"> return false;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> // TextEditor Delegate
</span><span class="cx">
</span><del>- textEditorBaseURL: function(textEditor)
</del><ins>+ textEditorBaseURL(textEditor)
</ins><span class="cx"> {
</span><span class="cx"> return this._sourceCode.url;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- textEditorShouldHideLineNumber: function(textEditor, lineNumber)
</del><ins>+ textEditorShouldHideLineNumber(textEditor, lineNumber)
</ins><span class="cx"> {
</span><span class="cx"> return lineNumber in this._invalidLineNumbers;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- textEditorGutterContextMenu: function(textEditor, lineNumber, columnNumber, editorBreakpoints, event)
</del><ins>+ textEditorGutterContextMenu(textEditor, lineNumber, columnNumber, editorBreakpoints, event)
</ins><span class="cx"> {
</span><span class="cx"> if (!this._supportsDebugging)
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> event.preventDefault();
</span><span class="cx">
</span><ins>+ function continueToLocation()
+ {
+ WebInspector.debuggerManager.continueToLocation(script.id, sourceCodeLocation.lineNumber, sourceCodeLocation.columnNumber);
+ }
+
+ function addBreakpoint()
+ {
+ var data = this.textEditorBreakpointAdded(this, 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();
+ }
+
</ins><span class="cx"> var contextMenu = new WebInspector.ContextMenu(event);
</span><span class="cx">
</span><span class="cx"> // Paused. Add Continue to Here option only if we have a script identifier for the location.
</span><span class="lines">@@ -1005,10 +1006,6 @@
</span><span class="cx"> var script = sourceCodeLocation.sourceCode.scriptForLocation(sourceCodeLocation);
</span><span class="cx">
</span><span class="cx"> if (script) {
</span><del>- function continueToLocation()
- {
- WebInspector.debuggerManager.continueToLocation(script.id, sourceCodeLocation.lineNumber, sourceCodeLocation.columnNumber);
- }
</del><span class="cx">
</span><span class="cx"> contextMenu.appendItem(WebInspector.UIString("Continue to Here"), continueToLocation);
</span><span class="cx"> contextMenu.appendSeparator();
</span><span class="lines">@@ -1026,11 +1023,6 @@
</span><span class="cx">
</span><span class="cx"> // No breakpoints.
</span><span class="cx"> if (!breakpoints.length) {
</span><del>- function addBreakpoint()
- {
- var data = this.textEditorBreakpointAdded(this, lineNumber, columnNumber);
- this.setBreakpointInfoForLineAndColumn(data.lineNumber, data.columnNumber, data.breakpointInfo);
- }
</del><span class="cx">
</span><span class="cx"> contextMenu.appendItem(WebInspector.UIString("Add Breakpoint"), addBreakpoint.bind(this));
</span><span class="cx"> contextMenu.show();
</span><span class="lines">@@ -1040,13 +1032,6 @@
</span><span class="cx"> // Single breakpoint.
</span><span class="cx"> if (breakpoints.length === 1) {
</span><span class="cx"> var breakpoint = breakpoints[0];
</span><del>- function revealInSidebar()
- {
- WebInspector.debuggerSidebarPanel.show();
- var treeElement = WebInspector.debuggerSidebarPanel.treeElementForRepresentedObject(breakpoint);
- if (treeElement)
- treeElement.revealAndSelect();
- }
</del><span class="cx">
</span><span class="cx"> breakpoint.appendContextMenuItems(contextMenu, event.target);
</span><span class="cx"> contextMenu.appendSeparator();
</span><span class="lines">@@ -1085,9 +1070,9 @@
</span><span class="cx"> contextMenu.appendItem(WebInspector.UIString("Enable Breakpoints"), toggleBreakpoints.bind(this));
</span><span class="cx"> contextMenu.appendItem(WebInspector.UIString("Delete Breakpoints"), removeBreakpoints.bind(this));
</span><span class="cx"> contextMenu.show();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- textEditorBreakpointAdded: function(textEditor, lineNumber, columnNumber)
</del><ins>+ textEditorBreakpointAdded(textEditor, lineNumber, columnNumber)
</ins><span class="cx"> {
</span><span class="cx"> if (!this._supportsDebugging)
</span><span class="cx"> return null;
</span><span class="lines">@@ -1113,9 +1098,9 @@
</span><span class="cx"> lineNumber: lineInfo.lineNumber,
</span><span class="cx"> columnNumber: lineInfo.columnNumber
</span><span class="cx"> };
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- textEditorBreakpointRemoved: function(textEditor, lineNumber, columnNumber)
</del><ins>+ textEditorBreakpointRemoved(textEditor, lineNumber, columnNumber)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(this._supportsDebugging);
</span><span class="cx"> if (!this._supportsDebugging)
</span><span class="lines">@@ -1132,9 +1117,9 @@
</span><span class="cx"> this._ignoreBreakpointRemovedBreakpoint = breakpoint;
</span><span class="cx"> WebInspector.debuggerManager.removeBreakpoint(breakpoint);
</span><span class="cx"> delete this._ignoreBreakpointAddedBreakpoint;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- textEditorBreakpointMoved: function(textEditor, oldLineNumber, oldColumnNumber, newLineNumber, newColumnNumber)
</del><ins>+ textEditorBreakpointMoved(textEditor, oldLineNumber, oldColumnNumber, newLineNumber, newColumnNumber)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(this._supportsDebugging);
</span><span class="cx"> if (!this._supportsDebugging)
</span><span class="lines">@@ -1159,9 +1144,9 @@
</span><span class="cx">
</span><span class="cx"> if (accurateNewLineInfo.lineNumber !== newLineInfo.lineNumber || accurateNewLineInfo.columnNumber !== newLineInfo.columnNumber)
</span><span class="cx"> this.updateBreakpointLineAndColumn(newLineInfo.lineNumber, newLineInfo.columnNumber, accurateNewLineInfo.lineNumber, accurateNewLineInfo.columnNumber);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- textEditorBreakpointClicked: function(textEditor, lineNumber, columnNumber)
</del><ins>+ textEditorBreakpointClicked(textEditor, lineNumber, columnNumber)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(this._supportsDebugging);
</span><span class="cx"> if (!this._supportsDebugging)
</span><span class="lines">@@ -1173,9 +1158,9 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> breakpoint.cycleToNextMode();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- textEditorUpdatedFormatting: function(textEditor)
</del><ins>+ textEditorUpdatedFormatting(textEditor)
</ins><span class="cx"> {
</span><span class="cx"> this._ignoreAllBreakpointLocationUpdates = true;
</span><span class="cx"> this._sourceCode.formatterSourceMap = this.formatterSourceMap;
</span><span class="lines">@@ -1211,17 +1196,17 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> this._reinsertAllIssues();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _clearWidgets: function()
</del><ins>+ _clearWidgets()
</ins><span class="cx"> {
</span><span class="cx"> for (var widget of this._widgetMap.values())
</span><span class="cx"> widget.clear();
</span><span class="cx">
</span><span class="cx"> this._widgetMap.clear();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _reinsertAllIssues: function()
</del><ins>+ _reinsertAllIssues()
</ins><span class="cx"> {
</span><span class="cx"> this._issuesLineNumberMap.clear();
</span><span class="cx"> this._clearWidgets();
</span><span class="lines">@@ -1231,18 +1216,18 @@
</span><span class="cx"> console.assert(this._matchesIssue(issue));
</span><span class="cx"> this._addIssue(issue);
</span><span class="cx"> }
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _debuggerDidPause: function(event)
</del><ins>+ _debuggerDidPause(event)
</ins><span class="cx"> {
</span><span class="cx"> this._updateTokenTrackingControllerState();
</span><span class="cx"> if (this._typeTokenAnnotator && this._typeTokenAnnotator.isActive())
</span><span class="cx"> this._typeTokenAnnotator.refresh();
</span><span class="cx"> if (this._basicBlockAnnotator && this._basicBlockAnnotator.isActive())
</span><span class="cx"> this._basicBlockAnnotator.refresh();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _debuggerDidResume: function(event)
</del><ins>+ _debuggerDidResume(event)
</ins><span class="cx"> {
</span><span class="cx"> this._updateTokenTrackingControllerState();
</span><span class="cx"> this._dismissPopover();
</span><span class="lines">@@ -1250,17 +1235,17 @@
</span><span class="cx"> this._typeTokenAnnotator.refresh();
</span><span class="cx"> if (this._basicBlockAnnotator && this._basicBlockAnnotator.isActive())
</span><span class="cx"> this._basicBlockAnnotator.refresh();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _sourceCodeSourceMapAdded: function(event)
</del><ins>+ _sourceCodeSourceMapAdded(event)
</ins><span class="cx"> {
</span><span class="cx"> WebInspector.notifications.addEventListener(WebInspector.Notification.GlobalModifierKeysDidChange, this._updateTokenTrackingControllerState, this);
</span><span class="cx"> this._sourceCode.removeEventListener(WebInspector.SourceCode.Event.SourceMapAdded, this._sourceCodeSourceMapAdded, this);
</span><span class="cx">
</span><span class="cx"> this._updateTokenTrackingControllerState();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _updateTokenTrackingControllerState: function()
</del><ins>+ _updateTokenTrackingControllerState()
</ins><span class="cx"> {
</span><span class="cx"> var mode = WebInspector.CodeMirrorTokenTrackingController.Mode.None;
</span><span class="cx"> if (WebInspector.debuggerManager.paused)
</span><span class="lines">@@ -1297,20 +1282,20 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> this.tokenTrackingController.mode = mode;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _hasColorMarkers: function()
</del><ins>+ _hasColorMarkers()
</ins><span class="cx"> {
</span><span class="cx"> for (var marker of this.markers) {
</span><span class="cx"> if (marker.type === WebInspector.TextMarker.Type.Color)
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx"> return false;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> // CodeMirrorTokenTrackingController Delegate
</span><span class="cx">
</span><del>- tokenTrackingControllerCanReleaseHighlightedRange: function(tokenTrackingController, element)
</del><ins>+ tokenTrackingControllerCanReleaseHighlightedRange(tokenTrackingController, element)
</ins><span class="cx"> {
</span><span class="cx"> if (!this._popover)
</span><span class="cx"> return true;
</span><span class="lines">@@ -1319,15 +1304,15 @@
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> return true;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- tokenTrackingControllerHighlightedRangeReleased: function(tokenTrackingController)
</del><ins>+ tokenTrackingControllerHighlightedRangeReleased(tokenTrackingController)
</ins><span class="cx"> {
</span><span class="cx"> if (!this._mouseIsOverPopover)
</span><span class="cx"> this._dismissPopover();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- tokenTrackingControllerHighlightedRangeWasClicked: function(tokenTrackingController)
</del><ins>+ tokenTrackingControllerHighlightedRangeWasClicked(tokenTrackingController)
</ins><span class="cx"> {
</span><span class="cx"> if (this.tokenTrackingController.mode !== WebInspector.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens)
</span><span class="cx"> return;
</span><span class="lines">@@ -1341,9 +1326,9 @@
</span><span class="cx"> WebInspector.resourceSidebarPanel.showOriginalOrFormattedSourceCodeLocation(sourceCodeLocation);
</span><span class="cx"> else
</span><span class="cx"> WebInspector.resourceSidebarPanel.showSourceCodeLocation(sourceCodeLocation);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- tokenTrackingControllerNewHighlightCandidate: function(tokenTrackingController, candidate)
</del><ins>+ tokenTrackingControllerNewHighlightCandidate(tokenTrackingController, candidate)
</ins><span class="cx"> {
</span><span class="cx"> if (this.tokenTrackingController.mode === WebInspector.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens) {
</span><span class="cx"> this.tokenTrackingController.highlightRange(candidate.hoveredTokenRange);
</span><span class="lines">@@ -1367,14 +1352,14 @@
</span><span class="cx"> else
</span><span class="cx"> this._dismissEditingController();
</span><span class="cx"> }
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- tokenTrackingControllerMouseOutOfHoveredMarker: function(tokenTrackingController, hoveredMarker)
</del><ins>+ tokenTrackingControllerMouseOutOfHoveredMarker(tokenTrackingController, hoveredMarker)
</ins><span class="cx"> {
</span><span class="cx"> this._dismissEditingController();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _tokenTrackingControllerHighlightedJavaScriptExpression: function(candidate)
</del><ins>+ _tokenTrackingControllerHighlightedJavaScriptExpression(candidate)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(candidate.expression);
</span><span class="cx">
</span><span class="lines">@@ -1414,9 +1399,9 @@
</span><span class="cx">
</span><span class="cx"> // No call frame available. Use the main page's context.
</span><span class="cx"> RuntimeAgent.evaluate.invoke({expression: candidate.expression, objectGroup: "popover", doNotPauseOnExceptionsAndMuteConsole: true}, populate.bind(this));
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _tokenTrackingControllerHighlightedJavaScriptTypeInformation: function(candidate)
</del><ins>+ _tokenTrackingControllerHighlightedJavaScriptTypeInformation(candidate)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(candidate.expression);
</span><span class="cx">
</span><span class="lines">@@ -1449,9 +1434,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RuntimeAgent.getRuntimeTypesForVariablesAtOffsets(allRequests, handler.bind(this));
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _showPopover: function(content, bounds)
</del><ins>+ _showPopover(content, bounds)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(this.tokenTrackingController.candidate || bounds);
</span><span class="cx">
</span><span class="lines">@@ -1477,9 +1462,9 @@
</span><span class="cx"> this.tokenTrackingController.highlightRange(candidate.expressionRange);
</span><span class="cx">
</span><span class="cx"> this._trackPopoverEvents();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _showPopoverForFunction: function(data)
</del><ins>+ _showPopoverForFunction(data)
</ins><span class="cx"> {
</span><span class="cx"> var candidate = this.tokenTrackingController.candidate;
</span><span class="cx">
</span><span class="lines">@@ -1512,9 +1497,9 @@
</span><span class="cx"> this._showPopover(content);
</span><span class="cx"> }
</span><span class="cx"> DebuggerAgent.getFunctionDetails(data.objectId, didGetDetails.bind(this));
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _showPopoverForObject: function(data)
</del><ins>+ _showPopoverForObject(data)
</ins><span class="cx"> {
</span><span class="cx"> var content = document.createElement("div");
</span><span class="cx"> content.className = "object expandable";
</span><span class="lines">@@ -1534,22 +1519,22 @@
</span><span class="cx"> bodyElement.appendChild(objectTree.element);
</span><span class="cx">
</span><span class="cx"> this._showPopover(content);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _showPopoverWithFormattedValue: function(remoteObject)
</del><ins>+ _showPopoverWithFormattedValue(remoteObject)
</ins><span class="cx"> {
</span><span class="cx"> var content = WebInspector.FormattedValue.createElementForRemoteObject(remoteObject);
</span><span class="cx"> this._showPopover(content);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- willDismissPopover: function(popover)
</del><ins>+ willDismissPopover(popover)
</ins><span class="cx"> {
</span><span class="cx"> this.tokenTrackingController.removeHighlightedRange();
</span><span class="cx">
</span><span class="cx"> RuntimeAgent.releaseObjectGroup("popover");
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _dismissPopover: function()
</del><ins>+ _dismissPopover()
</ins><span class="cx"> {
</span><span class="cx"> if (!this._popover)
</span><span class="cx"> return;
</span><span class="lines">@@ -1560,9 +1545,9 @@
</span><span class="cx"> this._popoverEventListenersAreRegistered = false;
</span><span class="cx"> this._popoverEventListeners.unregister();
</span><span class="cx"> }
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _trackPopoverEvents: function()
</del><ins>+ _trackPopoverEvents()
</ins><span class="cx"> {
</span><span class="cx"> if (!this._popoverEventListeners)
</span><span class="cx"> this._popoverEventListeners = new WebInspector.EventListenerSet(this, "Popover listeners");
</span><span class="lines">@@ -1572,27 +1557,27 @@
</span><span class="cx"> this._popoverEventListeners.register(this._popover.element, "mouseout", this._popoverMouseout);
</span><span class="cx"> this._popoverEventListeners.install();
</span><span class="cx"> }
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _popoverMouseover: function(event)
</del><ins>+ _popoverMouseover(event)
</ins><span class="cx"> {
</span><span class="cx"> this._mouseIsOverPopover = true;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _popoverMouseout: function(event)
</del><ins>+ _popoverMouseout(event)
</ins><span class="cx"> {
</span><span class="cx"> this._mouseIsOverPopover = this._popover.element.contains(event.relatedTarget);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _updateEditableMarkers: function(range)
</del><ins>+ _updateEditableMarkers(range)
</ins><span class="cx"> {
</span><span class="cx"> this.createColorMarkers(range);
</span><span class="cx"> this.createGradientMarkers(range);
</span><span class="cx">
</span><span class="cx"> this._updateTokenTrackingControllerState();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _tokenTrackingControllerHighlightedMarkedExpression: function(candidate, markers)
</del><ins>+ _tokenTrackingControllerHighlightedMarkedExpression(candidate, markers)
</ins><span class="cx"> {
</span><span class="cx"> // Look for the outermost editable marker.
</span><span class="cx"> var editableMarker;
</span><span class="lines">@@ -1629,20 +1614,20 @@
</span><span class="cx">
</span><span class="cx"> this._editingController.delegate = this;
</span><span class="cx"> this._editingController.presentHoverMenu();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _dismissEditingController: function(discrete)
</del><ins>+ _dismissEditingController(discrete)
</ins><span class="cx"> {
</span><span class="cx"> if (this._editingController)
</span><span class="cx"> this._editingController.dismissHoverMenu(discrete);
</span><span class="cx">
</span><span class="cx"> this.tokenTrackingController.hoveredMarker = null;
</span><span class="cx"> delete this._editingController;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> // CodeMirrorEditingController Delegate
</span><span class="cx">
</span><del>- editingControllerDidStartEditing: function(editingController)
</del><ins>+ editingControllerDidStartEditing(editingController)
</ins><span class="cx"> {
</span><span class="cx"> // We can pause the token tracking controller during editing, it will be reset
</span><span class="cx"> // to the expected state by calling _updateEditableMarkers() in the
</span><span class="lines">@@ -1654,18 +1639,18 @@
</span><span class="cx">
</span><span class="cx"> // We ignore content changes made as a result of color editing.
</span><span class="cx"> this._ignoreContentDidChange++;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- editingControllerDidFinishEditing: function(editingController)
</del><ins>+ editingControllerDidFinishEditing(editingController)
</ins><span class="cx"> {
</span><span class="cx"> this._updateEditableMarkers(editingController.range);
</span><span class="cx">
</span><span class="cx"> this._ignoreContentDidChange--;
</span><span class="cx">
</span><span class="cx"> delete this._editingController;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _setTypeTokenAnnotatorEnabledState: function(shouldActivate)
</del><ins>+ _setTypeTokenAnnotatorEnabledState(shouldActivate)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(this._typeTokenAnnotator);
</span><span class="cx"> if (!this._typeTokenAnnotator)
</span><span class="lines">@@ -1700,9 +1685,9 @@
</span><span class="cx"> WebInspector.showJavaScriptTypeInformationSetting.value = shouldActivate;
</span><span class="cx">
</span><span class="cx"> this._updateTokenTrackingControllerState();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _getAssociatedScript: function()
</del><ins>+ _getAssociatedScript()
</ins><span class="cx"> {
</span><span class="cx"> var script = null;
</span><span class="cx"> // FIXME: This needs to me modified to work with HTML files with inline script tags.
</span><span class="lines">@@ -1711,9 +1696,9 @@
</span><span class="cx"> else if (this._sourceCode instanceof WebInspector.Resource && this._sourceCode.type === WebInspector.Resource.Type.Script && this._sourceCode.scripts.length)
</span><span class="cx"> script = this._sourceCode.scripts[0];
</span><span class="cx"> return script;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _makeTypeTokenAnnotator: function()
</del><ins>+ _makeTypeTokenAnnotator()
</ins><span class="cx"> {
</span><span class="cx"> if (!RuntimeAgent.getRuntimeTypesForVariablesAtOffsets)
</span><span class="cx"> return;
</span><span class="lines">@@ -1723,9 +1708,9 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> this._typeTokenAnnotator = new WebInspector.TypeTokenAnnotator(this, script);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _makeBasicBlockAnnotator: function()
</del><ins>+ _makeBasicBlockAnnotator()
</ins><span class="cx"> {
</span><span class="cx"> if (!RuntimeAgent.getBasicBlocks)
</span><span class="cx"> return;
</span><span class="lines">@@ -1735,24 +1720,24 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> this._basicBlockAnnotator = new WebInspector.BasicBlockAnnotator(this, script);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _enableScrollEventsForTypeTokenAnnotator: function()
</del><ins>+ _enableScrollEventsForTypeTokenAnnotator()
</ins><span class="cx"> {
</span><span class="cx"> // Pause updating type tokens while scrolling to prevent frame loss.
</span><span class="cx"> console.assert(!this._typeTokenScrollHandler);
</span><span class="cx"> this._typeTokenScrollHandler = this._makeTypeTokenScrollEventHandler();
</span><span class="cx"> this.addScrollHandler(this._typeTokenScrollHandler);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _disableScrollEventsForTypeTokenAnnotator: function()
</del><ins>+ _disableScrollEventsForTypeTokenAnnotator()
</ins><span class="cx"> {
</span><span class="cx"> console.assert(this._typeTokenScrollHandler);
</span><span class="cx"> this.removeScrollHandler(this._typeTokenScrollHandler);
</span><span class="cx"> this._typeTokenScrollHandler = null;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _makeTypeTokenScrollEventHandler: function()
</del><ins>+ _makeTypeTokenScrollEventHandler()
</ins><span class="cx"> {
</span><span class="cx"> var timeoutIdentifier = null;
</span><span class="cx"> function scrollHandler()
</span><span class="lines">@@ -1779,4 +1764,17 @@
</span><span class="cx"> }
</span><span class="cx"> };
</span><span class="cx">
</span><del>-WebInspector.SourceCodeTextEditor.prototype.__proto__ = WebInspector.TextEditor.prototype;
</del><ins>+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"
+};
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsTextEditorjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js (182053 => 182054)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -23,90 +23,65 @@
</span><span class="cx"> * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-WebInspector.TextEditor = function(element, mimeType, delegate)
</del><ins>+WebInspector.TextEditor = class TextEditor extends WebInspector.Object
</ins><span class="cx"> {
</span><del>- // FIXME: Convert this to a WebInspector.Object subclass, and call super().
- // WebInspector.Object.call(this);
</del><ins>+ constructor(element, mimeType, delegate)
+ {
+ super();
</ins><span class="cx">
</span><del>- var text = (element ? element.textContent : "");
- this._element = element || document.createElement("div");
- this._element.classList.add(WebInspector.TextEditor.StyleClassName);
- this._element.classList.add(WebInspector.SyntaxHighlightedStyleClassName);
</del><ins>+ var text = (element ? element.textContent : "");
+ this._element = element || document.createElement("div");
+ this._element.classList.add("text-editor");
+ this._element.classList.add(WebInspector.SyntaxHighlightedStyleClassName);
</ins><span class="cx">
</span><del>- this._codeMirror = CodeMirror(this.element, {
- readOnly: true,
- indentWithTabs: true,
- indentUnit: 4,
- lineNumbers: true,
- lineWrapping: true,
- matchBrackets: true,
- autoCloseBrackets: true
- });
</del><ins>+ this._codeMirror = CodeMirror(this.element, {
+ readOnly: true,
+ indentWithTabs: true,
+ indentUnit: 4,
+ lineNumbers: true,
+ lineWrapping: true,
+ matchBrackets: true,
+ autoCloseBrackets: true
+ });
</ins><span class="cx">
</span><del>- 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);
</del><ins>+ 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);
</ins><span class="cx">
</span><del>- this._completionController = new WebInspector.CodeMirrorCompletionController(this._codeMirror, this);
- this._tokenTrackingController = new WebInspector.CodeMirrorTokenTrackingController(this._codeMirror, this);
</del><ins>+ this._completionController = new WebInspector.CodeMirrorCompletionController(this._codeMirror, this);
+ this._tokenTrackingController = new WebInspector.CodeMirrorTokenTrackingController(this._codeMirror, this);
</ins><span class="cx">
</span><del>- this._initialStringNotSet = true;
</del><ins>+ this._initialStringNotSet = true;
</ins><span class="cx">
</span><del>- this.mimeType = mimeType;
</del><ins>+ this.mimeType = mimeType;
</ins><span class="cx">
</span><del>- this._breakpoints = {};
- this._executionLineNumber = NaN;
- this._executionColumnNumber = NaN;
</del><ins>+ this._breakpoints = {};
+ this._executionLineNumber = NaN;
+ this._executionColumnNumber = NaN;
</ins><span class="cx">
</span><del>- this._searchQuery = null;
- this._searchResults = [];
- this._currentSearchResultIndex = -1;
- this._ignoreCodeMirrorContentDidChangeEvent = 0;
</del><ins>+ this._searchQuery = null;
+ this._searchResults = [];
+ this._currentSearchResultIndex = -1;
+ this._ignoreCodeMirrorContentDidChangeEvent = 0;
</ins><span class="cx">
</span><del>- this._formatted = false;
- this._formatterSourceMap = null;
</del><ins>+ this._formatted = false;
+ this._formatterSourceMap = null;
</ins><span class="cx">
</span><del>- this._delegate = delegate || null;
-};
</del><ins>+ this._delegate = delegate || null;
+ }
</ins><span class="cx">
</span><del>-// 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,
-
</del><span class="cx"> // Public
</span><span class="cx">
</span><span class="cx"> get element()
</span><span class="cx"> {
</span><span class="cx"> return this._element;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> get string()
</span><span class="cx"> {
</span><span class="cx"> return this._codeMirror.getValue();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> set string(newString)
</span><span class="cx"> {
</span><span class="lines">@@ -146,22 +121,22 @@
</span><span class="cx"> this._codeMirror.operation(update.bind(this));
</span><span class="cx"> this._ignoreCodeMirrorContentDidChangeEvent--;
</span><span class="cx"> console.assert(this._ignoreCodeMirrorContentDidChangeEvent >= 0);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> get readOnly()
</span><span class="cx"> {
</span><span class="cx"> return this._codeMirror.getOption("readOnly") || false;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> set readOnly(readOnly)
</span><span class="cx"> {
</span><span class="cx"> this._codeMirror.setOption("readOnly", readOnly);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> get formatted()
</span><span class="cx"> {
</span><span class="cx"> return this._formatted;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> set formatted(formatted)
</span><span class="cx"> {
</span><span class="lines">@@ -180,52 +155,52 @@
</span><span class="cx"> this._formatted = formatted;
</span><span class="cx">
</span><span class="cx"> this.dispatchEventToListeners(WebInspector.TextEditor.Event.FormattingDidChange);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> set autoFormat(auto)
</span><span class="cx"> {
</span><span class="cx"> this._autoFormat = auto;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- hasFormatter: function()
</del><ins>+ hasFormatter()
</ins><span class="cx"> {
</span><del>- const supportedModes = {
</del><ins>+ var supportedModes = {
</ins><span class="cx"> "javascript": true,
</span><span class="cx"> "css": true,
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> var mode = this._codeMirror.getMode();
</span><span class="cx"> return mode.name in supportedModes;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- canBeFormatted: function()
</del><ins>+ canBeFormatted()
</ins><span class="cx"> {
</span><span class="cx"> // Can be overriden by subclasses.
</span><span class="cx"> return this.hasFormatter();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- canShowTypeAnnotations: function()
</del><ins>+ canShowTypeAnnotations()
</ins><span class="cx"> {
</span><span class="cx"> return false;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> get selectedTextRange()
</span><span class="cx"> {
</span><span class="cx"> var start = this._codeMirror.getCursor(true);
</span><span class="cx"> var end = this._codeMirror.getCursor(false);
</span><span class="cx"> return this._textRangeFromCodeMirrorPosition(start, end);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> set selectedTextRange(textRange)
</span><span class="cx"> {
</span><span class="cx"> var position = this._codeMirrorPositionFromTextRange(textRange);
</span><span class="cx"> this._codeMirror.setSelection(position.start, position.end);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> get mimeType()
</span><span class="cx"> {
</span><span class="cx"> return this._mimeType;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> set mimeType(newMIMEType)
</span><span class="cx"> {
</span><span class="lines">@@ -233,12 +208,12 @@
</span><span class="cx">
</span><span class="cx"> this._mimeType = newMIMEType;
</span><span class="cx"> this._codeMirror.setOption("mode", newMIMEType);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> get executionLineNumber()
</span><span class="cx"> {
</span><span class="cx"> return this._executionLineNumber;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> set executionLineNumber(lineNumber)
</span><span class="cx"> {
</span><span class="lines">@@ -252,47 +227,47 @@
</span><span class="cx"> // Still dispatch the event even if the number didn't change. The execution state still
</span><span class="cx"> // could have changed (e.g. continuing in a loop with a breakpoint inside).
</span><span class="cx"> this.dispatchEventToListeners(WebInspector.TextEditor.Event.ExecutionLineNumberDidChange);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> get executionColumnNumber()
</span><span class="cx"> {
</span><span class="cx"> return this._executionColumnNumber;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> set executionColumnNumber(columnNumber)
</span><span class="cx"> {
</span><span class="cx"> this._executionColumnNumber = columnNumber;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> get formatterSourceMap()
</span><span class="cx"> {
</span><span class="cx"> return this._formatterSourceMap;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> get tokenTrackingController()
</span><span class="cx"> {
</span><span class="cx"> return this._tokenTrackingController;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> get delegate()
</span><span class="cx"> {
</span><span class="cx"> return this._delegate;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> set delegate(newDelegate)
</span><span class="cx"> {
</span><span class="cx"> this._delegate = newDelegate || null;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> get numberOfSearchResults()
</span><span class="cx"> {
</span><span class="cx"> return this._searchResults.length;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> get currentSearchQuery()
</span><span class="cx"> {
</span><span class="cx"> return this._searchQuery;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> set automaticallyRevealFirstSearchResult(reveal)
</span><span class="cx"> {
</span><span class="lines">@@ -303,9 +278,9 @@
</span><span class="cx"> if (this._currentSearchResultIndex === -1)
</span><span class="cx"> this._revealFirstSearchResultAfterCursor();
</span><span class="cx"> }
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- performSearch: function(query)
</del><ins>+ performSearch(query)
</ins><span class="cx"> {
</span><span class="cx"> if (this._searchQuery === query)
</span><span class="cx"> return;
</span><span class="lines">@@ -367,9 +342,9 @@
</span><span class="cx">
</span><span class="cx"> // Start the search.
</span><span class="cx"> boundBatchSearch();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- addSearchResults: function(textRanges)
</del><ins>+ addSearchResults(textRanges)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(textRanges);
</span><span class="cx"> if (!textRanges || !textRanges.length)
</span><span class="lines">@@ -391,9 +366,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> this._codeMirror.operation(markRanges.bind(this));
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- searchCleared: function()
</del><ins>+ searchCleared()
</ins><span class="cx"> {
</span><span class="cx"> function clearResults() {
</span><span class="cx"> for (var i = 0; i < this._searchResults.length; ++i)
</span><span class="lines">@@ -405,17 +380,17 @@
</span><span class="cx"> this._searchQuery = null;
</span><span class="cx"> this._searchResults = [];
</span><span class="cx"> this._currentSearchResultIndex = -1;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- searchQueryWithSelection: function()
</del><ins>+ searchQueryWithSelection()
</ins><span class="cx"> {
</span><span class="cx"> if (!this._codeMirror.somethingSelected())
</span><span class="cx"> return null;
</span><span class="cx">
</span><span class="cx"> return this._codeMirror.getSelection();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- revealPreviousSearchResult: function(changeFocus)
</del><ins>+ revealPreviousSearchResult(changeFocus)
</ins><span class="cx"> {
</span><span class="cx"> if (!this._searchResults.length)
</span><span class="cx"> return;
</span><span class="lines">@@ -431,9 +406,9 @@
</span><span class="cx"> this._currentSearchResultIndex = this._searchResults.length - 1;
</span><span class="cx">
</span><span class="cx"> this._revealSearchResult(this._searchResults[this._currentSearchResultIndex], changeFocus, -1);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- revealNextSearchResult: function(changeFocus)
</del><ins>+ revealNextSearchResult(changeFocus)
</ins><span class="cx"> {
</span><span class="cx"> if (!this._searchResults.length)
</span><span class="cx"> return;
</span><span class="lines">@@ -449,25 +424,25 @@
</span><span class="cx"> this._currentSearchResultIndex = 0;
</span><span class="cx">
</span><span class="cx"> this._revealSearchResult(this._searchResults[this._currentSearchResultIndex], changeFocus, 1);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- line: function(lineNumber)
</del><ins>+ line(lineNumber)
</ins><span class="cx"> {
</span><span class="cx"> return this._codeMirror.getLine(lineNumber);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- getTextInRange: function(startPosition, endPosition)
</del><ins>+ getTextInRange(startPosition, endPosition)
</ins><span class="cx"> {
</span><span class="cx"> return this._codeMirror.getRange(startPosition, endPosition);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- addStyleToTextRange: function(startPosition, endPosition, styleClassName)
</del><ins>+ addStyleToTextRange(startPosition, endPosition, styleClassName)
</ins><span class="cx"> {
</span><span class="cx"> endPosition.ch += 1;
</span><span class="cx"> return this._codeMirror.getDoc().markText(startPosition, endPosition, {className: styleClassName, inclusiveLeft: true, inclusiveRight: true});
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- revealPosition: function(position, textRangeToSelect, forceUnformatted, noHighlight)
</del><ins>+ revealPosition(position, textRangeToSelect, forceUnformatted, noHighlight)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(position === undefined || position instanceof WebInspector.SourceCodePosition, "revealPosition called without a SourceCodePosition");
</span><span class="cx"> if (!(position instanceof WebInspector.SourceCodePosition))
</span><span class="lines">@@ -524,14 +499,14 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> this._codeMirror.operation(revealAndHighlightLine.bind(this));
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- updateLayout: function(force)
</del><ins>+ updateLayout(force)
</ins><span class="cx"> {
</span><span class="cx"> this._codeMirror.refresh();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- shown: function()
</del><ins>+ shown()
</ins><span class="cx"> {
</span><span class="cx"> this._visible = true;
</span><span class="cx">
</span><span class="lines">@@ -542,14 +517,14 @@
</span><span class="cx"> // This needs to be done as a separate operation from the refresh
</span><span class="cx"> // so that the scrollInfo coordinates are correct.
</span><span class="cx"> this._revealPendingPositionIfPossible();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- hidden: function()
</del><ins>+ hidden()
</ins><span class="cx"> {
</span><span class="cx"> this._visible = false;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- setBreakpointInfoForLineAndColumn: function(lineNumber, columnNumber, breakpointInfo)
</del><ins>+ setBreakpointInfoForLineAndColumn(lineNumber, columnNumber, breakpointInfo)
</ins><span class="cx"> {
</span><span class="cx"> if (this._ignoreSetBreakpointInfoCalls)
</span><span class="cx"> return;
</span><span class="lines">@@ -558,9 +533,9 @@
</span><span class="cx"> this._addBreakpointToLineAndColumnWithInfo(lineNumber, columnNumber, breakpointInfo);
</span><span class="cx"> else
</span><span class="cx"> this._removeBreakpointFromLineAndColumn(lineNumber, columnNumber);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- updateBreakpointLineAndColumn: function(oldLineNumber, oldColumnNumber, newLineNumber, newColumnNumber)
</del><ins>+ updateBreakpointLineAndColumn(oldLineNumber, oldColumnNumber, newLineNumber, newColumnNumber)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(this._breakpoints[oldLineNumber]);
</span><span class="cx"> if (!this._breakpoints[oldLineNumber])
</span><span class="lines">@@ -573,18 +548,18 @@
</span><span class="cx"> var breakpointInfo = this._breakpoints[oldLineNumber][oldColumnNumber];
</span><span class="cx"> this._removeBreakpointFromLineAndColumn(oldLineNumber, oldColumnNumber);
</span><span class="cx"> this._addBreakpointToLineAndColumnWithInfo(newLineNumber, newColumnNumber, breakpointInfo);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- addStyleClassToLine: function(lineNumber, styleClassName)
</del><ins>+ addStyleClassToLine(lineNumber, styleClassName)
</ins><span class="cx"> {
</span><span class="cx"> var lineHandle = this._codeMirror.getLineHandle(lineNumber);
</span><span class="cx"> if (!lineHandle)
</span><span class="cx"> return null;
</span><span class="cx">
</span><span class="cx"> return this._codeMirror.addLineClass(lineHandle, "wrap", styleClassName);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- removeStyleClassFromLine: function(lineNumber, styleClassName)
</del><ins>+ removeStyleClassFromLine(lineNumber, styleClassName)
</ins><span class="cx"> {
</span><span class="cx"> var lineHandle = this._codeMirror.getLineHandle(lineNumber);
</span><span class="cx"> console.assert(lineHandle);
</span><span class="lines">@@ -592,9 +567,9 @@
</span><span class="cx"> return null;
</span><span class="cx">
</span><span class="cx"> return this._codeMirror.removeLineClass(lineHandle, "wrap", styleClassName);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- toggleStyleClassForLine: function(lineNumber, styleClassName)
</del><ins>+ toggleStyleClassForLine(lineNumber, styleClassName)
</ins><span class="cx"> {
</span><span class="cx"> var lineHandle = this._codeMirror.getLineHandle(lineNumber);
</span><span class="cx"> console.assert(lineHandle);
</span><span class="lines">@@ -602,9 +577,9 @@
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> return this._codeMirror.toggleLineClass(lineHandle, "wrap", styleClassName);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- createWidgetForLine: function(lineNumber)
</del><ins>+ createWidgetForLine(lineNumber)
</ins><span class="cx"> {
</span><span class="cx"> var lineHandle = this._codeMirror.getLineHandle(lineNumber);
</span><span class="cx"> if (!lineHandle)
</span><span class="lines">@@ -613,53 +588,53 @@
</span><span class="cx"> var widgetElement = document.createElement("div");
</span><span class="cx"> var lineWidget = this._codeMirror.addLineWidget(lineHandle, widgetElement, {coverGutter: false, noHScroll: true, handleMouseEvents: true});
</span><span class="cx"> return new WebInspector.LineWidget(lineWidget, widgetElement);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> get lineCount()
</span><span class="cx"> {
</span><span class="cx"> return this._codeMirror.lineCount();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- focus: function()
</del><ins>+ focus()
</ins><span class="cx"> {
</span><span class="cx"> this._codeMirror.focus();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- contentDidChange: function(replacedRanges, newRanges)
</del><ins>+ contentDidChange(replacedRanges, newRanges)
</ins><span class="cx"> {
</span><span class="cx"> // Implemented by subclasses.
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- rectsForRange: function(range)
</del><ins>+ rectsForRange(range)
</ins><span class="cx"> {
</span><span class="cx"> return this._codeMirror.rectsForRange(range);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> get markers()
</span><span class="cx"> {
</span><span class="cx"> return this._codeMirror.getAllMarks().map(function(codeMirrorTextMarker) {
</span><span class="cx"> return WebInspector.TextMarker.textMarkerForCodeMirrorTextMarker(codeMirrorTextMarker);
</span><span class="cx"> });
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- markersAtPosition: function(position)
</del><ins>+ markersAtPosition(position)
</ins><span class="cx"> {
</span><span class="cx"> return this._codeMirror.findMarksAt(position).map(function(codeMirrorTextMarker) {
</span><span class="cx"> return WebInspector.TextMarker.textMarkerForCodeMirrorTextMarker(codeMirrorTextMarker);
</span><span class="cx"> });
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- createColorMarkers: function(range)
</del><ins>+ createColorMarkers(range)
</ins><span class="cx"> {
</span><span class="cx"> return this._codeMirror.createColorMarkers(range);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- createGradientMarkers: function(range)
</del><ins>+ createGradientMarkers(range)
</ins><span class="cx"> {
</span><span class="cx"> return this._codeMirror.createGradientMarkers(range);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- editingControllerForMarker: function(editableMarker)
</del><ins>+ editingControllerForMarker(editableMarker)
</ins><span class="cx"> {
</span><span class="cx"> switch (editableMarker.type) {
</span><span class="cx"> case WebInspector.TextMarker.Type.Color:
</span><span class="lines">@@ -669,9 +644,9 @@
</span><span class="cx"> default:
</span><span class="cx"> return new WebInspector.CodeMirrorEditingController(this._codeMirror, editableMarker);
</span><span class="cx"> }
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- visibleRangeOffsets: function()
</del><ins>+ visibleRangeOffsets()
</ins><span class="cx"> {
</span><span class="cx"> var startOffset = null;
</span><span class="cx"> var endOffset = null;
</span><span class="lines">@@ -686,9 +661,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return {startOffset, endOffset};
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- originalOffsetToCurrentPosition: function(offset)
</del><ins>+ originalOffsetToCurrentPosition(offset)
</ins><span class="cx"> {
</span><span class="cx"> var position = null;
</span><span class="cx"> if (this._formatterSourceMap) {
</span><span class="lines">@@ -698,14 +673,14 @@
</span><span class="cx"> position = this._codeMirror.getDoc().posFromIndex(offset);
</span><span class="cx">
</span><span class="cx"> return position;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- currentOffsetToCurrentPosition: function(offset)
</del><ins>+ currentOffsetToCurrentPosition(offset)
</ins><span class="cx"> {
</span><span class="cx"> return this._codeMirror.getDoc().posFromIndex(offset);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- currentPositionToOriginalOffset: function(position)
</del><ins>+ currentPositionToOriginalOffset(position)
</ins><span class="cx"> {
</span><span class="cx"> var offset = null;
</span><span class="cx"> if (this._formatterSourceMap)
</span><span class="lines">@@ -714,36 +689,36 @@
</span><span class="cx"> offset = this.tokenTrackingController._codeMirror.getDoc().indexFromPos(position);
</span><span class="cx">
</span><span class="cx"> return offset;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- currentPositionToCurrentOffset: function(position)
</del><ins>+ currentPositionToCurrentOffset(position)
</ins><span class="cx"> {
</span><span class="cx"> return this._codeMirror.getDoc().indexFromPos(position);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- setInlineWidget: function(position, inlineElement)
</del><ins>+ setInlineWidget(position, inlineElement)
</ins><span class="cx"> {
</span><span class="cx"> return this._codeMirror.setUniqueBookmark(position, {widget: inlineElement});
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- addScrollHandler: function(handler)
</del><ins>+ addScrollHandler(handler)
</ins><span class="cx"> {
</span><span class="cx"> this._codeMirror.on("scroll", handler);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- removeScrollHandler: function(handler)
</del><ins>+ removeScrollHandler(handler)
</ins><span class="cx"> {
</span><span class="cx"> this._codeMirror.off("scroll", handler);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> // Protected
</span><span class="cx">
</span><del>- prettyPrint: function(pretty)
</del><ins>+ prettyPrint(pretty)
</ins><span class="cx"> {
</span><span class="cx"> function prettyPrintAndUpdateEditor()
</span><span class="cx"> {
</span><del>- const start = {line: 0, ch: 0};
- const end = {line: this._codeMirror.lineCount() - 1};
</del><ins>+ var start = {line: 0, ch: 0};
+ var end = {line: this._codeMirror.lineCount() - 1};
</ins><span class="cx">
</span><span class="cx"> var oldSelectionAnchor = this._codeMirror.getCursor("anchor");
</span><span class="cx"> var oldSelectionHead = this._codeMirror.getCursor("head");
</span><span class="lines">@@ -752,7 +727,7 @@
</span><span class="cx">
</span><span class="cx"> if (pretty) {
</span><span class="cx"> // <rdar://problem/10593948> Provide a way to change the tab width in the Web Inspector
</span><del>- const indentString = " ";
</del><ins>+ var indentString = " ";
</ins><span class="cx"> var originalLineEndings = [];
</span><span class="cx"> var formattedLineEndings = [];
</span><span class="cx"> var mapping = {original: [0], formatted: [0]};
</span><span class="lines">@@ -836,16 +811,16 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> this._codeMirror.operation(prettyPrintAndUpdateEditor.bind(this));
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><span class="cx"> // Private
</span><span class="cx">
</span><del>- hasEdits: function()
</del><ins>+ hasEdits()
</ins><span class="cx"> {
</span><span class="cx"> return !this._codeMirror.isClean();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _contentChanged: function(codeMirror, change)
</del><ins>+ _contentChanged(codeMirror, change)
</ins><span class="cx"> {
</span><span class="cx"> if (this._ignoreCodeMirrorContentDidChangeEvent > 0)
</span><span class="cx"> return;
</span><span class="lines">@@ -880,26 +855,26 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> this.dispatchEventToListeners(WebInspector.TextEditor.Event.ContentDidChange);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _textRangeFromCodeMirrorPosition: function(start, end)
</del><ins>+ _textRangeFromCodeMirrorPosition(start, end)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(start);
</span><span class="cx"> console.assert(end);
</span><span class="cx">
</span><span class="cx"> return new WebInspector.TextRange(start.line, start.ch, end.line, end.ch);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _codeMirrorPositionFromTextRange: function(textRange)
</del><ins>+ _codeMirrorPositionFromTextRange(textRange)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(textRange);
</span><span class="cx">
</span><span class="cx"> var start = {line: textRange.startLine, ch: textRange.startColumn};
</span><span class="cx"> var end = {line: textRange.endLine, ch: textRange.endColumn};
</span><span class="cx"> return {start, end};
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _revealPendingPositionIfPossible: function()
</del><ins>+ _revealPendingPositionIfPossible()
</ins><span class="cx"> {
</span><span class="cx"> // Nothing to do if we don't have a pending position.
</span><span class="cx"> if (!this._positionToReveal)
</span><span class="lines">@@ -910,9 +885,9 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> this.revealPosition(this._positionToReveal, this._textRangeToSelect, this._forceUnformatted);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _revealSearchResult: function(result, changeFocus, directionInCaseOfRevalidation)
</del><ins>+ _revealSearchResult(result, changeFocus, directionInCaseOfRevalidation)
</ins><span class="cx"> {
</span><span class="cx"> var position = result.find();
</span><span class="cx">
</span><span class="lines">@@ -972,9 +947,9 @@
</span><span class="cx">
</span><span class="cx"> // Listen for the end of the animation so we can remove the element.
</span><span class="cx"> this._bouncyHighlightElement.addEventListener("webkitAnimationEnd", animationEnded.bind(this));
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _binarySearchInsertionIndexInSearchResults: function(object, comparator)
</del><ins>+ _binarySearchInsertionIndexInSearchResults(object, comparator)
</ins><span class="cx"> {
</span><span class="cx"> // It is possible that markers in the search results array may have been deleted.
</span><span class="cx"> // In those cases the comparator will return "null" and we immediately stop
</span><span class="lines">@@ -998,9 +973,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return first - 1;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _revealFirstSearchResultBeforeCursor: function(changeFocus)
</del><ins>+ _revealFirstSearchResultBeforeCursor(changeFocus)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(this._searchResults.length);
</span><span class="cx">
</span><span class="lines">@@ -1025,9 +1000,9 @@
</span><span class="cx">
</span><span class="cx"> this._currentSearchResultIndex = index;
</span><span class="cx"> this._revealSearchResult(this._searchResults[this._currentSearchResultIndex], changeFocus);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _revealFirstSearchResultAfterCursor: function(changeFocus)
</del><ins>+ _revealFirstSearchResultAfterCursor(changeFocus)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(this._searchResults.length);
</span><span class="cx">
</span><span class="lines">@@ -1057,9 +1032,9 @@
</span><span class="cx">
</span><span class="cx"> this._currentSearchResultIndex = index;
</span><span class="cx"> this._revealSearchResult(this._searchResults[this._currentSearchResultIndex], changeFocus);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _cursorDoesNotMatchLastRevealedSearchResult: function()
</del><ins>+ _cursorDoesNotMatchLastRevealedSearchResult()
</ins><span class="cx"> {
</span><span class="cx"> console.assert(this._currentSearchResultIndex !== -1);
</span><span class="cx"> console.assert(this._searchResults.length);
</span><span class="lines">@@ -1072,9 +1047,9 @@
</span><span class="cx"> var lastRevealedSearchResultPosition = lastRevealedSearchResultMarker.from;
</span><span class="cx">
</span><span class="cx"> return WebInspector.compareCodeMirrorPositions(currentCursorPosition, lastRevealedSearchResultPosition) !== 0;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _revalidateSearchResults: function(direction)
</del><ins>+ _revalidateSearchResults(direction)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(direction !== undefined);
</span><span class="cx">
</span><span class="lines">@@ -1097,9 +1072,9 @@
</span><span class="cx"> else
</span><span class="cx"> this._revealFirstSearchResultBeforeCursor();
</span><span class="cx"> }
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _updateExecutionLine: function()
</del><ins>+ _updateExecutionLine()
</ins><span class="cx"> {
</span><span class="cx"> function update()
</span><span class="cx"> {
</span><span class="lines">@@ -1113,9 +1088,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> this._codeMirror.operation(update.bind(this));
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _setBreakpointStylesOnLine: function(lineNumber)
</del><ins>+ _setBreakpointStylesOnLine(lineNumber)
</ins><span class="cx"> {
</span><span class="cx"> var columnBreakpoints = this._breakpoints[lineNumber];
</span><span class="cx"> console.assert(columnBreakpoints);
</span><span class="lines">@@ -1170,18 +1145,18 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> this._codeMirror.operation(updateStyles.bind(this));
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _addBreakpointToLineAndColumnWithInfo: function(lineNumber, columnNumber, breakpointInfo)
</del><ins>+ _addBreakpointToLineAndColumnWithInfo(lineNumber, columnNumber, breakpointInfo)
</ins><span class="cx"> {
</span><span class="cx"> if (!this._breakpoints[lineNumber])
</span><span class="cx"> this._breakpoints[lineNumber] = {};
</span><span class="cx"> this._breakpoints[lineNumber][columnNumber] = breakpointInfo;
</span><span class="cx">
</span><span class="cx"> this._setBreakpointStylesOnLine(lineNumber);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _removeBreakpointFromLineAndColumn: function(lineNumber, columnNumber)
</del><ins>+ _removeBreakpointFromLineAndColumn(lineNumber, columnNumber)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(columnNumber in this._breakpoints[lineNumber]);
</span><span class="cx"> delete this._breakpoints[lineNumber][columnNumber];
</span><span class="lines">@@ -1208,21 +1183,21 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> this._codeMirror.operation(updateStyles.bind(this));
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _allColumnBreakpointInfoForLine: function(lineNumber)
</del><ins>+ _allColumnBreakpointInfoForLine(lineNumber)
</ins><span class="cx"> {
</span><span class="cx"> return this._breakpoints[lineNumber];
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _setColumnBreakpointInfoForLine: function(lineNumber, columnBreakpointInfo)
</del><ins>+ _setColumnBreakpointInfoForLine(lineNumber, columnBreakpointInfo)
</ins><span class="cx"> {
</span><span class="cx"> console.assert(columnBreakpointInfo);
</span><span class="cx"> this._breakpoints[lineNumber] = columnBreakpointInfo;
</span><span class="cx"> this._setBreakpointStylesOnLine(lineNumber);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _gutterMouseDown: function(codeMirror, lineNumber, gutterElement, event)
</del><ins>+ _gutterMouseDown(codeMirror, lineNumber, gutterElement, event)
</ins><span class="cx"> {
</span><span class="cx"> if (event.button !== 0 || event.ctrlKey)
</span><span class="cx"> return;
</span><span class="lines">@@ -1265,9 +1240,9 @@
</span><span class="cx"> // Register these listeners on the document so we can track the mouse if it leaves the gutter.
</span><span class="cx"> document.addEventListener("mousemove", this._documentMouseMovedEventListener, true);
</span><span class="cx"> document.addEventListener("mouseup", this._documentMouseUpEventListener, true);
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _gutterContextMenu: function(codeMirror, lineNumber, gutterElement, event)
</del><ins>+ _gutterContextMenu(codeMirror, lineNumber, gutterElement, event)
</ins><span class="cx"> {
</span><span class="cx"> if (this._delegate && typeof this._delegate.textEditorGutterContextMenu === "function") {
</span><span class="cx"> var breakpoints = [];
</span><span class="lines">@@ -1276,9 +1251,9 @@
</span><span class="cx">
</span><span class="cx"> this._delegate.textEditorGutterContextMenu(this, lineNumber, 0, breakpoints, event);
</span><span class="cx"> }
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _documentMouseMoved: function(event)
</del><ins>+ _documentMouseMoved(event)
</ins><span class="cx"> {
</span><span class="cx"> console.assert("_lineNumberWithMousedDownBreakpoint" in this);
</span><span class="cx"> if (!("_lineNumberWithMousedDownBreakpoint" in this))
</span><span class="lines">@@ -1332,9 +1307,9 @@
</span><span class="cx"> this._lineNumberWithDraggedBreakpoint = lineNumber;
</span><span class="cx"> this._columnNumberWithDraggedBreakpoint = columnNumber;
</span><span class="cx"> }
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _documentMouseUp: function(event)
</del><ins>+ _documentMouseUp(event)
</ins><span class="cx"> {
</span><span class="cx"> console.assert("_lineNumberWithMousedDownBreakpoint" in this);
</span><span class="cx"> if (!("_lineNumberWithMousedDownBreakpoint" in this))
</span><span class="lines">@@ -1345,9 +1320,9 @@
</span><span class="cx"> document.removeEventListener("mousemove", this._documentMouseMovedEventListener, true);
</span><span class="cx"> document.removeEventListener("mouseup", this._documentMouseUpEventListener, true);
</span><span class="cx">
</span><del>- 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";
</del><ins>+ 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";
</ins><span class="cx">
</span><span class="cx"> if (this._mouseDragged) {
</span><span class="cx"> if (!("_lineNumberWithDraggedBreakpoint" in this)) {
</span><span class="lines">@@ -1393,9 +1368,9 @@
</span><span class="cx"> delete this._columnNumberWithDraggedBreakpoint;
</span><span class="cx"> delete this._previousColumnBreakpointInfo;
</span><span class="cx"> delete this._mouseDragged;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _openClickedLinks: function(event)
</del><ins>+ _openClickedLinks(event)
</ins><span class="cx"> {
</span><span class="cx"> // Get the position in the text and the token at that position.
</span><span class="cx"> var position = this._codeMirror.coordsChar({left: event.pageX, top: event.pageY});
</span><span class="lines">@@ -1421,9 +1396,9 @@
</span><span class="cx"> // Stop processing the event.
</span><span class="cx"> event.preventDefault();
</span><span class="cx"> event.stopPropagation();
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _isPositionVisible: function(position)
</del><ins>+ _isPositionVisible(position)
</ins><span class="cx"> {
</span><span class="cx"> var scrollInfo = this._codeMirror.getScrollInfo();
</span><span class="cx"> var visibleRangeStart = scrollInfo.top;
</span><span class="lines">@@ -1431,9 +1406,9 @@
</span><span class="cx"> var coords = this._codeMirror.charCoords(position, "local");
</span><span class="cx">
</span><span class="cx"> return coords.top >= visibleRangeStart && coords.bottom <= visibleRangeEnd;
</span><del>- },
</del><ins>+ }
</ins><span class="cx">
</span><del>- _scrollIntoViewCentered: function(position)
</del><ins>+ _scrollIntoViewCentered(position)
</ins><span class="cx"> {
</span><span class="cx"> var scrollInfo = this._codeMirror.getScrollInfo();
</span><span class="cx"> var lineHeight = Math.ceil(this._codeMirror.defaultTextHeight());
</span><span class="lines">@@ -1442,4 +1417,21 @@
</span><span class="cx"> }
</span><span class="cx"> };
</span><span class="cx">
</span><del>-WebInspector.TextEditor.prototype.__proto__ = WebInspector.Object.prototype;
</del><ins>+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"
+};
</ins></span></pre>
</div>
</div>
</body>
</html>