Chromium Code Reviews| Index: content/browser/renderer_host/webmenurunner_mac.mm |
| diff --git a/content/browser/renderer_host/webmenurunner_mac.mm b/content/browser/renderer_host/webmenurunner_mac.mm |
| index 0e189bedd6941e304e4797177054e3bbcad5fd58..a5849161f9062d6e39765c90c92b11f1a50de44a 100644 |
| --- a/content/browser/renderer_host/webmenurunner_mac.mm |
| +++ b/content/browser/renderer_host/webmenurunner_mac.mm |
| @@ -120,10 +120,25 @@ |
| // bad happens. |
| [cell selectItemWithTag:index]; |
| - if (rightAligned_ && |
| - [cell respondsToSelector:@selector(setUserInterfaceLayoutDirection:)]) { |
| - [cell setUserInterfaceLayoutDirection: |
| - NSUserInterfaceLayoutDirectionRightToLeft]; |
| + if (rightAligned_) { |
| + SEL sel = @selector(setUserInterfaceLayoutDirection:); |
| + if ([cell respondsToSelector:sel]) { |
|
Avi (use Gerrit)
2016/11/30 17:25:04
NSCell has supported this property since 10.6, so
tkent
2016/11/30 23:43:57
Done.
|
| + [cell setUserInterfaceLayoutDirection: |
| + NSUserInterfaceLayoutDirectionRightToLeft]; |
| + } |
| + // setUserInterfaceLayoutDirection for NSMenu is supported on macOS 10.11+. |
| + if ([menu_ respondsToSelector:sel]) { |
| + NSUserInterfaceLayoutDirection direction = |
| + NSUserInterfaceLayoutDirectionRightToLeft; |
| + NSMethodSignature* signature = |
| + [NSMenu instanceMethodSignatureForSelector:sel]; |
| + NSInvocation* invocation = |
| + [NSInvocation invocationWithMethodSignature:signature]; |
| + [invocation setTarget:menu_.get()]; |
| + [invocation setSelector:sel]; |
| + [invocation setArgument:&direction atIndex:2]; |
| + [invocation invoke]; |
| + } |
| } |
| // When popping up a menu near the Dock, Cocoa restricts the menu |