Commit 32c21e27 authored by Santiago Aboy Solanes's avatar Santiago Aboy Solanes Committed by Commit Bot

[turbolizer] Make graph view's toolbar buttons focus the svg

... after executing their action.

This allows to search for a regex, click "hide unselected nodes", and
then immediately using graph view's keyboard shortcuts (e.g i, o, r).

Bug: v8:7327
Change-Id: Ieb7dbb3f1e32a78131500f8fb8b7805417c60e4e
Notry: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1930906Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65166}
parent 4105cce5
...@@ -384,6 +384,7 @@ export class GraphView extends PhaseView { ...@@ -384,6 +384,7 @@ export class GraphView extends PhaseView {
graph.layoutGraph(); graph.layoutGraph();
graph.updateGraphVisibility(); graph.updateGraphVisibility();
graph.viewWholeGraph(); graph.viewWholeGraph();
graph.focusOnSvg();
} }
showAllAction(view: GraphView) { showAllAction(view: GraphView) {
...@@ -395,6 +396,7 @@ export class GraphView extends PhaseView { ...@@ -395,6 +396,7 @@ export class GraphView extends PhaseView {
}); });
view.updateGraphVisibility(); view.updateGraphVisibility();
view.viewWholeGraph(); view.viewWholeGraph();
view.focusOnSvg();
} }
showControlAction(view: GraphView) { showControlAction(view: GraphView) {
...@@ -406,6 +408,7 @@ export class GraphView extends PhaseView { ...@@ -406,6 +408,7 @@ export class GraphView extends PhaseView {
}); });
view.updateGraphVisibility(); view.updateGraphVisibility();
view.viewWholeGraph(); view.viewWholeGraph();
view.focusOnSvg();
} }
toggleHideDead(view: GraphView) { toggleHideDead(view: GraphView) {
...@@ -417,6 +420,7 @@ export class GraphView extends PhaseView { ...@@ -417,6 +420,7 @@ export class GraphView extends PhaseView {
} }
const element = document.getElementById('toggle-hide-dead'); const element = document.getElementById('toggle-hide-dead');
element.classList.toggle('button-input-toggled', view.state.hideDead); element.classList.toggle('button-input-toggled', view.state.hideDead);
view.focusOnSvg();
} }
hideDead() { hideDead() {
...@@ -445,6 +449,7 @@ export class GraphView extends PhaseView { ...@@ -445,6 +449,7 @@ export class GraphView extends PhaseView {
} }
} }
view.updateGraphVisibility(); view.updateGraphVisibility();
view.focusOnSvg();
} }
hideSelectedAction(view: GraphView) { hideSelectedAction(view: GraphView) {
...@@ -454,14 +459,17 @@ export class GraphView extends PhaseView { ...@@ -454,14 +459,17 @@ export class GraphView extends PhaseView {
} }
} }
view.selectionHandler.clear(); view.selectionHandler.clear();
view.focusOnSvg();
} }
zoomSelectionAction(view: GraphView) { zoomSelectionAction(view: GraphView) {
view.viewSelection(); view.viewSelection();
view.focusOnSvg();
} }
toggleTypesAction(view: GraphView) { toggleTypesAction(view: GraphView) {
view.toggleTypes(); view.toggleTypes();
view.focusOnSvg();
} }
searchInputAction(searchBar: HTMLInputElement, e: KeyboardEvent, onlyVisible: boolean) { searchInputAction(searchBar: HTMLInputElement, e: KeyboardEvent, onlyVisible: boolean) {
...@@ -492,11 +500,15 @@ export class GraphView extends PhaseView { ...@@ -492,11 +500,15 @@ export class GraphView extends PhaseView {
this.updateGraphVisibility(); this.updateGraphVisibility();
searchBar.blur(); searchBar.blur();
this.viewSelection(); this.viewSelection();
(document.getElementById("graph").childNodes[0] as HTMLElement).focus(); this.focusOnSvg();
} }
e.stopPropagation(); e.stopPropagation();
} }
focusOnSvg() {
(document.getElementById("graph").childNodes[0] as HTMLElement).focus();
}
svgKeyDown() { svgKeyDown() {
const view = this; const view = this;
const state = this.state; const state = this.state;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment