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

Side by Side Diff: chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm

Issue 2478733002: Page Info (native Mac): remove images from accessibility order (Closed)
Patch Set: Separate the hack into a method for conceptual isolation (and maintainability). Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "chrome/browser/ui/cocoa/website_settings/website_settings_bubble_contro ller.h" 5 #import "chrome/browser/ui/cocoa/website_settings/website_settings_bubble_contro ller.h"
6 6
7 #import <AppKit/AppKit.h> 7 #import <AppKit/AppKit.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 10
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 NSFont* font = bold ? [NSFont boldSystemFontOfSize:fontSize] 612 NSFont* font = bold ? [NSFont boldSystemFontOfSize:fontSize]
613 : [NSFont systemFontOfSize:fontSize]; 613 : [NSFont systemFontOfSize:fontSize];
614 [textField setFont:font]; 614 [textField setFont:font];
615 [self sizeTextFieldHeightToFit:textField]; 615 [self sizeTextFieldHeightToFit:textField];
616 [textField setAutoresizingMask:NSViewWidthSizable]; 616 [textField setAutoresizingMask:NSViewWidthSizable];
617 [view addSubview:textField.get()]; 617 [view addSubview:textField.get()];
618 return textField.get(); 618 return textField.get();
619 } 619 }
620 620
621 // Add an image as a subview of the given view, placed at a pre-determined x 621 // Add an image as a subview of the given view, placed at a pre-determined x
622 // position and the given y position. Return the new NSImageView. 622 // position and the given y position. The image is not in the accessibility
623 // order, since the image is always accompanied by text in this bubble. Return
624 // the new NSImageView.
623 - (NSImageView*)addImageWithSize:(NSSize)size 625 - (NSImageView*)addImageWithSize:(NSSize)size
624 toView:(NSView*)view 626 toView:(NSView*)view
625 atPoint:(NSPoint)point { 627 atPoint:(NSPoint)point {
626 NSRect frame = NSMakeRect(point.x, point.y, size.width, size.height); 628 NSRect frame = NSMakeRect(point.x, point.y, size.width, size.height);
627 base::scoped_nsobject<NSImageView> imageView( 629 base::scoped_nsobject<NSImageView> imageView(
628 [[NSImageView alloc] initWithFrame:frame]); 630 [[NSImageView alloc] initWithFrame:frame]);
631 [self hideImageFromAccessibilityOrder:imageView];
629 [imageView setImageFrameStyle:NSImageFrameNone]; 632 [imageView setImageFrameStyle:NSImageFrameNone];
630 [view addSubview:imageView.get()]; 633 [view addSubview:imageView.get()];
631 return imageView.get(); 634 return imageView.get();
632 } 635 }
633 636
637 // Hide the given image view from the accessibility order for VoiceOver.
638 - (void)hideImageFromAccessibilityOrder:(NSImageView*)imageView {
639 // This is the minimum change necessary to get VoiceOver to skip the image
640 // (instead of reading the word "image"). Accessibility mechanisms in OSX
641 // change once in a while, so this may be fragile.
642 [[imageView cell] accessibilitySetOverrideValue:@""
643 forAttribute:NSAccessibilityRoleAttribute];
644 }
645
634 // Add a separator as a subview of the given view. Return the new view. 646 // Add a separator as a subview of the given view. Return the new view.
635 - (NSView*)addSeparatorToView:(NSView*)view { 647 - (NSView*)addSeparatorToView:(NSView*)view {
636 // Use an arbitrary position; it will be adjusted in performLayout. 648 // Use an arbitrary position; it will be adjusted in performLayout.
637 NSBox* spacer = [self 649 NSBox* spacer = [self
638 horizontalSeparatorWithFrame:NSMakeRect(0, 0, NSWidth([view frame]), 0)]; 650 horizontalSeparatorWithFrame:NSMakeRect(0, 0, NSWidth([view frame]), 0)];
639 [view addSubview:spacer]; 651 [view addSubview:spacer];
640 return spacer; 652 return spacer;
641 } 653 }
642 654
643 // Add a link button with the given text to |view|. 655 // Add a link button with the given text to |view|.
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 void WebsiteSettingsUIBridge::SetPermissionInfo( 1211 void WebsiteSettingsUIBridge::SetPermissionInfo(
1200 const PermissionInfoList& permission_info_list, 1212 const PermissionInfoList& permission_info_list,
1201 ChosenObjectInfoList chosen_object_info_list) { 1213 ChosenObjectInfoList chosen_object_info_list) {
1202 [bubble_controller_ setPermissionInfo:permission_info_list 1214 [bubble_controller_ setPermissionInfo:permission_info_list
1203 andChosenObjects:std::move(chosen_object_info_list)]; 1215 andChosenObjects:std::move(chosen_object_info_list)];
1204 } 1216 }
1205 1217
1206 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) { 1218 void WebsiteSettingsUIBridge::SetSelectedTab(TabId tab_id) {
1207 // TODO(lgarron): Remove this from the interface. (crbug.com/571533) 1219 // TODO(lgarron): Remove this from the interface. (crbug.com/571533)
1208 } 1220 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698