Chromium Code Reviews| Index: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm |
| diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm |
| index e768691fac2b039fa5383d607711f964ee1ece75..5175ba502eb7f701468362dd1874fc477744c948 100644 |
| --- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm |
| +++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm |
| @@ -554,6 +554,10 @@ NSPoint LocationBarViewMac::GetPageInfoBubblePoint() const { |
| void LocationBarViewMac::OnDecorationsChanged() { |
| // TODO(shess): The field-editor frame and cursor rects should not |
| // change, here. |
| + std::vector<LocationBarDecoration*> decorations; |
| + GetDecorations(&decorations); |
| + for (const auto& decoration : decorations) |
| + UpdateAccessibilityViewPosition(decoration); |
| [field_ updateMouseTracking]; |
| [field_ resetFieldEditorFrameIfNeeded]; |
| [field_ setNeedsDisplay:YES]; |
| @@ -972,7 +976,39 @@ bool LocationBarViewMac::UpdateZoomDecoration(bool default_zoom_changed) { |
| IsLocationBarDark()); |
| } |
| +void LocationBarViewMac::UpdateAccessibilityViewPosition( |
| + LocationBarDecoration* decoration) { |
| + if (!decoration->IsVisible()) |
| + return; |
| + NSRect r = |
| + [[field_ cell] frameForDecoration:decoration inFrame:[field_ frame]]; |
| + [decoration->GetAccessibilityView() setFrame:r]; |
| + [decoration->GetAccessibilityView() setNeedsDisplayInRect:r]; |
| +} |
| + |
| +void LocationBarViewMac::GetDecorations( |
| + std::vector<LocationBarDecoration*>* decorations) { |
|
Mark Mentovai
2016/06/23 19:30:55
Clear the vector on entry to this function and the
Elly Fong-Jones
2016/06/23 20:25:58
Done.
|
| + // TODO(ellyjones): content setting decorations aren't included right now, nor |
| + // are page actions and the keyword hint. |
|
Mark Mentovai
2016/06/23 19:30:55
This seems like a lot to keep in sync with (someth
Elly Fong-Jones
2016/06/23 20:25:58
It doesn't seem so. Most places only need one of t
|
| + decorations->push_back(location_icon_decoration_.get()); |
| + decorations->push_back(selected_keyword_decoration_.get()); |
| + decorations->push_back(ev_bubble_decoration_.get()); |
| + decorations->push_back(save_credit_card_decoration_.get()); |
| + decorations->push_back(star_decoration_.get()); |
| + decorations->push_back(translate_decoration_.get()); |
| + decorations->push_back(zoom_decoration_.get()); |
| + decorations->push_back(manage_passwords_decoration_.get()); |
| +} |
| + |
| void LocationBarViewMac::OnDefaultZoomLevelChanged() { |
| if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) |
| OnDecorationsChanged(); |
| } |
| + |
| +void LocationBarViewMac::GetDecorationAccessibilityViews( |
| + std::vector<NSView*>* views) { |
| + std::vector<LocationBarDecoration*> decorations; |
| + GetDecorations(&decorations); |
| + for (const auto& decoration : decorations) |
| + views->push_back(decoration->GetAccessibilityView()); |
| +} |