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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 offset: offset | 280 offset: offset |
281 }; | 281 }; |
282 }, | 282 }, |
283 | 283 |
284 /** | 284 /** |
285 * @param {?Selection} selection | 285 * @param {?Selection} selection |
286 */ | 286 */ |
287 _updateSelectionModel: function(selection) | 287 _updateSelectionModel: function(selection) |
288 { | 288 { |
289 var range = selection && selection.rangeCount ? selection.getRangeAt(0)
: null; | 289 var range = selection && selection.rangeCount ? selection.getRangeAt(0)
: null; |
290 if (!range || selection.isCollapsed) { | 290 if (!range || selection.isCollapsed || !this.element.hasSelection()) { |
291 this._headSelection = null; | 291 this._headSelection = null; |
292 this._anchorSelection = null; | 292 this._anchorSelection = null; |
293 return false; | 293 return false; |
294 } | 294 } |
295 | 295 |
296 var firstSelected = Number.MAX_VALUE; | 296 var firstSelected = Number.MAX_VALUE; |
297 var lastSelected = -1; | 297 var lastSelected = -1; |
298 | 298 |
299 var hasVisibleSelection = false; | 299 var hasVisibleSelection = false; |
300 for (var i = 0; i < this._renderedItems.length; ++i) { | 300 for (var i = 0; i < this._renderedItems.length; ++i) { |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 | 652 |
653 /** | 653 /** |
654 * @return {number} | 654 * @return {number} |
655 */ | 655 */ |
656 _visibleHeight: function() | 656 _visibleHeight: function() |
657 { | 657 { |
658 // Use offsetHeight instead of clientHeight to avoid being affected by h
orizontal scroll. | 658 // Use offsetHeight instead of clientHeight to avoid being affected by h
orizontal scroll. |
659 return this.element.offsetHeight; | 659 return this.element.offsetHeight; |
660 } | 660 } |
661 } | 661 } |
OLD | NEW |