W3C home > Mailing lists > Public > www-style@w3.org > March 2013

Re: [css3-regions] offsetParent for element collected inside a named flow

From: Andrei Bucur <abucur@adobe.com>
Date: Mon, 25 Mar 2013 14:53:42 +0000
To: Alan Stearns <stearns@adobe.com>
CC: Mihnea-Vlad Ovidenie <mihnea@adobe.com>, "www-style@w3.org" <www-style@w3.org>
Message-ID: <02601DC4-5215-4239-9310-24AD75452604@adobe.com>
With regions, this is more complicated because an element gets to occupy a certain space inside the viewport because of both the flow layout and region layout. I can imagine there are situations when developers want to access the offsetParent relative to the flow in some contexts and the visual offsetParent relative to the regions in other contexts.

If we go with the approach of changing this to follow only the visual ancestor path there will be no easy way to compute the flow offset* properties. I don't have hard data but I think there are JS libraries that use the offset* properties to make adjustment to the position of elements after layout. If we take the elements using those hypothetical libraries and flow them inside regions their layout will break because they expect offsetParent to point inside the flow, not the regions.

Maybe we can create a new API on the CSSOM (like visualOffset*) that can behave the way you described for regions, overflow fragments etc. and follow the visual ancestor path.



On Mar 23, 2013, at 1:12 AM, Alan Stearns <stearns@adobe.com> wrote:

> On 3/22/13 6:32 AM, "Mihnea-Vlad Ovidenie" <mihnea@adobe.com> wrote:
>> Hi,
>> CSSRegions spec [1] has a paragraph describing the computation of offset*
>> attributes for elements laid out in a named flow. However, it does not
>> mention explicitly if/how collecting an element inside a named flow
>> affects the way *offsetParent* [2] is determined.
>> For instance, in the case of the following markup:
>> <div id="contentNode" style="flow-into: flow">
>> </div>
>> What should *document.getElementById("contentNode").offsetParent* return?
>> In my opinion, it should return *null*, meaning that the algorithm of
>> determining the closest positioned containing element for an element
>> collected in a named flow should stop at the named flow level (and return
>> null in this case).
>> Thoughts?
>> [1] http://dev.w3.org/csswg/css3-regions/#cssomview-offset-attributes
>> [2] 
>> http://dev.w3.org/csswg/cssom-view/#extensions-to-the-htmlelement-interfac
>> e
> I do not think it should return null. But I don't think that following the
> algorithm defined in cssom-view for fragmented content is necessarily the
> right thing to do either. That algorithm doesn't take fragmentation
> contexts into account. Since the various offset properties are concerned
> with the edges of the CSS layout box, it makes much more sense to me to
> update the algorithm to accommodate fragment containers.
> Instead of only considering ancestor elements in step 2 of the
> offsetParent algorithm, I think it should walk the ancestor chain up to
> the nearest fragment boundary, then hop to the fragment container and walk
> its ancestry (repeating for as many fragmentation contexts as are nested).
> Thus the result could be the region containing the element, or a
> positioned ancestor of that region.
> If and when columns or overflow:fragment boxes can be positioned, this
> will be an issue for those fragmentation contexts as well. And in a
> paginated view case, I think it will be much more useful to return the
> page containing the element.
> Thanks,
> Alan
Received on Monday, 25 March 2013 14:55:28 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:27 UTC