<!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>[193274] branches/safari-601-branch/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/193274">193274</a></dd>
<dt>Author</dt> <dd>timothy@apple.com</dd>
<dt>Date</dt> <dd>2015-12-03 11:04:34 -0800 (Thu, 03 Dec 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/191496">r191496</a>. rdar://problem/23221163</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari601branchSourceWebInspectorUIChangeLog">branches/safari-601-branch/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#branchessafari601branchSourceWebInspectorUIUserInterfaceControllersCodeMirrorCompletionControllerjs">branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js</a></li>
<li><a href="#branchessafari601branchSourceWebInspectorUIUserInterfaceControllersCodeMirrorTokenTrackingControllerjs">branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTokenTrackingController.js</a></li>
<li><a href="#branchessafari601branchSourceWebInspectorUIUserInterfaceViewsSourceCodeTextEditorjs">branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari601branchSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-601-branch/Source/WebInspectorUI/ChangeLog (193273 => 193274)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601-branch/Source/WebInspectorUI/ChangeLog        2015-12-03 19:04:28 UTC (rev 193273)
+++ branches/safari-601-branch/Source/WebInspectorUI/ChangeLog        2015-12-03 19:04:34 UTC (rev 193274)
</span><span class="lines">@@ -1,5 +1,61 @@
</span><span class="cx"> 2015-12-02  Timothy Hatcher  &lt;timothy@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r191496. rdar://problem/23221163
+
+    2015-10-23  Nikita Vasilyev  &lt;nvasilyev@apple.com&gt;
+
+            Web Inspector: Command-Enter in Debugger should show a popover with evaluation result
+            https://bugs.webkit.org/show_bug.cgi?id=149195
+
+            Currenty, the only way to display the popover is to hover over the text with a mouse cursor.
+            Provide a way to display it via a keyboard shortcut.
+
+            Reviewed by Timothy Hatcher.
+
+            * UserInterface/Controllers/CodeMirrorCompletionController.js:
+            (WebInspector.CodeMirrorCompletionController): Deleted.
+            (WebInspector.CodeMirrorCompletionController.prototype._generateJavaScriptCompletions): Deleted.
+            Don't evaluate selected text from Debugger or Sources in the console.
+
+            * UserInterface/Controllers/CodeMirrorTokenTrackingController.js:
+            (WebInspector.CodeMirrorTokenTrackingController):
+            (WebInspector.CodeMirrorTokenTrackingController.prototype._handleCommandEnterKey):
+            (WebInspector.CodeMirrorTokenTrackingController.prototype._hidePopover):
+            Cmd-Enter triggers the popover, Esc hides it.
+
+            (WebInspector.CodeMirrorTokenTrackingController.prototype.set mode):
+            (WebInspector.CodeMirrorTokenTrackingController.prototype.removeHighlightedRange):
+            Don't use delete.
+
+            (WebInspector.CodeMirrorTokenTrackingController.prototype._mouseMovedWithMarkedText):
+            When a token isn't hovered, hide it only when it was triggered not by the keyboard.
+
+            (WebInspector.CodeMirrorTokenTrackingController.prototype._markedTextIsNoLongerHovered):
+            Don't use delete.
+
+            (WebInspector.CodeMirrorTokenTrackingController.prototype._updateHoveredTokenInfo):
+            (WebInspector.CodeMirrorTokenTrackingController.prototype._getTokenInfoForPosition):
+            Abstract out a no side effects _getTokenInfoForPosition method, which is also used by _handleCommandEnterKey.
+
+            (WebInspector.CodeMirrorTokenTrackingController.prototype._mouseMovedOutOfEditor):
+            (WebInspector.CodeMirrorTokenTrackingController.prototype._mouseButtonWasReleasedOverEditor):
+            Don't use delete.
+
+            (WebInspector.CodeMirrorTokenTrackingController.prototype._processNewHoveredToken):
+            (WebInspector.CodeMirrorTokenTrackingController.prototype._processNonSymbolToken):
+            (WebInspector.CodeMirrorTokenTrackingController.prototype._processJavaScriptExpression):
+            Pass tokenInfo as an argument to explicitly state that these methods require it.
+
+            (WebInspector.CodeMirrorTokenTrackingController.prototype._resetTrackingStates):
+            Don't use delete.
+
+            * UserInterface/Views/SourceCodeTextEditor.js:
+            (WebInspector.SourceCodeTextEditor.prototype.tokenTrackingControllerHighlightedRangeReleased):
+            Allow to hide the popover regardless of mouse position. Used when the text cursor moves or
+            when Esc key is pressed.
+
+2015-12-02  Timothy Hatcher  &lt;timothy@apple.com&gt;
+
</ins><span class="cx">         Merge r191493. rdar://problem/23221163
</span><span class="cx"> 
</span><span class="cx">     2015-10-23  Devin Rousso  &lt;dcrousso+webkit@gmail.com&gt;
</span></span></pre></div>
<a id="branchessafari601branchSourceWebInspectorUIUserInterfaceControllersCodeMirrorCompletionControllerjs"></a>
<div class="modfile"><h4>Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js (193273 => 193274)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js        2015-12-03 19:04:28 UTC (rev 193273)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js        2015-12-03 19:04:34 UTC (rev 193274)
</span><span class="lines">@@ -51,7 +51,6 @@
</span><span class="cx">             &quot;Right&quot;: this._handleRightOrEnterKey.bind(this),
</span><span class="cx">             &quot;Esc&quot;: this._handleEscapeKey.bind(this),
</span><span class="cx">             &quot;Enter&quot;: this._handleRightOrEnterKey.bind(this),
</span><del>-            &quot;Cmd-Enter&quot;: this._handleCommandEnterKey.bind(this),
</del><span class="cx">             &quot;Tab&quot;: this._handleTabKey.bind(this),
</span><span class="cx">             &quot;Cmd-A&quot;: this._handleHideKey.bind(this),
</span><span class="cx">             &quot;Cmd-Z&quot;: this._handleHideKey.bind(this),
</span><span class="lines">@@ -724,19 +723,6 @@
</span><span class="cx">         this._commitCompletionHint();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    _handleCommandEnterKey(codeMirror)
-    {
-        var modeName = codeMirror.getMode().name;
-        if (modeName !== &quot;javascript&quot; &amp;&amp; modeName !== &quot;htmlmixed&quot;)
-            return CodeMirror.Pass;
-
-        var selectedText = codeMirror.getSelection();
-        if (!selectedText)
-            return CodeMirror.Pass;
-
-        WebInspector.consoleLogViewController.consolePromptTextCommitted(null, selectedText);
-    }
-
</del><span class="cx">     _handleEscapeKey(codeMirror)
</span><span class="cx">     {
</span><span class="cx">         var delegateImplementsShouldAllowEscapeCompletion = this._delegate &amp;&amp; typeof this._delegate.completionControllerShouldAllowEscapeCompletion === &quot;function&quot;;
</span></span></pre></div>
<a id="branchessafari601branchSourceWebInspectorUIUserInterfaceControllersCodeMirrorTokenTrackingControllerjs"></a>
<div class="modfile"><h4>Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTokenTrackingController.js (193273 => 193274)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTokenTrackingController.js        2015-12-03 19:04:28 UTC (rev 193273)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorTokenTrackingController.js        2015-12-03 19:04:34 UTC (rev 193274)
</span><span class="lines">@@ -41,8 +41,17 @@
</span><span class="cx"> 
</span><span class="cx">         this._enabled = false;
</span><span class="cx">         this._tracking = false;
</span><del>-        this._hoveredTokenInfo = null;
</del><ins>+        this._previousTokenInfo = null;
</ins><span class="cx">         this._hoveredMarker = null;
</span><ins>+
+        var hidePopover = this._hidePopover.bind(this);
+
+        this._codeMirror.addKeyMap({
+            &quot;Cmd-Enter&quot;: this._handleCommandEnterKey.bind(this),
+            &quot;Esc&quot;: hidePopover
+        });
+
+        this._codeMirror.on(&quot;cursorActivity&quot;, hidePopover);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Public
</span><span class="lines">@@ -93,8 +102,8 @@
</span><span class="cx"> 
</span><span class="cx">         this._mode = mode || WebInspector.CodeMirrorTokenTrackingController.Mode.None;
</span><span class="cx"> 
</span><del>-        if (oldMode !== this._mode &amp;&amp; this._tracking &amp;&amp; this._hoveredTokenInfo)
-            this._processNewHoveredToken();
</del><ins>+        if (oldMode !== this._mode &amp;&amp; this._tracking &amp;&amp; this._previousTokenInfo)
+            this._processNewHoveredToken(this._previousTokenInfo);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     get mouseOverDelayDuration()
</span><span class="lines">@@ -174,7 +183,7 @@
</span><span class="cx">             return;
</span><span class="cx"> 
</span><span class="cx">         this._codeMirrorMarkedText.clear();
</span><del>-        delete this._codeMirrorMarkedText;
</del><ins>+        this._codeMirrorMarkedText = null;
</ins><span class="cx"> 
</span><span class="cx">         window.removeEventListener(&quot;mousemove&quot;, this, true);
</span><span class="cx">     }
</span><span class="lines">@@ -249,6 +258,26 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    _handleCommandEnterKey(codeMirror)
+    {
+        var tokenInfo = this._getTokenInfoForPosition(codeMirror.getCursor(&quot;head&quot;));
+        tokenInfo.triggeredBy = WebInspector.CodeMirrorTokenTrackingController.TriggeredBy.Keyboard;
+        this._processNewHoveredToken(tokenInfo);
+    }
+
+    _hidePopover()
+    {
+        if (!this._candidate)
+            return CodeMirror.Pass;
+
+        if (this._delegate &amp;&amp; typeof this._delegate.tokenTrackingControllerHighlightedRangeReleased === &quot;function&quot;) {
+            var forceHidePopover = true;
+            this._delegate.tokenTrackingControllerHighlightedRangeReleased(this, forceHidePopover);
+        }
+
+        this._candidate = null;
+    }
+
</ins><span class="cx">     _mouseEntered(event)
</span><span class="cx">     {
</span><span class="cx">         if (!this._tracking)
</span><span class="lines">@@ -262,6 +291,9 @@
</span><span class="cx"> 
</span><span class="cx">     _mouseMovedWithMarkedText(event)
</span><span class="cx">     {
</span><ins>+        if (this._candidate &amp;&amp; this._candidate.triggeredBy === WebInspector.CodeMirrorTokenTrackingController.TriggeredBy.Keyboard)
+            return;
+
</ins><span class="cx">         var shouldRelease = !event.target.classList.contains(this._classNameForHighlightedRange);
</span><span class="cx">         if (shouldRelease &amp;&amp; this._delegate &amp;&amp; typeof this._delegate.tokenTrackingControllerCanReleaseHighlightedRange === &quot;function&quot;)
</span><span class="cx">             shouldRelease = this._delegate.tokenTrackingControllerCanReleaseHighlightedRange(this, event.target);
</span><span class="lines">@@ -272,15 +304,18 @@
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        clearTimeout(this._markedTextMouseoutTimer);
-        delete this._markedTextMouseoutTimer;
</del><ins>+        if (this._markedTextMouseoutTimer)
+            clearTimeout(this._markedTextMouseoutTimer);
+
+        this._markedTextMouseoutTimer = 0;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     _markedTextIsNoLongerHovered()
</span><span class="cx">     {
</span><span class="cx">         if (this._delegate &amp;&amp; typeof this._delegate.tokenTrackingControllerHighlightedRangeReleased === &quot;function&quot;)
</span><span class="cx">             this._delegate.tokenTrackingControllerHighlightedRangeReleased(this);
</span><del>-        delete this._markedTextMouseoutTimer;
</del><ins>+
+        this._markedTextMouseoutTimer = 0;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     _mouseMovedOverEditor(event)
</span><span class="lines">@@ -305,35 +340,47 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Stop right here if we're hovering the same token as we were last time.
</span><del>-        if (this._hoveredTokenInfo &amp;&amp;
-            this._hoveredTokenInfo.position.line === position.line &amp;&amp;
-            this._hoveredTokenInfo.token.start === token.start &amp;&amp;
-            this._hoveredTokenInfo.token.end === token.end)
</del><ins>+        if (this._previousTokenInfo &amp;&amp;
+            this._previousTokenInfo.position.line === position.line &amp;&amp;
+            this._previousTokenInfo.token.start === token.start &amp;&amp;
+            this._previousTokenInfo.token.end === token.end)
</ins><span class="cx">             return;
</span><span class="cx"> 
</span><span class="cx">         // We have a new hovered token.
</span><ins>+        var tokenInfo = this._previousTokenInfo = this._getTokenInfoForPosition(position);
+
+        if (this._tokenHoverTimer)
+            clearTimeout(this._tokenHoverTimer);
+
+        this._tokenHoverTimer = 0;
+
+        if (this._codeMirrorMarkedText || !this._mouseOverDelayDuration)
+            this._processNewHoveredToken(tokenInfo);
+        else
+            this._tokenHoverTimer = setTimeout(this._processNewHoveredToken.bind(this, tokenInfo), this._mouseOverDelayDuration);
+    }
+
+    _getTokenInfoForPosition(position)
+    {
+        var token = this._codeMirror.getTokenAt(position);
</ins><span class="cx">         var innerMode = CodeMirror.innerMode(this._codeMirror.getMode(), token.state);
</span><span class="cx">         var codeMirrorModeName = innerMode.mode.alternateName || innerMode.mode.name;
</span><del>-        this._hoveredTokenInfo = {
</del><ins>+        return {
</ins><span class="cx">             token,
</span><span class="cx">             position,
</span><span class="cx">             innerMode,
</span><span class="cx">             modeName: codeMirrorModeName
</span><span class="cx">         };
</span><del>-
-        clearTimeout(this._tokenHoverTimer);
-
-        if (this._codeMirrorMarkedText || !this._mouseOverDelayDuration)
-            this._processNewHoveredToken();
-        else
-            this._tokenHoverTimer = setTimeout(this._processNewHoveredToken.bind(this), this._mouseOverDelayDuration);
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     _mouseMovedOutOfEditor(event)
</span><span class="cx">     {
</span><del>-        clearTimeout(this._tokenHoverTimer);
-        delete this._hoveredTokenInfo;
-        delete this._selectionMayBeInProgress;
</del><ins>+        if (this._tokenHoverTimer)
+            clearTimeout(this._tokenHoverTimer);
+
+        this._tokenHoverTimer = 0;
+        this._previousTokenInfo = null;
+        this._selectionMayBeInProgress = false;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     _mouseButtonWasPressedOverEditor(event)
</span><span class="lines">@@ -343,10 +390,10 @@
</span><span class="cx"> 
</span><span class="cx">     _mouseButtonWasReleasedOverEditor(event)
</span><span class="cx">     {
</span><del>-        delete this._selectionMayBeInProgress;
</del><ins>+        this._selectionMayBeInProgress = false;
</ins><span class="cx">         this._mouseMovedOverEditor(event);
</span><span class="cx"> 
</span><del>-        if (this._codeMirrorMarkedText &amp;&amp; this._hoveredTokenInfo) {
</del><ins>+        if (this._codeMirrorMarkedText &amp;&amp; this._previousTokenInfo) {
</ins><span class="cx">             var position = this._codeMirror.coordsChar({left: event.pageX, top: event.pageY});
</span><span class="cx">             var marks = this._codeMirror.findMarksAt(position);
</span><span class="cx">             for (var i = 0; i &lt; marks.length; ++i) {
</span><span class="lines">@@ -365,9 +412,9 @@
</span><span class="cx">         this._resetTrackingStates();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    _processNewHoveredToken()
</del><ins>+    _processNewHoveredToken(tokenInfo)
</ins><span class="cx">     {
</span><del>-        console.assert(this._hoveredTokenInfo);
</del><ins>+        console.assert(tokenInfo);
</ins><span class="cx"> 
</span><span class="cx">         if (this._selectionMayBeInProgress)
</span><span class="cx">             return;
</span><span class="lines">@@ -376,51 +423,55 @@
</span><span class="cx"> 
</span><span class="cx">         switch (this._mode) {
</span><span class="cx">         case WebInspector.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens:
</span><del>-            this._candidate = this._processNonSymbolToken();
</del><ins>+            this._candidate = this._processNonSymbolToken(tokenInfo);
</ins><span class="cx">             break;
</span><span class="cx">         case WebInspector.CodeMirrorTokenTrackingController.Mode.JavaScriptExpression:
</span><span class="cx">         case WebInspector.CodeMirrorTokenTrackingController.Mode.JavaScriptTypeInformation:
</span><del>-            this._candidate = this._processJavaScriptExpression();
</del><ins>+            this._candidate = this._processJavaScriptExpression(tokenInfo);
</ins><span class="cx">             break;
</span><span class="cx">         case WebInspector.CodeMirrorTokenTrackingController.Mode.MarkedTokens:
</span><del>-            this._candidate = this._processMarkedToken();
</del><ins>+            this._candidate = this._processMarkedToken(tokenInfo);
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (!this._candidate)
</span><span class="cx">             return;
</span><span class="cx"> 
</span><del>-        clearTimeout(this._markedTextMouseoutTimer);
-        delete this._markedTextMouseoutTimer;
</del><ins>+        this._candidate.triggeredBy = tokenInfo.triggeredBy;
</ins><span class="cx"> 
</span><ins>+        if (this._markedTextMouseoutTimer)
+            clearTimeout(this._markedTextMouseoutTimer);
+
+        this._markedTextMouseoutTimer = 0;
+
</ins><span class="cx">         if (this._delegate &amp;&amp; typeof this._delegate.tokenTrackingControllerNewHighlightCandidate === &quot;function&quot;)
</span><span class="cx">             this._delegate.tokenTrackingControllerNewHighlightCandidate(this, this._candidate);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    _processNonSymbolToken()
</del><ins>+    _processNonSymbolToken(tokenInfo)
</ins><span class="cx">     {
</span><span class="cx">         // Ignore any symbol tokens.
</span><del>-        var type = this._hoveredTokenInfo.token.type;
</del><ins>+        var type = tokenInfo.token.type;
</ins><span class="cx">         if (!type)
</span><span class="cx">             return null;
</span><span class="cx"> 
</span><del>-        var startPosition = {line: this._hoveredTokenInfo.position.line, ch: this._hoveredTokenInfo.token.start};
-        var endPosition = {line: this._hoveredTokenInfo.position.line, ch: this._hoveredTokenInfo.token.end};
</del><ins>+        var startPosition = {line: tokenInfo.position.line, ch: tokenInfo.token.start};
+        var endPosition = {line: tokenInfo.position.line, ch: tokenInfo.token.end};
</ins><span class="cx"> 
</span><span class="cx">         return {
</span><del>-            hoveredToken: this._hoveredTokenInfo.token,
</del><ins>+            hoveredToken: tokenInfo.token,
</ins><span class="cx">             hoveredTokenRange: {start: startPosition, end: endPosition},
</span><span class="cx">         };
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    _processJavaScriptExpression()
</del><ins>+    _processJavaScriptExpression(tokenInfo)
</ins><span class="cx">     {
</span><span class="cx">         // Only valid within JavaScript.
</span><del>-        if (this._hoveredTokenInfo.modeName !== &quot;javascript&quot;)
</del><ins>+        if (tokenInfo.modeName !== &quot;javascript&quot;)
</ins><span class="cx">             return null;
</span><span class="cx"> 
</span><del>-        var startPosition = {line: this._hoveredTokenInfo.position.line, ch: this._hoveredTokenInfo.token.start};
-        var endPosition = {line: this._hoveredTokenInfo.position.line, ch: this._hoveredTokenInfo.token.end};
</del><ins>+        var startPosition = {line: tokenInfo.position.line, ch: tokenInfo.token.start};
+        var endPosition = {line: tokenInfo.position.line, ch: tokenInfo.token.end};
</ins><span class="cx"> 
</span><span class="cx">         function tokenIsInRange(token, range)
</span><span class="cx">         {
</span><span class="lines">@@ -437,7 +488,7 @@
</span><span class="cx"> 
</span><span class="cx">             if (tokenIsInRange(startPosition, selectionRange) || tokenIsInRange(endPosition, selectionRange)) {
</span><span class="cx">                 return {
</span><del>-                    hoveredToken: this._hoveredTokenInfo.token,
</del><ins>+                    hoveredToken: tokenInfo.token,
</ins><span class="cx">                     hoveredTokenRange: selectionRange,
</span><span class="cx">                     expression: this._codeMirror.getSelection(),
</span><span class="cx">                     expressionRange: selectionRange,
</span><span class="lines">@@ -446,19 +497,19 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // We only handle vars, definitions, properties, and the keyword 'this'.
</span><del>-        var type = this._hoveredTokenInfo.token.type;
</del><ins>+        var type = tokenInfo.token.type;
</ins><span class="cx">         var isProperty = type.indexOf(&quot;property&quot;) !== -1;
</span><span class="cx">         var isKeyword = type.indexOf(&quot;keyword&quot;) !== -1;
</span><span class="cx">         if (!isProperty &amp;&amp; !isKeyword &amp;&amp; type.indexOf(&quot;variable&quot;) === -1 &amp;&amp; type.indexOf(&quot;def&quot;) === -1)
</span><span class="cx">             return null;
</span><span class="cx"> 
</span><span class="cx">         // Not object literal property names, but yes if an object literal shorthand property, which is a variable.
</span><del>-        var state = this._hoveredTokenInfo.innerMode.state;
</del><ins>+        var state = tokenInfo.innerMode.state;
</ins><span class="cx">         if (isProperty &amp;&amp; state.lexical &amp;&amp; state.lexical.type === &quot;}&quot;) {
</span><span class="cx">             // Peek ahead to see if the next token is &quot;}&quot; or &quot;,&quot;. If it is, we are a shorthand and therefore a variable.
</span><span class="cx">             var shorthand = false;
</span><del>-            var mode = this._hoveredTokenInfo.innerMode.mode;
-            var position =  {line: this._hoveredTokenInfo.position.line, ch: this._hoveredTokenInfo.token.end};
</del><ins>+            var mode = tokenInfo.innerMode.mode;
+            var position =  {line: tokenInfo.position.line, ch: tokenInfo.token.end};
</ins><span class="cx">             WebInspector.walkTokens(this._codeMirror, mode, position, function(tokenType, string) {
</span><span class="cx">                 if (tokenType)
</span><span class="cx">                     return false;
</span><span class="lines">@@ -474,12 +525,12 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // Only the &quot;this&quot; keyword.
</span><del>-        if (isKeyword &amp;&amp; this._hoveredTokenInfo.token.string !== &quot;this&quot;)
</del><ins>+        if (isKeyword &amp;&amp; tokenInfo.token.string !== &quot;this&quot;)
</ins><span class="cx">             return null;
</span><span class="cx"> 
</span><span class="cx">         // Work out the full hovered expression.
</span><del>-        var expression = this._hoveredTokenInfo.token.string;
-        var expressionStartPosition = {line: this._hoveredTokenInfo.position.line, ch: this._hoveredTokenInfo.token.start};
</del><ins>+        var expression = tokenInfo.token.string;
+        var expressionStartPosition = {line: tokenInfo.position.line, ch: tokenInfo.token.start};
</ins><span class="cx">         while (true) {
</span><span class="cx">             var token = this._codeMirror.getTokenAt(expressionStartPosition);
</span><span class="cx">             if (!token)
</span><span class="lines">@@ -501,7 +552,7 @@
</span><span class="cx"> 
</span><span class="cx">         // Return the candidate for this token and expression.
</span><span class="cx">         return {
</span><del>-            hoveredToken: this._hoveredTokenInfo.token,
</del><ins>+            hoveredToken: tokenInfo.token,
</ins><span class="cx">             hoveredTokenRange: {start: startPosition, end: endPosition},
</span><span class="cx">             expression,
</span><span class="cx">             expressionRange: {start: expressionStartPosition, end: endPosition},
</span><span class="lines">@@ -515,9 +566,13 @@
</span><span class="cx"> 
</span><span class="cx">     _resetTrackingStates()
</span><span class="cx">     {
</span><del>-        clearTimeout(this._tokenHoverTimer);
-        delete this._selectionMayBeInProgress;
-        delete this._hoveredTokenInfo;
</del><ins>+        if (this._tokenHoverTimer)
+            clearTimeout(this._tokenHoverTimer);
+
+        this._tokenHoverTimer = 0;
+
+        this._selectionMayBeInProgress = false;
+        this._previousTokenInfo = null;
</ins><span class="cx">         this.removeHighlightedRange();
</span><span class="cx">     }
</span><span class="cx"> };
</span><span class="lines">@@ -531,3 +586,8 @@
</span><span class="cx">     JavaScriptTypeInformation: &quot;javascript-type-information&quot;,
</span><span class="cx">     MarkedTokens: &quot;marked-tokens&quot;
</span><span class="cx"> };
</span><ins>+
+WebInspector.CodeMirrorTokenTrackingController.TriggeredBy = {
+    Keyboard: &quot;keyboard&quot;,
+    Hover: &quot;hover&quot;
+};
</ins></span></pre></div>
<a id="branchessafari601branchSourceWebInspectorUIUserInterfaceViewsSourceCodeTextEditorjs"></a>
<div class="modfile"><h4>Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js (193273 => 193274)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js        2015-12-03 19:04:28 UTC (rev 193273)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js        2015-12-03 19:04:34 UTC (rev 193274)
</span><span class="lines">@@ -1300,9 +1300,9 @@
</span><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    tokenTrackingControllerHighlightedRangeReleased(tokenTrackingController)
</del><ins>+    tokenTrackingControllerHighlightedRangeReleased(tokenTrackingController, forceHide = false)
</ins><span class="cx">     {
</span><del>-        if (!this._mouseIsOverPopover)
</del><ins>+        if (forceHide || !this._mouseIsOverPopover)
</ins><span class="cx">             this._dismissPopover();
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>