Re: CSS Device Adaptation and legacy meta tags and doctypes

On Wed, May 9, 2012 at 12:49 PM, Kenneth Rohde Christiansen
<kenneth.christiansen@gmail.com> wrote:
> Hi there,

Hi, resurrecting this thread.

> Following a discussion on webkit-dev [1], we would like to have added
> a nomative section in the CSS Device Adaptation spec [2], specifying
> how to handle legacy viewport tags, such as HandheldFriendly.
>
> The spec already briefly talks about XHTML-MP in the following:
>
> "Certain DOCTYPEs (for instance XHTML Mobile Profile) are used to recognize
> mobile documents which are assumed to be designed for handheld devices, hence
> using the viewport size as the initial containing block size."
>
> The Nokia N9 browser, WP7 Internet Explorer and Android already
> implement such support. And testing shows that iOS at least does
> similar things for XHTML-MP.
>
> The IE team even has a blog post explaining how it works [3]
>
> Basically there is a priority:
>
> XHTML-MP doctype (overrides default configuration)
> HandheldFriendly meta tag (overrides XHTML-MP doctype)
> MobileOptimized (overrides HandheldFriendly, etc)
> viewport (overrides MobileOptimized etc)

I've tried to twist my brain around this and I think a prioritization
makes sense. Currently, the spec says that meta viewport elements are
cascaded together with @viewport rules. It probably makes more sense
with a prioritization where meta viewport rules, and other legacy
tags, are dropped in the presence of @viewport rules in a UA
supporting @viewport. Otherwise there will be an unpredictable mix of
descriptors from the various legacy tags and the @viewport descriptors
depending on which of the legacy tags are supported in a given UA.

I think the XHTML-MP doctype should be an expection, though. XHTML-MP
doctype should affect the _UA_ styles. XHTML-MP documents is not a
legacy tag in the same sense, and a UA that implements only @viewport
would still have separate UA styles which don't have the @viewport {
min-width: 980px } as the HTML/HTML5 documents would have.

The legacy tags should be on the author level of the cascade, though.

So, the cascade would be something like this:

1. UA stylesheets (different @viewport for HTML and XHTML-MP)
2. User stylesheets
3. Author style - only one of the sources below picked for the
cascading. Based on presence - listed in increasing priority.
3.1. HandheldFriendly
3.2. MobileOptimized
3.3. Meta Viewport  (The 980px default width behavior should be on the
author level here before adding meta tags instead of having it at UA
level as mentioned in Section 11 of css-device-adapt)
3.4. @viewport

I do agree that the legacy handling doesn't belong in the
css-device-adapt spec. It's there for historical reasons and the fact
that it's easier to keep it up-to-date with changes in @viewport
descriptors while the spec evolves. I'm fine with moving legacy tag
handling into HTML as normative.

> The XHTML-MP doctype would correspond to the following viewport meta
> tag: <meta name="viewport" content="width=device-width,
> height=device-height, initial-scale=1">
>
> The same counts for HandheldFriendly (and MobileOptimized, in the case
> the content attribute is missing or not parseable)
>
> Else <meta name="MobileOptimized" content="320"> would to correspond
> to  <meta name="viewport" content="width=320, initial-scale=1">


> [1] http://thread.gmane.org/gmane.os.opendarwin.webkit.devel/20536
> [2] http://www.w3.org/TR/css-device-adapt/
> [3] http://blogs.msdn.com/b/iemobile/archive/2010/11/22/the-ie-mobile-viewport-on-windows-phone-7.aspx

-- 
Rune Lillesveen

Received on Monday, 26 August 2013 11:50:12 UTC