Closed Bug 35101 Opened 24 years ago Closed 24 years ago

HTMLInputElement.select() does not work

Categories

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

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: sfraser_bugs, Assigned: sfraser_bugs)

Details

(Whiteboard: Fix in Hand)

The select() method on HTMLInputElement() does not work. It calls into 
nsHTMLInputElement::Select(), which calls

formControlFrame->SetProperty(presContext, nsHTMLAtoms::select, "");

on the nsGfxTextControlFrame, but this does nothing.

It seems to me that we should add selection-setting methods to 
nsIGfxTextControlFrame, and call them.

I'm looking at this because of bug 33967, which is related.
Simon, you hit this one right on the head.  It made fixing it a cinch.  I
probably won't get a chance to get it in with some of the other nasty things I'm
trying to fix for M16, so setting Milestone to M17.
Status: NEW → ASSIGNED
OS: Mac System 8.5 → All
Whiteboard: Fix in Hand
Target Milestone: --- → M17
I have the fix in my tree. Taking bug.
Assignee: pollmann → sfraser
Status: ASSIGNED → NEW
I have a fix in my tree too, as I mentioned above and wrote in the status 
whiteboard yesterday.  Does your fix look like mine?  Here's a patch (may be 
offset, lines added to nsGfxTextControlFrame::SetProperty):

Index: nsGfxTextControlFrame.cpp
===================================================================
RCS file: /cvsroot/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp,v
retrieving revision 3.161
diff -r3.161 nsGfxTextControlFrame.cpp
1443a1418,1423
>       }
>     }
>     else if (nsHTMLAtoms::select == aName)
>     {
>       if (mEditor) {
>         mEditor->SelectAll();

If yours is equivalent, please feel free to mark it r=pollmann.
Arg, I think I added yesterday's comment about not getting the fix in until M17 
to the wrong bug.  :S  I see why you grabbed this (I updated milestones on over 
50 bugs yesterday, guess I made at least one mistake).  At any rate the change 
is small, feel free to check it in.
No, my fix is a little more involved. I've added a method 
SetSelectionRange(PRInt32 start, PRInt32 end) to ns[I]GfxTextControlFrame, 
because I need to implement support for setting the selection specifically from 
JS (see bug 33967). So I have a bunch more code to go in, some of which fixes 
this bug.
Status: NEW → ASSIGNED
I checked in a fix for this for both <input type="text">, and <textarea>
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Thanks Simon, you are 'da man'.  :)
Updating QA contact.
QA Contact: ckritzer → bsharma
Verified on build 2001-08-13-03T os:win98,win95,mac8.6
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.