Bug 609162 - Do not invalidate textarea at every value change when a placeholder is set. r=bz a=bsmedberg
authorMounir Lamouri <mounir.lamouri@gmail.com>
Wed, 24 Nov 2010 00:46:49 +0100
changeset 58141 a26199cd24df75cd83fdce0439a77f722e0a7c0e
parent 58140 023f675df2a0736749c35e0ac35f8feed46d76b5
child 58142 0dccfde3b86c1e7d1aae75b0f941675c3d82412e
push id17175
push usermlamouri@mozilla.com
push dateWed, 24 Nov 2010 10:15:50 +0000
treeherdermozilla-central@7f5cd850578e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz, bsmedberg
bugs609162
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 609162 - Do not invalidate textarea at every value change when a placeholder is set. r=bz a=bsmedberg
content/html/content/src/nsHTMLTextAreaElement.cpp
--- a/content/html/content/src/nsHTMLTextAreaElement.cpp
+++ b/content/html/content/src/nsHTMLTextAreaElement.cpp
@@ -556,22 +556,25 @@ nsHTMLTextAreaElement::SetUserInput(cons
   }
   SetValueInternal(aValue, PR_TRUE);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHTMLTextAreaElement::SetValueChanged(PRBool aValueChanged)
 {
+  PRBool previousValue = mValueChanged;
+
   mValueChanged = aValueChanged;
   if (!aValueChanged && !mState->IsEmpty()) {
     mState->EmptyValue();
   }
 
-  if (HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder)) {
+  if (mValueChanged != previousValue &&
+      HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder)) {
     nsIDocument* doc = GetCurrentDoc();
     if (doc) {
       mozAutoDocUpdate upd(doc, UPDATE_CONTENT_STATE, PR_TRUE);
       doc->ContentStatesChanged(this, nsnull, NS_EVENT_STATE_MOZ_PLACEHOLDER);
     }
   }
 
   return NS_OK;