diff --git a/mozilla/content/base/src/nsSelection.cpp b/mozilla/content/base/src/nsSelection.cpp index 57af6ad1fe8..8f5ed910613 100644 --- a/mozilla/content/base/src/nsSelection.cpp +++ b/mozilla/content/base/src/nsSelection.cpp @@ -2765,7 +2765,9 @@ nsSelection::TakeFocus(nsIContent *aNewFocus, PRUint32 aContentOffset, } else { + PRBool oldDesiredXSet = mDesiredXSet; //need to keep old desired X if it was set. mDomSelections[index]->Collapse(domNode, aContentOffset); + mDesiredXSet = oldDesiredXSet; //now reset desired X back. mBatching = batching; mChangesDuringBatching = changes; } @@ -5892,6 +5894,7 @@ nsTypedSelection::Collapse(nsIDOMNode* aParentNode, PRInt32 aOffset) { if (!aParentNode) return NS_ERROR_INVALID_ARG; + mFrameSelection->InvalidateDesiredX(); if (!IsValidSelectionPoint(mFrameSelection, aParentNode)) return NS_ERROR_FAILURE; nsresult result; diff --git a/mozilla/layout/generic/nsSelection.cpp b/mozilla/layout/generic/nsSelection.cpp index 57af6ad1fe8..8f5ed910613 100644 --- a/mozilla/layout/generic/nsSelection.cpp +++ b/mozilla/layout/generic/nsSelection.cpp @@ -2765,7 +2765,9 @@ nsSelection::TakeFocus(nsIContent *aNewFocus, PRUint32 aContentOffset, } else { + PRBool oldDesiredXSet = mDesiredXSet; //need to keep old desired X if it was set. mDomSelections[index]->Collapse(domNode, aContentOffset); + mDesiredXSet = oldDesiredXSet; //now reset desired X back. mBatching = batching; mChangesDuringBatching = changes; } @@ -5892,6 +5894,7 @@ nsTypedSelection::Collapse(nsIDOMNode* aParentNode, PRInt32 aOffset) { if (!aParentNode) return NS_ERROR_INVALID_ARG; + mFrameSelection->InvalidateDesiredX(); if (!IsValidSelectionPoint(mFrameSelection, aParentNode)) return NS_ERROR_FAILURE; nsresult result;