[whatwg] Simplified <picture> element draft

Yoav Weiss yoav at yoav.ws
Mon Jan 6 09:42:31 PST 2014

On Sat, Jan 4, 2014 at 10:19 PM, Boris Zbarsky <bzbarsky at 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
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.

More information about the whatwg mailing list