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 a81d2c9e2f642b0299a07de5f8612dc4b997c5c3..bb33a007aa6b6b2fa8ee5fde498d569fef725a2c 100644 |
--- a/content/browser/renderer_host/webmenurunner_mac.mm |
+++ b/content/browser/renderer_host/webmenurunner_mac.mm |
@@ -82,6 +82,14 @@ |
[[NSAttributedString alloc] initWithString:title attributes:attrs]); |
[menuItem setAttributedTitle:attrTitle]; |
+ // We set the title as well as the attributed title here. The attributed title |
+ // will be displayed in the menu, but typeahead will use the non-attributed |
+ // string that doesn't contain any leading or trailing whitespace. This is |
+ // what Apple uses in WebKit as well: |
+ // http://trac.webkit.org/browser/trunk/Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm#L90 |
+ NSCharacterSet* whitespaceSet = [NSCharacterSet whitespaceCharacterSet]; |
+ [menuItem setTitle:[title stringByTrimmingCharactersInSet:whitespaceSet]]; |
+ |
[menuItem setTag:[menu_ numberOfItems] - 1]; |
} |