Issue #2241 - Part 4.3: Move devtools over to getBounds().

This leaves getAdjustedQuads alone because it lives in its own world and its
result gets sent over IPC. That leaves things in a bit of an intermediate state,
but that should be OK for now.

Backported from Mozilla bug 1186265.
This commit is contained in:
Job Bautista 2023-05-12 11:54:35 +08:00 committed by roytam1
commit 69e45fd84e
8 changed files with 32 additions and 23 deletions

View file

@ -39,14 +39,14 @@ add_task(function* () {
// Calculate offsets to click in the middle of the first box quad.
let rect = prop.editor.valueSpan.getBoundingClientRect();
let firstQuad = prop.editor.valueSpan.getBoxQuads()[0];
let firstQuadBounds = prop.editor.valueSpan.getBoxQuads()[0].getBounds();
// For a multiline value, the first quad left edge is not aligned with the
// bounding rect left edge. The offsets expected by focusEditableField are
// relative to the bouding rectangle, so we need to translate the x-offset.
let x = firstQuad.bounds.left - rect.left + firstQuad.bounds.width / 2;
let x = firstQuadBounds.left - rect.left + firstQuadBounds.width / 2;
// The first quad top edge is aligned with the bounding top edge, no
// translation needed here.
let y = firstQuad.bounds.height / 2;
let y = firstQuadBounds.height / 2;
info("Focusing the css property editable value");
let editor = yield focusEditableField(view, prop.editor.valueSpan, x, y);