Base textNodeLength on textNode.textContent.length

This is how we were computing the length previously. Not sure what the
difference is but I want to keep it the same.
This commit is contained in:
Nathan Sobo
2015-07-09 00:18:42 -05:00
parent a352a2ca61
commit 442e75853b

View File

@@ -346,15 +346,15 @@ class LinesTileComponent
rangeForMeasurement ?= document.createRange()
iterator = document.createNodeIterator(lineNode, NodeFilter.SHOW_TEXT, AcceptFilter)
textNode = iterator.nextNode()
textNodeLength = textNode.length
textNodeLength = textNode.textContent.length
textNodeIndex = 0
nextTextNodeIndex = textNode.textContent.length
nextTextNodeIndex = textNodeLength
while nextTextNodeIndex <= charIndex
textNode = iterator.nextNode()
textNodeLength = textNode.length
textNodeLength = textNode.textContent.length
textNodeIndex = nextTextNodeIndex
nextTextNodeIndex = textNodeIndex + textNode.textContent.length
nextTextNodeIndex = textNodeIndex + textNodeLength
i = charIndex - textNodeIndex
rangeForMeasurement.setStart(textNode, i)