Closed Bug 559993 Opened 14 years ago Closed 14 years ago

finding text doesn't scroll it into view properly


(Core :: Web Painting, defect, P2)




Tracking Status
blocking2.0 --- final+


(Reporter: tnikkel, Assigned: tnikkel)




(2 files)

Attached file testcase
In the attached testcase ctrl-f for "div", it will find the div that is off the screen to the right first, then it will select the red div but will only scroll the very right edge of it into view.

Not fixed by bug 548792.
First bad revision:
5d8894904869	Robert O'Callahan — Bug 526394. Part 26: Rework nsSelection to use frames only. r=mats
blocking2.0: --- → ?
blocking2.0: ? → final+
Priority: -- → P2
I'm seeing this on the tinderbox page, half the time the highlighted text is offscreen.
Assignee: nobody → tnikkel
nsTypedSelection::ScrollIntoView calls nsTypedSelection::GetSelectionAnchorGeometry (which used to be called nsTypedSelection::GetSelectionRegionRectAndScrollableView) to get a rect relative to a frame to scroll into view. GetSelectionAnchorGeometry returns a zero width rect at the offset of the focus point in the frame containing the focus point. In this case the focus point is the end of the selection, so we just scroll into view the end of the selection.

GetSelectionAnchorGeometry used to have some hacks in it for this situation: it used to extend the rect by 1/4 the width of the nearest scrollable view if the rect was not scrolled into view.

Seems like the correct thing to do here is to include the whole selection in the rect we want to scroll into view.
Attached patch patchSplinter Review
This patch adds a new type of selection region to scroll into view: the whole selection. We just compute a rect that encompasses the anchor and focus rect and scroll that into view.

Does this need an IID bump and/or to get in for beta 7?
Attachment #488143 - Flags: review?(roc)
Comment on attachment 488143 [details] [diff] [review]

+  focusRect = focusRect + focusFrame->GetOffsetTo(anchorFrame);

+= ?
Attachment #488143 - Flags: review?(roc) → review+
(In reply to comment #5)
> +  focusRect = focusRect + focusFrame->GetOffsetTo(anchorFrame);
> += ?

Changed to +=.

Does the nsISelectionController.idl change need an IID bump and/or to get in before beta 7?
And to remind myself, I need to write a test for this.
(In reply to comment #4)
> Does this need an IID bump and/or to get in for beta 7?

I don't think it needs an IID bump.
Closed: 14 years ago
Resolution: --- → FIXED
Component: Layout: View Rendering → Layout: Web Painting
You need to log in before you can comment on or make changes to this bug.