Closed Bug 14803 Opened 25 years ago Closed 25 years ago

textarea not setting value properly

Categories

(Core :: Layout: Form Controls, defect, P3)

x86
Linux
defect

Tracking

()

VERIFIED DUPLICATE of bug 18859

People

(Reporter: rginda, Assigned: buster)

Details

Attachments

(1 file)

Load attached test case in apprunner
select initial text and delete it
enter 'a\nb\n' (where \n is [ENTER], not a literal '\' and 'n')
click [Clear Value]
* the value will be cleared
enter 'c\nd\n'
click [Clear Value]
* the value WILL NOT be cleared
click [Set Value to 'foo\nbar\n'
* 'foo\nbar\n' will be PRE-PENDED to the existing text, instead of replacing it
clear all text from the textarea
click [Dump Value]
* the value will still have a '\n' in it.

This problem does not show up if '\n' is not part of the value keyed in, eg:
entering 'a', [Clear Value], 'b', [Clear Value], 'c', [Clear Value] works as
expected.
Attached file test cse for bug 14803
Assignee: trudelle → karnaze
Component: XP Toolkit/Widgets → HTML Form Controls
this is an HTML form control, not an xptoolkit widget. reassigning.
Assignee: karnaze → buster
Reassigning to Steve.
accepting, setting target milestone to M12
Status: NEW → ASSIGNED
Target Milestone: M12
QA Contact: beppe → gerardok
change qa contact to gerardok
Summary: gfx textarea not setting value properly → textarea not setting value properly
I tracked this down to the following:
 in nsGfxTextControlFrame::SelectAllTextContent
there is this line:  nsCOMPtr<nsIDOMCharacterData>text =
do_QueryInterface(lastChild);

This line results in text being null in the case where the last character is /n
so the selection is not made and therefore not replaced when the new text is set/
inserted.

It seems to me that we should have/use SelectAll to avoid these edge cases across
the various usages of the editor.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → DUPLICATE
dup of 18859. kathy diagnosed the problem correctly, kin and joe found the same
solution for a similar problem that they already fixed.  I'll remove the dead
code.

*** This bug has been marked as a duplicate of 18859 ***
Status: RESOLVED → VERIFIED
verifying as a dup.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: