mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 15:55:36 +00:00
Bug 1508656 - migrate startPicker and stopPicker to nodePicker; r=ochameau
Depends on D12122 Differential Revision: https://phabricator.services.mozilla.com/D12126 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
28023e75ca
commit
ee318a3580
@ -98,12 +98,12 @@ add_task(async function() {
|
||||
async function inspectorShouldBeOpenAndHighlighting(inspector) {
|
||||
is(toolbox.currentToolId, "inspector", "Correct tool has been loaded");
|
||||
|
||||
await toolbox.once("picker-started");
|
||||
await toolbox.inspector.nodePicker.once("picker-started");
|
||||
|
||||
ok(true, "picker-started event received, highlighter started");
|
||||
inspector.synthesizeKey();
|
||||
|
||||
await toolbox.once("picker-stopped");
|
||||
await toolbox.inspector.nodePicker.once("picker-stopped");
|
||||
ok(true, "picker-stopped event received, highlighter stopped");
|
||||
}
|
||||
|
||||
|
@ -141,8 +141,8 @@ class AnimationInspector {
|
||||
this.provider = provider;
|
||||
|
||||
this.inspector.sidebar.on("select", this.onSidebarSelectionChanged);
|
||||
this.inspector.toolbox.on("picker-started", this.onElementPickerStarted);
|
||||
this.inspector.toolbox.on("picker-stopped", this.onElementPickerStopped);
|
||||
this.inspector.inspector.nodePicker.on("picker-started", this.onElementPickerStarted);
|
||||
this.inspector.inspector.nodePicker.on("picker-stopped", this.onElementPickerStopped);
|
||||
this.inspector.toolbox.on("select", this.onSidebarSelectionChanged);
|
||||
}
|
||||
|
||||
@ -165,8 +165,12 @@ class AnimationInspector {
|
||||
this.inspector.selection.off("new-node-front", this.update);
|
||||
this.inspector.sidebar.off("select", this.onSidebarSelectionChanged);
|
||||
this.inspector.toolbox.off("inspector-sidebar-resized", this.onSidebarResized);
|
||||
this.inspector.toolbox.off("picker-started", this.onElementPickerStarted);
|
||||
this.inspector.toolbox.off("picker-stopped", this.onElementPickerStopped);
|
||||
this.inspector.inspector.nodePicker.off(
|
||||
"picker-started", this.onElementPickerStarted
|
||||
);
|
||||
this.inspector.inspector.nodePicker.off(
|
||||
"picker-stopped", this.onElementPickerStopped
|
||||
);
|
||||
this.inspector.toolbox.off("select", this.onSidebarSelectionChanged);
|
||||
|
||||
this.animationsFrontPromise.then(front => {
|
||||
|
@ -207,12 +207,12 @@ BoxModel.prototype = {
|
||||
* geometry editor enabled state.
|
||||
*/
|
||||
onHideGeometryEditor() {
|
||||
const { markup, selection, toolbox } = this.inspector;
|
||||
const { markup, selection, inspector } = this.inspector;
|
||||
|
||||
this.highlighters.hideGeometryEditor();
|
||||
this.store.dispatch(updateGeometryEditorEnabled(false));
|
||||
|
||||
toolbox.off("picker-started", this.onHideGeometryEditor);
|
||||
inspector.nodePicker.off("picker-started", this.onHideGeometryEditor);
|
||||
selection.off("new-node-front", this.onHideGeometryEditor);
|
||||
markup.off("leave", this.onMarkupViewLeave);
|
||||
markup.off("node-hover", this.onMarkupViewNodeHover);
|
||||
@ -365,7 +365,7 @@ BoxModel.prototype = {
|
||||
* toggle button is clicked.
|
||||
*/
|
||||
onToggleGeometryEditor() {
|
||||
const { markup, selection, toolbox } = this.inspector;
|
||||
const { markup, selection, inspector } = this.inspector;
|
||||
const nodeFront = this.inspector.selection.nodeFront;
|
||||
const state = this.store.getState();
|
||||
const enabled = !state.boxModel.geometryEditorEnabled;
|
||||
@ -375,13 +375,13 @@ BoxModel.prototype = {
|
||||
|
||||
if (enabled) {
|
||||
// Hide completely the geometry editor if the picker is clicked or a new node front
|
||||
toolbox.on("picker-started", this.onHideGeometryEditor);
|
||||
inspector.nodePicker.on("picker-started", this.onHideGeometryEditor);
|
||||
selection.on("new-node-front", this.onHideGeometryEditor);
|
||||
// Temporary hide the geometry editor
|
||||
markup.on("leave", this.onMarkupViewLeave);
|
||||
markup.on("node-hover", this.onMarkupViewNodeHover);
|
||||
} else {
|
||||
toolbox.off("picker-started", this.onHideGeometryEditor);
|
||||
inspector.nodePicker.off("picker-started", this.onHideGeometryEditor);
|
||||
selection.off("new-node-front", this.onHideGeometryEditor);
|
||||
markup.off("leave", this.onMarkupViewLeave);
|
||||
markup.off("node-hover", this.onMarkupViewNodeHover);
|
||||
|
@ -12,7 +12,7 @@ add_task(async function() {
|
||||
await addTab("data:text/html;charset=utf-8," + encodeURIComponent(TEST_URI));
|
||||
|
||||
const {view, toolbox} = await openRuleView();
|
||||
const pickerStopped = toolbox.once("picker-stopped");
|
||||
const pickerStopped = toolbox.inspector.nodePicker.once("picker-stopped");
|
||||
|
||||
await startPicker(toolbox);
|
||||
|
||||
|
@ -60,7 +60,7 @@ add_task(async function() {
|
||||
await testActor.isNodeCorrectlyHighlighted(iframeBodySelector, is);
|
||||
|
||||
info("Waiting for the element picker to deactivate.");
|
||||
await inspector.toolbox.highlighterUtils.stopPicker();
|
||||
await inspector.inspector.nodePicker.stop();
|
||||
|
||||
function moveMouseOver(selector, x, y) {
|
||||
info("Waiting for element " + selector + " to be highlighted");
|
||||
|
@ -51,7 +51,7 @@ add_task(async function() {
|
||||
"Breadcrumbs have 9 items.");
|
||||
|
||||
info("Waiting for element picker to deactivate.");
|
||||
await inspector.toolbox.highlighterUtils.stopPicker();
|
||||
await inspector.inspector.nodePicker.stop();
|
||||
|
||||
function moveMouseOver(selector) {
|
||||
info("Waiting for element " + selector + " to be highlighted");
|
||||
|
@ -44,7 +44,7 @@ add_task(async function() {
|
||||
info("First child selection test Passed.");
|
||||
|
||||
info("Stopping the picker");
|
||||
await toolbox.highlighterUtils.stopPicker();
|
||||
await toolbox.inspector.nodePicker.stop();
|
||||
|
||||
function doKeyHover(args) {
|
||||
info("Key pressed. Waiting for element to be highlighted/hovered");
|
||||
|
@ -40,7 +40,7 @@ add_task(async function() {
|
||||
info("Previously chosen child is remembered. Passed.");
|
||||
|
||||
info("Stopping the picker");
|
||||
await toolbox.highlighterUtils.stopPicker();
|
||||
await toolbox.inspector.nodePicker.stop();
|
||||
|
||||
function doKeyHover(args) {
|
||||
info("Key pressed. Waiting for element to be highlighted/hovered");
|
||||
|
@ -48,14 +48,14 @@ add_task(async function() {
|
||||
return promise.all([
|
||||
inspector.selection.once("new-node-front"),
|
||||
inspector.once("inspector-updated"),
|
||||
inspector.toolbox.once("picker-stopped"),
|
||||
inspector.inspector.nodePicker.once("picker-stopped"),
|
||||
]);
|
||||
}
|
||||
|
||||
function doKeyStop(args) {
|
||||
info("Key pressed. Waiting for picker to be canceled");
|
||||
testActor.synthesizeKey(args);
|
||||
return inspector.toolbox.once("picker-stopped");
|
||||
return inspector.inspector.nodePicker.once("picker-stopped");
|
||||
}
|
||||
|
||||
function moveMouseOver(selector) {
|
||||
|
@ -24,7 +24,7 @@ add_task(async function() {
|
||||
await onHover;
|
||||
|
||||
info("Press escape and wait for the picker to stop");
|
||||
const onPickerStopped = toolbox.once("picker-stopped");
|
||||
const onPickerStopped = toolbox.inspector.nodePicker.once("picker-stopped");
|
||||
testActor.synthesizeKey({
|
||||
key: "VK_ESCAPE",
|
||||
options: {},
|
||||
|
@ -39,5 +39,5 @@ add_task(async function() {
|
||||
ok(isVisible, "Inspector is highlighting after iframe nav.");
|
||||
|
||||
info("Stopping element picker.");
|
||||
await toolbox.highlighterUtils.stopPicker();
|
||||
await toolbox.inspector.nodePicker.stop();
|
||||
});
|
||||
|
@ -12,7 +12,7 @@ const TEST_URI = "data:text/html;charset=UTF-8," +
|
||||
|
||||
add_task(async function() {
|
||||
const { toolbox } = await openInspectorForURL(TEST_URI);
|
||||
const pickerStopped = toolbox.once("picker-stopped");
|
||||
const pickerStopped = toolbox.inspector.nodePicker.once("picker-stopped");
|
||||
|
||||
info("Starting the inspector picker");
|
||||
await startPicker(toolbox);
|
||||
|
@ -67,7 +67,7 @@ add_task(async function() {
|
||||
await startPickerAndAssertSwitchToInspector(toolbox);
|
||||
|
||||
info("Stoppping element picker.");
|
||||
await toolbox.highlighterUtils.stopPicker();
|
||||
await toolbox.inspector.nodePicker.stop();
|
||||
|
||||
checkResults();
|
||||
});
|
||||
|
@ -68,7 +68,7 @@ var navigateTo = async function(inspector, url) {
|
||||
var startPicker = async function(toolbox, skipFocus) {
|
||||
info("Start the element picker");
|
||||
toolbox.win.focus();
|
||||
await toolbox.highlighterUtils.startPicker();
|
||||
await toolbox.inspector.nodePicker.start();
|
||||
if (!skipFocus) {
|
||||
// By default make sure the content window is focused since the picker may not focus
|
||||
// the content window by default.
|
||||
|
@ -963,13 +963,14 @@ function isReverseSearchInputFocused(hud) {
|
||||
*/
|
||||
async function selectNodeWithPicker(toolbox, testActor, selector) {
|
||||
const inspector = toolbox.getPanel("inspector");
|
||||
const inspectorFront = inspector.inspector;
|
||||
|
||||
const onPickerStarted = inspector.toolbox.once("picker-started");
|
||||
inspector.toolbox.highlighterUtils.startPicker();
|
||||
const onPickerStarted = inspectorFront.nodePicker.once("picker-started");
|
||||
inspectorFront.nodePicker.start();
|
||||
await onPickerStarted;
|
||||
|
||||
info(`Picker mode started, now clicking on "${selector}" to select that node`);
|
||||
const onPickerStopped = toolbox.once("picker-stopped");
|
||||
const onPickerStopped = inspectorFront.nodePicker.once("picker-stopped");
|
||||
const onInspectorUpdated = inspector.once("inspector-updated");
|
||||
|
||||
testActor.synthesizeMouse({
|
||||
|
Loading…
Reference in New Issue
Block a user