- From: Robert O'Callahan <robert@ocallahan.org>
- Date: Thu, 8 Sep 2011 17:34:50 +1200
- To: John J Barton <johnjbarton@johnjbarton.com>
- Cc: Erik Arvidsson <arv@chromium.org>, "Tab Atkins Jr." <jackalmage@gmail.com>, Andrew Dupont <w3@andrewdupont.net>, www-style@w3.org
- Message-ID: <CAOp6jLbeN4yhWL7NyLv2hdziwd-LGPe3vLBzFrL10ad344zX2Q@mail.gmail.com>
On Thu, Sep 8, 2011 at 5:04 PM, John J Barton <johnjbarton@johnjbarton.com>wrote: > From the tools point of view, a layout event would be better (it can > count). In the short run this makes the problem worse: now we are in > JS, do something that triggers layout, enter layout code, call JS > event handler for layout event, return to layout, return to JS. (The > event handler could be very expensive but it's up the tool/dev to deal > with that). I guess we call only if we have a handler set and the > handler would be per document or window so it's pretty cheap. > It would be difficult to expose a synchronous "onlayout" event to Web content safely, and it would be pointless to make it asynchronous. Some sort of debugger-level event would make sense, but that doesn't need to be standardized. If the event has some info on how much the layout 'cost', then the dev > would see "OMG my function is firing 47million layouts at 10ms each!". > That sounds like something good for a debugger-level timeline API. Or *maybe* web-perf. First however we need a way for devs to avoid triggering layout, in a > way that does not pin down the browser layout engine implementations. > Knowledge is an annoying thing when you can't do anything with it. > > Is there/could there a way to take action on such info? Or maybe the > real question is more like: what prevents multiple JS ops from being > batched and triggering one or at least potentially fewer layouts. > You need to know what makes layouts dirty, and what requires dirty layouts to be brought up to date. Almost all DOM changes can make layouts dirty. Almost all CSSOM (Views) APIs require dirty layouts to be recalculated. That's a good start... Rob -- "If we claim to be without sin, we deceive ourselves and the truth is not in us. If we confess our sins, he is faithful and just and will forgive us our sins and purify us from all unrighteousness. If we claim we have not sinned, we make him out to be a liar and his word is not in us." [1 John 1:8-10]
Received on Thursday, 8 September 2011 05:35:19 UTC