Closed
Bug 42676
Opened 24 years ago
Closed 15 years ago
Can't drag to extend selection out of blocks with overflow:hidden/auto/scroll
Categories
(Core :: DOM: Selection, defect)
Core
DOM: Selection
Tracking
()
RESOLVED
FIXED
mozilla1.9.3a1
People
(Reporter: Chris244, Assigned: masayuki)
References
(Depends on 1 open bug)
Details
(Keywords: testcase)
Attachments
(4 files, 13 obsolete files)
<h1 style="overflow: hidden">One</h1>
<h1 style="overflow: hidden">Two</h1>
<h2>Three</h2>
When selection starts in an element with overflow:hidden, selection can't extend
to any other elements.
So if I start selection in One, I can't select Two or Three. Similarly for Two.
If I start selection in Three, I CAN select One and Two.
Confirming 2000-06-16-12-M17 and changing to Selection.
Assignee: clayton → mjudge
Status: UNCONFIRMED → NEW
Component: Layout → Selection
Ever confirmed: true
QA Contact: petersen → elig
i will bet these are classified in a different childlist than normal. i will
peek at this.
Updated•24 years ago
|
QA Contact: elig → BlakeR1234
Comment 5•24 years ago
|
||
*SPAM*: Changing the QA contact of all open/resolved Selection bugs from
elig@netscape.com to BlakeR1234@aol.com. After the many great years of service
Eli has given to Mozilla, it's time for him to move on; he has accepted a
position at Eazel. We'll be sad to see him go, and I'll do my best to fill his
spot...
Comment 6•24 years ago
|
||
moving to future, adding helpwanted
Keywords: helpwanted
Target Milestone: M19 → Future
build 2001112104 win32
interestingly if I start the selection from above "One" I can select all text on
the page.
Comment 9•20 years ago
|
||
Same with value "scroll" (1.8a6 NB/W2K, FF1.0/Linux). Moving to default.
Assignee: mjudge → selection
Status: ASSIGNED → NEW
OS: Windows NT → All
Priority: P3 → --
QA Contact: tpreston
Hardware: PC → All
Comment 10•20 years ago
|
||
Wow, this is such an annoying longstanding bug...
Confirmed: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2)
Gecko/20050414 Firefox/1.0+
Comment 11•19 years ago
|
||
*** Bug 290932 has been marked as a duplicate of this bug. ***
Comment 12•19 years ago
|
||
>>overflow:hidden causes selection problems
Confirmed with:
Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8) Gecko/20051104 Firefox/1.5
Also overflow: scroll; and overflow: visible; will cause selection problems.
Only overflow: visible; looks good.
Comment 13•19 years ago
|
||
Comment 14•18 years ago
|
||
Needs debugger to observe ongoing events.
Comment 15•18 years ago
|
||
There is also problems when element has overflow:hidden in the realm of scripting and mouse events.
Confirmed Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1a3) Gecko/20060526 BonEcho/2.0a3
Comment 16•16 years ago
|
||
Confirmed with:
Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1
Comment 17•16 years ago
|
||
Martijn, would it be possible to have a better testcase which don't rely on Firebug? I cannot find its inspector component.
Assignee: selection → nobody
QA Contact: selection
Comment 18•16 years ago
|
||
The mouse is captured when drag selecting inside overflow:scroll frames. Perhaps that mouse capturing should only happen when there is actually something to scroll in the frame?
Updated•16 years ago
|
Attachment #201945 -
Attachment is obsolete: true
Updated•16 years ago
|
Attachment #10286 -
Attachment is obsolete: true
Comment 19•16 years ago
|
||
This dispatches the even not only to the capturing view, but also to the original (outer) view (and to all views in between).
It mostly works, and doesn't regress textarea behavior.
The problem, however, is that the selection in this case flickers as the mouse is dragged, since when the capturing view handles the selection it truncates it to that view, and only later the parent view extends it back towards the pointer.
This perhaps could have been fixed using the selection batching mechanism, but it seems that it's virtually impossible to access it from nsViewManager (which doesn't know anything about selections, or even frames).
Ideas are welcome.
Updated•16 years ago
|
Summary: overflow:hidden causes selection problems → Can't drag to extend selection out of blocks with overflow:hidden/auto/scroll
Comment 24•15 years ago
|
||
Old and annoying bug with several duplicates. Could this get some attention for 1.9.2?
Flags: blocking1.9.2?
Flags: wanted1.9.2-
Flags: blocking1.9.2?
Flags: blocking1.9.2-
Assignee | ||
Comment 25•15 years ago
|
||
almost works, but there are some problems...
Assignee | ||
Comment 26•15 years ago
|
||
Attachment #407228 -
Attachment is obsolete: true
Assignee | ||
Comment 27•15 years ago
|
||
Works fine for me in simple cases, however, this should fail when the mouse cursor is on a different subtree.
Attachment #407281 -
Attachment is obsolete: true
Assignee | ||
Comment 28•15 years ago
|
||
Assignee | ||
Comment 29•15 years ago
|
||
maybe this is ok. I'll create many tests.
Attachment #407290 -
Attachment is obsolete: true
Assignee | ||
Comment 30•15 years ago
|
||
Attachment #407436 -
Attachment is obsolete: true
Assignee | ||
Comment 31•15 years ago
|
||
Assignee | ||
Comment 32•15 years ago
|
||
Attachment #407498 -
Attachment is obsolete: true
Assignee | ||
Comment 33•15 years ago
|
||
Attachment #411646 -
Attachment is obsolete: true
Assignee | ||
Comment 34•15 years ago
|
||
Roc, would you review this? Or Smaug is better reviewer?
This patch checks whether the frame under the mouse cursor is descendant of the selection root or not. If true, expands the selection to the frame, otherwise, uses the selection anchor (current behavior).
The automated test has two problems:
1. When it moves the mouse cursor to the iframe, the nsFrameSelection::HandleDrag() is called on the frame's shell, not capturing shell's. Therefore, the selection isn't changed by the mouse move event on the iframe.
2. When it moves the mouse cursor to the input field or textarea element and the containers are overflow: visible;, nsFrameSelection::HandleDrag() isn't called. I'm not sure where stops the processing.
But they shouldn't be problem in daily usage. And they are out of scope of this bug.
Attachment #411647 -
Attachment is obsolete: true
Attachment #411889 -
Flags: review?(roc)
Assignee | ||
Comment 35•15 years ago
|
||
Roc:
Would you review this?
Olli is probably a better reviewer for this.
Assignee | ||
Comment 37•15 years ago
|
||
Comment on attachment 411889 [details] [diff] [review]
Patch v3.4
thank you, roc.
olli, would you review this?
Attachment #411889 -
Flags: review?(roc) → review?(Olli.Pettay)
Comment 38•15 years ago
|
||
Comment on attachment 411889 [details] [diff] [review]
Patch v3.4
How does this work with (XBL) anonymous content?
Normally range objects' boundary points should be in the same (possibly anonymous) subtree.
Assignee | ||
Comment 39•15 years ago
|
||
Good point, the previous patch sometimes returns another subtree's frame. I changed nsINode::GetSelectionRootContent. It should be return same subtree's content always.
However, XBL binding content breaks the selection by mouse moving (on the current trunk too). If I moves the mouse cursor to the XBL content, the selection handling is stolen by the subtree. I guess that nsIFrame::GetContentOffsetsFromPoint() returns another subtree's content.
http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsFrame.cpp#2764
http://mxr.mozilla.org/mozilla-central/source/layout/generic/nsFrame.cpp#2646
So, it should be another bug, I don't include the testcases for it.
Attachment #411889 -
Attachment is obsolete: true
Attachment #413270 -
Flags: review?(Olli.Pettay)
Attachment #411889 -
Flags: review?(Olli.Pettay)
Comment 40•15 years ago
|
||
(In reply to comment #39)
> So, it should be another bug, I don't include the testcases for it.
Sure. It is not clear to me whether we even should fix selection handling in
several different subtrees. Or if it is fixed, how.
nsRange certainly doesn't handle that kind case by default.
Comment 41•15 years ago
|
||
Comment on attachment 413270 [details] [diff] [review]
Patch v4.0
>+static nsIContent* GetRootForContentSubtree(nsIContent* aContent)
>+{
>+ NS_ENSURE_TRUE(aContent, nsnull);
>+ nsIContent* content = aContent;
>+ while (content) {
>+ nsIContent* parent = content->GetParent();
>+ if (!parent)
>+ break;
>+ PRUint32 childCount = parent->GetChildCount();
>+ if (childCount < 1)
>+ break;
>+ PRInt32 childIndex = parent->IndexOf(content);
>+ if (childIndex < 0 || PRUint32(childIndex) >= childCount)
>+ break;
>+ content = parent;
>+ }
>+ return content;
>+}
This is a bit slow, especially IndexOf.
You could do something like this:
NS_ENSURE_TRUE(aContent, nsnull);
nsIContent* stop = aContent->GetBindingParent();
while (aContent) {
nsIContent* parent = aContent->GetParent();
if (parent == stop) {
break;
}
aContent = parent;
}
return aContent;
> nsIContent*
> nsINode::GetSelectionRootContent(nsIPresShell* aPresShell)
So have you checked all the other callers of this method.
Can they handle the functional change?
And this change needs to be documented in nsINode.
Attachment #413270 -
Flags: review?(Olli.Pettay) → review-
Assignee | ||
Comment 42•15 years ago
|
||
(In reply to comment #41)
> > nsIContent*
> > nsINode::GetSelectionRootContent(nsIPresShell* aPresShell)
> So have you checked all the other callers of this method.
> Can they handle the functional change?
Yes, because I created the method and it is used for getting the selection root content by each caller, so, the name and the new behavior do match.
However, nsFrameSelection::SelectAll() still doesn't use this method, I think we should change it. But I think it should be done in another bug in order to change clearly.
Attachment #413270 -
Attachment is obsolete: true
Attachment #413358 -
Flags: review?(Olli.Pettay)
Comment 43•15 years ago
|
||
Comment on attachment 413358 [details] [diff] [review]
Patch v4.1
>diff --git a/content/base/public/nsINode.h b/content/base/public/nsINode.h
>--- a/content/base/public/nsINode.h
>+++ b/content/base/public/nsINode.h
>@@ -798,17 +798,19 @@ public:
> */
> nsIContent* GetTextEditorRootContent(nsIEditor** aEditor = nsnull);
>
> /**
> * Get the nearest selection root, ie. the node that will be selected if the
> * user does "Select All" while the focus is in this node. Note that if this
> * node is not in an editor, the result comes from the nsFrameSelection that
> * is related to aPresShell, so the result might not be the ancestor of this
>- * node.
>+ * node. Be aware that if this node isn't in same subtree as the selection
>+ * limiter of the nsFrameSelection, this returns the root content of the
>+ * bound contents.
I don't quite understand this comment.
"the root content of the bound contents"?
Please add some XBL tests.
Attachment #413358 -
Flags: review?(Olli.Pettay) → review+
Assignee | ||
Comment 44•15 years ago
|
||
(In reply to comment #43)
> > /**
> > * Get the nearest selection root, ie. the node that will be selected if the
> > * user does "Select All" while the focus is in this node. Note that if this
> > * node is not in an editor, the result comes from the nsFrameSelection that
> > * is related to aPresShell, so the result might not be the ancestor of this
> >- * node.
> >+ * node. Be aware that if this node isn't in same subtree as the selection
> >+ * limiter of the nsFrameSelection, this returns the root content of the
> >+ * bound contents.
> I don't quite understand this comment.
> "the root content of the bound contents"?
I meant the XBL subtree's root content.
> Please add some XBL tests.
When I move mouse on the XBL contents, the selection is aborted unexpectedly, therefore I didn't include the tests with XBL in the previous patch... (It's not a regression of my patch.)
Comment 45•15 years ago
|
||
(In reply to comment #44)
> When I move mouse on the XBL contents, the selection is aborted unexpectedly,
> therefore I didn't include the tests with XBL in the previous patch... (It's
> not a regression of my patch.)
But you did test XBL anyway. So it would be great to get at least some simple
XBL test here, if just possible.
Assignee | ||
Comment 46•15 years ago
|
||
(In reply to comment #45)
> (In reply to comment #44)
> > When I move mouse on the XBL contents, the selection is aborted unexpectedly,
> > therefore I didn't include the tests with XBL in the previous patch... (It's
> > not a regression of my patch.)
> But you did test XBL anyway. So it would be great to get at least some simple
> XBL test here, if just possible.
I found the bug, it's bug 451254.
https://bug451254.bugzilla.mozilla.org/attachment.cgi?id=414288
Try this testcase, you can check the drag aborting by the bug.
So, I have no idea of the profitable testcase under current behavior.
Comment 47•15 years ago
|
||
(In reply to comment #46)
> So, I have no idea of the profitable testcase under current behavior.
I'd like to see some testcase, since the current behavior has been tested here,
and adding a testcase for that reduces the risk for unwanted regressions.
Assignee | ||
Comment 48•15 years ago
|
||
This includes XBL contents, however, this test doesn't drag over the XBL binding contents because if we do so, the drag session will be broken. Instead, the test checks whether we can select the XBL content's children (<children/>) correctly or not.
Attachment #413358 -
Attachment is obsolete: true
Assignee | ||
Updated•15 years ago
|
Keywords: helpwanted → checkin-needed
Target Milestone: Future → mozilla1.9.3a1
Assignee | ||
Comment 49•15 years ago
|
||
Comment 50•15 years ago
|
||
in Minefield/3.7a3pre
When selection starts in an element with overflow!=visible, selection extends
to other elements. but page doesn't scroll
So if I start selection in element with overflow:hidden and move mouse out of page selection extends to start or the end of the page (this depends on where selection started, not the boundary, and if selection started in the middle it changes randomly with mouse move )
but page's scroll position isn't changed
Comment 51•15 years ago
|
||
with this patch scrollable element (element with overflow!=visible)
still captures mouse events, and doesn't allow other elements to process mouse
this patch forcibly extends selection but events have wrong rangeOffset and Parent
only when scrollable element can't be scrolled at (or is completely scrolled and mouse is far enough so that user definitely tries to extend selection not scroll!) it should leave events to other elements to allow selection extending
Assignee | ||
Comment 52•15 years ago
|
||
please file a new bug.
Comment 53•15 years ago
|
||
filed https://bugzilla.mozilla.org/show_bug.cgi?id=552707
please have a look at it
it seems scrolling with selection doesn't work with iframes as well (noticed on the iframe in bug filling page)
could you check if this happens because of this patch or something else?
You need to log in
before you can comment on or make changes to this bug.
Description
•