Bug 1567310 Part 3: Make all devtools callers of getBoxQuads include option to suppress whitespace frames. r=gl

Differential Revision: https://phabricator.services.mozilla.com/D45120
This commit is contained in:
Brad Werth
2019-09-12 19:05:52 +00:00
parent af044af539
commit d2a197b2f5
6 changed files with 26 additions and 6 deletions

View File

@@ -338,7 +338,10 @@ AutocompletePopup.prototype = {
},
_scrollElementIntoViewIfNeeded: function(element) {
const quads = element.getBoxQuads({ relativeTo: this.tooltip.panel });
const quads = element.getBoxQuads({
relativeTo: this.tooltip.panel,
createFramesForSuppressedWhitespace: false,
});
if (!quads || !quads[0]) {
return;
}

View File

@@ -974,7 +974,10 @@ AbstractCanvasGraph.prototype = {
// not taking the document zoom factor into consideration consistently.
if (!this._boundingBox || this._maybeDirtyBoundingBox) {
const topDocument = this._topWindow.document;
const boxQuad = this._canvas.getBoxQuads({ relativeTo: topDocument })[0];
const boxQuad = this._canvas.getBoxQuads({
relativeTo: topDocument,
createFramesForSuppressedWhitespace: false,
})[0];
this._boundingBox = boxQuad;
this._maybeDirtyBoundingBox = false;
}

View File

@@ -280,7 +280,13 @@ const calculateHorizontalPosition = (
const getRelativeRect = function(node, relativeTo) {
// getBoxQuads is a non-standard WebAPI which will not work on non-firefox
// browser when running launchpad on Chrome.
if (!node.getBoxQuads || !node.getBoxQuads({ relativeTo })[0]) {
if (
!node.getBoxQuads ||
!node.getBoxQuads({
relativeTo,
createFramesForSuppressedWhitespace: false,
})[0]
) {
const { top, left, width, height } = node.getBoundingClientRect();
const right = left + width;
const bottom = top + height;
@@ -290,7 +296,9 @@ const getRelativeRect = function(node, relativeTo) {
// Width and Height can be taken from the rect.
const { width, height } = node.getBoundingClientRect();
const quadBounds = node.getBoxQuads({ relativeTo })[0].getBounds();
const quadBounds = node
.getBoxQuads({ relativeTo, createFramesForSuppressedWhitespace: false })[0]
.getBounds();
const top = quadBounds.top;
const left = quadBounds.left;

View File

@@ -497,7 +497,10 @@ class ShapesHighlighter extends AutoRefreshHighlighter {
const nodeWin = this.currentNode.ownerGlobal;
// Get bounding box of iframe document relative to global document.
const bounds = nodeWin.document
.getBoxQuads({ relativeTo: win.document })[0]
.getBoxQuads({
relativeTo: win.document,
createFramesForSuppressedWhitespace: false,
})[0]
.getBounds();
xOffset = bounds.left - nodeWin.scrollX + win.scrollX;
yOffset = bounds.top - nodeWin.scrollY + win.scrollY;

View File

@@ -222,7 +222,9 @@ function nodeHasSize(node) {
return false;
}
const quads = node.getBoxQuads();
const quads = node.getBoxQuads({
createFramesForSuppressedWhitespace: false,
});
return quads.some(quad => {
const bounds = quad.getBounds();
return bounds.width && bounds.height;

View File

@@ -164,6 +164,7 @@ function getAdjustedQuads(boundaryWindow, node, region, { ignoreZoom } = {}) {
const quads = node.getBoxQuads({
box: region,
relativeTo: boundaryWindow.document,
createFramesForSuppressedWhitespace: false,
});
if (!quads.length) {