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 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 /** | 560 /** |
561 * @param {!Element} itemElement | 561 * @param {!Element} itemElement |
562 * @param {!Node} container | 562 * @param {!Node} container |
563 * @param {number} offset | 563 * @param {number} offset |
564 * @return {number} | 564 * @return {number} |
565 */ | 565 */ |
566 _textOffsetInNode: function(itemElement, container, offset) | 566 _textOffsetInNode: function(itemElement, container, offset) |
567 { | 567 { |
568 var chars = 0; | 568 var chars = 0; |
569 var node = itemElement; | 569 var node = itemElement; |
570 while ((node = node.traverseNextTextNode()) && node !== container) | 570 while ((node = node.traverseNextTextNode()) && !node.isSelfOrDescendant(
container)) |
571 chars += node.textContent.length; | 571 chars += node.textContent.length; |
572 return chars + offset; | 572 return chars + offset; |
573 }, | 573 }, |
574 | 574 |
575 /** | 575 /** |
576 * @param {!Event} event | 576 * @param {!Event} event |
577 */ | 577 */ |
578 _onScroll: function(event) | 578 _onScroll: function(event) |
579 { | 579 { |
580 this.refresh(); | 580 this.refresh(); |
(...skipping 71 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 |