diff --git a/atom/browser/mac/atom_application.mm b/atom/browser/mac/atom_application.mm index 7d1fd532012a..b8377181359c 100644 --- a/atom/browser/mac/atom_application.mm +++ b/atom/browser/mac/atom_application.mm @@ -4,10 +4,9 @@ #import "atom/browser/mac/atom_application.h" +#include "atom/browser/browser.h" #include "base/auto_reset.h" #include "base/strings/sys_string_conversions.h" -#include "atom/browser/browser.h" - #include "content/public/browser/browser_accessibility_state.h" @implementation AtomApplication @@ -49,7 +48,7 @@ } - (void)accessibilitySetValue:(id)value forAttribute:(NSString *)attribute { - // undocumented attribute that VoiceOver happens to set while running. + // Undocumented attribute that VoiceOver happens to set while running. // Chromium uses this too, even though it's not exactly right. if ([attribute isEqualToString:@"AXEnhancedUserInterface"]) { [self updateAccessibilityEnabled:[value boolValue]]; @@ -58,7 +57,7 @@ } - (void)updateAccessibilityEnabled:(BOOL)enabled { - content::BrowserAccessibilityState *ax_state = content::BrowserAccessibilityState::GetInstance(); + auto ax_state = content::BrowserAccessibilityState::GetInstance(); if (enabled) { ax_state->OnScreenReaderDetected(); diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm index 05edf173b308..668826624b4b 100644 --- a/atom/browser/native_window_mac.mm +++ b/atom/browser/native_window_mac.mm @@ -11,11 +11,11 @@ #include "atom/common/options_switches.h" #include "base/mac/mac_util.h" #include "base/strings/sys_string_conversions.h" +#include "content/public/browser/browser_accessibility_state.h" #include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/render_widget_host_view.h" -#include "content/public/browser/browser_accessibility_state.h" #include "native_mate/dictionary.h" #include "vendor/brightray/browser/inspectable_web_contents.h" #include "vendor/brightray/browser/inspectable_web_contents_view.h" @@ -195,24 +195,23 @@ static const CGFloat kAtomWindowCornerRadius = 4.0; } - (id)accessibilityAttributeValue:(NSString*)attribute { - if ([attribute isEqualToString:@"AXChildren"]) { - NSArray *children = [super accessibilityAttributeValue:attribute]; + if (![attribute isEqualToString:@"AXChildren"]) + return [super accessibilityAttributeValue:attribute]; - // Filter out objects that aren't the title bar buttons. - // This has the effect of removing the window title, which VoiceOver already sees. - // * when VoiceOver is disabled, this causes Cmd+C to be used for TTS but still - // leaves the buttons available in the accessibility tree. - // * when VoiceOver is enabled, the full accessibility tree is used. - // Without removing the title and with VO disabled, the TTS would always read the - // window title instead of using Cmd+C to get the selected text. - NSPredicate *predicate = [NSPredicate predicateWithFormat: - @"(self isKindOfClass: %@) OR (self.className == %@)", - [NSButtonCell class], @"RenderWidgetHostViewCocoa"]; - - return [children filteredArrayUsingPredicate:predicate]; - } - - return [super accessibilityAttributeValue:attribute]; + // Filter out objects that aren't the title bar buttons. This has the effect + // of removing the window title, which VoiceOver already sees. + // * when VoiceOver is disabled, this causes Cmd+C to be used for TTS but + // still leaves the buttons available in the accessibility tree. + // * when VoiceOver is enabled, the full accessibility tree is used. + // Without removing the title and with VO disabled, the TTS would always read + // the window title instead of using Cmd+C to get the selected text. + NSPredicate *predicate = [NSPredicate predicateWithFormat: + @"(self isKindOfClass: %@) OR (self.className == %@)", + [NSButtonCell class], + @"RenderWidgetHostViewCocoa"]; + + NSArray *children = [super accessibilityAttributeValue:attribute]; + return [children filteredArrayUsingPredicate:predicate]; } @end