W3C home > Mailing lists > Public > www-svg@w3.org > January 2014

Percentage on objectBoundingBox

From: Dirk Schulze <dschulze@adobe.com>
Date: Fri, 3 Jan 2014 19:53:06 +0000
To: "www-svg@w3.org" <www-svg@w3.org>
Message-ID: <7DADDAB2-1EE8-40D5-A697-472ECA7B4078@adobe.com>

I checked the behavior of objectBoundingBox on content with percentage values:

<clipPath clipPathUnits="objectBoundingBox" id="clip1">
<circle cx="0.5" cy="0.5" r="0.5"/>
<clipPath clipPathUnits="objectBoundingBox" id="clip2">
<circle cx="50%" cy="50%" r="50%"/>

>From the section “Object bounding box units” in SVG 1.1 [1] I would assume that both clipping paths do exactly the same. And yet, all SVG viewers seem to hide content completely clipped with the second clipping path. 

If percentages are used within the content of a ‘pattern’, ‘clipPath’, ‘mask’ or ‘filter’ element, these values are treated according to the processing rules for percentages as defined in Units.

The section about Units[2] say that percentage are resolved to the nearest viewport.

The three rectangles on the right demonstrate the use of percentages. Note that the width and height of the viewport in the user coordinate system for the viewport element (in this case, the outermost svg element) are 4000 and 2000, respectively, because processing the ‘viewBox’ attribute results in a transformed user coordinate system

Of course it depends if <pattern>, <mask>, <clipPath> and so on create a new viewport. I am not sure if that is ever explicitly said. Especially for userSpaceOnUse we take the nearest viewport of the affected element. Even though, what does it mean for the example above?


[1] http://www.w3.org/TR/SVG11/coords.html#ObjectBoundingBox
[2] http://www.w3.org/TR/SVG11/coords.html#Units

(image/svg+xml attachment: clip-path.svg)

Received on Friday, 3 January 2014 19:53:37 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:50 UTC