Closed Bug 326932 Opened 19 years ago Closed 18 years ago

Triple-click paragraph selection doesn't work correctly in paragraphs containing form controls

Categories

(Core :: DOM: Selection, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: uriber, Assigned: uriber)

References

Details

(Keywords: testcase)

Attachments

(3 files, 1 obsolete file)

In a paragraph which contains an <input type="text">, triple-clicking before the input control selects nothing. Triple-clicking after the (last) control selects only the part of the paragraph after the control.

Triple-click should in both cases select the entire paragraph.

Thanks to Martijn, which originally discovered this for <isindex>.
Attached file testcase
Well, iirc, Ria originally discovered this for <isindex>, I was merely passing it through :)
This behaviour has changed since 1.5. With 1.5.0.1 double-clicking any of the text results in the _whole_ line of text being selected (both sides of the input box)
Keywords: testcase
(In reply to comment #3)
> This behaviour has changed since 1.5. With 1.5.0.1 double-clicking any of the
> text results in the _whole_ line of text being selected (both sides of the
> input box)

Steve, this is a trunk-only bug (since bug 32807 was only fixed on the trunk).
Attached file testcase 2
This testcase demonstrates that the problem is not limited to text inputs, but affects all form controls (in this way or another).
Summary: Triple-click doesn't work in paragraphs containing a text input control → Triple-click paragraph selection doesn't work correctly in paragraphs containing form controls
Attached patch patch (obsolete) — Splinter Review
Some form controls are block frames, and some contain (anonymous) block frames. Since we don't want to form controls to be paragraph separators, this patch simply skips them (without drilling into them) when looking for block frames.

Is there a more general solution I can employ here? Testing for form controls is a bit ugly.

This patch does *not* fix the <isindex> case, which is apparently a different problem (although the isindex's content is the parent content of the HRs' content, trying to find the HR content inside the isindex content using IndexOf() returns -1).
Attachment #212764 - Flags: review?(roc)
You attached the wrong file.

Depending on how you were doing this, you may want to test line->IsBlock() instead of looking for block frames per se.
Attachment #212764 - Attachment is obsolete: true
Attachment #212764 - Flags: review?(roc)
Attached patch patchSplinter Review
Oops. This is the original patch I meant to attach. I'll look into roc's suggestion and request a review (on this patch or a modified one) later.
Comment on attachment 213007 [details] [diff] [review]
patch

Other methods for checking for blockness didn't quite work for me, so requesting review on this.
Attachment #213007 - Flags: review?(roc)
Comment on attachment 213007 [details] [diff] [review]
patch

Please add a comment

// XXX we really need a way to determine whether a frame is inline-level
Attachment #213007 - Flags: superreview+
Attachment #213007 - Flags: review?(roc)
Attachment #213007 - Flags: review+
I wonder if you could rewrite FindBlockFrameOrBR to iterate over lines with a separate function for iterating within lines. Then you could know whether you're looking at a line of inlines (even if they are inline blocks), and eDirPrevious could be faster since the lines are a doubly linked list. Did you try this?
Checked in, with the extra comment:

Checking in layout/generic/nsFrame.cpp;
/cvsroot/mozilla/layout/generic/nsFrame.cpp,v  <--  nsFrame.cpp
new revision: 3.622; previous revision: 3.621
done
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9alpha
Do you think we could have a reasonable IsFrameOfType bit for this?  That is, is this something we might need for non-form-control frames too?  Say for inline-block?
(In reply to comment #11)
> I wonder if you could rewrite FindBlockFrameOrBR to iterate over lines with a
> separate function for iterating within lines. Then you could know whether
> you're looking at a line of inlines (even if they are inline blocks), and
> eDirPrevious could be faster since the lines are a doubly linked list. Did you
> try this?
> 

Oops - I somehow missed this comment before checking in, only noticed it now.

No, I haven't tried this. I'll try to do this soon.
(In reply to comment #13)
> Do you think we could have a reasonable IsFrameOfType bit for this?  That is,
> is this something we might need for non-form-control frames too?  Say for
> inline-block?
 
This was directed to roc, right?

Me, I'd love to have a method which would tell me whether a frame behaves like an inline "from the outside". I was pretty surprised not to find one.
But I can't say much intelligently about an implementation of such a method.
> This was directed to roc, right?

Well... it was directed at anyone who cares to answer.

> I'd love to have a method which would tell me whether a frame behaves like
> an inline "from the outside"

I believe we want such things anyway.  So we should add it... dbaron, do we have a bug on doing that, do you know?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: