Commit 78366d79 authored by alekseys's avatar alekseys Committed by Commit bot

Add search hint bubbles to Print Preview advanced options controls.

BUG=397741

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

Cr-Commit-Position: refs/heads/master@{#293827}
parent b873f1a4
...@@ -99,9 +99,13 @@ cr.define('print_preview', function() { ...@@ -99,9 +99,13 @@ cr.define('print_preview', function() {
var searchEvent = new Event(SearchBox.EventType.SEARCH); var searchEvent = new Event(SearchBox.EventType.SEARCH);
var query = this.getQuery_(); var query = this.getQuery_();
searchEvent.query = query; searchEvent.query = query;
if (query) {
// Generate regexp-safe query by escaping metacharacters. // Generate regexp-safe query by escaping metacharacters.
var safeQuery = query.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); var safeQuery = query.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
searchEvent.queryRegExp = new RegExp('(' + safeQuery + ')', 'ig'); searchEvent.queryRegExp = new RegExp('(' + safeQuery + ')', 'ig');
} else {
searchEvent.queryRegExp = null;
}
this.dispatchEvent(searchEvent); this.dispatchEvent(searchEvent);
}, },
......
...@@ -36,5 +36,11 @@ ...@@ -36,5 +36,11 @@
#advanced-settings .settings { #advanced-settings .settings {
border-spacing: 0; border-spacing: 0;
display: table; display: table;
position: relative;
width: 100%; width: 100%;
} }
.advanced-settings-item-extra-padding {
display: table-row;
height: 15px;
}
...@@ -126,9 +126,15 @@ cr.define('print_preview', function() { ...@@ -126,9 +126,15 @@ cr.define('print_preview', function() {
* @private * @private
*/ */
filterLists_: function(query) { filterLists_: function(query) {
var lastVisibleItemWithBubble = null;
this.items_.forEach(function(item) { this.items_.forEach(function(item) {
item.updateSearchQuery(query); item.updateSearchQuery(query);
if (item.searchBubbleShown)
lastVisibleItemWithBubble = item;
}); });
setIsVisible(
this.getChildElement('.advanced-settings-item-extra-padding'),
!!lastVisibleItemWithBubble);
}, },
/** /**
...@@ -158,14 +164,20 @@ cr.define('print_preview', function() { ...@@ -158,14 +164,20 @@ cr.define('print_preview', function() {
var availableHeight = this.getAvailableContentHeight_(); var availableHeight = this.getAvailableContentHeight_();
var containerEl = this.getChildElement('.settings-area'); var containerEl = this.getChildElement('.settings-area');
containerEl.style.maxHeight = availableHeight + 'px'; containerEl.style.maxHeight = availableHeight + 'px';
var settingsEl = this.getChildElement('.settings');
vendorCapabilities.forEach(function(capability) { vendorCapabilities.forEach(function(capability) {
var item = new print_preview.AdvancedSettingsItem( var item = new print_preview.AdvancedSettingsItem(
this.eventTarget_, this.printTicketStore_, capability); this.eventTarget_, this.printTicketStore_, capability);
this.addChild(item); this.addChild(item);
item.render(this.getChildElement('.settings')); item.render(settingsEl);
this.items_.push(item); this.items_.push(item);
}.bind(this)); }.bind(this));
var extraPadding = document.createElement('div');
extraPadding.classList.add('advanced-settings-item-extra-padding');
extraPadding.hidden = true;
settingsEl.appendChild(extraPadding);
}, },
/** /**
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
.advanced-settings-item-label { .advanced-settings-item-label {
-webkit-padding-end: 20px; -webkit-padding-end: 20px;
display: table-cell; display: table-cell;
line-height: 24px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
vertical-align: middle; vertical-align: middle;
...@@ -35,7 +34,6 @@ ...@@ -35,7 +34,6 @@
.advanced-settings-item-value { .advanced-settings-item-value {
display: table-cell; display: table-cell;
line-height: 24px;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
vertical-align: middle; vertical-align: middle;
...@@ -43,7 +41,12 @@ ...@@ -43,7 +41,12 @@
width: 175px; width: 175px;
} }
.advanced-settings-item-value-select-control {
line-height: 24px;
}
.advanced-settings-item-value-text-control { .advanced-settings-item-value-text-control {
height: 28px; height: 28px;
line-height: 24px;
width: 175px; width: 175px;
} }
...@@ -109,6 +109,10 @@ cr.define('print_preview', function() { ...@@ -109,6 +109,10 @@ cr.define('print_preview', function() {
this.renderCapability_(); this.renderCapability_();
}, },
get searchBubbleShown() {
return getIsVisible(this.getElement()) && !!this.searchBubble_;
},
/** /**
* @return {HTMLSelectElement} Select element. * @return {HTMLSelectElement} Select element.
* @private * @private
...@@ -155,7 +159,7 @@ cr.define('print_preview', function() { ...@@ -155,7 +159,7 @@ cr.define('print_preview', function() {
var textContent = this.capability_.display_name; var textContent = this.capability_.display_name;
var nameMatches = this.query_ ? !!textContent.match(this.query_) : true; var nameMatches = this.query_ ? !!textContent.match(this.query_) : true;
var optionMatches = null; var optionMatches = null;
if (false && this.query_) { if (this.query_) {
if (this.capability_.type == 'SELECT') { if (this.capability_.type == 'SELECT') {
this.capability_.select_cap.option.some(function(option) { this.capability_.select_cap.option.some(function(option) {
optionMatches = (option.display_name || '').match(this.query_); optionMatches = (option.display_name || '').match(this.query_);
...@@ -186,7 +190,6 @@ cr.define('print_preview', function() { ...@@ -186,7 +190,6 @@ cr.define('print_preview', function() {
nameEl.title = textContent; nameEl.title = textContent;
if (optionMatches) { if (optionMatches) {
window.console.log(optionMatches[0]);
var element = var element =
this.capability_.type == 'SELECT' ? this.select_ : this.text_; this.capability_.type == 'SELECT' ? this.select_ : this.text_;
if (!this.searchBubble_) { if (!this.searchBubble_) {
......
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