Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Unified Diff: third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js

Issue 2849973003: DevTools: remove continue to location from behind experiment. (Closed)
Patch Set: same Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js b/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js
index 84f38c1938304b22cf03861f0ab5b3deaddbc198..d3137327451d6adb33e84ce1a4feabde9b16ca8b 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptSourceFrame.js
@@ -55,6 +55,7 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame {
this.textEditor.element.addEventListener('keyup', this._onKeyUp.bind(this), true);
this.textEditor.element.addEventListener('mousemove', this._onMouseMove.bind(this), false);
this.textEditor.element.addEventListener('mousedown', this._onMouseDown.bind(this), true);
+ this.textEditor.element.addEventListener('focusout', this._onBlur.bind(this), false);
if (Runtime.experiments.isEnabled('continueToLocationMarkers')) {
this.textEditor.element.addEventListener('wheel', event => {
if (UI.KeyboardShortcut.eventHasCtrlOrMeta(event))
@@ -485,6 +486,9 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame {
* @param {!KeyboardEvent} event
*/
_onKeyDown(event) {
+ this._controlDown = false;
+ this._clearContinueToLocations();
dgozman 2017/04/29 00:36:56 So this rebuilds inline values on every key stroke
+
if (event.key === 'Escape') {
if (this._popoverHelper.isPopoverVisible()) {
this._popoverHelper.hidePopover();
@@ -492,9 +496,15 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame {
}
return;
}
+
if (UI.KeyboardShortcut.eventHasCtrlOrMeta(event) && this._executionLocation) {
- if (!this._continueToLocationDecorations)
- this._showContinueToLocations();
+ this._controlDown = true;
+ if (event.key === 'Control') {
dgozman 2017/04/29 00:36:56 or meta
+ setTimeout(() => {
+ if (this._executionLocation && this._controlDown)
+ this._showContinueToLocations();
+ }, 150);
+ }
}
}
@@ -502,7 +512,7 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame {
* @param {!MouseEvent} event
*/
_onMouseMove(event) {
- if (this._executionLocation && UI.KeyboardShortcut.eventHasCtrlOrMeta(event)) {
+ if (this._executionLocation && this._controlDown && UI.KeyboardShortcut.eventHasCtrlOrMeta(event)) {
if (!this._continueToLocationDecorations)
this._showContinueToLocations();
}
@@ -532,11 +542,18 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame {
}
/**
+ * @param {!Event} event
+ */
+ _onBlur(event) {
+ this._clearContinueToLocations();
+ this._controlDown = this._controlDown && this.textEditor.element.isAncestor(event.target);
+ }
+
+ /**
* @param {!KeyboardEvent} event
*/
_onKeyUp(event) {
- if (UI.KeyboardShortcut.eventHasCtrlOrMeta(event))
- return;
+ this._controlDown = false;
this._clearContinueToLocations();
}
@@ -601,10 +618,11 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame {
if (this.isShowing()) {
// We need SourcesTextEditor to be initialized prior to this call. @see crbug.com/506566
setImmediate(() => {
- this._generateValuesInSource();
- if (Runtime.experiments.isEnabled('continueToLocationMarkers')) {
- if (this._continueToLocationDecorations)
+ if (this._controlDown) {
+ if (Runtime.experiments.isEnabled('continueToLocationMarkers'))
this._showContinueToLocations();
+ } else {
+ this._generateValuesInSource();
}
});
}
@@ -660,6 +678,8 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame {
*/
function renderLocations(locations) {
this._clearContinueToLocations();
+ this.textEditor.hideExecutionLineBackground();
+ this._clearValueWidgets();
this._continueToLocationDecorations = new Map();
for (var location of locations) {
var lineNumber = location.lineNumber;
@@ -841,12 +861,14 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame {
}
_clearContinueToLocations() {
+ this.textEditor.showExecutionLineBackground();
+ this._generateValuesInSource();
if (!this._continueToLocationDecorations)
return;
this.textEditor.operation(() => {
for (var decoration of this._continueToLocationDecorations.keys())
this.textEditor.removeHighlight(decoration);
- delete this._continueToLocationDecorations;
+ this._continueToLocationDecorations = null;
});
}

Powered by Google App Engine
This is Rietveld 408576698