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

Unified Diff: chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm

Issue 1938243002: [Mac][Material Design] Correct location bar editing text colors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase from ToT. Created 4 years, 8 months 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 | « chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
diff --git a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
index ec31a5b5c093d576348c16b297655c85ebf5d6a8..9783982c981bc6c1ea248ec0a057f2a0c7473af6 100644
--- a/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
+++ b/chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.mm
@@ -546,6 +546,9 @@ void OmniboxViewMac::ApplyTextAttributes(
const base::string16& display_text,
NSMutableAttributedString* attributedString) {
NSUInteger as_length = [attributedString length];
+ if (as_length == 0) {
+ return;
+ }
NSRange as_entire_string = NSMakeRange(0, as_length);
bool in_dark_mode = [[field_ window] inIncognitoModeWithSystemTheme];
@@ -557,6 +560,15 @@ void OmniboxViewMac::ApplyTextAttributes(
value:@"en_US_POSIX"
range:as_entire_string];
+ // Under Material Design, force the text to be a single color white editing.
+ if (ui::MaterialDesignController::IsModeMaterial() &&
+ [field_ currentEditor]) {
+ [attributedString addAttribute:NSForegroundColorAttributeName
+ value:HostTextColor(in_dark_mode)
+ range:as_entire_string];
+ return;
+ }
+
url::Component scheme, host;
AutocompleteInput::ParseForEmphasizeComponents(
display_text, ChromeAutocompleteSchemeClassifier(profile_), &scheme,
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698