Commit ed6d1f0b authored by Dan Beam's avatar Dan Beam Committed by Commit Bot

Local NTP, Realbox: more UI polish

* restore search magnifying glass (aka loupe) as default icon @ 20px
* add 8px of bottom margin below last realbox result
* add feature to experiment with Google (g) icon ("super g")

R=mahmadi@chromium.org

Bug: 1017495
Change-Id: I4db697dcf66d20ab2509ccbec35317f80919c10c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1884951
Commit-Queue: Dan Beam <dbeam@chromium.org>
Reviewed-by: default avatarMoe Ahmadi <mahmadi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710626}
parent 80ce75d8
...@@ -259,6 +259,10 @@ body.hide-fakebox #fakebox { ...@@ -259,6 +259,10 @@ body.hide-fakebox #fakebox {
padding-inline-end: 48px; padding-inline-end: 48px;
} }
#realbox-matches a:last-of-type {
margin-bottom: 8px; /* Last result is tight with border-radius. */
}
.clock-icon, .clock-icon,
.search-icon { .search-icon {
-webkit-mask-position: center; -webkit-mask-position: center;
...@@ -281,6 +285,10 @@ body.hide-fakebox #fakebox { ...@@ -281,6 +285,10 @@ body.hide-fakebox #fakebox {
url(../../../../ui/webui/resources/images/icon_search.svg); url(../../../../ui/webui/resources/images/icon_search.svg);
} }
#realbox-input-wrapper > .search-icon {
-webkit-mask-size: 20px; /* Loupe in realbox is bigger than in matches. */
}
html[dir=rtl] :-webkit-any(.clock-icon, .search-icon) { html[dir=rtl] :-webkit-any(.clock-icon, .search-icon) {
right: 16px; right: 16px;
} }
...@@ -425,7 +433,8 @@ html[dir=rtl] .microphone-icon { ...@@ -425,7 +433,8 @@ html[dir=rtl] .microphone-icon {
right: auto; right: auto;
} }
#realbox-input-wrapper :-webkit-any(.google-g-icon, .microphone-icon) { #realbox-input-wrapper > :-webkit-any(.google-g-icon, .microphone-icon,
.search-icon) {
z-index: 3; z-index: 3;
} }
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
<div id="realbox-container" $i18n{hiddenIfRealboxDisabled}> <div id="realbox-container" $i18n{hiddenIfRealboxDisabled}>
<div id="realbox-input-wrapper"> <div id="realbox-input-wrapper">
<div class="google-g-icon"></div> <div class="$i18n{realboxIconClass}"></div>
<input id="realbox" type="search" autocomplete="off" spellcheck="false" <input id="realbox" type="search" autocomplete="off" spellcheck="false"
aria-live="polite" autofocus> aria-live="polite" autofocus>
<button id="realbox-microphone" class="microphone-icon" hidden></button> <button id="realbox-microphone" class="microphone-icon" hidden></button>
......
...@@ -1036,6 +1036,11 @@ void LocalNtpSource::StartDataRequest( ...@@ -1036,6 +1036,11 @@ void LocalNtpSource::StartDataRequest(
replacements["hiddenIfRealboxEnabled"] = realbox_enabled ? "hidden" : ""; replacements["hiddenIfRealboxEnabled"] = realbox_enabled ? "hidden" : "";
replacements["hiddenIfRealboxDisabled"] = realbox_enabled ? "" : "hidden"; replacements["hiddenIfRealboxDisabled"] = realbox_enabled ? "" : "hidden";
bool use_google_g_icon =
base::FeatureList::IsEnabled(features::kNtpRealboxUseGoogleGIcon);
replacements["realboxIconClass"] =
use_google_g_icon ? "google-g-icon" : "search-icon";
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
base::StringPiece html = bundle.GetRawDataResource(IDR_LOCAL_NTP_HTML); base::StringPiece html = bundle.GetRawDataResource(IDR_LOCAL_NTP_HTML);
std::string replaced = ui::ReplaceTemplateExpressions(html, replacements); std::string replaced = ui::ReplaceTemplateExpressions(html, replacements);
......
...@@ -34,6 +34,11 @@ const base::Feature kDismissNtpPromos{"DismissNtpPromos", ...@@ -34,6 +34,11 @@ const base::Feature kDismissNtpPromos{"DismissNtpPromos",
const base::Feature kNtpCustomizationMenuV2{"NtpCustomizationMenuV2", const base::Feature kNtpCustomizationMenuV2{"NtpCustomizationMenuV2",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
// If enabled, the real search box ("realbox") on the New Tab page will show a
// Google (g) icon instead of the typical magnifying glass (aka loupe).
const base::Feature kNtpRealboxUseGoogleGIcon{
"NtpRealboxUseGoogleGIcon", base::FEATURE_DISABLED_BY_DEFAULT};
// If enabled, the search box in the middle of the NTP will accept input // If enabled, the search box in the middle of the NTP will accept input
// directly (i.e. not be a "fake" box) and search results will show directly // directly (i.e. not be a "fake" box) and search results will show directly
// below the non-fake input ("realbox"). // below the non-fake input ("realbox").
......
...@@ -17,6 +17,7 @@ extern const base::Feature kChromeColorsCustomColorPicker; ...@@ -17,6 +17,7 @@ extern const base::Feature kChromeColorsCustomColorPicker;
extern const base::Feature kConfirmNtpSuggestionRemovals; extern const base::Feature kConfirmNtpSuggestionRemovals;
extern const base::Feature kDismissNtpPromos; extern const base::Feature kDismissNtpPromos;
extern const base::Feature kNtpCustomizationMenuV2; extern const base::Feature kNtpCustomizationMenuV2;
extern const base::Feature kNtpRealboxUseGoogleGIcon;
// Note: only exposed for about:flags. Use IsNtpRealboxEnabled() instead. // Note: only exposed for about:flags. Use IsNtpRealboxEnabled() instead.
extern const base::Feature kNtpRealbox; extern const base::Feature kNtpRealbox;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment