Closed
Bug 75676
Opened 24 years ago
Closed 24 years ago
textField.textLength() is broken
Categories
(Core :: Layout, defect)
Tracking
()
VERIFIED
FIXED
mozilla0.9
People
(Reporter: sfraser_bugs, Assigned: sfraser_bugs)
References
()
Details
Attachments
(3 files)
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
Details | Diff | Splinter Review |
The textLength attribute on text fields is broken; it always returns the length
of the initial value, even after editing. This is because it erroneously always
returns the length of the cached value (see
nsGfxTextControlFrame2::GetTextLength()).
Assignee | ||
Comment 1•24 years ago
|
||
Assignee | ||
Comment 2•24 years ago
|
||
Assignee | ||
Comment 3•24 years ago
|
||
The fix is to expose a InvalidateCachedState() method from
nsGfxTextControlFrame2, which is called by nsTextInputListener's
NotifySelectionChanged method. This means that any edit will invalidate the
cached value (as will moving the caret). This ensures that later calls to
GetTextLength() do the right thing.
In future I think we need to do better value caching here, to avoid expensive
calls to the output system. We should probably hook up a transaction listener or
something, rather than using selection changed.
See the URL for a testcase.
Looking for r=(anthonyd, mjudge) and sr=(kin)
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9
Assignee | ||
Comment 4•24 years ago
|
||
Assignee | ||
Comment 5•24 years ago
|
||
The 3rd attachment contains a better fix. Rather than invalidate the cached state
on every selectin change, we do it when the nsTextInputListener tells us that the
content changed. I'll remove the commented out code in
nsTextInputListener::NotifySelectionChanged().
Assignee | ||
Comment 7•24 years ago
|
||
Fix checked in (i'll get a posthumous r=mjudge).
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•