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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 }, | 502 }, |
503 | 503 |
504 /** | 504 /** |
505 * @param {!Element} itemElement | 505 * @param {!Element} itemElement |
506 * @param {!Node} container | 506 * @param {!Node} container |
507 * @param {number} offset | 507 * @param {number} offset |
508 * @return {number} | 508 * @return {number} |
509 */ | 509 */ |
510 _textOffsetInNode: function(itemElement, container, offset) | 510 _textOffsetInNode: function(itemElement, container, offset) |
511 { | 511 { |
512 if (!offset) | |
513 return 0; | |
514 var chars = 0; | 512 var chars = 0; |
515 var node = itemElement; | 513 var node = itemElement; |
516 while ((node = node.traverseNextTextNode()) && node !== container) | 514 while ((node = node.traverseNextTextNode()) && node !== container) |
517 chars += node.textContent.length; | 515 chars += node.textContent.length; |
518 return chars + offset; | 516 return chars + offset; |
519 }, | 517 }, |
520 | 518 |
521 /** | 519 /** |
522 * @param {!Event} event | 520 * @param {!Event} event |
523 */ | 521 */ |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 | 590 |
593 /** | 591 /** |
594 * @return {number} | 592 * @return {number} |
595 */ | 593 */ |
596 _visibleHeight: function() | 594 _visibleHeight: function() |
597 { | 595 { |
598 // Use offsetHeight instead of clientHeight to avoid being affected by h
orizontal scroll. | 596 // Use offsetHeight instead of clientHeight to avoid being affected by h
orizontal scroll. |
599 return this.element.offsetHeight; | 597 return this.element.offsetHeight; |
600 } | 598 } |
601 } | 599 } |
OLD | NEW |