OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 /** | 99 /** |
100 * @param {!AnchorBox} anchorBox | 100 * @param {!AnchorBox} anchorBox |
101 */ | 101 */ |
102 setPosition: function(anchorBox) | 102 setPosition: function(anchorBox) |
103 { | 103 { |
104 this._updateBoxPosition(anchorBox); | 104 this._updateBoxPosition(anchorBox); |
105 }, | 105 }, |
106 | 106 |
107 /** | 107 /** |
108 * @param {!AnchorBox=} anchorBox | 108 * @param {?AnchorBox|undefined} anchorBox |
109 */ | 109 */ |
110 _updateBoxPosition: function(anchorBox) | 110 _updateBoxPosition: function(anchorBox) |
111 { | 111 { |
112 this._anchorBox = anchorBox; | 112 this._anchorBox = anchorBox; |
113 anchorBox = anchorBox || this._anchorElement.boxInWindow(window); | 113 anchorBox = anchorBox || this._anchorElement.boxInWindow(window); |
114 | 114 |
115 // Position relative to main DevTools element. | 115 // Position relative to main DevTools element. |
116 var container = WebInspector.inspectorView.devtoolsElement(); | 116 var container = WebInspector.inspectorView.devtoolsElement(); |
117 anchorBox = anchorBox.relativeToElement(container); | 117 anchorBox = anchorBox.relativeToElement(container); |
118 var totalWidth = container.offsetWidth; | 118 var totalWidth = container.offsetWidth; |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 | 338 |
339 _rememberRowCountPerViewport: function() | 339 _rememberRowCountPerViewport: function() |
340 { | 340 { |
341 if (!this.contentElement.firstChild) | 341 if (!this.contentElement.firstChild) |
342 return; | 342 return; |
343 | 343 |
344 this._rowCountPerViewport = Math.floor(this.containerElement.offsetHeigh
t / this.contentElement.firstChild.offsetHeight); | 344 this._rowCountPerViewport = Math.floor(this.containerElement.offsetHeigh
t / this.contentElement.firstChild.offsetHeight); |
345 }, | 345 }, |
346 | 346 |
347 /** | 347 /** |
348 * @param {!AnchorBox} anchorBox | 348 * @param {?AnchorBox} anchorBox |
349 * @param {!Array.<string>} completions | 349 * @param {!Array.<string>} completions |
350 * @param {number} selectedIndex | 350 * @param {number} selectedIndex |
351 * @param {boolean} canShowForSingleItem | 351 * @param {boolean} canShowForSingleItem |
352 * @param {string} userEnteredText | 352 * @param {string} userEnteredText |
353 */ | 353 */ |
354 updateSuggestions: function(anchorBox, completions, selectedIndex, canShowFo
rSingleItem, userEnteredText) | 354 updateSuggestions: function(anchorBox, completions, selectedIndex, canShowFo
rSingleItem, userEnteredText) |
355 { | 355 { |
356 if (this._canShowBox(completions, canShowForSingleItem, userEnteredText)
) { | 356 if (this._canShowBox(completions, canShowForSingleItem, userEnteredText)
) { |
357 this._updateItems(completions, selectedIndex, userEnteredText); | 357 this._updateItems(completions, selectedIndex, userEnteredText); |
358 this._updateBoxPosition(anchorBox); | 358 this._updateBoxPosition(anchorBox); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 enterKeyPressed: function() | 422 enterKeyPressed: function() |
423 { | 423 { |
424 var hasSelectedItem = !!this._selectedElement; | 424 var hasSelectedItem = !!this._selectedElement; |
425 this.acceptSuggestion(); | 425 this.acceptSuggestion(); |
426 | 426 |
427 // Report the event as non-handled if there is no selected item, | 427 // Report the event as non-handled if there is no selected item, |
428 // to commit the input or handle it otherwise. | 428 // to commit the input or handle it otherwise. |
429 return hasSelectedItem; | 429 return hasSelectedItem; |
430 } | 430 } |
431 } | 431 } |
OLD | NEW |