| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 cr.define('settings', function() { | 5 cr.define('settings', function() { |
| 6 /** @const {string} */ | 6 /** @const {string} */ |
| 7 var WRAPPER_CSS_CLASS = 'search-highlight-wrapper'; | 7 var WRAPPER_CSS_CLASS = 'search-highlight-wrapper'; |
| 8 | 8 |
| 9 /** @const {string} */ | 9 /** @const {string} */ |
| 10 var HIT_CSS_CLASS = 'search-highlight-hit'; | 10 var HIT_CSS_CLASS = 'search-highlight-hit'; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 searchBubble = document.createElement('div'); | 190 searchBubble = document.createElement('div'); |
| 191 searchBubble.classList.add(SEARCH_BUBBLE_CSS_CLASS); | 191 searchBubble.classList.add(SEARCH_BUBBLE_CSS_CLASS); |
| 192 var innards = document.createElement('div'); | 192 var innards = document.createElement('div'); |
| 193 innards.classList.add('search-bubble-innards'); | 193 innards.classList.add('search-bubble-innards'); |
| 194 innards.textContent = rawQuery; | 194 innards.textContent = rawQuery; |
| 195 searchBubble.appendChild(innards); | 195 searchBubble.appendChild(innards); |
| 196 element.appendChild(searchBubble); | 196 element.appendChild(searchBubble); |
| 197 | 197 |
| 198 // Dynamically position the bubble at the edge the associated control | 198 // Dynamically position the bubble at the edge the associated control |
| 199 // element. | 199 // element. |
| 200 searchBubble.style.top = element.offsetTop + element.offsetHeight + 'px'; | 200 var updatePosition = function() { |
| 201 if (innards.classList.contains('above')) { |
| 202 searchBubble.style.top = |
| 203 element.offsetTop - searchBubble.offsetHeight + 'px'; |
| 204 } else { |
| 205 searchBubble.style.top = |
| 206 element.offsetTop + element.offsetHeight + 'px'; |
| 207 } |
| 208 }; |
| 209 updatePosition(); |
| 210 |
| 211 searchBubble.addEventListener('mouseover', function() { |
| 212 innards.classList.toggle('above'); |
| 213 updatePosition(); |
| 214 }); |
| 201 } | 215 } |
| 202 | 216 |
| 203 /** | 217 /** |
| 204 * Finds and makes visible the <settings-section> parent of |node|. | 218 * Finds and makes visible the <settings-section> parent of |node|. |
| 205 * @param {!Node} node | 219 * @param {!Node} node |
| 206 * @param {string} rawQuery | 220 * @param {string} rawQuery |
| 207 * @private | 221 * @private |
| 208 */ | 222 */ |
| 209 function revealParentSection_(node, rawQuery) { | 223 function revealParentSection_(node, rawQuery) { |
| 210 var associatedControl = null; | 224 var associatedControl = null; |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 function setSearchManagerForTesting(searchManager) { | 600 function setSearchManagerForTesting(searchManager) { |
| 587 SearchManagerImpl.instance_ = searchManager; | 601 SearchManagerImpl.instance_ = searchManager; |
| 588 } | 602 } |
| 589 | 603 |
| 590 return { | 604 return { |
| 591 getSearchManager: getSearchManager, | 605 getSearchManager: getSearchManager, |
| 592 setSearchManagerForTesting: setSearchManagerForTesting, | 606 setSearchManagerForTesting: setSearchManagerForTesting, |
| 593 SearchRequest: SearchRequest, | 607 SearchRequest: SearchRequest, |
| 594 }; | 608 }; |
| 595 }); | 609 }); |
| OLD | NEW |