Skip to content

Commit d6f0e15

Browse files
author
agoloman
committed
Revert "Bug 1295057 - [devtools] Update the eyedropper screenshot on resize. r=devtools-reviewers,ochameau" for causing dt failures @browser_eyedropper_update.js.
This reverts commit 938c6b9. Revert "Bug 1932143 - [devtools] Fix telling RDM about picker states. r=ochameau,devtools-reviewers" This reverts commit aee609d.
1 parent 97adac3 commit d6f0e15

File tree

6 files changed

+12
-210
lines changed

6 files changed

+12
-210
lines changed

devtools/client/framework/toolbox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2308,7 +2308,7 @@ Toolbox.prototype = {
23082308
* One of devtools/shared/picker-constants
23092309
*/
23102310
async tellRDMAboutPickerState(state, pickerType) {
2311-
const { localTab } = this.commands.descriptorFront;
2311+
const { localTab } = this.target;
23122312

23132313
if (!ResponsiveUIManager.isActiveForTab(localTab)) {
23142314
return;

devtools/client/menus.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,8 @@ exports.menuitems = [
136136

137137
// If RDM is active, disable touch simulation events if they're enabled.
138138
// Similarly, enable them when the color picker is done picking.
139-
if (
140-
ResponsiveUIManager.isActiveForTab(commands.descriptorFront.localTab)
141-
) {
142-
const ui = ResponsiveUIManager.getResponsiveUIForTab(
143-
commands.descriptorFront.localTab
144-
);
139+
if (ResponsiveUIManager.isActiveForTab(target.localTab)) {
140+
const ui = ResponsiveUIManager.getResponsiveUIForTab(target.localTab);
145141
await ui.responsiveFront.setElementPickerState(
146142
true,
147143
PICKER_TYPES.EYEDROPPER

devtools/client/responsive/test/browser/browser.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@ fail-if = ["a11y_checks"] # Bug 1849028 clicked element may not be focusable and
7878
https_first_disabled = true
7979
tags = "devtools webextensions"
8080

81-
["browser_eyedropper.js"]
82-
83-
["browser_eyedropper_update.js"]
84-
8581
["browser_in_rdm_pane.js"]
8682

8783
["browser_many_toggles.js"]

devtools/client/responsive/test/browser/browser_eyedropper.js

Lines changed: 0 additions & 77 deletions
This file was deleted.

devtools/client/responsive/test/browser/browser_eyedropper_update.js

Lines changed: 0 additions & 98 deletions
This file was deleted.

devtools/server/actors/highlighters/eye-dropper.js

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const {
1818
getCurrentZoom,
1919
getFrameOffsets,
2020
} = require("resource://devtools/shared/layout/utils.js");
21-
const { debounce } = require("resource://devtools/shared/debounce.js");
2221

2322
loader.lazyGetter(this, "clipboardHelper", () =>
2423
Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper)
@@ -48,7 +47,6 @@ const CLOSE_DELAY = 750;
4847
*/
4948
class EyeDropper {
5049
#pageEventListenersAbortController;
51-
#debouncedUpdateScreenshot;
5250
constructor(highlighterEnv) {
5351
EventEmitter.decorate(this);
5452

@@ -62,12 +60,6 @@ class EyeDropper {
6260
// Get a couple of settings from prefs.
6361
this.format = Services.prefs.getCharPref(FORMAT_PREF);
6462
this.eyeDropperZoomLevel = Services.prefs.getIntPref(ZOOM_LEVEL_PREF);
65-
66-
this.#debouncedUpdateScreenshot = debounce(
67-
this.updateScreenshot.bind(this),
68-
200,
69-
this
70-
);
7163
}
7264

7365
ID_CLASS_PREFIX = "eye-dropper-";
@@ -157,9 +149,11 @@ class EyeDropper {
157149
// Get the page's current zoom level.
158150
this.pageZoom = getCurrentZoom(this.win);
159151

160-
// Take a screenshot of the viewport.
152+
// Take a screenshot of the viewport. This needs to be done first otherwise the
153+
// eyedropper UI will appear in the screenshot itself (since the UI is injected as
154+
// native anonymous content in the page).
161155
// Once the screenshot is ready, the magnified area will be drawn.
162-
this.updateScreenshot(options.screenshot);
156+
this.prepareImageCapture(options.screenshot);
163157

164158
// Start listening for user events.
165159
const { pageListenerTarget } = this.highlighterEnv;
@@ -173,7 +167,9 @@ class EyeDropper {
173167
pageListenerTarget.addEventListener("keydown", this, { signal });
174168
pageListenerTarget.addEventListener("DOMMouseScroll", this, { signal });
175169
pageListenerTarget.addEventListener("FullZoomChange", this, { signal });
176-
pageListenerTarget.addEventListener("resize", this, { signal });
170+
171+
// Show the eye-dropper.
172+
this.getElement("root").removeAttribute("hidden");
177173

178174
// Prepare the canvas context on which we're drawing the magnified page portion.
179175
this.ctx = this.getElement("canvas").getCanvasContext();
@@ -243,15 +239,11 @@ class EyeDropper {
243239
* If null, we'll use `drawWindow` to get the the page screenshot
244240
* (⚠️ but it won't handle remote frames).
245241
*/
246-
async updateScreenshot(screenshot) {
247-
const rootElement = this.getElement("root");
248-
242+
async prepareImageCapture(screenshot) {
249243
let imageSource;
250244
if (screenshot) {
251245
imageSource = this.#dataURItoBlob(screenshot);
252246
} else {
253-
// Hide the eyedropper while we take the screenshot.
254-
rootElement.setAttribute("hidden", "true");
255247
imageSource = getWindowAsImageData(this.win);
256248
}
257249

@@ -266,10 +258,7 @@ class EyeDropper {
266258

267259
// Set an attribute on the root element to be able to run tests after the first draw
268260
// was done.
269-
rootElement.setAttribute("drawn", "true");
270-
271-
// Show the eyedropper.
272-
rootElement.removeAttribute("hidden");
261+
this.getElement("root").setAttribute("drawn", "true");
273262
}
274263

275264
/**
@@ -422,10 +411,6 @@ class EyeDropper {
422411
this.hide();
423412
this.show();
424413
break;
425-
case "resize":
426-
this.getElement("root").removeAttribute("drawn");
427-
this.#debouncedUpdateScreenshot();
428-
break;
429414
}
430415
}
431416

0 commit comments

Comments
 (0)