[whatwg] Supporting scrollTop and scrollLeft on the Canvas element

Charles Pritchard chuck at jumis.com
Sat Feb 4 10:21:32 PST 2012


On 2/4/12 12:30 AM, Anne van Kesteren wrote:
> On Tue, 31 Jan 2012 23:35:45 +0100, Charles Pritchard 
> <chuck at jumis.com> wrote:
>> I'd like to see scrollTop and scrollLeft supported for the Canvas 
>> element. They would simply fire an onscroll event on the element, and 
>> do nothing else.
>> Many Canvas UIs use only one visible canvas layer, or otherwise, one 
>> main canvas layer.
>
> That would require special casing <canvas> in 
> http://dev.w3.org/csswg/cssom-view/#scroll-an-element which I'm not 
> sure is a good idea. Why don't you just dispatch a synthetic scroll 
> event?
>

Does the scroll event carry x/y information?

I agree, this is a special case for canvas -- the precedent set by 
<input type=text> is that form controls may have separate scroll semantics.

My proposal is not thought-out all the way, but I'm hoping it can float.

The idea here is to enable scroll with limited height/width canvas layer 
to work well.

This is going to be useful for context.scrollPathIntoView as well as 
simply running Element.scrollIntoView on elements within the Canvas 
sub-tree.

Currently, the scroll* attributes in Canvas are read only and set to 
zero. So, I think there is room to support them in the future.

-Charles







More information about the whatwg mailing list