Last Comment Bug 641352 - Add nsHTMLTextAreaElement::IsValueEmpty const
: Add nsHTMLTextAreaElement::IsValueEmpty const
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: DOM: Core & HTML (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla6
Assigned To: Mounir Lamouri (:mounir)
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-13 12:23 PDT by Mounir Lamouri (:mounir)
Modified: 2011-04-12 23:39 PDT (History)
2 users (show)
mounir: in‑testsuite-
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Add IsValueEmpty (2.86 KB, patch)
2011-03-13 12:27 PDT, Mounir Lamouri (:mounir)
bzbarsky: review+
Details | Diff | Review
Add IsValueEmpty (2.93 KB, patch)
2011-04-12 10:54 PDT, Mounir Lamouri (:mounir)
bzbarsky: review+
Details | Diff | Review

Description Mounir Lamouri (:mounir) 2011-03-13 12:23:02 PDT

    
Comment 1 Mounir Lamouri (:mounir) 2011-03-13 12:27:36 PDT
Created attachment 519041 [details] [diff] [review]
Add IsValueEmpty

Like for nsHTMLInputElement, it makes thing easier to read.
But unlike nsHTMLInputElement, it comes with perf improvement given that we don't check if the string is the empty string but if mValue is NULL (by calling nsTextEditorState::IsEmpty).
Comment 2 Boris Zbarsky [:bz] (Out June 25-July 6) 2011-03-16 07:49:53 PDT
Comment on attachment 519041 [details] [diff] [review]
Add IsValueEmpty

r=me
Comment 3 Mounir Lamouri (:mounir) 2011-03-24 07:41:11 PDT
Ehsan, nsTextEditorState::IsEmpty doesn't sound to do what I expected it to do (returning if nsTextEditorState value is empty). Did I misinterpreted this method? is it mis-named? or is it not working as expected?
Comment 4 :Ehsan Akhgari (out sick) 2011-03-24 15:46:55 PDT
(In reply to comment #3)
> Ehsan, nsTextEditorState::IsEmpty doesn't sound to do what I expected it to do
> (returning if nsTextEditorState value is empty). Did I misinterpreted this
> method? is it mis-named? or is it not working as expected?

It is not the best named method in our tree for sure.  ;-)  But the only call site I can find for it expects it to work this way.
Comment 5 Mounir Lamouri (:mounir) 2011-04-12 10:54:50 PDT
Created attachment 525438 [details] [diff] [review]
Add IsValueEmpty

The only chunk that has been changed is:

+bool
+nsHTMLTextAreaElement::IsValueEmpty() const
+{
+  nsAutoString value;
+  GetValueInternal(value, PR_TRUE);
+
+  return value.IsEmpty();
+}

In the previous patch, it was returning mState.IsEmpty().
Comment 6 Boris Zbarsky [:bz] (Out June 25-July 6) 2011-04-12 22:39:01 PDT
Comment on attachment 525438 [details] [diff] [review]
Add IsValueEmpty

r=me
Comment 7 Mounir Lamouri (:mounir) 2011-04-12 23:39:53 PDT
Pushed:
http://hg.mozilla.org/mozilla-central/rev/ebe25dc723b5

Note You need to log in before you can comment on or make changes to this bug.