W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2015

Re: Imperative API for Node Distribution in Shadow DOM (Revisited)

From: Ryosuke Niwa <rniwa@apple.com>
Date: Tue, 05 May 2015 11:20:40 -0700
Cc: Elliott Sprehn <esprehn@chromium.org>, Hayato Ito <hayato@chromium.org>, Domenic Denicola <d@domenic.me>, Justin Fagnani <justinfagnani@google.com>, WebApps WG <public-webapps@w3.org>, Erik Bryn <erik@erikbryn.com>, Dimitri Glazkov <dglazkov@google.com>, Edward O'Connor <eoconnor@apple.com>, Steve Orvell <sorvell@google.com>
Message-id: <D7F5C4E8-DA46-498E-AADA-67BD01FE1849@apple.com>
To: Anne van Kesteren <annevk@annevk.nl>

> On May 4, 2015, at 10:20 PM, Anne van Kesteren <annevk@annevk.nl> wrote:
> 
>> On Tue, May 5, 2015 at 6:58 AM, Elliott Sprehn <esprehn@chromium.org> wrote:
>> We can solve this
>> problem by running the distribution code in a separate scripting context
>> with a restricted (distribution specific) API as is being discussed for
>> other extension points in the platform.
> 
> That seems like a lot of added complexity, but yeah, that would be an
> option I suppose. Dimitri added something like this to the imperative
> API proposal page a couple of days ago.
> 
> 
>> One thing to consider here is that we very much consider distribution a
>> style concept. It's about computing who you inherit style from and where you
>> should be in the box tree. It just so happens it's also leveraged in event
>> dispatch too (like pointer-events). It happens asynchronously from DOM
>> mutation as needed just like style and reflow though.
> 
> I don't really see it that way. The render tree is still computed from
> the composed tree. The composed tree is still a DOM tree, just
> composed from various other trees. In the "open" case you can access
> it synchronously through various APIs (e.g. >>> if we keep that for
> querySelector() selectors and also deepPath).

I agree. I don't see any reason node distribution should be considered as a style concept. It's a DOM concept. There is no CSS involved here.

I have issues with the argument that we should do it lazily.  On one hand, if node distribution is so expensive that we need to do it lazily, then it's unacceptable to make event dispatching so much slower.  On the other hand, if node distribution is fast, as it should be, then there is no reason we need to do it lazily.

The problem is really the redistributions. If we instead had explicit insertion points under each shadow host, then we wouldn't really need redistributions at all, and node distribution can happen in O(1) per child change.

- R. Niwa
Received on Tuesday, 5 May 2015 18:21:11 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:27:31 UTC