Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1582502 - Don't interpret a click at 0,0 of a fullscreen video as…
Browse files Browse the repository at this point in the history
… a click on the Picture-in-Picture toggle. r=JSON_voorhees

We weren't handling the case where the toggle has no dimensions, so its X and Y
coordinate would be at 0,0, which would match a click in the top-left corner of
the screen for a video that was fullscreened.

This adds a check that ensures that the toggle has both width and height before
checking whether or not a mouse event occurred within it.

Differential Revision: https://phabricator.services.mozilla.com/D47789
  • Loading branch information
mikeconley committed Oct 1, 2019
1 parent 94c3243 commit d80d466
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions toolkit/actors/PictureInPictureChild.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,14 @@ class PictureInPictureToggleChild extends ActorChild {
let toggleRect = toggle.ownerGlobal.windowUtils.getBoundsWithoutFlushing(
toggle
);

// If the toggle has no dimensions, we're definitely not over it.
if (!toggleRect.width || !toggleRect.height) {
return false;
}

let { clientX, clientY } = event;

return (
clientX >= toggleRect.left &&
clientX <= toggleRect.right &&
Expand Down

0 comments on commit d80d466

Please sign in to comment.