зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1572651 - (Part 3) Add option for highlighters to get node position without scroll offsets. r=pbro
Depends on D47092 Given that the highlighter rendering surface is sized to the viewport of the inspected page (as opposed to the whole document), we need a way to ignore scroll offsets when getting data about the node position so the highlighter doesn't get drawn off-screen. Differential Revision: https://phabricator.services.mozilla.com/D47094 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
780c3bc0b5
Коммит
77daa88970
|
@ -85,6 +85,7 @@ function AutoRefreshHighlighter(highlighterEnv) {
|
|||
|
||||
AutoRefreshHighlighter.prototype = {
|
||||
_ignoreZoom: false,
|
||||
_ignoreScroll: false,
|
||||
|
||||
/**
|
||||
* Window corresponding to the current highlighterEnv. When replaying, this
|
||||
|
@ -194,7 +195,7 @@ AutoRefreshHighlighter.prototype = {
|
|||
this.contentWindow,
|
||||
this.currentNode,
|
||||
region,
|
||||
{ ignoreZoom: this._ignoreZoom }
|
||||
{ ignoreScroll: this._ignoreScroll, ignoreZoom: this._ignoreZoom }
|
||||
);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -154,7 +154,12 @@ exports.getFrameOffsets = getFrameOffsets;
|
|||
* An array of objects that have the same structure as quads returned by
|
||||
* getBoxQuads. An empty array if the node has no quads or is invalid.
|
||||
*/
|
||||
function getAdjustedQuads(boundaryWindow, node, region, { ignoreZoom } = {}) {
|
||||
function getAdjustedQuads(
|
||||
boundaryWindow,
|
||||
node,
|
||||
region,
|
||||
{ ignoreZoom, ignoreScroll } = {}
|
||||
) {
|
||||
if (!node || !node.getBoxQuads) {
|
||||
return [];
|
||||
}
|
||||
|
@ -170,7 +175,9 @@ function getAdjustedQuads(boundaryWindow, node, region, { ignoreZoom } = {}) {
|
|||
}
|
||||
|
||||
const scale = ignoreZoom ? 1 : getCurrentZoom(node);
|
||||
const { scrollX, scrollY } = boundaryWindow;
|
||||
const { scrollX, scrollY } = ignoreScroll
|
||||
? { scrollX: 0, scrollY: 0 }
|
||||
: boundaryWindow;
|
||||
|
||||
const xOffset = scrollX * scale;
|
||||
const yOffset = scrollY * scale;
|
||||
|
|
Загрузка…
Ссылка в новой задаче