Closed Bug 601352 Opened 14 years ago Closed 14 years ago

Console does not scroll expression result into view

Categories

(DevTools :: General, defect)

defect
Not set
normal

Tracking

(blocking2.0 final+)

RESOLVED FIXED
Tracking Status
blocking2.0 --- final+

People

(Reporter: dangoor, Assigned: msucan)

References

Details

(Whiteboard: [patchclean:1021])

Attachments

(1 file, 3 obsolete files)

If the log output fills the console output area and you type an expression (eg 1+1), the 1+1 is scrolled into view but the 2 is just below the view.
Blocks: devtools4b8
blocking requested, as this bug makes the JS command line very annoying in practice.
blocking2.0: --- → ?
Attached patch proposed fix and test code (obsolete) — Splinter Review
Proposed fix and test code.
Attachment #481255 - Flags: feedback?(rcampbell)
Status: NEW → ASSIGNED
OS: Mac OS X → All
Hardware: x86 → All
Whiteboard: [patchclean:1006]
Version: unspecified → Trunk
Comment on attachment 481255 [details] [diff] [review]
proposed fix and test code

I don't know. I'd try a full run of content mochitests with this patch before signing off on it. Ask a layout peer.
Attachment #481255 - Flags: feedback?(rcampbell)
I ran all browser-chrome-tests (9000+ of them). No failures related to this change. Shall I ask a layout peer then?
Comment on attachment 481255 [details] [diff] [review]
proposed fix and test code

Asking for review from Simon Montagu.
Attachment #481255 - Flags: review?(smontagu)
Comment on attachment 481255 [details] [diff] [review]
proposed fix and test code

Is there any reason not to make the same change in nsScrollBoxObject::ScrollToElement?
(In reply to comment #6)
> Comment on attachment 481255 [details] [diff] [review]
> proposed fix and test code
> 
> Is there any reason not to make the same change in
> nsScrollBoxObject::ScrollToElement?

Thanks for looking into the patch!

Given it's my first patch for Gecko itself, I tried to keep changes minimal. If the change is fine, then I can do the same for ScrollToElement. Shall I do that?
Attached patch updated patch (obsolete) — Splinter Review
Updated patch. Changes:

- did the same change in ScrollToElement as in EnsureElementIsVisible - as requested by Simon. Thanks for your comment!

- rebased the patch on top of the latest mozilla-central. This required fixes for mochitest.

Asking for review from Robert O'Callahan as suggested by Simon.
Attachment #481255 - Attachment is obsolete: true
Attachment #484320 - Flags: review?(roc)
Attachment #481255 - Flags: review?(smontagu)
Whiteboard: [patchclean:1006] → [patchclean:1019]
I think rect.x/y are relative to the top-left of the document, ignoring scrolling, but crect is relative to the top-left of the scrollbox border-box. So this doesn't seem right.

How about you just rip out the guts of ScrollToElement and make it call nsIPresShell::ScrollContentIntoView? EnsureElementIsVisible can probably do that too (just pass NS_PRESSHELL_SCROLL_ANYWHERE).
You might want to extend ScrollContentIntoView to accept the SCROLL_FIRST_ANCESTOR_ONLY and SCROLL_OVERFLOW_HIDDEN flags, since to preserve current scrollbox behavior we'd need to pass those flags. (A call to scrollToElement does not currently cause any ancestors of the scrollbox to scroll.)
Attached patch patch update 3 (obsolete) — Splinter Review
Updated patch with the changes requested. Thanks a lot for your comments!

Changes:

- added a new aFlags argument to PresShell::ScrollContentIntoView() which takes the SCROLL_FIRST_ANCESTOR_ONLY SCROLL_OVERFLOW_HIDDEN flags (same as ScrollFrameRectIntoView()).

- added the same aFlags argument to DoScrollContentIntoView().

- updated accordingly all the code that calls the two methods.

- changed nsScrollBoxObject::ScrollToElement() to use PresShell::ScrollContentIntoView().

- changed nsScrollBoxObject::EnsureElementIsVisible() to use PresShell::ScrollContentIntoView().

- updated the mochitest file to better check if the last logged message is visible.

All mochitests pass, no failures on my system.

I am not sure if the new aFlags function argument is fine... or if I should add a new ScrollContentIntoView() function that takes four arguments - such that all other calls wouldn't need to be changed. Perhaps this is only a matter of preference.

Please let me know if I have to make further changes. Thanks again!
Attachment #484320 - Attachment is obsolete: true
Attachment #485125 - Flags: review?(roc)
Attachment #484320 - Flags: review?(roc)
Whiteboard: [patchclean:1019] → [patchclean:1021]
Comment on attachment 485125 [details] [diff] [review]
patch update 3

Need to bump IID on nsIPresShell.

This may need to land on beta7 branch due to the IID bump. I'm not sure. Please ask #developers or elsewhere.

Great patch! I love to see all that nasty code being removed :-)
Attachment #485125 - Flags: review?(roc) → review+
Bumped IID as requested.

Thanks for the review+ Robert!

Asking for approval2.0+ to get this patch checked into beta7 and into mozilla-central default branch.
Attachment #485125 - Attachment is obsolete: true
Attachment #485248 - Flags: approval2.0?
Keywords: checkin-needed
Can go in over the b7 freeze, checkin with a=roc/beltzner for b7 or whatever. Post b7 if you need to make these sorts of changes, you'll have to create new and exciting interfaces.
Comment on attachment 485248 [details] [diff] [review]
[checked-in] patch update 4

http://hg.mozilla.org/mozilla-central/rev/0046c811c921
Attachment #485248 - Attachment description: patch update 4 → [checked-in] patch update 4
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
blocking2.0: ? → final+
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: