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

Unified Diff: content/browser/renderer_host/webmenurunner_mac.mm

Issue 99043003: Fix typeahead for popup menu with attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comment with the link Created 7 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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];
}
« 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