Commit ae6defdf authored by dubroy@chromium.org's avatar dubroy@chromium.org

History: Prevent search box from disappearing when search term is deleted.

Also removed unnecessary calls to updateNavBar_().

This fix is based on http://crrev.com/219018, which had to be reverted
because it introduced a regression.

BUG=263870
TEST=See repro steps in bug.
R=jhawkins@chromium.org

Review URL: https://codereview.chromium.org/23464026

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221512 0039d316-1c4b-4281-b951-d872f2087c98
parent 5d88a98b
......@@ -938,6 +938,13 @@ HistoryView.prototype.onModelReady = function(doneLoading) {
document.body.classList.remove('has-results');
this.updateNavBar_();
if (isMobileVersion()) {
// Hide the search field if it is empty and there are no results.
var hasResults = this.model_.visits_.length > 0;
var isSearch = this.model_.getSearchText().length > 0;
$('search-field').hidden = !(hasResults || isSearch);
}
};
/**
......@@ -1298,7 +1305,6 @@ HistoryView.prototype.displayResults_ = function(doneLoading) {
createElementWithClassName('div', 'no-results-message'));
noResults.textContent = loadTimeData.getString('noResults');
this.resultDiv_.appendChild(resultsFragment);
this.updateNavBar_();
return;
}
......@@ -1326,7 +1332,6 @@ HistoryView.prototype.displayResults_ = function(doneLoading) {
// Add all the days and their visits to the page.
this.resultDiv_.appendChild(resultsFragment);
}
this.updateNavBar_();
};
/**
......@@ -1335,9 +1340,10 @@ HistoryView.prototype.displayResults_ = function(doneLoading) {
*/
HistoryView.prototype.updateNavBar_ = function() {
this.updateRangeButtons_();
// Managed users have the control bar on top, don't show it on the bottom
// as well.
if (!loadTimeData.getBoolean('isManagedProfile')) {
// Managed users have the control bar on top, don't show it on the bottom
// as well.
$('newest-button').hidden = this.pageIndex_ == 0;
$('newer-button').hidden = this.pageIndex_ == 0;
$('older-button').hidden =
......
......@@ -81,11 +81,6 @@ html[dir='rtl'] #search-field {
background-position: right 16px center;
}
/* Hide the search field if it is empty (!valid) and there are no results. */
body:not(.has-results) #search-field:not(:valid) {
display: none;
}
.no-results-message {
margin-bottom: 1em;
padding-left: 16px;
......
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