| 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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 } | 459 } |
| 460 | 460 |
| 461 var chars = 0; | 461 var chars = 0; |
| 462 var node = itemElement; | 462 var node = itemElement; |
| 463 while ((node = node.traverseNextNode(itemElement)) && node !== selectionNode
) { | 463 while ((node = node.traverseNextNode(itemElement)) && node !== selectionNode
) { |
| 464 if (node.nodeType !== Node.TEXT_NODE || node.parentElement.nodeName === 'S
TYLE' || | 464 if (node.nodeType !== Node.TEXT_NODE || node.parentElement.nodeName === 'S
TYLE' || |
| 465 node.parentElement.nodeName === 'SCRIPT') | 465 node.parentElement.nodeName === 'SCRIPT') |
| 466 continue; | 466 continue; |
| 467 chars += Components.Linkifier.untruncatedNodeText(node).length; | 467 chars += Components.Linkifier.untruncatedNodeText(node).length; |
| 468 } | 468 } |
| 469 // If the selection offset is at the end of a link's ellipsis, use the untru
ncated length as offset. | 469 // If the selected node text was truncated, treat any non-zero offset as the
full length. |
| 470 var untruncatedContainerLength = Components.Linkifier.untruncatedNodeText(se
lectionNode).length; | 470 var untruncatedContainerLength = Components.Linkifier.untruncatedNodeText(se
lectionNode).length; |
| 471 if (offset === 1 && untruncatedContainerLength > offset) | 471 if (offset > 0 && untruncatedContainerLength !== selectionNode.textContent.l
ength) |
| 472 offset = untruncatedContainerLength; | 472 offset = untruncatedContainerLength; |
| 473 return chars + offset; | 473 return chars + offset; |
| 474 } | 474 } |
| 475 | 475 |
| 476 /** | 476 /** |
| 477 * @param {!Event} event | 477 * @param {!Event} event |
| 478 */ | 478 */ |
| 479 _onScroll(event) { | 479 _onScroll(event) { |
| 480 this.refresh(); | 480 this.refresh(); |
| 481 } | 481 } |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 Console.ConsoleViewportElement.prototype = { | 606 Console.ConsoleViewportElement.prototype = { |
| 607 willHide() {}, | 607 willHide() {}, |
| 608 | 608 |
| 609 wasShown() {}, | 609 wasShown() {}, |
| 610 | 610 |
| 611 /** | 611 /** |
| 612 * @return {!Element} | 612 * @return {!Element} |
| 613 */ | 613 */ |
| 614 element() {}, | 614 element() {}, |
| 615 }; | 615 }; |
| OLD | NEW |