mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 15:28:39 +09:00
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:
parent
840658ab39
commit
69e45fd84e
8 changed files with 32 additions and 23 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ AutocompletePopup.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
let {top, height} = quads[0].bounds;
|
||||
let {top, height} = quads[0].getBounds();
|
||||
let containerHeight = this._tooltip.panel.getBoundingClientRect().height;
|
||||
if (top < 0) {
|
||||
// Element is above container.
|
||||
|
|
|
|||
|
|
@ -85,9 +85,9 @@ function* runTests(doc) {
|
|||
ok(arrow, "Tooltip has an arrow");
|
||||
|
||||
// Get the geometry of the anchor, the tooltip panel & arrow.
|
||||
let arrowBounds = arrow.getBoxQuads({relativeTo: doc})[0].bounds;
|
||||
let panelBounds = tooltip.panel.getBoxQuads({relativeTo: doc})[0].bounds;
|
||||
let anchorBounds = el.getBoxQuads({relativeTo: doc})[0].bounds;
|
||||
let arrowBounds = arrow.getBoxQuads({relativeTo: doc})[0].getBounds();
|
||||
let panelBounds = tooltip.panel.getBoxQuads({relativeTo: doc})[0].getBounds();
|
||||
let anchorBounds = el.getBoxQuads({relativeTo: doc})[0].getBounds();
|
||||
|
||||
let intersects = arrowBounds.left <= anchorBounds.right &&
|
||||
arrowBounds.right >= anchorBounds.left;
|
||||
|
|
|
|||
|
|
@ -78,9 +78,9 @@ function* runTests(doc) {
|
|||
ok(arrow, "Tooltip has an arrow");
|
||||
|
||||
// Get the geometry of the anchor, the tooltip panel & arrow.
|
||||
let arrowBounds = arrow.getBoxQuads({relativeTo: doc})[0].bounds;
|
||||
let panelBounds = tooltip.panel.getBoxQuads({relativeTo: doc})[0].bounds;
|
||||
let anchorBounds = el.getBoxQuads({relativeTo: doc})[0].bounds;
|
||||
let arrowBounds = arrow.getBoxQuads({relativeTo: doc})[0].getBounds();
|
||||
let panelBounds = tooltip.panel.getBoxQuads({relativeTo: doc})[0].getBounds();
|
||||
let anchorBounds = el.getBoxQuads({relativeTo: doc})[0].getBounds();
|
||||
|
||||
let intersects = arrowBounds.left <= anchorBounds.right &&
|
||||
arrowBounds.right >= anchorBounds.left;
|
||||
|
|
|
|||
|
|
@ -114,5 +114,5 @@ let runAutocompletionTest = Task.async(function* (editor) {
|
|||
*/
|
||||
function getPopupOffset({popup, input}) {
|
||||
let popupQuads = popup._panel.getBoxQuads({relativeTo: input});
|
||||
return popupQuads[0].bounds.left;
|
||||
return popupQuads[0].getBounds().left;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,9 +176,9 @@ const getRelativeRect = function (node, relativeTo) {
|
|||
// Width and Height can be taken from the rect.
|
||||
let {width, height} = node.getBoundingClientRect();
|
||||
|
||||
let quads = node.getBoxQuads({relativeTo});
|
||||
let top = quads[0].bounds.top;
|
||||
let left = quads[0].bounds.left;
|
||||
let quadBounds = node.getBoxQuads({relativeTo})[0].getBounds();
|
||||
let top = quadBounds.top;
|
||||
let left = quadBounds.left;
|
||||
|
||||
// Compute right and bottom coordinates using the rest of the data.
|
||||
let right = left + width;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue