Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3039)

Unified Diff: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm

Issue 2091063002: Location bar: make decorations accessible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: first round Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..b40b17e573cba43be0e1b33d4bb0130f1dbf0f16 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,9 @@ 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();
+ for (const auto& decoration : decorations)
+ UpdateAccessibilityViewPosition(decoration);
[field_ updateMouseTracking];
[field_ resetFieldEditorFrameIfNeeded];
[field_ setNeedsDisplay:YES];
@@ -972,7 +975,40 @@ 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];
+}
+
+std::vector<LocationBarDecoration*> LocationBarViewMac::GetDecorations() {
+ std::vector<LocationBarDecoration*> decorations;
+ // TODO(ellyjones): content setting decorations aren't included right now, nor
+ // are page actions and the keyword hint.
+ 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());
+ return decorations;
+}
+
void LocationBarViewMac::OnDefaultZoomLevelChanged() {
if (UpdateZoomDecoration(/*default_zoom_changed=*/true))
OnDecorationsChanged();
}
+
+std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() {
+ std::vector<LocationBarDecoration*> decorations = GetDecorations();
+ std::vector<NSView*> views;
+ for (const auto& decoration : decorations)
+ views.push_back(decoration->GetAccessibilityView());
+ return views;
+}
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h ('k') | chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698