Closed Bug 74091 Opened 23 years ago Closed 22 years ago

TEXTAREA loses soft returns on back button. [form sub]

Categories

(Core :: Layout: Form Controls, defect)

x86
All
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla1.1alpha

People

(Reporter: donguana, Assigned: john)

References

Details

(Keywords: testcase, Whiteboard: [FIX])

Attachments

(4 files)

I've notice a small glitch with the textarea element in the forms. 

If you create a form using something like the HTML code below:

<FORM  METHOD="POST" ACTION="anything.cgi">
   <TEXTAREA NAME="ANYTHING" ROWS="7" COLS="50" WRAP="HARD"></TEXTAREA>
   <INPUT  TYPE="SUBMIT">
</FORM>

Then you enter some data in the form. Enter enough data so that the textarea box
does soft returns. Now when the form is submitted the data is sent with hard
returns as it should. But now if I hit the back button to get the form on the
window again (so I can continue editing) all the soft returns within the form
have now changed to hard returns. Maybe this is the way the system was designed
to work, but I don't think it should be this way. To me if I go back, the form
should contain the exact same data as it did before I hit submit. I noticed that
this bug exist on Netscape 4.76 and on mozilla browsers but does not exist on IE
5.5. It is more are an annoyance than anything. 

Here is a step by step sample. 

* Create the form as mentioned above.
* Enter the information below as one line to let the window do soft returns.
When reporting a bug about page handling, it is recommended that you test the
problem isn't an intentional difference between the modes. 
* Now type "Hello world" before the word "problem"
* You should notice that the text is still in soft returns.
* Now submit the form and then click on the back button. 
* The data should still be in the box. 
* Now enter "Another Word" before "Hello".
* You should notice that is now a hard return after the word "problem"
cc Joe in case he knows anything about this bug.
this might be related to bug 50633
Attached file testcase
confirmed Win2K 20010607, 0.9.1 branch
Status: UNCONFIRMED → NEW
Ever confirmed: true
Mass move of form submission bugs, Eric, I am sorry I don't have more time to 
look at these closer.
Assignee: rods → pollmann
Bulk reassigning form bugs to Alex
Assignee: pollmann → alexsavulov
Summary: TEXTAREA loses soft returns on back button. → TEXTAREA loses soft returns on back button. [form sub]
The bug is sill here on 2001-10-23-09-trunk...
setting milestone
Target Milestone: --- → Future
This is totally form controls, and will probably be fixed when bug 112430 is ...
the problem is the way we're using the serializer--we just have to flip a bit
somewhere that says not to make the wraps happen when we're about to store the
value.  In that bug we're going to be touching that code directly anyway.
Assignee: alexsavulov → jkeiser
Component: Form Submission → HTML Form Controls
Depends on: 112430
Target Milestone: Future → mozilla1.0
Moving to Mozilla1.1
Target Milestone: mozilla1.0 → mozilla1.1
Keywords: testcase
I keep meaning to nominate this.  This is an incredibly annoying bug for me when
using Mozilla.
Severity: minor → normal
Keywords: mozilla1.0, nsbeta1
OS: Windows NT → All
nsbeta1-.
Keywords: nsbeta1nsbeta1-
Status: NEW → ASSIGNED
Attached file JS testcase
A related problem, which I am uploading now, is that JS shows hard returns even
though it should not (at least IE does not, and it seem to me they are
right--wrap=hard is essentially unformatted until submission).
Attached patch PatchSplinter Review
This patch fixes the problem by adding an interface to nsGfxTextControlFrame2
to allow content to grab the value either with or without wrapping.  Content
will grab it without wrapping in all cases now except submission.  To keep
everything else the same, all frames do as they did before and grab the value
with wrapping.

This has been tested with Bugzilla and with the testcase provided.  wrap=hard
submits with wrapping but does not appear to be wrapped for JS or for
save/restore.  Glory be!

This patch also consolidates GetPrimaryFrame(), which was being done in
multiple places.  Everything is tested and still works (I tested
image.naturalHeight).  I would have liked to consolidate body.bgColor, but a
bug there prevented testing (there *is* no primary frame) so I left it the same
and added a comment.
So the preceding patch works, and I am writing this comment with the patched
build to prove it.  The patch was uploaded with the patched build, of course,
but that has wrap=soft.

save/restore works beautifully.
Comment on attachment 83468 [details] [diff] [review]
Patch

make sure you test Printing and PP r=rods
Attachment #83468 - Flags: review+
Whiteboard: [FIX]
Comment on attachment 83468 [details] [diff] [review]
Patch

sr=attinasi
Attachment #83468 - Flags: superreview+
Checked in to trunk.
(marking fixed)
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Argh! This caused bug 145741, there isn't always a frame available for all
elements, we're now calling GetPrimaryFrameFor() and then calling
CallQueryInterface() on the result in at least two places w/o checking if we
found a frame or not! CallQueryInterface() is NOT null safe! I'll fix bug
145741, but someone should add null ptr protection in nsHTMLTextAreaElement.cpp too.

Reopening.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
My bad, I keep thinking do_QueryInterface and CallQueryInterface are
functionally the same thing, which they are not.
BTW, looking at the patch, there are no other places where I introduced this.
Comment on attachment 84299 [details] [diff] [review]
CallQueryInterface brown bag fix

This looks like it will also fix the crash I'm seeing when submitting after
using "Edit Attachment as Comment" in bugzilla.

In any case, r=dbaron.
Attachment #84299 - Flags: review+
Status: REOPENED → ASSIGNED
Comment on attachment 84299 [details] [diff] [review]
CallQueryInterface brown bag fix

sr=jst

nsHTMLImageElement::GetImageFrame() (bug 145741) and the one you just fixed
were the two places where CallQueryInterface() could be called on a null
pointer IIRC.
Attachment #84299 - Flags: superreview+
Yet Another Fix Checked In.
Status: ASSIGNED → RESOLVED
Closed: 22 years ago22 years ago
Resolution: --- → FIXED
Verifying on build 2002-07-03-10-trunk on windows 98
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: