Re: [css-device-adaptation] Progress?

On Wed, Feb 18, 2015 at 10:45 PM, Yoav Weiss <yoav@yoav.ws> wrote:
> My main problem with the device-adaptation spec and the `@viewport` rule is
> that it enables external style sheets to impact the viewport dimensions.
> That can introduce issues around viewport dimensions based resource loading
> (so both <link media> based CSS and `srcset`/`<picture>` based responsive
> images).
>
> One way to solve this would be to limit `@viewport` inline styles in the
> document's head, and add smarts to the UAs parsing mechanisms so that they
> can apply those rules when kicking off loading of viewport-dimensions based
> resources.

I agree the UA should be allowed to resolve the viewport based on
inline styles in head, and it should be established as a "best
practice", but I'm not sure we need to disallow authors to shoot
themselves in the foot. Do we have other examples in CSS where we
handle rules differently based on their origin?

> I also believe that these rules can cause circularity issues. Was that
> discussed in the past? Am I correct that they can be declared only on
> certain media queries? (either through `@media` or through the `media`
> attribute)

Yes, this has been discussed. Circularity is avoided by resolving MQs
for @viewport using the initial viewport instead of the actual
viewport:

http://dev.w3.org/csswg/css-device-adapt/#media-queries

It was discussed if @viewport should not be allowed inside @media, but
you have the same problem with media attributes: "<style
media="(min-width: 400px)">@viewport { width: 200px }</style>"

Resolving MQs against the initial viewport is also a pre-requisite to
be able to drop the min/max descriptors.

@page relying on width/height media queries has the same problem.

-- 
Rune Lillesveen

Received on Thursday, 19 February 2015 10:46:15 UTC