- From: Yoav Weiss <yoav@yoav.ws>
- Date: Mon, 6 Jan 2014 18:42:31 +0100
- To: Boris Zbarsky <bzbarsky@mit.edu>
- Cc: whatwg <whatwg@lists.whatwg.org>
On Sat, Jan 4, 2014 at 10:19 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote: > On 1/4/14 3:16 PM, Yoav Weiss wrote: > >> Thanks for the review. I'd like to better understand what would be >> required >> to implement off-the-main-thread MQ evaluation in Blink. Since it's a >> Blink >> specific discussion, I'll start a Blink-dev thread on the subject. >> > > Note that Gecko has similar constraints here as far as I know, at the > moment. > > It should be noted that the picture spec does not require media query evaluation *inside* the preloader. For example, the way I prototyped<https://codereview.chromium.org/14449003/>a previous incarnation of the spec's selection algorithm in Blink's HTMLPreloadScanner, is by sending the `media` attribute to the main thread along with the URL, and run the evaluation there. While current picture, with its `sizes` attribute, will require a somewhat different mechanism, a similar method can be used. I don't know much about Gecko's implementation of the preloader, so I could be wrong, but from looking at nsHtml5TreeOpExecutor, it seems like in Gecko (similarly to current Blink) the preloader's products are sent to the main thread before the actual resource loading takes place. If that is in fact the case, picture's resource preloading could be implemented by passing the `media` and `sizes` attributes to the main thread along with the URL, at least as an initial implementation, until off-the-main-thread MQ evaluation would be feasible. Regarding the `sizes` attribute, Adam has pointed out on blink-dev<https://groups.google.com/a/chromium.org/d/msg/blink-dev/HJkM2ebPuX0/3hPQQ57TttcJ> that its parsing would require heavier CSS parsing machinery than simple MQ evaluation. I think that some aspects of it can be simplified at first phase (e.g. the `calc()` requirement), to ease initial implementation, and resolving the use cases, even if it's with somewhat less precision.
Received on Monday, 6 January 2014 17:43:06 UTC