Re: [cssom-view] Origin of a canvas & scrollable element

On Tue, 23 Sep 2014 00:55:59 +0200, Tab Atkins Jr. <jackalmage@gmail.com>  
wrote:

> On Fri, Sep 19, 2014 at 12:09 AM, Simon Pieters <simonp@opera.com> wrote:
>> Hi,
>>
>> So I'm trying to specify how scrollLeft et al work in CSSOM View:
>>
>> http://lists.w3.org/Archives/Public/www-archive/2014May/att-0007/dsc06430-zcorpan-whiteboard.jpg
>>
>> However, I'm having trouble finding anything in CSS that defines where  
>> the
>> origin is of a canvas or a scrollable element.
>>
>> What defines the correct rendering of these examples?
>>
>> http://software.hixie.ch/utilities/js/live-dom-viewer/saved/3188
>> http://software.hixie.ch/utilities/js/live-dom-viewer/saved/3185
>>
>> Looking at http://www.w3.org/TR/CSS2/visudet.html#x1
>>
>> [[
>> 1. The containing block in which the root element lives is a rectangle
>> called the initial containing block. For continuous media, it has the
>> dimensions of the viewport and is anchored at the canvas origin; it is  
>> the
>> page area for paged media. The 'direction' property of the initial
>> containing block is the same as for the root element.
>> ]]
>>
>> there is no definition of "canvas origin" AFAICT.
>>
>> Further:
>>
>> [[
>> 4. If the element has 'position: absolute', the containing block is
>> established by the nearest ancestor with a 'position' of 'absolute',
>> 'relative' or 'fixed', in the following way:
>> ...
>> 4.2 Otherwise, the containing block is formed by the padding edge of the
>> ancestor.
>> ]]
>>
>> But if the containing block is a scrollable element, the padding edge
>> doesn't move when you scroll, yet the position:absolute element does  
>> move in
>> browsers. So that seems wrong.
>>
>> http://dev.w3.org/csswg/css-position/#def-containing-blocks is  
>> basically the
>> same thing.
>>
>> Am I missing something?
>
> It sounds like you're missing the definition of the "canvas" itself.
> The canvas is defined at
> http://www.w3.org/TR/CSS21/intro.html#the-canvas, but it doesn't seem
> to quite go into enough detail to nail down that the "origin" of it
> would be the rectangle it ordinarily limits rendering to.

That's not a correct definition, I think. See the test case above. The  
origin needs to be the point on the canvas where the top left corner of  
the viewport is when the viewport is in the default scroll position, or  
some such, where the default scroll position depends on writing  
mode/direction.

-- 
Simon Pieters
Opera Software

Received on Tuesday, 23 September 2014 10:35:25 UTC