I need a scrollable content object model

I have been having a lot of fun in the last 24 hours trying to “control the scroll” of an element’s content. I don’t think anyone really took the time to make scrolling friendly to scripting.
There are four general categories of scrollable content I’m aware of (bear in mind this is from a DOM point of view):
(1) <html:textarea/>
(2) <browser/>, <editor/> <iframe>, etc.
(3) <box style=”scroll:overflow;” />
(4) <arrowscrollbox/>
Textareas provide basic properties (scrollTop, scrollLeft, scrollHeight, scrollWidth) for determining which portion of the content to show. This is good. But it doesn’t easily expose the scrollbars themselves as objects a script can access. The same goes for the rest of them. There really is no native (that is, implemented directly in Mozilla) way to script the scrolling of such scrollable content directly.
It’d be really nice if there was an nsIScrollableContent.idl (or whatever) set of properties for any time you have a content box with at least one scrollbar. References to the scrollbars themselves (<xul:scrollbar/>?) would be great. References to the properties which determine where the content is scrolled to would be almost as good.
I thought to myself, this just won’t do. So I started asking myself, how can I create my own scrollable content? One way to simulate content which has scrolled partially is by setting the following style:

.scrollableContent {
overflow: hidden;
margin-top: 0px;
margin-left: 0px;
clip: rect(0px 0px 0px 0px);

Then, by adjusting the margin-top and margin-left properties, the content could appear to scroll. After a little tinkering, I created a widget which is halfway to a scriptable scrolling content. You can see it here. (The demo currently also checks for DOMAttrModified elements bubbling up — this lets me check for when a scrollbar in the demo actually moves.)
I haven’t yet implemented the scrolling of content yet; there’s some linear mathematics I need to do, including resizing the thumb of each bar appropriately. I’ve also filed bug 243128 for adding a few properties to <xul:scrollbar/> elements. They basically expose the scrollbar’s attributes to JS as properties.
If the first patch passes muster, I’ll propose code for percentage-based handling of scrollbars.
Use cases: This is where I usually get hung up. My current motivation is to create a line-numbered multiline textbox control. Other advantages of this would be to directly expose a scrolling capability to JavaScript; dynamic effects, anyone?