Page preview popovers sometimes cover their originating element
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Nov 2014 22:52:42 +0000 (22:52 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Nov 2014 22:52:42 +0000 (22:52 +0000)
commite61062b344b71c39d2ff6c43576866b17b0227b1
tree8586a7edeb97f871e03db3ecff5ce79d468666f8
parent1a16e1052d0a74b7506703403ff81f792ca7b252
Page preview popovers sometimes cover their originating element
https://bugs.webkit.org/show_bug.cgi?id=138437

Patch by Conrad Shultz <conrad_shultz@apple.com> on 2014-11-05
Reviewed by Beth Dakin.

If a popover is sufficiently large, and the originating element is in a particular location, it's
possible that the popover can't be positioned in a manner that doesn't occlude the originating element.
Address this by scaling down the popover content if it can't fit entirely between the originating
element and the screen edge.

* UIProcess/mac/WKActionMenuController.mm:
(-[WKActionMenuController _previewURLFromActionMenu:]):
Update to use -_createPreviewPopoverForURL:originRect:.
(-[WKActionMenuController _createPreviewPopoverForURL:originRect:]):
Renamed from -_createPreviewPopoverForURL:; extract code to -_preferredSizeForPopoverPresentedFromOriginRect:.
(-[WKActionMenuController _preferredSizeForPopoverPresentedFromOriginRect:]):
Compute a size that is as large as possible while keeping the popover between the origin rect and screen edge
(with an arbitrary padding applied to keep from directly abutting the screen edge).
(-[WKActionMenuController _createPreviewPopoverForURL:]): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175643 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/mac/WKActionMenuController.mm