diff options
Diffstat (limited to 'dom/base/nsFocusManager.cpp')
-rw-r--r-- | dom/base/nsFocusManager.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index 01c1944be..c14087c8a 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -2457,7 +2457,7 @@ nsFocusManager::GetSelectionLocation(nsIDocument* aDocument, nsCOMPtr<nsIDOMNode> startNode, endNode; bool isCollapsed = false; nsCOMPtr<nsIContent> startContent, endContent; - int32_t startOffset = 0; + uint32_t startOffset = 0; if (domSelection) { domSelection->GetIsCollapsed(&isCollapsed); nsCOMPtr<nsIDOMRange> domRange; @@ -2471,7 +2471,6 @@ nsFocusManager::GetSelectionLocation(nsIDocument* aDocument, startContent = do_QueryInterface(startNode); if (startContent && startContent->IsElement()) { - NS_ASSERTION(startOffset >= 0, "Start offset cannot be negative"); childContent = startContent->GetChildAt(startOffset); if (childContent) { startContent = childContent; @@ -2480,9 +2479,8 @@ nsFocusManager::GetSelectionLocation(nsIDocument* aDocument, endContent = do_QueryInterface(endNode); if (endContent && endContent->IsElement()) { - int32_t endOffset = 0; + uint32_t endOffset = 0; domRange->GetEndOffset(&endOffset); - NS_ASSERTION(endOffset >= 0, "End offset cannot be negative"); childContent = endContent->GetChildAt(endOffset); if (childContent) { endContent = childContent; @@ -2510,7 +2508,7 @@ nsFocusManager::GetSelectionLocation(nsIDocument* aDocument, bool isFormControl = startContent->IsNodeOfType(nsINode::eHTML_FORM_CONTROL); - if (nodeValue.Length() == (uint32_t)startOffset && !isFormControl && + if (nodeValue.Length() == startOffset && !isFormControl && startContent != aDocument->GetRootElement()) { // Yes, indeed we were at the end of the last node nsCOMPtr<nsIFrameEnumerator> frameTraversal; |