Skip to content

Commit

Permalink
fix: use content box for OOPIF offset calculations (#7911)
Browse files Browse the repository at this point in the history
If an iframe has a border, it has to be added to the offsets
too. We can work around it by using the content box coordinates
for the offsets. That should also prevent discrepancies if the
iframe has a padding set.
  • Loading branch information
OrKoN committed Jan 18, 2022
1 parent c09522a commit 344feb5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/common/JSHandle.ts
Expand Up @@ -489,14 +489,14 @@ export class ElementHandle<
const { backendNodeId } = await parent._client.send('DOM.getFrameOwner', {
frameId: frame._id,
});
const { quads } = await parent._client.send('DOM.getContentQuads', {
const result = await parent._client.send('DOM.getBoxModel', {
backendNodeId: backendNodeId,
});
if (!quads || !quads.length) {
if (!result) {
break;
}
const protocolQuads = quads.map((quad) => this._fromProtocolQuad(quad));
const topLeftCorner = protocolQuads[0][0];
const contentBoxQuad = result.model.content;
const topLeftCorner = this._fromProtocolQuad(contentBoxQuad)[0];
offsetX += topLeftCorner.x;
offsetY += topLeftCorner.y;
frame = parent;
Expand Down

0 comments on commit 344feb5

Please sign in to comment.