- From: Erik Dahlstrom <ed@opera.com>
- Date: Tue, 20 Jul 2010 13:09:56 +0200
- To: "public-svg-wg@w3.org" <public-svg-wg@w3.org>
Forwarded on Tav's behalf for ISSUE-2351.
------- Forwarded message -------
From: "Tavmjong Bah" <tavmjong@gmail.com>
Subject: Proposed changes for units.
Date: Fri, 16 Jul 2010 20:20:29 +0200
Re: ISSUE-2351: Clarify that units are required on <length>s in style
attribute; fix examples in text. [SVG 1.1 F2 Last Call
First an update on the issue:
After some discussion on the www-svg mailing list, it can be
concluded that the examples in 6.6 are correct as the parameter
in question ('stroke-width') is not a CSS defined property and
thus does not need a unit. The example in 7.10 is wrong as
'font-size' is a CSS defined property and its use in a 'style'
attribute requires a unit.
Second, a proposal to clarify when units are required follows. Part of
the proposal is based on suggested text from Doug Schepers.
Tav
Proposed changes:
4.2 Basic data types
Change <angle> section to:
Angles are specified in one of two ways, depending upon whether
they are used in CSS property syntax or SVG presentation attribute
syntax:
* When an <angle> is used in a stylesheet or with a property in a
'style' attribute, the syntax must match the following pattern:
angle ::= number (~"deg" | ~"grad" | ~"rad")?
where deg indicates degrees, grad indicates grads and rad
indicates radians. The unit identifier may be in lower
(recommended) or upper case.
For properties defined in CSS2 [CSS2], an angle unit identifier
must be provided. For angle values in SVG-specific properties
the angle unit identifier is optional. If a unit is not
provided, the angle value is assumed to be in degrees.
* When an <angle> is used in an SVG attribute, the syntax must
match the following pattern:
angle ::= number ("deg" | "grad" | "rad")?
The unit identifier must be in lower case.
In the SVG DOM, <angle> values are represented using SVGAngle or
SVGAnimatedAngle objects.
Change <length> section to:
A length is a distance measurement, given as a number, along with
a unit which may be optional. Lengths are specified in one of two
ways, depending upon whether they are used in CSS property syntax
or SVG presentation attribute syntax:
* When a <length> is used in a stylesheet or with a property in a
'style' attribute, the syntax must match the following pattern:
length ::= number (~"em" | ~"ex" | ~"px" | ~"in" | ~"cm" | ~"mm" |
~"pt" | ~"pc")?
See the CSS2 specification for the meanings of the unit
identifiers. The unit identifier may be in lower (recommended)
or upper case.
For properties defined in CSS2 [CSS2], a length unit identifier
must be provided. For length values in SVG-specific properties,
the length unit identifier is optional. If a unit is not
provided, the length value represents a distance in the current
user coordinate system.
* When a <length> is used in an SVG presentation attribute, the
syntax must match the following pattern:
length ::= number ("em" | "ex" | "px" | "in" | "cm" | "mm" | "pt" |
"pc" | "%")?
The unit identifier must be in lower case.
Note that a percentage unit identifier is allowed in the
presentation attribute (non-property) <length> definition. The
meaning of a percentage length value depends on the attribute for
which the percentage length value has been specified. Two common
cases are: (a) when a percentage length value represents a
percentage of the viewport width or height (refer to the section
that discusses units in general), and (b) when a percentage
length value represents a percentage of the bounding box width or
height on a given object (refer to the section that describes
object bounding box units).
In the SVG DOM, <length> values are represented using SVGLength or
SVGAnimatedLength objects.
6.6 Styling with CSS
Add at end of "Implementations that..." paragraph:
"Note that property declarations inside the 'style' attribute must
follow CSS style rules, see 6.12."
6.12 The 'style' attribute
Add period to end of sentence in first paragraph, followed by:
"Property declarations must follow CSS style rules thus CSS defined
properties (e.g. 'font-size') with a <length> value must include a
unit (for non-zero values). See 6.1 for a list of CSS defined
properties."
7.10 Units:
Change first line from:
All coordinates and lengths in SVG can be specified with or without a
unit identifier.
to:
"All coordinates and lengths in SVG can be specified with or without a
unit identifier. (Note that CSS defined properties used in a CSS style
sheet or the 'style' attribute require units for lengths, see 6.1.)"
Change:
<text style="font-size: 50">Text size is 50 user units</text>
to:
<text font-size="50">Text size is 50 user units</text>
--
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed
Received on Tuesday, 20 July 2010 11:10:31 UTC