Skip to content

Commit

Permalink
Fix no hints in iframes not near top-left corner
Browse files Browse the repository at this point in the history
The check for visible iframes used global coordinates instead of
document local coordinates for the `getElementsFromPoint` check, causing
some iframes never to get hints based on their size and positioning.
  • Loading branch information
lydell committed Aug 17, 2024
1 parent 8ea1b53 commit 6fa26b1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/worker/ElementManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,8 @@ export default class ElementManager {
return [];
}

const box = getVisibleBox(element.getBoundingClientRect(), viewports);
const rect = element.getBoundingClientRect();
const box = getVisibleBox(rect, viewports);

// Frames are slow to visit. Gmail has ~10 weird frames that are super
// small. Not sure what they do. But not visiting those saves around ~80ms
Expand All @@ -1333,8 +1334,8 @@ export default class ElementManager {

const elementsAtPoint = getElementsFromPoint(
element,
Math.round(box.x + box.width / 2),
Math.round(box.y + box.height / 2)
Math.round(rect.x + rect.width / 2),
Math.round(rect.y + rect.height / 2)
);

// Make sure that the frame is visible – for example, not `visibility:
Expand Down

0 comments on commit 6fa26b1

Please sign in to comment.