| Index: chrome/browser/ui/cocoa/location_bar/location_bar_decoration.mm
|
| diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_decoration.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_decoration.mm
|
| index 7182d5e41d7ccd409ff4e17e147ede8fbe025601..5e8d18d7addc6a578e547b5bc9894b5017abb261 100644
|
| --- a/chrome/browser/ui/cocoa/location_bar/location_bar_decoration.mm
|
| +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_decoration.mm
|
| @@ -38,6 +38,7 @@
|
| // VoiceOver.
|
| @interface DecorationAccessibilityView : NSButton {
|
| LocationBarDecoration* owner_; // weak
|
| + NSRect apparentFrame_;
|
| }
|
|
|
| // NSView:
|
| @@ -49,6 +50,8 @@ - (NSString*)accessibilityLabel;
|
|
|
| // This method is called when this DecorationAccessibilityView is activated.
|
| - (void)actionDidHappen;
|
| +
|
| +- (void)setApparentFrame:(NSRect)r;
|
| @end
|
|
|
| @implementation DecorationAccessibilityView
|
| @@ -60,6 +63,7 @@ - (id)initWithOwner:(LocationBarDecoration*)owner {
|
| self->owner_ = owner;
|
| [self setAction:@selector(actionDidHappen)];
|
| [self setTarget:self];
|
| + self->apparentFrame_ = NSZeroRect;
|
| }
|
| return self;
|
| }
|
| @@ -67,11 +71,7 @@ - (id)initWithOwner:(LocationBarDecoration*)owner {
|
| - (BOOL)acceptsFirstResponder {
|
| // This NSView is only focusable if the owning LocationBarDecoration can
|
| // accept mouse presses.
|
| - // TODO(ellyjones): Once the key view loop order in ToolbarController is fixed
|
| - // up properly (which will require some redesign of
|
| - // LocationBarViewMac::GetDecorationAccessibilityViews()), this method should
|
| - // honor |owner_->AcceptsMousePress()|. See https://crbug.com/623883.
|
| - return NO;
|
| + return owner_->AcceptsMousePress() ? YES : NO;
|
| }
|
|
|
| - (void)drawRect:(NSRect)dirtyRect {
|
| @@ -92,6 +92,21 @@ - (NSString*)accessibilityLabel {
|
| return label ? label : owner_->GetToolTip();
|
| }
|
|
|
| +- (void)setApparentFrame:(NSRect)r {
|
| + apparentFrame_ = r;
|
| +}
|
| +
|
| +// The focus ring (and all other visuals) should be positioned using the
|
| +// apparent frame, not the real frame, because of the hack in
|
| +// LocationBarViewMac::UpdateAccessibilityView().
|
| +- (void)drawFocusRingMask {
|
| + NSRectFill([self focusRingMaskBounds]);
|
| +}
|
| +
|
| +- (NSRect)focusRingMaskBounds {
|
| + return [[self superview] convertRect:apparentFrame_ toView:self];
|
| +}
|
| +
|
| @end
|
|
|
| @interface DecorationMouseTrackingDelegate : NSObject {
|
| @@ -163,8 +178,10 @@ - (void)mouseExited:(NSEvent*)event {
|
| return NSInsetRect(frame, 0.0, kBackgroundFrameYInset);
|
| }
|
|
|
| -void LocationBarDecoration::UpdateAccessibilityView() {
|
| - [accessibility_view_.get() setEnabled:AcceptsMousePress()];
|
| +void LocationBarDecoration::UpdateAccessibilityView(NSRect apparent_frame) {
|
| + auto v = static_cast<DecorationAccessibilityView*>(accessibility_view_);
|
| + [accessibility_view_ setEnabled:AcceptsMousePress()];
|
| + [v setApparentFrame:apparent_frame];
|
| }
|
|
|
| void LocationBarDecoration::DrawInFrame(NSRect frame, NSView* control_view) {
|
|
|