Re: CSS Viewport proposal

On Mon, 09 Aug 2010 18:10:58 +0200, Bjoern Hoehrmann <derhoermi@gmx.net>  
wrote:

> * Rune Lillesveen wrote:
>> If there's any interest - here's my attempt at specifying the
>> functionality of the viewport META tag in CSS syntax using an @viewport
>> block:
>>
>>   http://people.opera.com/rune/TR/ED-css-viewport-20100806/
>
> CSS intentionally avoids boolean property value as you have them here
> for "user-scalable". An alternative would be spelling out the relevant
> effect, so one value could be "scalable".

For instance "scalable | non-scalable" with "scalable" as initial value?  
Better naming suggestions are welcome.

>> The proposal includes a mapping from the viewport META syntax into the
>> proposed CSS syntax.
>
> That is some orders of magnitude more complex than it needs to be, I
> for instance just spent five minutes trying to understand the split
> between line 7 and line 11 until I figured out that the idea is to
> parse "foo bar=baz" as if it was "foo=baz" which strikes me as a bad
> idea.

It's an algorithm trying to exactly match the Safari implementation, and  
is not an attempt to create a reasonable parsing algorithm for the content  
attribute. "width height=300" will in fact set the width to 300 in the  
Safari browser. The whole of chapter 7 could be dropped from the spec as  
far as I'm concerned, but we (Opera) need it internally to be as  
interoperable with Safari as we can on the viewport meta.

> I see no reason why this needs to be more complicated than splitting
> at "," and then splitting the items at "=" into name and value (or no
> value if there is no "="), while ignoring white space at the start,
> end, and around "=" and ",". That's easier to implement and describe
> and does not lead to surprising results as the one mentioned above.
>
> (The code for this in WebKit is actually a copy of the code used to
> parse window.open(...) features including a comment noting that it's
> supposed to mimic Internet Explorer; so I'd rather doubt this needs
> to be this complicated for reasons of compatibility.)

As mentioned above, the "foo bar=baz" -> "foo=baz" actually works like  
that in Safari.

Is the parsing code you're talking about also the same code that's used in  
Safari WebKit?

-- 
Rune Lillesveen
Senior Core Developer / Architect
Opera Software ASA

Received on Monday, 9 August 2010 17:18:09 UTC