Re: [cssom-view] Which APIs should be 'double' vs. 'long'

On Fri, 18 Dec 2015 18:55:20 +0100, Trav Stone <travtrilogi@gmail.com>  
wrote:

> Hi Simon,
>
> Many thanks! Had no idea Range existed, but it does indeed return the  
> value
> I need. I'd still argue that your proposed API is a bit easier to use  
> than
> Range, but perhaps I'm in the minority with that viewpoint.
>
> At any rate, I really appreciate your response- very helpful!

The proposed API is not at all instead of Range. It's instead of  
Element#scrollWidth etc.


On Fri, 18 Dec 2015 19:08:41 +0100, Rick Byers <rbyers@chromium.org> wrote:

> I had thought an API like getScrollRect wasn't necessary because
> getBoundingClientRect + fractional scrollTop/scrollLeft covered all the
> scenarios.  But if there are scenarios that need fractional
> scrollHeight/scrollWidth (or maybe even if it's demonstrably easier to  
> use
> getScrollRect), then I'd certainly support your getScrollRect proposal.

Consider Trav's case, but there is a scrollbar visible. Then  
getBoundingClientRect doesn't return the width you want. You want the  
width excluding the scrollbar, if there is one.

Or if there's a border, then getBoundingClientRect includes the border.  
But getBoxQuads() lets you select the content box... An alternative would  
be to extend getBoxQuads() with a way to get the "content minus  
scrollbars" box.

     elm.getBoxQuads({box: 'scroll'})[0].getBounds().width

It's more wordy than elm.scrollWidth (and elm.getScrollRect().width),  
although you can support transformed boxes.

-- 
Simon Pieters
Opera Software

Received on Monday, 21 December 2015 08:34:01 UTC