From 71b82bdb5e75cbe689883e2d39dcbc54e36f5ebe Mon Sep 17 00:00:00 2001 From: Ben Wells Date: Fri, 3 Jun 2016 15:59:59 +1000 Subject: [PATCH] Correctly move permission bubbles after entering / exiting fullscreen. When full screen is entered or exited the position of the bubble arrow may need to be updated. This change updates the location, and ensures the bubble is repainted when the arrow location is updated. BUG=614928 Review-Url: https://codereview.chromium.org/2036503002 Cr-Commit-Position: refs/heads/master@{#397314} (cherry picked from commit 2c657c1722cfc92eb307341859a294ff64d6d40a) Review URL: https://codereview.chromium.org/2036973002 . Cr-Commit-Position: refs/branch-heads/2743@{#201} Cr-Branched-From: 2b3ae3b8090361f8af5a611712fc1a5ab2de53cb-refs/heads/master@{#394939} --- chrome/browser/ui/cocoa/info_bubble_view.mm | 8 ++++++++ .../website_settings/permission_bubble_controller.mm | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/chrome/browser/ui/cocoa/info_bubble_view.mm b/chrome/browser/ui/cocoa/info_bubble_view.mm index 81eade77d4e0d..103db6b5c53ae 100644 --- a/chrome/browser/ui/cocoa/info_bubble_view.mm +++ b/chrome/browser/ui/cocoa/info_bubble_view.mm @@ -129,4 +129,12 @@ - (void)setBackgroundColor:(NSColor*)backgroundColor { backgroundColor_.reset([backgroundColor retain]); } +- (void)setArrowLocation:(info_bubble::BubbleArrowLocation)location { + if (arrowLocation_ == location) + return; + + arrowLocation_ = location; + [self setNeedsDisplayInRect:[self bounds]]; +} + @end diff --git a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm index bfb30cb157431..56badab36f531 100644 --- a/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.mm @@ -263,7 +263,7 @@ - (void)parentWindowWillToggleFullScreen:(NSNotification*)notification { - (void)parentWindowDidResize:(NSNotification*)notification { DCHECK(bridge_); - [self setAnchorPoint:[self getExpectedAnchorPoint]]; + [self updateAnchorPosition]; } - (void)parentWindowDidMove:(NSNotification*)notification { @@ -433,6 +433,7 @@ - (void)showWithDelegate:(PermissionBubbleView::Delegate*)delegate - (void)updateAnchorPosition { [self setParentWindow:[self getExpectedParentWindow]]; [self setAnchorPoint:[self getExpectedAnchorPoint]]; + [[self bubble] setArrowLocation:[self getExpectedArrowLocation]]; } - (NSPoint)getExpectedAnchorPoint {