diff --git a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp
index 5c5c8a6a5c8..016847678cb 100644
--- a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp
+++ b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp
@@ -206,8 +206,12 @@ public:
protected:
+
nsGfxTextControlFrame2* mFrame; // weak reference
nsString mFocusedValue;
+
+ PRPackedBool mSelectionWasCollapsed;
+ PRPackedBool mKnowSelectionCollapsed;
};
@@ -221,6 +225,9 @@ NS_IMPL_RELEASE(nsTextInputListener)
nsTextInputListener::nsTextInputListener()
+: mFrame(nsnull)
+, mSelectionWasCollapsed(PR_TRUE)
+, mKnowSelectionCollapsed(PR_FALSE)
{
NS_INIT_REFCNT();
}
@@ -298,8 +305,16 @@ NS_IMETHODIMP
nsTextInputListener::NotifySelectionChanged(nsIDOMDocument* aDoc, nsIDOMSelection* aSel, PRInt16 aReason)
{
PRBool collapsed;
- if (!mFrame || !aDoc || !aSel || NS_FAILED(aSel->GetIsCollapsed(&collapsed)) || collapsed)
- return NS_OK;//no update if collapsed
+ if (!mFrame || !aDoc || !aSel || NS_FAILED(aSel->GetIsCollapsed(&collapsed)))
+ return NS_OK;
+
+ // if the collapsed state did not change, don't fire notifications
+ if (mKnowSelectionCollapsed && collapsed == mSelectionWasCollapsed)
+ return NS_OK;
+
+ mSelectionWasCollapsed = collapsed;
+ mKnowSelectionCollapsed = PR_TRUE;
+
nsCOMPtr content;
nsresult rv = mFrame->GetContent(getter_AddRefs(content));
if (NS_FAILED(rv) || !content )
@@ -2566,8 +2581,8 @@ nsGfxTextControlFrame2::SetInitialChildList(nsIPresContext* aPresContext,
first->QueryInterface(NS_GET_IID(nsIScrollableFrame), (void **) &scrollableFrame);
if (scrollableFrame)
scrollableFrame->SetScrollbarVisibility(aPresContext,PR_FALSE,PR_FALSE);
-
}
+
//register keylistener
nsCOMPtr erP;
if (NS_SUCCEEDED(mContent->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), getter_AddRefs(erP))) && erP)
@@ -2581,8 +2596,8 @@ nsGfxTextControlFrame2::SetInitialChildList(nsIPresContext* aPresContext,
nsresult rv = aPresContext->GetShell(getter_AddRefs(shell));
if (NS_FAILED(rv) || !shell)
return rv?rv:NS_ERROR_FAILURE;
-
}
+
while(first)
{
nsIScrollableView *scrollView;
diff --git a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.h b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.h
index c1d5946bf84..54cf736c48e 100644
--- a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.h
+++ b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.h
@@ -221,6 +221,7 @@ private:
NS_IMETHODIMP GetFirstTextNode(nsIDOMCharacterData* *aFirstTextNode);
nsresult SelectAllContents();
nsresult SetSelectionEndPoints(PRInt32 aSelStart, PRInt32 aSelEnd);
+
private:
nsCOMPtr mEditor;
nsCOMPtr mSelCon;
@@ -231,11 +232,12 @@ private:
nscoord mSuggestedHeight;
nsSize mSize;
- PRBool mIsProcessing;
+ PRPackedBool mIsProcessing;
+ PRPackedBool mNotifyOnInput;//default this to off to stop any notifications until setup is complete
+
nsFormFrame *mFormFrame;
nsTextInputSelectionImpl *mTextSelImpl;
nsTextInputListener *mTextListener;
- PRBool mNotifyOnInput;//default this to off to stop any notifications until setup is complete
};
#endif