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

Side by Side Diff: chrome/browser/resources/settings/search_settings.js

Issue 2260373002: Settings Search: Make tooltip run away from mouse. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resolve origin/master conflicts Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/settings/settings_shared_css.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/settings/settings_shared_css.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698