diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp index ef38d64bf12..15c6004e843 100644 --- a/layout/generic/nsSelection.cpp +++ b/layout/generic/nsSelection.cpp @@ -4388,12 +4388,8 @@ Selection::Collapse(nsINode* aParentNode, int32_t aOffset) if (!IsValidSelectionPoint(mFrameSelection, aParentNode)) return NS_ERROR_FAILURE; nsresult result; - - nsRefPtr presContext = GetPresContext(); - if (presContext->Document() != aParentNode->OwnerDoc()) - return NS_ERROR_FAILURE; - // Delete all of the current ranges + nsRefPtr presContext = GetPresContext(); Clear(presContext); // Turn off signal for table selection @@ -4620,10 +4616,6 @@ Selection::Extend(nsINode* aParentNode, int32_t aOffset) if (!IsValidSelectionPoint(mFrameSelection, aParentNode)) return NS_ERROR_FAILURE; - nsRefPtr presContext = GetPresContext(); - if (presContext->Document() != aParentNode->OwnerDoc()) - return NS_ERROR_FAILURE; - //mFrameSelection->InvalidateDesiredX(); nsINode* anchorNode = GetAnchorNode(); @@ -4658,6 +4650,7 @@ Selection::Extend(nsINode* aParentNode, int32_t aOffset) aParentNode, aOffset, &disconnected); + nsRefPtr presContext = GetPresContext(); nsRefPtr difRange = new nsRange(aParentNode); if ((result1 == 0 && result3 < 0) || (result1 <= 0 && result2 < 0)){//a1,2 a,1,2 //select from 1 to 2 unless they are collapsed