Sun, 10 Mar 2013 19:35:27 -0700
Incorporate feedback from Liam R E Quin.
dschulze@344 | 1 | <!DOCTYPE html public '-//W3C//DTD HTML 4.01//EN' |
dschulze@344 | 2 | 'http://www.w3.org/TR/html4/strict.dtd'> |
dschulze@273 | 3 | <html lang="en"> |
dschulze@273 | 4 | <head> |
dschulze@273 | 5 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
dschulze@273 | 6 | <title>CSS Masking</title> |
dschulze@273 | 7 | <link rel=contents href="#contents"> |
dschulze@273 | 8 | <link rel=index href="#index"> |
dschulze@273 | 9 | <link rel="stylesheet" type="text/css" href="default.css"> |
dschulze@273 | 10 | <link rel="stylesheet" type="text/css" |
dschulze@273 | 11 | href="http://www.w3.org/StyleSheets/TR/W3C-ED.css"> |
dschulze@696 | 12 | <script defer=defer |
dschulze@696 | 13 | src="http://test.csswg.org/harness/annotate.js#CSS-MASKING_DEV" |
dschulze@696 | 14 | type="text/javascript"></script> |
dschulze@273 | 15 | </head> |
dschulze@273 | 16 | |
dschulze@273 | 17 | <div class="head"> |
dschulze@273 | 18 | <!--logo--> |
dschulze@273 | 19 | |
dschulze@273 | 20 | <h1>CSS Masking</h1> |
dschulze@273 | 21 | |
dschulze@273 | 22 | <h2 class="no-num no-toc">[LONGSTATUS] [DATE]</h2> |
dschulze@273 | 23 | <dl> |
dschulze@273 | 24 | <dt>This version: |
dschulze@708 | 25 | <dd><a href="http://dvcs.w3.org/hg/FXTF/raw-file/default/masking/index.html">http://dvcs.w3.org/hg/FXTF/raw-file/default/masking/index.html</a> |
dschulze@273 | 26 | <!--http://www.w3.org/TR/[YEAR]/WD-[SHORTNAME]-[CDATE]/--> |
dschulze@273 | 27 | |
dschulze@273 | 28 | <dt>Latest version: |
dschulze@273 | 29 | <dd><a href="http://www.w3.org/TR/css-masking/">[LATEST]</a> |
dschulze@273 | 30 | |
dschulze@273 | 31 | <dt>Editor's draft: |
dschulze@708 | 32 | <dd><a href="http://dvcs.w3.org/hg/FXTF/raw-file/default/masking/index.html">http://dvcs.w3.org/hg/FXTF/raw-file/default/masking/index.html</a> |
dschulze@273 | 33 | |
dschulze@273 | 34 | <dt>Editors: |
dschulze@427 | 35 | <dd class="vcard"> |
dschulze@427 | 36 | <span class="fn">Dirk Schulze</span>, |
dschulze@427 | 37 | <span class="org">Adobe Systems</span>, |
dschulze@427 | 38 | <span class="email">dschulze@adobe.com</span> |
dschulze@427 | 39 | </dd> |
dschulze@427 | 40 | <dd class="vcard"> |
birtles@438 | 41 | <span class="fn">Brian Birtles</span>, |
birtles@438 | 42 | <span class="org">Mozilla Japan</span>, |
birtles@438 | 43 | <span class="email">bbirtles@mozilla.com</span> |
birtles@438 | 44 | </dd> |
dschulze@441 | 45 | <dd class="vcard"> |
dschulze@441 | 46 | <span class="fn"><a href="http://www.xanthir.com/contact/">Tab Atkins Jr.</a></span>, |
dschulze@441 | 47 | <span class="org">Google, Inc.</span> |
dschulze@441 | 48 | </dd> |
dschulze@273 | 49 | </dl> |
dschulze@273 | 50 | |
dschulze@273 | 51 | <!--copyright--> |
dschulze@273 | 52 | |
dschulze@273 | 53 | <hr title="Separator for header"> |
dschulze@273 | 54 | </div> |
dschulze@273 | 55 | |
dschulze@273 | 56 | <h2 class="no-num no-toc" id="abstract">Abstract</h2> |
dschulze@273 | 57 | |
dschulze@453 | 58 | <p> |
birtles@466 | 59 | CSS Masking provides two means for partially or fully hiding portions of |
birtles@466 | 60 | visual elements: masking and clipping. |
dschulze@454 | 61 | </p> |
dschulze@454 | 62 | |
dschulze@454 | 63 | <p> |
birtles@466 | 64 | Masking describes how to use another graphical element or image as a luminance |
birtles@466 | 65 | or alpha mask. |
dschulze@279 | 66 | Typically, rendering an element via CSS or SVG can conceptually described as if the element, |
birtles@466 | 67 | including its children, are drawn into a buffer and then that buffer is composited |
birtles@466 | 68 | into the element's parent. |
birtles@466 | 69 | Luminance and alpha masks influence the transparency of this buffer before the |
birtles@466 | 70 | compositing stage. |
dschulze@453 | 71 | </p> |
dschulze@273 | 72 | |
dschulze@454 | 73 | <p> |
birtles@466 | 74 | Clipping describes the visible region of visual elements. |
birtles@466 | 75 | The region can be described by using certain SVG graphics elements or basic |
birtles@466 | 76 | shapes. |
birtles@466 | 77 | Anything outside of this region is not rendered. |
dschulze@454 | 78 | </p> |
dschulze@454 | 79 | |
dschulze@273 | 80 | <h2 class="no-num no-toc" id="status">Status of this document</h2> |
dschulze@273 | 81 | |
dschulze@273 | 82 | <!--status--> |
dschulze@273 | 83 | |
dschulze@273 | 84 | <h2 class="no-num no-toc" id="contents"> |
dschulze@273 | 85 | Table of contents</h2> |
dschulze@273 | 86 | |
dschulze@273 | 87 | <!--toc--> |
dschulze@273 | 88 | |
dschulze@273 | 89 | <h2 id="intro"> |
dschulze@273 | 90 | Introduction |
dschulze@273 | 91 | </h2> |
dschulze@273 | 92 | |
dschulze@273 | 93 | <p> |
dschulze@454 | 94 | With CSS Masking it is possible to specify another graphics element, shape or file |
dschulze@454 | 95 | to be used as clipping region or an luminance or alpha mask for compositing the current object into the |
dschulze@273 | 96 | background. |
dschulze@273 | 97 | </p> |
dschulze@273 | 98 | |
dschulze@273 | 99 | <p> |
dschulze@454 | 100 | A mask is applied using the 'mask', 'mask-image' or 'mask-box-image' properties. |
dschulze@281 | 101 | The mask source may be defined using a <a>'mask element'</a> element referenced |
dschulze@281 | 102 | by the 'mask' property. |
dschulze@281 | 103 | Alternatively, for many simple uses, the 'mask-image' property may |
dschulze@281 | 104 | refer directly to graphical elements or images to be used as mask |
dschulze@281 | 105 | forgoing the need for an explicit <a>'mask element'</a> element. The |
dschulze@281 | 106 | 'mask' property is also a shorthand for other masking properties. |
dschulze@486 | 107 | 'mask-box-image' splits a mask image into 9 pieces. The pieces may be sliced, |
dschulze@454 | 108 | scaled and stretched in various ways to fit the size of the mask image area. |
dschulze@273 | 109 | </p> |
dschulze@273 | 110 | |
dschulze@273 | 111 | <p> |
dschulze@281 | 112 | The effect of applying a mask is as if the mask images or mask source elements are |
dschulze@486 | 113 | rendered into an off-screen image which has been initialized to transparent |
dschulze@273 | 114 | black. |
dschulze@273 | 115 | The graphical object to which the mask is applied |
dschulze@273 | 116 | will be painted onto the background through the |
dschulze@273 | 117 | mask, thus completely or partially masking out parts of the graphical |
dschulze@273 | 118 | object. |
dschulze@273 | 119 | </p> |
dschulze@273 | 120 | |
dschulze@454 | 121 | <p> |
dschulze@454 | 122 | Clipping defines a visible region of a visual element. The region can be specified with SVG <a>graphics element</a> or |
dschulze@454 | 123 | basic shapes. Everything outside of a region does not get rendered. |
dschulze@454 | 124 | </p> |
dschulze@454 | 125 | |
dschulze@273 | 126 | <div class="example"> |
dschulze@311 | 127 | <div class=figure> |
dschulze@311 | 128 | <img src="images/luminance-mask.svg" width="655px" height="260px" alt="Example Mask"> |
dschulze@453 | 129 | <p class=caption> |
dschulze@453 | 130 | A luminance mask (middle) is applied on a shape filled with a gradient (left). This results in a masked shape |
dschulze@453 | 131 | (right). |
dschulze@453 | 132 | </p> |
dschulze@311 | 133 | </div> |
dschulze@273 | 134 | </div> |
dschulze@273 | 135 | |
dschulze@279 | 136 | <h2 id="placement">Module interactions</h2> |
dschulze@273 | 137 | |
dschulze@279 | 138 | <p>This specification defines a set of CSS properties that affect the visual rendering of elements to which |
dschulze@273 | 139 | those properties are applied; these effects are applied after elements have been sized and positioned according |
dschulze@273 | 140 | to the <a href="http://www.w3.org/TR/CSS2/visuren.html" title="Visual formatting model">Visual formatting model</a> |
dschulze@453 | 141 | from [[!CSS21]]. Some values of these properties result in the creation of a |
dschulze@453 | 142 | <a href="http://www.w3.org/TR/CSS2/visuren.html#containing-block" title="Visual formatting model">containing block</a>, |
dschulze@453 | 143 | and/or the creation of a <a href="http://www.w3.org/TR/CSS2/visuren.html#z-index" title="Visual formatting model">stacking |
dschulze@453 | 144 | context</a>. |
dschulze@273 | 145 | </p> |
dschulze@273 | 146 | |
dschulze@659 | 147 | <p> |
dschulze@698 | 148 | Definitions of CSS properties and values in this specification comply with defintions in CSS Backgrounds and Borders [[!CSS3BG]]. To avoid redundancy, this specification relies on descriptions and definitions of CSS Backgrounds and Borders. Every reference will be marked clearly. The following terms in CSS Backgrounds and Borders have the following meaning in this specification: |
dschulze@659 | 149 | </p> |
dschulze@659 | 150 | |
dschulze@659 | 151 | <table class="data" id="term-matching"> |
dschulze@659 | 152 | <thead> |
dschulze@659 | 153 | <tr> |
dschulze@659 | 154 | <th>Term in [[!CSS3BG]] |
dschulze@659 | 155 | <th>Term in CSS Masking |
dschulze@659 | 156 | </tr> |
dschulze@659 | 157 | </thead> |
dschulze@659 | 158 | <tbody> |
dschulze@659 | 159 | <tr> |
dschulze@659 | 160 | <th>background images |
dschulze@659 | 161 | <td>mask images |
dschulze@659 | 162 | </tr> |
dschulze@659 | 163 | <tr> |
dschulze@659 | 164 | <th>background painting area |
dschulze@659 | 165 | <td>mask painting area |
dschulze@659 | 166 | </tr> |
dschulze@659 | 167 | <tr> |
dschulze@659 | 168 | <th>background-size |
dschulze@659 | 169 | <td>mask-size |
dschulze@659 | 170 | </tr> |
dschulze@659 | 171 | <tr> |
dschulze@659 | 172 | <th>background-position |
dschulze@659 | 173 | <td>mask-position |
dschulze@659 | 174 | </tr> |
dschulze@659 | 175 | <tr> |
dschulze@659 | 176 | <th>background positioning area |
dschulze@659 | 177 | <td>mask positioning area |
dschulze@659 | 178 | </tr> |
dschulze@659 | 179 | <tr> |
dschulze@659 | 180 | <th>border image area |
dschulze@659 | 181 | <td>mask box image area |
dschulze@659 | 182 | </tr> |
dschulze@659 | 183 | </tbody> |
dschulze@659 | 184 | </table> |
dschulze@279 | 185 | |
dschulze@473 | 186 | <p> |
dschulze@473 | 187 | Some property and element definitions in this specification require an SVG 1.1 implementation [[!SVG11]]. UAs without |
dschulze@734 | 188 | support for SVG must not implement any of the following properties and elements: 'mask-type', 'clip-rule', <a>'clipPath element'</a> element, <a>'mask element'</a> element. For UAs without |
dschulze@734 | 189 | support for SVG, the 'mask' and 'clip-path' properties must neither support references to |
dschulze@734 | 190 | <a>'mask element'</a> elements nor to <a>'clipPath element'</a> elements. |
dschulze@473 | 191 | </p> |
dschulze@473 | 192 | |
dschulze@279 | 193 | <h2 id="values">Values</h2> |
dschulze@279 | 194 | |
dschulze@453 | 195 | <p> |
dschulze@453 | 196 | This specification follows the <a href="http://www.w3.org/TR/CSS21/about.html#property-defs">CSS property definition |
dschulze@731 | 197 | conventions</a> from [[!CSS21]]. Value types not defined in this specification are defined in CSS Values and Units Module Level 3 [[!CSS3VAL]]. |
dschulze@453 | 198 | </p> |
dschulze@279 | 199 | |
dschulze@453 | 200 | <p> |
dschulze@453 | 201 | In addition to the property-specific values listed in their definitions, all properties defined in this specification |
dschulze@453 | 202 | also accept the <a href="http://www.w3.org/TR/CSS21/cascade.html#value-def-inherit">inherit</a> keyword as their |
dschulze@453 | 203 | property value. For readability it has not been repeated explicitly. |
dschulze@453 | 204 | </p> |
dschulze@279 | 205 | |
dschulze@273 | 206 | <h2 id="definitions">Definitions</h2> |
dschulze@273 | 207 | |
dschulze@273 | 208 | <p> |
dschulze@273 | 209 | When used in this specification, terms have the meanings assigned in this section. |
dschulze@273 | 210 | </p> |
dschulze@273 | 211 | |
dschulze@273 | 212 | <dl> |
dschulze@273 | 213 | <dt id="TermClientBoundingRect"><dfn>bounding client rect</dfn></dt> |
dschulze@273 | 214 | <dd> |
dschulze@273 | 215 | <p> |
dschulze@273 | 216 | The union of all border boxes for the element that has an associated CSS layout box and is not |
dschulze@734 | 217 | in the <code>http://www.w3.org/2000/svg</code> namespace and its descendant elements. Or the |
dschulze@273 | 218 | object bounding box [[!SVG11]], if the element does not have |
dschulze@273 | 219 | an associated CSS layout box and is in the <code>http://www.w3.org/2000/svg</code> namespace |
dschulze@273 | 220 | (See <a href="http://www.w3.org/TR/cssom-view/#dom-element-getboundingclientrect">getBoundingClientRect</a> |
dschulze@463 | 221 | [[CSSOM-VIEW]]). |
dschulze@273 | 222 | </p> |
dschulze@273 | 223 | </dd> |
dschulze@273 | 224 | <dt id="TermLocalCoordinateSystem"><dfn>local coordinate system</dfn></dt> |
dschulze@273 | 225 | <dd> |
dschulze@273 | 226 | <p> |
dschulze@273 | 227 | In general, a coordinate system defines locations and distances on the current |
dschulze@273 | 228 | canvas. The current local coordinate system (also user coordinate system) is the |
dschulze@273 | 229 | coordinate system that is currently active and which is used to define how |
dschulze@273 | 230 | coordinates and lengths are located and computed, respectively, on the current |
dschulze@273 | 231 | canvas [[CSS3-TRANSFORMS]]. |
dschulze@273 | 232 | </p> |
dschulze@273 | 233 | <p> |
dschulze@273 | 234 | For elements that have an associated CSS layout box, the current user coordinate system has its origin at |
dschulze@273 | 235 | the top-left corner of the <span class="term">bounding client rect</span> and one unit equals one CSS pixel. |
dschulze@273 | 236 | The viewport for resolving percentage values is defined by the width and height of the |
dschulze@273 | 237 | <span class="term">bounding client rect</span>. |
dschulze@273 | 238 | </p> |
dschulze@273 | 239 | <p> |
dschulze@273 | 240 | If the element does not have an associated CSS layout box and is in the <code>http://www.w3.org/2000/svg</code> |
dschulze@273 | 241 | namespace, the current local coordinate system has its origin at the top-left corner of the element's |
dschulze@273 | 242 | nearest viewport. |
dschulze@273 | 243 | </p> |
dschulze@273 | 244 | </dd> |
dschulze@273 | 245 | <dt id="TermUserCoordinateSystem"><dfn>user coordinate system</dfn></dt> |
dschulze@273 | 246 | <dd> |
dschulze@734 | 247 | The term <var>user coordinate system</var> is equivalent to the term <var>local coordinate system</var>. |
dschulze@273 | 248 | </dd> |
dschulze@273 | 249 | <dt id="TermObjectBoundingBoxUnits"><dfn>object bounding box units</dfn></dt> |
dschulze@273 | 250 | <dd> |
dschulze@453 | 251 | The <span class="term">bounding client rect</span> defines the coordinate system in which to resolve values, as |
dschulze@453 | 252 | defined in <a>object bounding box units</a> [[!SVG11]]. |
dschulze@273 | 253 | </dd> |
dschulze@281 | 254 | <dt id="TermMask"><dfn>mask</dfn></dt> |
dschulze@281 | 255 | <dd> |
dschulze@486 | 256 | An off-screen image which has been initialized to transparent |
dschulze@281 | 257 | black. |
dschulze@281 | 258 | The graphical object to which the mask is applied |
dschulze@281 | 259 | will be painted onto the background through the |
dschulze@281 | 260 | mask, thus completely or partially masking out parts of the graphical |
dschulze@281 | 261 | object. |
dschulze@281 | 262 | </dd> |
dschulze@343 | 263 | <dt id="TermMaskSource"><dfn>mask source</dfn></dt> |
dschulze@281 | 264 | <dd> |
dschulze@281 | 265 | A mask defined by a <a>'mask element'</a> element. |
dschulze@281 | 266 | </dd> |
dschulze@298 | 267 | <dt id="TermClippingPath">clipping path</dt> |
dschulze@298 | 268 | <dd> |
dschulze@298 | 269 | A combination of the SVG elements <a>'path'</a>, <a>'text'</a> |
dschulze@298 | 270 | and <a>basic shapes</a> which serve as the |
dschulze@298 | 271 | outline of a (in the absence of anti-aliasing) 1-bit <a href="#TermMask">mask</a>, |
dschulze@298 | 272 | where everything on the "inside" of the outline is allowed to |
dschulze@298 | 273 | show through but everything on the outside is masked out. See 'clip-path'. |
dschulze@298 | 274 | </dd> |
dschulze@273 | 275 | </dl> |
dschulze@273 | 276 | |
dschulze@281 | 277 | <h2>The Mask Rendering Model</h2> |
dschulze@279 | 278 | |
dschulze@453 | 279 | <p> |
dschulze@453 | 280 | The application of the 'clip-path', 'mask' or 'mask-image' properties to an element formatted with the CSS box model |
dschulze@734 | 281 | establishes a stacking context in the same way that CSS 'opacity' does, and all the element's descendants are rendered |
dschulze@453 | 282 | together as a group with the masking applied to the group as a whole. |
dschulze@453 | 283 | </p> |
dschulze@279 | 284 | |
dschulze@453 | 285 | <p> |
dschulze@734 | 286 | The 'mask' and 'mask-image' properties have no effect on the geometry of any element's CSS boxes. |
dschulze@453 | 287 | </p> |
dschulze@279 | 288 | |
dschulze@453 | 289 | <p> |
dschulze@453 | 290 | The compositing model follows the SVG compositing model [[!SVG11]]: first any filter effect is applied, then any |
dschulze@453 | 291 | clipping, masking and opacity. These effects all apply after any other CSS effects such as 'border'. As per SVG, the |
dschulze@453 | 292 | application of 'mask' or 'mask-image' has no effect on hit-testing. |
dschulze@453 | 293 | </p> |
dschulze@279 | 294 | |
dschulze@279 | 295 | <h3 id="layering">Layering Multiple Mask Images</h3> |
dschulze@279 | 296 | |
dschulze@279 | 297 | <p>The mask of a box can have multiple <span |
dschulze@279 | 298 | class=index>layers</span>. The number |
dschulze@279 | 299 | of layers is determined by the number of comma-separated values in the |
dschulze@279 | 300 | 'mask-image' property. Note that a value of 'none' still creates |
dschulze@279 | 301 | a layer. |
dschulze@279 | 302 | |
dschulze@698 | 303 | See <a href="http://www.w3.org/TR/css3-background/#layering">Layering Multiple Background Images</a> [[!CSS3BG]]. |
dschulze@279 | 304 | |
dschulze@698 | 305 | <p>The first layer is the layer closest to the user, |
dschulze@281 | 306 | the next one is painted behind the first, and so on. All mask images |
dschulze@443 | 307 | are transformed to alpha masks (if necessary) and combined by compositing |
dschulze@443 | 308 | on the <a href="#TermMask">mask</a>. |
dschulze@279 | 309 | |
dschulze@279 | 310 | <h3 id="MaskValues">Calculating mask values</h3> |
dschulze@279 | 311 | |
dschulze@279 | 312 | <p> |
dschulze@281 | 313 | A mask may be interpreted using one of two different methods with regards |
dschulze@279 | 314 | to calculating the mask values that will be multiplied with the target alpha |
dschulze@279 | 315 | values. |
dschulze@279 | 316 | </p> |
dschulze@279 | 317 | |
dschulze@279 | 318 | <p> |
dschulze@279 | 319 | The first and simplest method of calculating the mask values is to use the alpha |
dschulze@279 | 320 | channel of the mask source. |
dschulze@279 | 321 | In this case the mask value at a given point is simply the value of the alpha channel at that point. |
dschulze@279 | 322 | The color channels do not contribute to the mask value. |
dschulze@279 | 323 | </p> |
dschulze@279 | 324 | |
dschulze@279 | 325 | <p> |
dschulze@453 | 326 | The second method of calculating the mask values is to use the luminance of the mask source. |
dschulze@453 | 327 | In this case the mask value at a given point is computed from the color channel values and alpha channel value using |
dschulze@453 | 328 | the following procedure. |
dschulze@279 | 329 | </p> |
dschulze@279 | 330 | |
dschulze@279 | 331 | <ol> |
dschulze@279 | 332 | <li>Compute a luminance value from the color channel values. |
dschulze@279 | 333 | <ul> |
dschulze@279 | 334 | <li> |
dschulze@279 | 335 | If the computed value of 'color-interpolation' on the <a>'mask element'</a> element is 'linearRGB', convert the |
dschulze@279 | 336 | original image color values (potentially in the sRGB color space) to the linear |
dschulze@343 | 337 | RGB color space. |
dschulze@279 | 338 | </li> |
dschulze@279 | 339 | <li>Then, using non-premultiplied RGB color values, apply the |
dschulze@279 | 340 | luminance-to-alpha coefficients (as defined in the <a>'feColorMatrix'</a> |
dschulze@452 | 341 | filter primitive [[!SVG11]]) to convert the RGB color values to luminance |
dschulze@279 | 342 | values. |
dschulze@279 | 343 | </li> |
dschulze@279 | 344 | </ul> |
dschulze@279 | 345 | </li> |
dschulze@279 | 346 | <li>Multiply the computed luminance value by the corresponding alpha |
dschulze@279 | 347 | value to produce the mask value.</li> |
dschulze@279 | 348 | </ol> |
dschulze@279 | 349 | |
dschulze@279 | 350 | <p>Regardless of the method used, the procedure for calculating |
dschulze@279 | 351 | mask values assumes the content of the mask is a four-channel RGBA graphics |
dschulze@279 | 352 | object. |
dschulze@279 | 353 | For other types of graphics objects, special handling is required as |
dschulze@279 | 354 | follows.</p> |
dschulze@279 | 355 | |
dschulze@279 | 356 | <p>For a three-channel RGB graphics object that is used in a mask (e.g., |
dschulze@279 | 357 | when referencing a three-channel image file), the effect is as if the object |
dschulze@279 | 358 | were converted into a four-channel RGBA image with the alpha channel |
dschulze@279 | 359 | uniformly set to 1.</p> |
dschulze@279 | 360 | |
dschulze@279 | 361 | <p>For a single-channel image that is used in a mask (e.g., when |
dschulze@279 | 362 | referencing a single-channel grayscale image file), the effect is as if the |
dschulze@279 | 363 | object were converted into a four-channel RGBA image, where the single |
dschulze@279 | 364 | channel from the referenced object is used to compute the three color |
dschulze@724 | 365 | channels and the alpha channel is uniformly set to 1.</p> |
dschulze@724 | 366 | <p class="note">Note that when |
dschulze@279 | 367 | referencing a grayscale image file, the transfer curve relating the |
dschulze@279 | 368 | encoded grayscale values to linear light values must be taken into |
dschulze@279 | 369 | account when computing the color channels.</p> |
dschulze@279 | 370 | |
dschulze@281 | 371 | <p class="note">Note that SVG <a>graphics elements</a> (e.g., <a>'circle'</a> or <a>'text'</a>) |
dschulze@281 | 372 | are all treated as four-channel RGBA images for the purposes |
dschulze@279 | 373 | of masking operations.</p> |
dschulze@279 | 374 | |
dschulze@279 | 375 | <p>The effect of a mask is identical to what would have happened if |
dschulze@279 | 376 | there were no mask but instead the alpha channel of the given object |
dschulze@279 | 377 | were multiplied with the mask's resulting mask values.</p> |
dschulze@279 | 378 | |
dschulze@292 | 379 | <h2 id="masking">Mask</h2> |
dschulze@292 | 380 | <h3 id="the-mask-image">The 'mask-image' property</h3> |
dschulze@274 | 381 | |
dschulze@274 | 382 | <table class="propdef"> |
dschulze@274 | 383 | <tr> |
dschulze@274 | 384 | <th>Name: |
dschulze@274 | 385 | <td><dfn>mask-image</dfn> |
dschulze@274 | 386 | <tr> |
dschulze@274 | 387 | <th><a href="#values">Value</a>: |
dschulze@607 | 388 | <td><var><mask-reference></var> |
dschulze@274 | 389 | <tr> |
dschulze@274 | 390 | <th>Initial: |
dschulze@274 | 391 | <td>none |
dschulze@274 | 392 | <tr> |
dschulze@274 | 393 | <th>Applies to: |
dschulze@274 | 394 | <td>All elements. In SVG, it applies to <a>container elements</a> and <a>graphics elements</a> |
dschulze@274 | 395 | <tr> |
dschulze@274 | 396 | <th>Inherited: |
dschulze@274 | 397 | <td>no |
dschulze@274 | 398 | <tr> |
dschulze@274 | 399 | <th>Percentages: |
dschulze@274 | 400 | <td>N/A |
dschulze@274 | 401 | <tr> |
dschulze@274 | 402 | <th>Media: |
dschulze@274 | 403 | <td>visual |
dschulze@274 | 404 | <tr> |
dschulze@274 | 405 | <th>Computed value: |
dschulze@274 | 406 | <td>as specified, but with URIs made absolute |
dschulze@274 | 407 | <tr> |
dschulze@274 | 408 | <th>Animatable: |
dschulze@274 | 409 | <td>no |
dschulze@274 | 410 | </table> |
dschulze@274 | 411 | |
dschulze@536 | 412 | <p>This property sets the mask image(s) or the mask source of an element. Images |
dschulze@274 | 413 | are drawn with the first specified one on top (closest to the user) |
dschulze@274 | 414 | and each subsequent image behind the previous one. |
birtles@435 | 415 | Where: |
dschulze@274 | 416 | |
dschulze@607 | 417 | <pre class=prod><var><dfn><mask-reference></dfn></var> = <var><mask-image></var># | <var><mask-element></var></pre> |
dschulze@536 | 418 | |
dschulze@536 | 419 | <pre class=prod><var><dfn><mask-image></dfn></var> = <var><image></var> | none </pre> |
dschulze@536 | 420 | |
dschulze@607 | 421 | <pre class=prod><var><dfn><mask-element></dfn></var> = <var><url></var> | <var>child</var> | <var><child-selector></var></pre> |
dschulze@536 | 422 | |
dschulze@536 | 423 | <pre class=prod><dfn><child-selector></dfn> = select(<var><compound-selector></var>#)</pre> |
dschulze@536 | 424 | |
dschulze@607 | 425 | <p class="note">A <var><mask-element></var> can just be specified as a single value and can not contibute to a list of <var><mask-reference></var> values. Otherwise the specified value of the property is invalid. (See examples below.)</p> |
dschulze@274 | 426 | |
dschulze@277 | 427 | <dl> |
dschulze@536 | 428 | <dt> |
dschulze@536 | 429 | <dfn>'<url>'</dfn> |
dschulze@536 | 430 | </dt> |
dschulze@536 | 431 | <dd> |
dschulze@731 | 432 | A URL reference to a <a>'mask element'</a> element (for example ''url(commonmasks.svg#mask)'') or an <var><image></var>. |
dschulze@536 | 433 | </dd> |
birtles@697 | 434 | <dt>''child''</dt> |
dschulze@536 | 435 | <dd> |
dschulze@698 | 436 | A keyword to indicate that the last direct sibling <a>'mask element'</a> |
dschulze@698 | 437 | element of the element the 'mask-image' property is applied should be used as the mask source. It is equivalent to |
dschulze@536 | 438 | ''select(mask:last-of-type)''.</dd> |
birtles@697 | 439 | <dt>'<child-selector>'</dt> |
dschulze@536 | 440 | <dd> |
dschulze@536 | 441 | A comma-separated list of <a>compound selector</a>s scoped at the element to |
dschulze@698 | 442 | which the 'mask-image' property is applied. |
dschulze@536 | 443 | The first matching element in <a>tree order</a> (as defined in [[!DOM]]) as |
dschulze@536 | 444 | a result of evaluating the list of selectors is taken as the mask source. |
dschulze@536 | 445 | If there are no matching elements the mask source is invalid. |
dschulze@536 | 446 | </dd> |
dschulze@536 | 447 | <dt><dfn>'<compound-selector>'</dfn></dt> |
dschulze@536 | 448 | <dd> |
dschulze@536 | 449 | A <a>compound selector</a> as defined in [[!SELECTORS4]]. |
dschulze@536 | 450 | <dd> |
birtles@287 | 451 | <dt><dfn><image></dfn></dt> |
dschulze@277 | 452 | <dd> |
dschulze@277 | 453 | A 2D image. (See [[!CSS3-IMAGES]].) |
dschulze@277 | 454 | </dd> |
birtles@439 | 455 | <dt><dfn>''none''</dfn></dt> |
birtles@439 | 456 | <dd> |
birtles@439 | 457 | A value of ''none'' counts as an image layer but does not mask the element. |
birtles@439 | 458 | </dd> |
dschulze@277 | 459 | </dl> |
dschulze@277 | 460 | |
dschulze@615 | 461 | <p class="note">If the URI in the ''url()'' function has a fragment identifier, the <var><mask-reference></var> is treated as <var><mask-element></var>, otherwise as <var><mask-image></var>.</p> |
dschulze@536 | 462 | |
dschulze@536 | 463 | <p>An invalid or non-existent mask source is ignored and no masking is applied.</p> |
dschulze@536 | 464 | |
birtles@436 | 465 | <p>A mask image that is empty (zero width or zero height), that fails to |
birtles@436 | 466 | download, is non-existent, or that cannot be displayed (e.g. because it is not |
birtles@436 | 467 | in a supported image format) is ignored. No masking is applied. |
dschulze@274 | 468 | |
dschulze@274 | 469 | <p>See the section <a href="#layering">“Layering multiple mask |
dschulze@274 | 470 | images”</a> for how 'mask-image' interacts with other |
dschulze@274 | 471 | comma-separated mask properties to form each mask image |
dschulze@274 | 472 | layer. |
dschulze@274 | 473 | |
dschulze@274 | 474 | <div class="example"> |
dschulze@274 | 475 | <p>Some examples specifying mask images:</p> |
dschulze@274 | 476 | <pre> |
dschulze@274 | 477 | body { mask-image: linear-gradient(black 0%, transparent 100%) } |
dschulze@274 | 478 | p { mask-image: none } |
dschulze@274 | 479 | div { mask-image: url(tl.png), url(tr.png) } |
dschulze@274 | 480 | </pre> |
dschulze@536 | 481 | |
dschulze@536 | 482 | <p>Some examples of a specified mask source:</p> |
dschulze@536 | 483 | <pre> |
dschulze@536 | 484 | img { mask-image: url(#mask) } |
dschulze@536 | 485 | span { mask-image: url(resources.svg#mask2) } |
dschulze@536 | 486 | </pre> |
dschulze@536 | 487 | |
dschulze@536 | 488 | <p>Examples of <i>invalid</i> mask source usages:</p> |
dschulze@536 | 489 | <pre> |
dschulze@536 | 490 | p { mask-image: url(#mask), url(tl.png) } |
dschulze@536 | 491 | img { mask-image: url(#mask), url(resources.svg#mask2) } |
dschulze@536 | 492 | </pre> |
dschulze@615 | 493 | <p>A <var><mask-element></var> value that is either used together with another <var><mask-element></var> value or an <var><mask-image></var> value makes the whole specified 'mask-image' value list invalid. |
dschulze@274 | 494 | </div> |
dschulze@274 | 495 | |
dschulze@551 | 496 | <h3 id="the-mask-source-type">The 'mask-source-type' property</h3> |
dschulze@551 | 497 | |
dschulze@551 | 498 | <table class="propdef"> |
dschulze@551 | 499 | <tr> |
dschulze@551 | 500 | <th>Name: |
dschulze@551 | 501 | <td><dfn>mask-source-type</dfn> |
dschulze@551 | 502 | <tr> |
dschulze@551 | 503 | <th><a href="#values">Value</a>: |
dschulze@551 | 504 | <td><var><source-type></var># |
dschulze@551 | 505 | <tr> |
dschulze@551 | 506 | <th>Initial: |
dschulze@551 | 507 | <td>auto |
dschulze@551 | 508 | <tr> |
dschulze@551 | 509 | <th>Applies to: |
dschulze@551 | 510 | <td>All elements. In SVG, it applies to <a>container elements</a> and <a>graphics elements</a> |
dschulze@551 | 511 | <tr> |
dschulze@551 | 512 | <th>Inherited: |
dschulze@551 | 513 | <td>no |
dschulze@551 | 514 | <tr> |
dschulze@551 | 515 | <th>Percentages: |
dschulze@551 | 516 | <td>N/A |
dschulze@551 | 517 | <tr> |
dschulze@551 | 518 | <th>Media: |
dschulze@551 | 519 | <td>visual |
dschulze@551 | 520 | <tr> |
dschulze@551 | 521 | <th>Computed value: |
dschulze@551 | 522 | <td>as specified |
dschulze@551 | 523 | <tr> |
dschulze@551 | 524 | <th>Animatable: |
dschulze@731 | 525 | <td>no |
dschulze@551 | 526 | </table> |
dschulze@551 | 527 | |
dschulze@551 | 528 | <p>The 'mask-source-type' property indicates whether the <var><mask-reference></var> |
dschulze@551 | 529 | is treated as luminance mask or alpha mask. (See <a href="#MaskValues">Calculating mask values</a>.)</p> |
dschulze@551 | 530 | |
dschulze@551 | 531 | <pre class=prod><dfn><var><source-type></var></dfn> = alpha | luminance | auto</pre> |
dschulze@551 | 532 | |
dschulze@551 | 533 | <p>Values have the following meanings: |
dschulze@551 | 534 | |
dschulze@551 | 535 | <dl> |
dschulze@551 | 536 | <dt><dfn>''alpha''</dfn></dt> |
dschulze@551 | 537 | <dd> |
dschulze@551 | 538 | A value of ''alpha'' indicates that the alpha values of the mask |
dschulze@551 | 539 | image should be used as the mask values. |
dschulze@551 | 540 | See <a href="#MaskValues">Calculating mask values</a>.</p> |
dschulze@551 | 541 | </dd> |
dschulze@551 | 542 | <dt><dfn>''luminance''</dfn></dt> |
dschulze@551 | 543 | <dd> |
dschulze@551 | 544 | A value of ''luminance'' indicates that the luminance values of the mask |
dschulze@551 | 545 | image should be used as the mask values. |
dschulze@551 | 546 | See <a href="#MaskValues">Calculating mask values</a>.</p> |
dschulze@551 | 547 | </dd> |
dschulze@551 | 548 | <dt><dfn>''auto''</dfn></dt> |
dschulze@551 | 549 | <dd> |
dschulze@551 | 550 | <p> |
dschulze@552 | 551 | If the <var><mask-reference></var> of the 'mask-image' property is of type <var><mask-image></var> the luminance values of the mask |
dschulze@551 | 552 | image should be used as the mask values. |
dschulze@551 | 553 | <p> |
dschulze@615 | 554 | If the <var><mask-reference></var> of the 'mask-image' property is of type <var><mask-element></var> the alpha values of the mask |
dschulze@551 | 555 | image should be used as the mask values. |
dschulze@551 | 556 | </dd> |
dschulze@551 | 557 | </dl> |
dschulze@551 | 558 | |
dschulze@552 | 559 | <div class="example"> |
dschulze@552 | 560 | <p> |
dschulze@552 | 561 | In the following example, the 'mask-type' property sets the mask type value for the <a>'mask element'</a> element to |
dschulze@552 | 562 | ''alpha''. The 'mask-image' property has a reference to this <a>'mask element'</a> element and the 'mask-source-type' property has a value of ''luminance''. The 'mask-source-type' property will override the definition of 'mask-type' to ''luminance''. |
dschulze@552 | 563 | <pre> |
dschulze@552 | 564 | <mask id="SVGMask" mask-type="alpha" maskContentUnits="objectBoundingBox"> |
dschulze@552 | 565 | <radialGradient id="radialFill"> |
dschulze@552 | 566 | <stop stop-color="white" offset="0"/> |
dschulze@552 | 567 | <stop stop-color="black" offset="1"/> |
dschulze@552 | 568 | </radialGradient> |
dschulze@552 | 569 | <circle fill="url(#radialFill)" cx="0.5" cy="0.5" r="0.5"/> |
dschulze@552 | 570 | </mask> |
dschulze@552 | 571 | |
dschulze@552 | 572 | <style> |
dschulze@552 | 573 | rect { |
dschulze@552 | 574 | mask-image: url(#SVGMask); |
dschulze@552 | 575 | mask-source-type: luminance; |
dschulze@552 | 576 | } |
dschulze@552 | 577 | </style> |
dschulze@552 | 578 | |
dschulze@552 | 579 | <rect width="200" height="200" fill="green"/> |
dschulze@552 | 580 | </pre> |
dschulze@552 | 581 | </div> |
dschulze@551 | 582 | |
dschulze@292 | 583 | <h3 id="the-mask-repeat">The 'mask-repeat' property</h3> |
dschulze@274 | 584 | |
dschulze@274 | 585 | <table class="propdef"> |
dschulze@274 | 586 | <tr> |
dschulze@274 | 587 | <th>Name: |
dschulze@274 | 588 | <td><dfn>mask-repeat</dfn> |
dschulze@274 | 589 | <tr> |
dschulze@274 | 590 | <th><a href="#values">Value</a>: |
dschulze@280 | 591 | <td><var><repeat-style></var># |
dschulze@274 | 592 | <tr> |
dschulze@274 | 593 | <th>Initial: |
dschulze@274 | 594 | <td>repeat |
dschulze@274 | 595 | <tr> |
dschulze@274 | 596 | <th>Applies to: |
dschulze@274 | 597 | <td>All elements. In SVG, it applies to <a>container elements</a> and <a>graphics elements</a> |
dschulze@274 | 598 | <tr> |
dschulze@274 | 599 | <th>Inherited: |
dschulze@274 | 600 | <td>no |
dschulze@274 | 601 | <tr> |
dschulze@274 | 602 | <th>Percentages: |
dschulze@274 | 603 | <td>N/A |
dschulze@274 | 604 | <tr> |
dschulze@274 | 605 | <th>Media: |
dschulze@274 | 606 | <td>visual |
dschulze@274 | 607 | <tr> |
dschulze@274 | 608 | <th>Computed value: |
dschulze@274 | 609 | <td>A list, each item consisting of: |
dschulze@274 | 610 | two keywords, one per dimension |
dschulze@274 | 611 | <tr> |
dschulze@274 | 612 | <th>Animatable: |
dschulze@274 | 613 | <td>no |
dschulze@274 | 614 | </table> |
dschulze@274 | 615 | |
dschulze@274 | 616 | <p>Specifies how mask images are tiled after they have been |
dschulze@274 | 617 | <a href="#the-mask-size">sized</a> and <a href="#the-mask-position">positioned</a>. |
dschulze@274 | 618 | Where |
dschulze@274 | 619 | <pre class=prod><dfn><var><repeat-style></var></dfn> = repeat-x | repeat-y | [repeat | space | round | no-repeat]{1,2}</pre> |
dschulze@274 | 620 | |
dschulze@659 | 621 | <p>See <a href="http://www.w3.org/TR/css3-background/#the-background-repeat">Tiling Images: the 'background-repeat' property</a> [[!CSS3BG]] for the defintions of the property values. |
dschulze@274 | 622 | |
dschulze@282 | 623 | <div class=example> |
dschulze@282 | 624 | <p style="display:none">Example(s): |
dschulze@282 | 625 | <pre> |
dschulze@282 | 626 | body { |
dschulze@282 | 627 | background-color: blue; |
birtles@435 | 628 | mask-image: url(dot-mask.png) luminance; |
dschulze@282 | 629 | mask-repeat: space; |
dschulze@282 | 630 | } |
dschulze@282 | 631 | </pre> |
dschulze@282 | 632 | |
dschulze@282 | 633 | <div class=figure> |
dschulze@282 | 634 | <p><img src="images/mask-repeat.svg" alt="Image of an element with a dotted mask." width="240" style="border: solid black 1px;"> |
dschulze@282 | 635 | |
dschulze@282 | 636 | <p class=caption>The effect of 'space': the mask image of a dot is |
dschulze@282 | 637 | tiled to cover the whole <span class=index>mask painting area</span> and the mask images are equally |
dschulze@282 | 638 | spaced. |
dschulze@282 | 639 | </div> |
dschulze@282 | 640 | </div> |
dschulze@282 | 641 | |
dschulze@274 | 642 | <p>See the section <a href="#layering">“Layering multiple mask |
dschulze@277 | 643 | images”</a> for how 'mask-repeat' interacts with other |
dschulze@274 | 644 | comma-separated mask properties to form each mask image |
dschulze@274 | 645 | layer. |
dschulze@274 | 646 | |
dschulze@292 | 647 | <h3 id="the-mask-position">The 'mask-position' property</h3> |
dschulze@274 | 648 | |
dschulze@274 | 649 | <table class="propdef"> |
dschulze@274 | 650 | <tr> |
dschulze@274 | 651 | <th>Name: |
dschulze@274 | 652 | <td><dfn>mask-position</dfn> |
dschulze@274 | 653 | <tr> |
dschulze@274 | 654 | <th><a href="#values">Value</a>: |
dschulze@274 | 655 | |
dschulze@280 | 656 | <td><var><position></var># |
dschulze@274 | 657 | <tr> |
dschulze@274 | 658 | <th>Initial: |
dschulze@274 | 659 | <td>0% 0% |
dschulze@274 | 660 | <tr> |
dschulze@274 | 661 | <th>Applies to: |
dschulze@274 | 662 | <td>All elements. In SVG, it applies to <a>container elements</a> and <a>graphics elements</a> |
dschulze@274 | 663 | <tr> |
dschulze@274 | 664 | <th>Inherited: |
dschulze@274 | 665 | <td>no |
dschulze@274 | 666 | <tr> |
dschulze@274 | 667 | <th>Percentages: |
dschulze@274 | 668 | <td>refer to size of <span class=index>mask painting area</span> <em>minus</em> size of mask image; see text |
dschulze@274 | 669 | <tr> |
dschulze@274 | 670 | <th>Media: |
dschulze@274 | 671 | <td>visual |
dschulze@274 | 672 | <tr> |
dschulze@274 | 673 | <th>Computed value: |
dschulze@274 | 674 | <td>A list, each item consisting of: |
dschulze@274 | 675 | two keywords representing the origin and two offsets from that |
dschulze@274 | 676 | origin, each given as an absolute length (if given a <length>), |
dschulze@274 | 677 | otherwise as a percentage. |
dschulze@274 | 678 | <tr> |
dschulze@274 | 679 | <th>Animatable: |
dschulze@731 | 680 | <td>as <a href="http://dev.w3.org/csswg/css3-transitions/#animtype-repeatable-list">repeatable list</a> of <a href="http://dev.w3.org/csswg/css3-transitions/#animtype-simple-list">simple list</a> of <a href="http://dev.w3.org/csswg/css3-transitions/#animtype-lpcalc">length, percentage, or calc</a> |
dschulze@274 | 681 | </table> |
dschulze@274 | 682 | |
dschulze@274 | 683 | <p>Where |
dschulze@274 | 684 | <pre class=prod><dfn><var><position></var></dfn> = [ |
dschulze@274 | 685 | [ left | center | right | top | bottom | <var><percentage></var> | <var><length></var> ] |
dschulze@274 | 686 | | |
dschulze@274 | 687 | [ left | center | right | <var><percentage></var> | <var><length></var> ] |
dschulze@274 | 688 | [ top | center | bottom | <var><percentage></var> | <var><length></var> ] |
dschulze@274 | 689 | | |
dschulze@274 | 690 | [ center | [ left | right ] [ <var><percentage></var> | <var><length></var> ]? ] && |
dschulze@274 | 691 | [ center | [ top | bottom ] [ <var><percentage></var> | <var><length></var> ]? ] |
dschulze@274 | 692 | ]</pre> |
dschulze@274 | 693 | |
dschulze@659 | 694 | <p>See <a href="http://www.w3.org/TR/css3-background/#the-background-position">Positioning Images: the 'background-position' property</a> [[!CSS3BG]] for the defintions of the property values. |
dschulze@274 | 695 | |
dschulze@274 | 696 | <div class="example"> |
dschulze@274 | 697 | <p>In the example below, the (single) image is placed in the lower-right |
dschulze@274 | 698 | corner of the viewport. |
dschulze@274 | 699 | <pre> |
dschulze@274 | 700 | body { |
dschulze@274 | 701 | mask-image: url("logo.png"); |
dschulze@274 | 702 | mask-position: 100% 100%; |
dschulze@274 | 703 | mask-repeat: no-repeat; |
dschulze@274 | 704 | } |
dschulze@274 | 705 | </pre> |
dschulze@274 | 706 | </div> |
dschulze@274 | 707 | |
dschulze@274 | 708 | <div class=example> |
dschulze@274 | 709 | <p>Mask positions can also be relative to other corners than the |
dschulze@274 | 710 | top left. E.g., the following puts the background image 10px from the |
dschulze@274 | 711 | bottom and 3em from the right: |
dschulze@274 | 712 | |
dschulze@274 | 713 | <pre>mask-position: right 3em bottom 10px</pre> |
dschulze@274 | 714 | </div> |
dschulze@274 | 715 | |
dschulze@274 | 716 | <p>See the section <a href="#layering">“Layering multiple mask |
dschulze@277 | 717 | images”</a> for how 'mask-position' interacts with other |
dschulze@274 | 718 | comma-separated mask properties to form each mask image |
dschulze@274 | 719 | layer. |
dschulze@274 | 720 | |
dschulze@292 | 721 | <h3 id="the-mask-clip">The 'mask-clip' property</h3> |
dschulze@274 | 722 | |
dschulze@274 | 723 | <table class="propdef"> |
dschulze@274 | 724 | <tr> |
dschulze@274 | 725 | <th>Name: |
dschulze@274 | 726 | <td><dfn>mask-clip</dfn> |
dschulze@274 | 727 | <tr> |
dschulze@274 | 728 | <th><a href="#values">Value</a>: |
dschulze@615 | 729 | <td><var><clip-box></var># |
dschulze@274 | 730 | <tr> |
dschulze@274 | 731 | <th>Initial: |
dschulze@274 | 732 | <td>border-box |
dschulze@274 | 733 | <tr> |
dschulze@274 | 734 | <th>Applies to: |
dschulze@274 | 735 | <td>All elements. In SVG, it applies to <a>container elements</a> and <a>graphics elements</a> |
dschulze@274 | 736 | <tr> |
dschulze@274 | 737 | <th>Inherited: |
dschulze@274 | 738 | <td>no |
dschulze@274 | 739 | <tr> |
dschulze@274 | 740 | <th>Percentages: |
dschulze@274 | 741 | <td>N/A |
dschulze@274 | 742 | <tr> |
dschulze@274 | 743 | <th>Media: |
dschulze@274 | 744 | <td>visual |
dschulze@274 | 745 | <tr> |
dschulze@274 | 746 | <th>Computed value: |
dschulze@274 | 747 | <td>as specified |
dschulze@274 | 748 | <tr> |
dschulze@274 | 749 | <th>Animatable: |
dschulze@274 | 750 | <td>no |
dschulze@274 | 751 | </table> |
dschulze@274 | 752 | |
dschulze@274 | 753 | <p>Determines the <dfn id="mask-painting-area">mask painting area</dfn>, |
dschulze@474 | 754 | which determines the area that is affected by the mask. The painted content |
dschulze@474 | 755 | of an element may be resricted to this area. |
dschulze@274 | 756 | The syntax of the property is given with |
dschulze@274 | 757 | |
dschulze@615 | 758 | <pre class=prod><dfn><var><clip-box></var></dfn> = <var><box></var> | no-clip</pre> |
dschulze@615 | 759 | <pre class=prod><dfn><var><box></var></dfn> = border-box | padding-box | content-box</pre> |
dschulze@274 | 760 | |
dschulze@274 | 761 | <p>Values have the following meanings: |
dschulze@274 | 762 | |
dschulze@274 | 763 | <dl> |
dschulze@274 | 764 | <dt><dfn title="''border-box''!!'mask-clip' value"> |
dschulze@274 | 765 | ''border-box''</dfn></dt> |
dschulze@474 | 766 | <dd>The painted content is rectricted to (clipped to) the |
dschulze@432 | 767 | <span>border box</span> respectively <span>painting box</span> for objects without associated layout box. |
dschulze@274 | 768 | <dt><dfn title="''padding-box''!!'mask-clip' value"> |
dschulze@274 | 769 | ''padding-box''</dfn></dt> |
dschulze@474 | 770 | <dd>The painted content is rectricted to (clipped to) the |
dschulze@274 | 771 | <span>padding box.</span> |
dschulze@274 | 772 | <dt><dfn title="''content-box''!!'mask-clip' value"> |
dschulze@615 | 773 | ''content-box''</dfn></dt> |
dschulze@474 | 774 | <dd>The painted content is rectricted to (clipped to) the |
dschulze@615 | 775 | <span>content box</span> respectively <span>object bounding box</span> [[!SVG11]] for objects without associated layout box. |
dschulze@536 | 776 | <dt><dfn title="''no-clip''!!'mask-clip' value"> |
dschulze@536 | 777 | ''no-clip''</dfn></dt> |
dschulze@474 | 778 | <dd>The painted content is not restricted (not clipped). The <span>mask painting area</span> is set to |
dschulze@474 | 779 | the <span>bounding client rect</span>. |
dschulze@274 | 780 | </dl> |
dschulze@274 | 781 | |
dschulze@432 | 782 | <p class="note">Note that there is no corresponding box for |
dschulze@432 | 783 | ''padding-box'' on objects without associated layout box |
dschulze@432 | 784 | and ''content-box'' is choosen instead.</p> |
dschulze@274 | 785 | |
dschulze@274 | 786 | <p>See the section <a href="#layering">“Layering multiple mask |
dschulze@277 | 787 | images”</a> for how 'mask-clip' interacts with other |
dschulze@274 | 788 | comma-separated mask properties to form each mask image |
dschulze@274 | 789 | layer. |
dschulze@274 | 790 | |
dschulze@292 | 791 | <h3 id="the-mask-origin">The 'mask-origin' property</h3> |
dschulze@275 | 792 | |
dschulze@275 | 793 | <table class="propdef"> |
dschulze@275 | 794 | <tr> |
dschulze@275 | 795 | <th>Name: |
dschulze@275 | 796 | <td><dfn>mask-origin</dfn> |
dschulze@275 | 797 | <tr> |
dschulze@275 | 798 | <th><a href="#values">Value</a>: |
dschulze@280 | 799 | <td><var><box></var># |
dschulze@275 | 800 | <tr> |
dschulze@275 | 801 | <th>Initial: |
dschulze@275 | 802 | <td>padding-box |
dschulze@275 | 803 | <tr> |
dschulze@275 | 804 | <th>Applies to: |
dschulze@277 | 805 | <td>All elements. In SVG, it applies to <a>container elements</a> and <a>graphics elements</a> |
dschulze@275 | 806 | <tr> |
dschulze@275 | 807 | <th>Inherited: |
dschulze@275 | 808 | <td>no |
dschulze@275 | 809 | <tr> |
dschulze@275 | 810 | <th>Percentages: |
dschulze@275 | 811 | <td>N/A |
dschulze@275 | 812 | <tr> |
dschulze@275 | 813 | <th>Media: |
dschulze@275 | 814 | <td>visual |
dschulze@275 | 815 | <tr> |
dschulze@275 | 816 | <th>Computed value: |
dschulze@275 | 817 | <td>as specified |
dschulze@275 | 818 | <tr> |
dschulze@275 | 819 | <th>Animatable: |
dschulze@275 | 820 | <td>no |
dschulze@275 | 821 | </table> |
dschulze@275 | 822 | |
dschulze@275 | 823 | <p>For elements rendered as a single box, specifies the |
dschulze@275 | 824 | <dfn id="mask-positioning-area">mask positioning area</dfn>. |
dschulze@275 | 825 | For elements rendered as multiple boxes (e.g., inline boxes on several |
dschulze@275 | 826 | lines, boxes on several pages) specifies which boxes 'box-decoration-break' |
dschulze@275 | 827 | operates on to determine the mask positioning area(s). |
dschulze@275 | 828 | |
dschulze@275 | 829 | <dl> |
dschulze@275 | 830 | <dt><dfn title="''padding-box''!!'mask-origin' value"> |
dschulze@275 | 831 | ''padding-box''</dfn> |
dschulze@275 | 832 | <dd>The position is relative to the padding box. (For single boxes |
dschulze@275 | 833 | ''0 0'' is the upper left corner of the padding edge, |
dschulze@275 | 834 | ''100% 100%'' is the lower right corner.) |
dschulze@275 | 835 | <dt><dfn title="''border-box''!!'mask-origin' value"> |
dschulze@275 | 836 | ''border-box''</dfn> |
dschulze@432 | 837 | <dd>The position is relative to the border box respectively <span>painting box</span> for objects without associated layout box. |
dschulze@275 | 838 | <dt><dfn>''content-box''</dfn> |
dschulze@432 | 839 | <dd>The position is relative to the content box respectively object bounding box [[!SVG11]] for objects without associated layout box. |
dschulze@275 | 840 | </dl> |
dschulze@275 | 841 | |
dschulze@432 | 842 | <p class="note">Note that there is no corresponding box for |
dschulze@432 | 843 | ''padding-box'' on objects without associated layout box |
dschulze@432 | 844 | and ''content-box'' is choosen instead.</p> |
dschulze@432 | 845 | |
dschulze@275 | 846 | <p class="note">Note that if 'mask-clip' is ''padding-box'', |
dschulze@275 | 847 | 'mask-origin' is ''border-box'', 'mask-position' is |
dschulze@275 | 848 | ''top left'' (the initial value), and the element has a |
dschulze@275 | 849 | non-zero border, then the top and left of the mask image will be |
dschulze@275 | 850 | clipped. |
dschulze@275 | 851 | |
dschulze@275 | 852 | <p>See the section <a href="#layering">“Layering multiple mask |
dschulze@277 | 853 | images”</a> for how 'mask-origin' interacts with other |
dschulze@277 | 854 | comma-separated mask properties to form each mask image |
dschulze@277 | 855 | layer. |
dschulze@277 | 856 | |
dschulze@292 | 857 | <h3 id="the-mask-size">The 'mask-size' property</h3> |
dschulze@277 | 858 | |
dschulze@277 | 859 | <table class="propdef"> |
dschulze@277 | 860 | <tr> |
dschulze@277 | 861 | <th>Name: |
dschulze@277 | 862 | <td><dfn>mask-size</dfn> |
dschulze@277 | 863 | <tr> |
dschulze@277 | 864 | <th><a href="#values">Value</a>: |
dschulze@280 | 865 | <td><var><mask-size></var># |
dschulze@277 | 866 | <tr> |
dschulze@277 | 867 | <th>Initial: |
dschulze@277 | 868 | <td>auto |
dschulze@277 | 869 | <tr> |
dschulze@277 | 870 | <th>Applies to: |
dschulze@277 | 871 | <td>All elements. In SVG, it applies to <a>container elements</a> and <a>graphics elements</a> |
dschulze@277 | 872 | <tr> |
dschulze@277 | 873 | <th>Inherited: |
dschulze@277 | 874 | <td>no |
dschulze@277 | 875 | <tr> |
dschulze@277 | 876 | <th>Percentages: |
dschulze@277 | 877 | <td>see text |
dschulze@277 | 878 | <tr> |
dschulze@277 | 879 | <th>Media: |
dschulze@277 | 880 | <td>visual |
dschulze@277 | 881 | <tr> |
dschulze@277 | 882 | <th>Computed value: |
dschulze@277 | 883 | <td>as specified, but with lengths made absolute |
dschulze@277 | 884 | <tr> |
dschulze@277 | 885 | <th>Animatable: |
dschulze@731 | 886 | <td>as <a href="http://dev.w3.org/csswg/css3-transitions/#animtype-repeatable-list">repeatable list</a> of <a href="http://dev.w3.org/csswg/css3-transitions/#animtype-simple-list">simple list</a> of <a href="http://dev.w3.org/csswg/css3-transitions/#animtype-lpcalc">length, percentage, or calc</a> |
dschulze@731 | 887 | (<span class="note">This means keyword values are not animatable.</span>) |
dschulze@277 | 888 | </table> |
dschulze@277 | 889 | |
dschulze@277 | 890 | <p>Specifies the size of the mask images. Where |
dschulze@277 | 891 | |
dschulze@277 | 892 | <pre class=prod><dfn><var><mask-size></var></dfn> = [ <var><length></var> | <var><percentage></var> | auto ]{1,2} | cover | contain</pre> |
dschulze@277 | 893 | |
dschulze@659 | 894 | <p>See <a href="http://www.w3.org/TR/css3-background/#the-background-size">Sizing Images: the ‘background-size’ property</a> [[!CSS3BG]] for the defintions of the property values. |
dschulze@277 | 895 | |
dschulze@277 | 896 | <p>See the section <a href="#layering">“Layering multiple mask |
dschulze@277 | 897 | images”</a> for how 'mask-size' interacts with other |
dschulze@277 | 898 | comma-separated mask properties to form each mask image |
dschulze@277 | 899 | layer. |
dschulze@277 | 900 | |
dschulze@292 | 901 | <h3 id="mask-property">The 'mask' property</h3> |
dschulze@273 | 902 | |
dschulze@273 | 903 | <table class="propdef"> |
dschulze@273 | 904 | <tr> |
dschulze@273 | 905 | <th>Name:</th> |
dschulze@273 | 906 | <td><dfn id="MaskProperty">mask</dfn></td> |
dschulze@273 | 907 | </tr> |
dschulze@273 | 908 | <tr> |
dschulze@273 | 909 | <th>Value:</th> |
dschulze@536 | 910 | <td><var><mask-layer></var>#</td> |
dschulze@273 | 911 | </tr> |
dschulze@273 | 912 | <tr> |
dschulze@273 | 913 | <th>Initial:</th> |
dschulze@277 | 914 | <td>see individual properties</td> |
dschulze@273 | 915 | </tr> |
dschulze@273 | 916 | <tr> |
dschulze@273 | 917 | <th>Applies to:</th> |
dschulze@273 | 918 | <td>All elements. In SVG, it applies to <a>container elements</a> and <a>graphics elements</a></td> |
dschulze@273 | 919 | </tr> |
dschulze@273 | 920 | <tr> |
dschulze@273 | 921 | <th>Inherited:</th> |
dschulze@273 | 922 | <td>no</td> |
dschulze@273 | 923 | </tr> |
dschulze@273 | 924 | <tr> |
dschulze@273 | 925 | <th>Percentages:</th> |
dschulze@277 | 926 | <td>see individual properties</td> |
dschulze@273 | 927 | </tr> |
dschulze@273 | 928 | <tr> |
dschulze@273 | 929 | <th>Media:</th> |
dschulze@273 | 930 | <td>visual</td> |
dschulze@273 | 931 | </tr> |
dschulze@273 | 932 | <tr> |
dschulze@273 | 933 | <th>Computed value:</th> |
dschulze@277 | 934 | <td>see individual properties</td> |
dschulze@273 | 935 | </tr> |
dschulze@273 | 936 | <tr> |
birtles@440 | 937 | <th>Animatable:</th> |
dschulze@277 | 938 | <td>see individual properties</td> |
dschulze@273 | 939 | </tr> |
dschulze@273 | 940 | </table> |
dschulze@277 | 941 | <p>Where</p> |
dschulze@273 | 942 | |
dschulze@615 | 943 | <pre class=prod><dfn><mask-layer></dfn> = <var><mask-reference></var> <var><source-type></var>? || <var><position></var> [ / <var><mask-size></var> ]? || <var><repeat-style></var> || <var><box></var> || <var><clip-box></var></pre> |
dschulze@615 | 944 | |
dschulze@615 | 945 | <p> |
dschulze@615 | 946 | If one <var><box></var> value is present then it sets both 'mask-origin' and 'mask-clip' to that value. If two <var><box></var> values are present, then the first sets 'mask-origin' and the second 'mask-clip'. |
dschulze@445 | 947 | |
dschulze@445 | 948 | <p class="note"> |
dschulze@445 | 949 | Note that the properties 'mask-image', 'mask-repeat', 'mask-position', 'mask-clip', 'mask-origin' and |
dschulze@446 | 950 | 'mask-size' have no affect on <a>'mask element'</a> elements. |
dschulze@445 | 951 | </p> |
dschulze@273 | 952 | |
dschulze@432 | 953 | <h3 id="the-mask-type">The 'mask-type' property</h3> |
dschulze@432 | 954 | |
dschulze@432 | 955 | <table class="propdef"> |
dschulze@432 | 956 | <tr> |
dschulze@432 | 957 | <th>Name: |
dschulze@432 | 958 | <td><dfn>mask-type</dfn> |
dschulze@432 | 959 | <tr> |
dschulze@432 | 960 | <th><a href="#values">Value</a>: |
dschulze@551 | 961 | <td>luminance | alpha |
dschulze@432 | 962 | <tr> |
dschulze@432 | 963 | <th>Initial: |
dschulze@432 | 964 | <td>luminance |
dschulze@432 | 965 | <tr> |
dschulze@432 | 966 | <th>Applies to: |
dschulze@451 | 967 | <td><a>'mask element'</a> elements |
dschulze@432 | 968 | <tr> |
dschulze@432 | 969 | <th>Inherited: |
dschulze@432 | 970 | <td>no |
dschulze@432 | 971 | <tr> |
dschulze@432 | 972 | <th>Percentages: |
dschulze@432 | 973 | <td>N/A |
dschulze@432 | 974 | <tr> |
dschulze@432 | 975 | <th>Media: |
dschulze@432 | 976 | <td>visual |
dschulze@432 | 977 | <tr> |
dschulze@432 | 978 | <th>Computed value: |
dschulze@432 | 979 | <td>as specified |
dschulze@432 | 980 | <tr> |
dschulze@432 | 981 | <th>Animatable: |
dschulze@731 | 982 | <td>no |
dschulze@432 | 983 | </table> |
dschulze@432 | 984 | |
birtles@435 | 985 | <p>The 'mask-type' property defines whether the content of the |
birtles@435 | 986 | <a>'mask element'</a> is treated as as luminance mask or alpha mask, as |
birtles@435 | 987 | described in <a href="#MaskValues">Calculating mask values</a>.</p> |
dschulze@432 | 988 | |
dschulze@432 | 989 | <p>Values have the following meanings: |
dschulze@432 | 990 | |
dschulze@432 | 991 | <dl> |
birtles@447 | 992 | <dt>''luminance''</dt> |
dschulze@432 | 993 | <dd>Indicates that the luminance values of the mask should be used.</dd> |
dschulze@432 | 994 | |
birtles@447 | 995 | <dt>''alpha''</dt> |
dschulze@432 | 996 | <dd>Indicates that the alpha values of the mask should be used.</dd> |
dschulze@432 | 997 | </dl> |
dschulze@432 | 998 | |
dschulze@445 | 999 | <p>The 'mask-type' property is a presentation attribute for SVG elements.</p> |
dschulze@445 | 1000 | |
dschulze@292 | 1001 | <h3 id="MaskElement">The <span class="element-name">'mask'</span> element</h3> |
dschulze@273 | 1002 | |
dschulze@273 | 1003 | <!--elementsummary mask--> |
dschulze@273 | 1004 | |
dschulze@273 | 1005 | <div class="adef-list"> |
dschulze@273 | 1006 | <p><em>Attribute definitions:</em></p> |
dschulze@273 | 1007 | <dl> |
dschulze@273 | 1008 | <dt id="MaskElementMaskUnitsAttribute"><span |
dschulze@273 | 1009 | class="adef">maskUnits</span> = "<em>userSpaceOnUse</em> | |
dschulze@273 | 1010 | <em>objectBoundingBox</em>"</dt> |
dschulze@273 | 1011 | <dd>Defines the coordinate system for attributes |
dschulze@273 | 1012 | <a>'mask/x'</a>, <a>'mask/y'</a>, <a>'mask/width'</a> and <a>'mask/height'</a>.<br /> |
dschulze@273 | 1013 | If <span |
dschulze@273 | 1014 | class="attr-value">maskUnits="userSpaceOnUse"</span>, |
dschulze@273 | 1015 | <a>'mask/x'</a>, <a>'mask/y'</a>, <a>'mask/width'</a> and <a>'mask/height'</a> |
dschulze@273 | 1016 | represent values in the current user coordinate system in place at |
dschulze@273 | 1017 | the time when the <a>'mask element'</a> |
dschulze@273 | 1018 | element is referenced (i.e., the user coordinate system for |
dschulze@273 | 1019 | the element referencing the <a>'mask element'</a> element via the |
dschulze@273 | 1020 | 'mask' property).<br /> |
dschulze@273 | 1021 | If <span |
dschulze@273 | 1022 | class="attr-value">maskUnits="objectBoundingBox"</span>, |
dschulze@273 | 1023 | <a>'mask/x'</a>, <a>'mask/y'</a>, <a>'mask/width'</a> and <a>'mask/height'</a> |
dschulze@273 | 1024 | represent fractions or percentages of the bounding box of |
dschulze@273 | 1025 | the element to which the mask is applied. (See <span class="term">object bounding box |
dschulze@273 | 1026 | units</span>.)<br /> |
dschulze@273 | 1027 | If attribute <a>'mask/maskUnits'</a> is |
dschulze@273 | 1028 | not specified, then the effect is as if a value of <span |
dschulze@273 | 1029 | class="attr-value">'objectBoundingBox'</span> were |
dschulze@273 | 1030 | specified.<br /> |
dschulze@343 | 1031 | <span class="anim-target">Animatable: |
dschulze@273 | 1032 | yes.</span></dd> |
dschulze@273 | 1033 | <dt id="MaskElementMaskContentUnitsAttribute"><span |
dschulze@273 | 1034 | class="adef">maskContentUnits</span> = |
dschulze@273 | 1035 | "<em>userSpaceOnUse</em> | <em>objectBoundingBox</em>"</dt> |
dschulze@273 | 1036 | <dd>Defines the coordinate system for the contents of the |
dschulze@273 | 1037 | <a>'mask element'</a>.<br /> |
dschulze@273 | 1038 | If <span |
dschulze@273 | 1039 | class="attr-value">maskContentUnits="userSpaceOnUse"</span>, |
dschulze@273 | 1040 | the user coordinate system for the contents of the |
dschulze@273 | 1041 | <a>'mask element'</a> element is the current |
dschulze@273 | 1042 | user coordinate system in place at the time when the |
dschulze@273 | 1043 | <a>'mask element'</a> element is referenced |
dschulze@273 | 1044 | (i.e., the user coordinate system for the element |
dschulze@273 | 1045 | referencing the <a>'mask element'</a> |
dschulze@273 | 1046 | element via the 'mask' |
dschulze@273 | 1047 | property).<br /> |
dschulze@273 | 1048 | If <span |
dschulze@273 | 1049 | class="attr-value">maskContentUnits="objectBoundingBox"</span>, |
dschulze@273 | 1050 | the user coordinate system for the contents of the <a>'mask element'</a> is established using the |
dschulze@273 | 1051 | bounding box of the element to which the mask is applied. |
dschulze@273 | 1052 | (See <span class="term">object bounding box |
dschulze@273 | 1053 | units</span>.)<br /> |
dschulze@273 | 1054 | If attribute <a>'maskContentUnits'</a> is not specified, |
dschulze@273 | 1055 | then the effect is as if a value of <span |
dschulze@273 | 1056 | class="attr-value">'userSpaceOnUse'</span> were |
dschulze@273 | 1057 | specified.<br /> |
dschulze@343 | 1058 | <span class="anim-target">Animatable: |
dschulze@273 | 1059 | yes.</span></dd> |
dschulze@273 | 1060 | <dt id="MaskElementXAttribute"><span |
dschulze@343 | 1061 | class="adef">x</span> = "<var><length></var> | <var><percentage></var>"</dt> |
dschulze@273 | 1062 | <dd>The x-axis coordinate of one corner of the rectangle |
dschulze@724 | 1063 | for the largest possible offscreen buffer. |
dschulze@726 | 1064 | If the attribute is not specified but at least one of the attributes <a>'mask/y'</a>, |
dschulze@726 | 1065 | <a>'mask/width'</a> or <a>'mask/height'</a> are specified, the effect is as if a |
dschulze@273 | 1066 | value of <span class='attr-value'>'-10%'</span> were specified.<br /> |
dschulze@343 | 1067 | <span class="anim-target">Animatable: |
dschulze@273 | 1068 | yes.</span></dd> |
dschulze@273 | 1069 | <dt id="MaskElementYAttribute"><span |
dschulze@343 | 1070 | class="adef">y</span> = "<var><length></var> | <var><percentage></var>"</dt> |
dschulze@273 | 1071 | <dd>The y-axis coordinate of one corner of the rectangle |
dschulze@273 | 1072 | for the largest possible offscreen buffer.<br /> |
dschulze@726 | 1073 | If the attribute is not specified but at least one of the attributes <a>'mask/x'</a>, |
dschulze@726 | 1074 | <a>'mask/width'</a> or <a>'mask/height'</a> are specified, the effect is as if a |
dschulze@273 | 1075 | value of <span class='attr-value'>'-10%'</span> were specified.<br /> |
dschulze@726 | 1076 | <span class="anim-target">Animatable: |
dschulze@273 | 1077 | yes.</span></dd> |
dschulze@273 | 1078 | <dt id="MaskElementWidthAttribute"><span |
dschulze@343 | 1079 | class="adef">width</span> = "<var><length></var> | <var><percentage></var>"</dt> |
dschulze@273 | 1080 | <dd>The width of the largest possible offscreen buffer. |
dschulze@279 | 1081 | A negative value or a value of zero disables rendering of the element.<br /> |
dschulze@726 | 1082 | If the attribute is not specified but at least one of the attributes <a>'mask/x'</a>, |
dschulze@726 | 1083 | <a>'mask/y'</a> or <a>'mask/height'</a> are specified, the effect is as if a |
dschulze@273 | 1084 | value of <span class='attr-value'>'120%'</span> were specified.<br /> |
dschulze@343 | 1085 | <span class="anim-target">Animatable: |
dschulze@273 | 1086 | yes.</span></dd> |
dschulze@273 | 1087 | <dt id="MaskElementHeightAttribute"><span |
dschulze@343 | 1088 | class="adef">height</span> = "<var><length></var> | <var><percentage></var>"</dt> |
dschulze@273 | 1089 | <dd>The height of the largest possible offscreen |
dschulze@273 | 1090 | buffer.<br /> |
dschulze@726 | 1091 | A negative value or a value of zero disables rendering of the element.<br /> |
dschulze@726 | 1092 | If the attribute is not specified but at least one of the attributes <a>'mask/x'</a>, |
dschulze@726 | 1093 | <a>'mask/y'</a> or <a>'mask/width'</a> are specified, the effect is as if a |
dschulze@273 | 1094 | value of <span class='attr-value'>'120%'</span> were specified.<br /> |
dschulze@343 | 1095 | <span class="anim-target">Animatable: |
dschulze@273 | 1096 | yes.</span></dd> |
dschulze@273 | 1097 | </dl> |
dschulze@273 | 1098 | </div> |
dschulze@734 | 1099 | <p>If at least one of the attributes <a>'mask/x'</a>, |
dschulze@726 | 1100 | <a>'mask/y'</a>, <a>'mask/width'</a> or <a>'mask/height'</a> are specified, |
dschulze@726 | 1101 | the given object and the rectangle defined by |
dschulze@726 | 1102 | <a>'mask/x'</a>, <a>'mask/y'</a>, <a>'mask/width'</a> and <a>'mask/height'</a> |
dschulze@727 | 1103 | establish a current clipping path. The rendered content of the mask must be clipped |
dschulze@726 | 1104 | by this current clipping path.<p/> |
dschulze@273 | 1105 | |
dschulze@343 | 1106 | <p>CSS properties inherit into the |
dschulze@273 | 1107 | <a>'mask element'</a> element from its ancestors; properties do <em>not</em> |
dschulze@273 | 1108 | inherit from the element referencing the <a>'mask element'</a> element.</p> |
dschulze@273 | 1109 | |
dschulze@273 | 1110 | <p><a>'mask element'</a> elements are never rendered directly; their only |
dschulze@273 | 1111 | usage is as something that can be referenced using the 'mask' |
dschulze@273 | 1112 | property. The 'opacity', 'filter' and 'display' properties do not apply to the |
dschulze@273 | 1113 | <a>'mask element'</a> element; thus, <a>'mask element'</a> elements are not |
dschulze@273 | 1114 | directly rendered even if the 'display' property is set to a value |
dschulze@273 | 1115 | other than 'none', and <a>'mask element'</a> |
dschulze@273 | 1116 | elements are available for referencing even when the 'display' property |
dschulze@273 | 1117 | on the <a>'mask element'</a> element or any of its ancestors is set to |
dschulze@273 | 1118 | <span class="prop-value">none</span>.</p> |
dschulze@273 | 1119 | |
dschulze@292 | 1120 | <h2>Mask Box Image</h2> |
dschulze@292 | 1121 | |
dschulze@342 | 1122 | <p> |
birtles@466 | 1123 | With 'mask-box-image' a mask can be split into nine pieces: four corners, four |
birtles@466 | 1124 | edges and the middle piece as demonstrated in the figure below. |
dschulze@342 | 1125 | </p> |
dschulze@342 | 1126 | |
dschulze@342 | 1127 | <div class=figure> |
dschulze@342 | 1128 | <img src="images/mask-box-image-mask.svg" alt="pieces of a mask box image" width="240"> |
dschulze@342 | 1129 | <p class=caption> |
dschulze@342 | 1130 | Pieces of a mask box image. |
dschulze@342 | 1131 | </p> |
dschulze@342 | 1132 | </div> |
dschulze@342 | 1133 | |
dschulze@342 | 1134 | <p> |
dschulze@659 | 1135 | These pieces may be sliced, scaled and stretched in various ways to fit the size of the <span class=index>mask image area</span>. The usage of 'mask-box-image' corresponds to the 'border-image' property of CSS Background and Borders [[!CSS3BG]]. |
dschulze@342 | 1136 | </p> |
dschulze@299 | 1137 | |
dschulze@313 | 1138 | <div class=example> |
dschulze@342 | 1139 | <p> |
birtles@436 | 1140 | The mask image in the following example is split into four corners with |
birtles@436 | 1141 | dimensions of 75 pixels, four edges and the middle piece that is stretched |
birtles@436 | 1142 | and scaled. |
dschulze@342 | 1143 | </p> |
dschulze@342 | 1144 | |
dschulze@313 | 1145 | <div class=figure> |
dschulze@313 | 1146 | <img src="images/mask-box-image.svg" alt="Example for 'mask-box-image'" width="720" height="240"> |
dschulze@342 | 1147 | <p class=caption> |
dschulze@453 | 1148 | Example for 'mask-box-image'. The object on the left is the object to mask. The second image is the alpha mask and |
dschulze@453 | 1149 | the last image the masked object. |
dschulze@342 | 1150 | </p> |
dschulze@313 | 1151 | </div> |
dschulze@342 | 1152 | |
dschulze@313 | 1153 | <pre> |
dschulze@342 | 1154 | div { |
dschulze@342 | 1155 | background: linear-gradient(bottom, #F27BAA 0%, #FCC8AD 100%); |
dschulze@342 | 1156 | mask-box-image-slice: 25 fill; |
dschulze@342 | 1157 | mask-box-image-repeat: stretch; |
dschulze@342 | 1158 | mask-box-image-source: url(mask.png); |
dschulze@313 | 1159 | }</pre> |
dschulze@313 | 1160 | </div> |
dschulze@313 | 1161 | |
dschulze@299 | 1162 | <h3 id="the-mask-box-image-source">The 'mask-box-image-source' property</h3> |
dschulze@299 | 1163 | |
dschulze@299 | 1164 | <table class=propdef> |
dschulze@299 | 1165 | <tr> |
dschulze@299 | 1166 | <th>Name: |
dschulze@299 | 1167 | <td><dfn>mask-box-image-source</dfn> |
dschulze@299 | 1168 | <tr> |
dschulze@299 | 1169 | <th><a href="#values">Value</a>: |
dschulze@299 | 1170 | <td><var><mask-image></var> |
dschulze@299 | 1171 | <tr> |
dschulze@299 | 1172 | <th>Initial: |
dschulze@299 | 1173 | <td>none |
dschulze@299 | 1174 | <tr> |
dschulze@299 | 1175 | <th>Applies to: |
dschulze@299 | 1176 | <td>All elements. In SVG, it applies to <a>container elements</a> and <a>graphics elements</a>. |
dschulze@299 | 1177 | <tr> |
dschulze@299 | 1178 | <th>Inherited: |
dschulze@299 | 1179 | <td>no |
dschulze@299 | 1180 | <tr> |
dschulze@299 | 1181 | <th>Percentages: |
dschulze@299 | 1182 | <td>N/A |
dschulze@299 | 1183 | <tr> |
dschulze@299 | 1184 | <th>Media: |
dschulze@299 | 1185 | <td>visual |
dschulze@299 | 1186 | <tr> |
dschulze@299 | 1187 | <th>Computed value: |
dschulze@299 | 1188 | <td>''none'' or the image with its URI made absolute |
dschulze@299 | 1189 | <tr> |
dschulze@299 | 1190 | <th>Animatable: |
dschulze@299 | 1191 | <td>no |
dschulze@299 | 1192 | </table> |
dschulze@299 | 1193 | |
dschulze@301 | 1194 | <p>Specifies an image to be used as mask. If the value is ''none'' or if the image cannot be displayed |
dschulze@301 | 1195 | (or the property doesn't apply), the content won't get masked. |
dschulze@301 | 1196 | |
dschulze@299 | 1197 | <h3 id="the-mask-box-image-slice">The 'mask-box-image-slice' property</h3> |
dschulze@299 | 1198 | |
dschulze@299 | 1199 | <table class=propdef> |
dschulze@299 | 1200 | <tr> |
dschulze@299 | 1201 | <th>Name: |
dschulze@299 | 1202 | <td><dfn>mask-box-image-slice</dfn> |
dschulze@299 | 1203 | <tr> |
dschulze@299 | 1204 | <th><a href="#values">Value</a>: |
dschulze@299 | 1205 | <td>[<var><number></var> | <var><percentage></var>]{1,4} && fill? |
dschulze@299 | 1206 | <tr> |
dschulze@299 | 1207 | <th>Initial: |
dschulze@301 | 1208 | <td>0 fill |
dschulze@299 | 1209 | <tr> |
dschulze@299 | 1210 | <th>Applies to: |
dschulze@299 | 1211 | <td>All elements. In SVG, it applies to <a>container elements</a> and <a>graphics elements</a>. |
dschulze@299 | 1212 | <tr> |
dschulze@299 | 1213 | <th>Inherited: |
dschulze@299 | 1214 | <td>no |
dschulze@299 | 1215 | <tr> |
dschulze@299 | 1216 | <th>Percentages: |
dschulze@451 | 1217 | <td>refer to size of the mask image |
dschulze@299 | 1218 | <tr> |
dschulze@299 | 1219 | <th>Media: |
dschulze@299 | 1220 | <td>visual |
dschulze@299 | 1221 | <tr> |
dschulze@299 | 1222 | <th>Computed value: |
dschulze@299 | 1223 | <td>as specified |
dschulze@299 | 1224 | <tr> |
dschulze@299 | 1225 | <th>Animatable: |
dschulze@299 | 1226 | <td>no |
dschulze@299 | 1227 | </table> |
dschulze@299 | 1228 | |
dschulze@301 | 1229 | <p>This property specifies inward offsets from the top, right, bottom, |
dschulze@301 | 1230 | and left edges of the mask image, dividing it into nine regions: four corners, |
dschulze@301 | 1231 | four edges and a middle. |
dschulze@301 | 1232 | The middle image part is discarded (treated as fully transparent black) |
dschulze@301 | 1233 | unless the ''fill'' keyword is present. |
dschulze@301 | 1234 | |
dschulze@659 | 1235 | <p>See <a href="http://www.w3.org/TR/css3-background/#the-border-image-slice">Image Slicing: the 'border-image-slice' property</a> [[!CSS3BG]] for the defintions of the property values. |
dschulze@301 | 1236 | |
dschulze@299 | 1237 | <h3 id="the-mask-box-image-width">The 'mask-box-image-width' property</h3> |
dschulze@299 | 1238 | |
dschulze@299 | 1239 | <table class=propdef> |
dschulze@299 | 1240 | <tr> |
dschulze@299 | 1241 | <th>Name: |
dschulze@299 | 1242 | <td><dfn>mask-box-image-width</dfn> |
dschulze@299 | 1243 | <tr> |
dschulze@299 | 1244 | <th><a href="#values">Value</a>: |
dschulze@299 | 1245 | <td>[ <var><length></var> | <var><percentage></var> | <var><number></var> | auto ]{1,4} |
dschulze@299 | 1246 | <tr> |
dschulze@299 | 1247 | <th>Initial: |
dschulze@301 | 1248 | <td>auto |
dschulze@299 | 1249 | <tr> |
dschulze@299 | 1250 | <th>Applies to: |
dschulze@299 | 1251 | <td>All elements. In SVG, it applies to <a>container elements</a> and <a>graphics elements</a>. |
dschulze@299 | 1252 | <tr> |
dschulze@299 | 1253 | <th>Inherited: |
dschulze@299 | 1254 | <td>no |
dschulze@299 | 1255 | <tr> |
dschulze@299 | 1256 | <th>Percentages: |
dschulze@451 | 1257 | <td>relative to width/height of the <em>mask box image area</em> |
dschulze@299 | 1258 | <tr> |
dschulze@299 | 1259 | <th>Media: |
dschulze@299 | 1260 | <td>visual |
dschulze@299 | 1261 | <tr> |
dschulze@299 | 1262 | <th>Computed value: |
dschulze@299 | 1263 | <td>all <var><length></var>s made absolute, otherwise as specified |
dschulze@299 | 1264 | <tr> |
dschulze@299 | 1265 | <th>Animatable: |
dschulze@299 | 1266 | <td>no |
dschulze@299 | 1267 | </table> |
dschulze@299 | 1268 | |
dschulze@301 | 1269 | <p>The mask image is drawn inside an area called the |
dschulze@301 | 1270 | <em>mask box image area</em>. This is an area whose boundaries |
dschulze@301 | 1271 | by default correspond to the mask box, see 'mask-box-image-outset'. |
dschulze@301 | 1272 | |
dschulze@659 | 1273 | <p>See <a href="http://www.w3.org/TR/css3-background/#the-border-image-width">Drawing Areas: the ‘border-image-width’ property</a> [[!CSS3BG]] for the defintions of the property values. |
dschulze@301 | 1274 | |
birtles@466 | 1275 | <p class=note> |
birtles@466 | 1276 | Note that for SVG elements without an associated layout box the 'border-width' |
birtles@466 | 1277 | is considered to be ''0''. |
birtles@466 | 1278 | </p> |
dschulze@301 | 1279 | |
dschulze@299 | 1280 | <h3 id="the-mask-box-image-outset">The 'mask-box-image-outset' property</h3> |
dschulze@299 | 1281 | |
dschulze@299 | 1282 | <table class=propdef> |
dschulze@299 | 1283 | <tr> |
dschulze@299 | 1284 | <th>Name: |
dschulze@299 | 1285 | <td><dfn>mask-box-image-outset</dfn> |
dschulze@299 | 1286 | <tr> |
dschulze@299 | 1287 | <th><a href="#values">Value</a>: |
dschulze@299 | 1288 | <td>[ <var><length></var> | <var><number></var> ]{1,4} |
dschulze@299 | 1289 | <tr> |
dschulze@299 | 1290 | <th>Initial: |
dschulze@299 | 1291 | <td>0 |
dschulze@299 | 1292 | <tr> |
dschulze@299 | 1293 | <th>Applies to: |
dschulze@299 | 1294 | <td>All elements. In SVG, it applies to <a>container elements</a> and <a>graphics elements</a>. |
dschulze@299 | 1295 | <tr> |
dschulze@299 | 1296 | <th>Inherited: |
dschulze@299 | 1297 | <td>no |
dschulze@299 | 1298 | <tr> |
dschulze@299 | 1299 | <th>Percentages: |
dschulze@299 | 1300 | <td>N/A |
dschulze@299 | 1301 | <tr> |
dschulze@299 | 1302 | <th>Media: |
dschulze@299 | 1303 | <td>visual |
dschulze@299 | 1304 | <tr> |
dschulze@299 | 1305 | <th>Computed value: |
dschulze@299 | 1306 | <td>all <var><length></var>s made absolute, otherwise as specified |
dschulze@299 | 1307 | <tr> |
dschulze@299 | 1308 | <th>Animatable: |
dschulze@299 | 1309 | <td>no |
dschulze@299 | 1310 | </table> |
dschulze@299 | 1311 | |
dschulze@301 | 1312 | <p>The values specify the amount by which the <dfn>mask box image |
dschulze@301 | 1313 | area</dfn> extends beyond the border box. |
dschulze@301 | 1314 | If it has four values, they set the outsets on the top, right, bottom and |
dschulze@301 | 1315 | left sides in that order. If the left is missing, it is the same as the right; |
dschulze@301 | 1316 | if the bottom is missing, it is the same as the top; if the right is missing, |
dschulze@301 | 1317 | it is the same as the top. |
dschulze@301 | 1318 | |
dschulze@301 | 1319 | <p>As with 'mask-box-image-width', a <number> represents a multiple of the |
dschulze@343 | 1320 | corresponding 'border-width'. |
dschulze@301 | 1321 | Negative values are not allowed for any of the 'mask-box-image-outset' values. |
dschulze@301 | 1322 | |
dschulze@453 | 1323 | <p class=note>Note that for SVG elements without associated layout box the 'border-width' is considered to be ''0''.</p> |
dschulze@301 | 1324 | |
dschulze@299 | 1325 | <h3 id="the-mask-box-image-repeat">The 'mask-box-image-repeat' property</h3> |
dschulze@299 | 1326 | |
dschulze@299 | 1327 | <table class=propdef> |
dschulze@299 | 1328 | <tr> |
dschulze@299 | 1329 | <th>Name: |
dschulze@299 | 1330 | <td><dfn>mask-box-image-repeat</dfn> |
dschulze@299 | 1331 | <tr> |
dschulze@299 | 1332 | <th><a href="#values">Value</a>: |
dschulze@299 | 1333 | <td>[ stretch | repeat | round | space ]{1,2} |
dschulze@299 | 1334 | <tr> |
dschulze@299 | 1335 | <th>Initial: |
dschulze@299 | 1336 | <td>stretch |
dschulze@299 | 1337 | <tr> |
dschulze@299 | 1338 | <th>Applies to: |
dschulze@299 | 1339 | <td>All elements. In SVG, it applies to <a>container elements</a> and <a>graphics elements</a>. |
dschulze@299 | 1340 | <tr> |
dschulze@299 | 1341 | <th>Inherited: |
dschulze@299 | 1342 | <td>no |
dschulze@299 | 1343 | <tr> |
dschulze@299 | 1344 | <th>Percentages: |
dschulze@299 | 1345 | <td>N/A |
dschulze@299 | 1346 | <tr> |
dschulze@299 | 1347 | <th>Media: |
dschulze@299 | 1348 | <td>visual |
dschulze@299 | 1349 | <tr> |
dschulze@299 | 1350 | <th>Computed value: |
dschulze@299 | 1351 | <td>as specified |
dschulze@299 | 1352 | <tr> |
dschulze@299 | 1353 | <th>Animatable: |
dschulze@299 | 1354 | <td>no |
dschulze@299 | 1355 | </table> |
dschulze@299 | 1356 | |
dschulze@301 | 1357 | <p>This property specifies how the images for the sides and the middle |
dschulze@301 | 1358 | part of the mask image are scaled and tiled. The first keyword applies |
dschulze@301 | 1359 | to the horizontal sides, the second to the vertical ones. |
dschulze@301 | 1360 | If the second keyword is absent, it is assumed to be the same as the first. |
dschulze@301 | 1361 | |
dschulze@659 | 1362 | <p>See <a href="http://www.w3.org/TR/css3-background/#the-border-image-repeat">Image Tiling: the 'border-image-repeat' property</a> [[!CSS3BG]] for the defintions of the property values. |
dschulze@659 | 1363 | |
dschulze@659 | 1364 | <p>The exact process for scaling and tiling the mask box image parts is given in the section <a href="#masking-with-the-mask-box-image">Masking with the mask-box-image</a>. |
dschulze@301 | 1365 | |
dschulze@299 | 1366 | <h3 id="the-mask-box-image">The 'mask-box-image' property</h3> |
dschulze@299 | 1367 | |
dschulze@299 | 1368 | <table class=propdef> |
dschulze@299 | 1369 | <tr> |
dschulze@299 | 1370 | <th>Name: |
dschulze@299 | 1371 | <td><dfn>mask-box-image</dfn> |
dschulze@299 | 1372 | <tr> |
dschulze@299 | 1373 | <th><a href="#values">Value</a>: |
dschulze@299 | 1374 | <td> <var><'mask-box-image-source'></var> |
dschulze@299 | 1375 | || <var><'mask-box-image-slice'></var> |
dschulze@299 | 1376 | [ / <var><'mask-box-image-width'></var> | |
dschulze@299 | 1377 | / <var><'mask-box-image-width'></var>? / <var><'mask-box-image-outset'></var> ]? |
dschulze@299 | 1378 | || <var><'mask-box-image-repeat'></var> |
dschulze@299 | 1379 | <tr> |
dschulze@299 | 1380 | <th>Initial: |
dschulze@299 | 1381 | <td>See individual properties |
dschulze@299 | 1382 | <tr> |
dschulze@299 | 1383 | <th>Applies to: |
dschulze@299 | 1384 | <td>See individual properties |
dschulze@299 | 1385 | <tr> |
dschulze@299 | 1386 | <th>Inherited: |
dschulze@299 | 1387 | <td>no |
dschulze@299 | 1388 | <tr> |
dschulze@299 | 1389 | <th>Percentages: |
dschulze@299 | 1390 | <td>N/A |
dschulze@299 | 1391 | <tr> |
dschulze@299 | 1392 | <th>Media: |
dschulze@299 | 1393 | <td>visual |
dschulze@299 | 1394 | <tr> |
dschulze@299 | 1395 | <th>Computed value: |
dschulze@299 | 1396 | <td>See individual properties |
dschulze@299 | 1397 | <tr> |
dschulze@299 | 1398 | <th>Animatable: |
dschulze@299 | 1399 | <td>See individual properties |
dschulze@299 | 1400 | </table> |
dschulze@292 | 1401 | |
dschulze@301 | 1402 | <p>This is a shorthand property for setting 'mask-box-image-source', |
dschulze@301 | 1403 | 'mask-box-image-slice', 'mask-box-image-width', 'mask-box-image-outset' and |
dschulze@301 | 1404 | 'mask-box-image-repeat'. Omitted values are set to their initial values. |
dschulze@301 | 1405 | |
dschulze@453 | 1406 | <h3 id="masking-with-the-mask-box-image">Masking with the mask-box-image</h3> |
dschulze@453 | 1407 | |
dschulze@453 | 1408 | <p> |
dschulze@453 | 1409 | After the mask-box-image given by 'mask-box-image-source' is sliced by |
dschulze@453 | 1410 | the 'mask-box-image-slice' values, the resulting nine images are scaled, |
dschulze@453 | 1411 | positioned, and tiled into their corresponding mask image regions |
dschulze@659 | 1412 | in four steps as described in the section <a href="http://www.w3.org/TR/css3-background/#border-image-process">Drawing the Border Image</a> [[!CSS3BG]]. |
dschulze@453 | 1413 | |
dschulze@301 | 1414 | |
dschulze@298 | 1415 | <h2>Clipping paths</h2> |
dschulze@273 | 1416 | |
dschulze@453 | 1417 | <p> |
birtles@466 | 1418 | The clipping path restricts the region to which paint can be applied, the |
birtles@466 | 1419 | so-called clipping region. |
birtles@466 | 1420 | Conceptually, any parts of the drawing that lie outside of this region are not |
birtles@466 | 1421 | drawn. |
birtles@466 | 1422 | This includes any content, background, borders, text decoration, outline and |
birtles@466 | 1423 | visible scrolling mechanism of the element to which the clipping path is |
birtles@466 | 1424 | applied, and those of its descendants. |
dschulze@460 | 1425 | </p> |
dschulze@460 | 1426 | |
dschulze@460 | 1427 | <p> |
birtles@466 | 1428 | An element's ancestors may also clip portions of their content (e.g., via |
birtles@466 | 1429 | their own 'clip' or 'clip-path' properties and/or if their 'overflow' property |
birtles@466 | 1430 | is not ''visible''). |
birtles@466 | 1431 | What is rendered is the cumulative intersection. |
dschulze@460 | 1432 | </p> |
dschulze@460 | 1433 | |
dschulze@460 | 1434 | <p> |
dschulze@460 | 1435 | If the clipping region exceeds the bounds of the UA's document window, content may be clipped to that window by the |
dschulze@460 | 1436 | native operating environment. |
dschulze@453 | 1437 | </p> |
dschulze@273 | 1438 | |
dschulze@298 | 1439 | <h3 id="the-clip-path">The 'clip-path' property</h3> |
dschulze@298 | 1440 | <table class="propdef"> |
dschulze@298 | 1441 | <tr> |
dschulze@298 | 1442 | <th>Name:</th> |
dschulze@298 | 1443 | <td><dfn>clip-path</dfn></td> |
dschulze@298 | 1444 | </tr> |
dschulze@298 | 1445 | <tr> |
dschulze@298 | 1446 | <th>Value:</th> |
dschulze@338 | 1447 | <td><var><shape></var> | <var><clip-source></var> | none</td> |
dschulze@298 | 1448 | </tr> |
dschulze@298 | 1449 | <tr> |
dschulze@298 | 1450 | <th>Initial:</th> |
dschulze@298 | 1451 | <td>none</td> |
dschulze@298 | 1452 | </tr> |
dschulze@298 | 1453 | <tr> |
dschulze@298 | 1454 | <th>Applies to:</th> |
dschulze@298 | 1455 | <td>All elements. SVG <a>container elements</a>, <a>graphics elements</a> |
dschulze@298 | 1456 | and <a>'clipPath'</a></td> |
dschulze@298 | 1457 | </tr> |
dschulze@298 | 1458 | <tr> |
dschulze@298 | 1459 | <th>Inherited:</th> |
dschulze@298 | 1460 | <td>no</td> |
dschulze@298 | 1461 | </tr> |
dschulze@298 | 1462 | <tr> |
dschulze@298 | 1463 | <th>Percentages:</th> |
dschulze@338 | 1464 | <td>as specified</td> |
dschulze@298 | 1465 | </tr> |
dschulze@298 | 1466 | <tr> |
dschulze@298 | 1467 | <th>Media:</th> |
dschulze@298 | 1468 | <td>visual</td> |
dschulze@298 | 1469 | </tr> |
dschulze@298 | 1470 | <tr> |
dschulze@342 | 1471 | <th>Computed value:</th> |
dschulze@452 | 1472 | <td>as specified, but with <var><url></var> values made absolute</td> |
dschulze@298 | 1473 | </tr> |
dschulze@298 | 1474 | <tr> |
birtles@440 | 1475 | <th>Animatable:</th> |
dschulze@731 | 1476 | <td>See <a href="http://dev.w3.org/csswg/css3-exclusions/#shape-inside">'shape-inside'</a> and <a href="http://dev.w3.org/csswg/css3-exclusions/#shape-outside">'shape-outside'</a> [[!CSS3-EXCLUSIONS]]</td> |
dschulze@298 | 1477 | </tr> |
dschulze@298 | 1478 | </table> |
dschulze@298 | 1479 | |
dschulze@552 | 1480 | <pre class=prod><dfn><clip-source></dfn> = <var><url></var> | <var>child</var> | <var><child-selector></var> |
dschulze@453 | 1481 | </pre> |
dschulze@338 | 1482 | |
dschulze@298 | 1483 | <dl> |
dschulze@338 | 1484 | <dt> |
dschulze@338 | 1485 | <dfn>'<shape>'</dfn> |
dschulze@338 | 1486 | </dt> |
dschulze@338 | 1487 | <dd> |
dschulze@552 | 1488 | A basic shape function as defined in CSS3 Exclusions. The origin of clipping shapes is on the top left of the <span |
dschulze@552 | 1489 | class=index>bounding client rect</span>. Percentage values are resolved against the |
dschulze@552 | 1490 | <span class=index>bounding client rect</span> width and height. (See [[!CSS3-EXCLUSIONS]].) |
dschulze@338 | 1491 | </dd> |
birtles@697 | 1492 | <dt>''child''</dt> |
birtles@697 | 1493 | <dd> |
dschulze@698 | 1494 | A keyword to indicate that the last direct sibling <a>'clipPath element'</a> |
dschulze@698 | 1495 | element of the element the 'clip-path' property is applied should be used as the clip source. It is equivalent to |
birtles@697 | 1496 | ''select(clipPath:last-of-type)''.</dd> |
birtles@697 | 1497 | <dt>'<child-selector>'</dt> |
birtles@697 | 1498 | <dd> |
birtles@697 | 1499 | A comma-separated list of <a>compound selector</a>s scoped at the element to |
birtles@697 | 1500 | which the 'clip-path' property is applied. |
birtles@697 | 1501 | The first matching element in <a>tree order</a> (as defined in [[!DOM]]) as |
birtles@697 | 1502 | a result of evaluating the list of selectors is taken as the clip source. |
birtles@697 | 1503 | If there are no matching elements the clip source is invalid. |
birtles@697 | 1504 | </dd> |
dschulze@298 | 1505 | </dl> |
dschulze@298 | 1506 | |
dschulze@298 | 1507 | <h3 id="the-clip-rule">The 'clip-rule' property</h3> |
dschulze@298 | 1508 | |
dschulze@298 | 1509 | <table class="propdef"> |
dschulze@298 | 1510 | <tr> |
dschulze@298 | 1511 | <th>Name:</th> |
dschulze@298 | 1512 | <td><dfn>clip-rule</dfn></td> |
dschulze@298 | 1513 | </tr> |
dschulze@298 | 1514 | <tr> |
dschulze@298 | 1515 | <th>Value:</th> |
dschulze@298 | 1516 | <td>nonzero | evenodd</td> |
dschulze@298 | 1517 | </tr> |
dschulze@298 | 1518 | <tr> |
dschulze@298 | 1519 | <th>Initial:</th> |
dschulze@298 | 1520 | <td>nonzero</td> |
dschulze@298 | 1521 | </tr> |
dschulze@298 | 1522 | <tr> |
dschulze@298 | 1523 | <th>Applies to:</th> |
dschulze@298 | 1524 | <td><a>graphics elements</a> within a <a>'clipPath'</a> element</td> |
dschulze@298 | 1525 | </tr> |
dschulze@298 | 1526 | <tr> |
dschulze@298 | 1527 | <th>Inherited:</th> |
dschulze@298 | 1528 | <td>yes</td> |
dschulze@298 | 1529 | </tr> |
dschulze@298 | 1530 | <tr> |
dschulze@298 | 1531 | <th>Percentages:</th> |
dschulze@298 | 1532 | <td>N/A</td> |
dschulze@298 | 1533 | </tr> |
dschulze@298 | 1534 | <tr> |
dschulze@298 | 1535 | <th>Media:</th> |
dschulze@298 | 1536 | <td>visual</td> |
dschulze@298 | 1537 | </tr> |
dschulze@298 | 1538 | <tr> |
dschulze@298 | 1539 | <th>Computed value:</th> |
dschulze@298 | 1540 | <td>as specified</td> |
dschulze@298 | 1541 | </tr> |
dschulze@298 | 1542 | <tr> |
birtles@440 | 1543 | <th>Animatable:</th> |
dschulze@731 | 1544 | <td>no</td> |
dschulze@298 | 1545 | </tr> |
dschulze@298 | 1546 | </table> |
dschulze@298 | 1547 | |
dschulze@298 | 1548 | <dl> |
dschulze@298 | 1549 | <dt><dfn>''nonzero''</dfn></dt> |
dschulze@465 | 1550 | <dd>See description of <a>'fill-rule'</a> property [[SVG11]].</dd> |
dschulze@298 | 1551 | |
dschulze@298 | 1552 | <dt><dfn>''evenodd''</dfn></dt> |
dschulze@465 | 1553 | <dd>See description of <a>'fill-rule'</a> property [[SVG11]].</dd> |
dschulze@298 | 1554 | </dl> |
dschulze@298 | 1555 | |
dschulze@298 | 1556 | <p>The 'clip-rule' property only applies to graphics elements that are |
dschulze@298 | 1557 | contained within a <a>'clipPath'</a> element. |
dschulze@298 | 1558 | |
dschulze@298 | 1559 | <div class=example> |
dschulze@298 | 1560 | The following fragment of code |
dschulze@298 | 1561 | will cause an evenodd clipping rule to be applied to the clipping path because |
dschulze@298 | 1562 | 'clip-rule' is specified on the <a>'path'</a> element that defines the |
dschulze@298 | 1563 | clipping shape:</p> |
dschulze@298 | 1564 | |
dschulze@298 | 1565 | <pre> |
dschulze@298 | 1566 | <g clip-rule="nonzero"> |
dschulze@298 | 1567 | <clipPath id="MyClip"> |
dschulze@298 | 1568 | <path d="..." clip-rule="evenodd" /> |
dschulze@298 | 1569 | </clipPath> |
dschulze@298 | 1570 | <rect clip-path="url(#MyClip)" ... /> |
dschulze@298 | 1571 | </g> |
dschulze@298 | 1572 | </pre> |
dschulze@298 | 1573 | |
dschulze@298 | 1574 | <p>whereas the following fragment of code will <em>not</em> cause an |
dschulze@298 | 1575 | evenodd clipping rule to be applied because the 'clip-rule' is |
dschulze@298 | 1576 | specified on the referencing element, not on the object defining the |
dschulze@298 | 1577 | clipping shape:</p> |
dschulze@298 | 1578 | |
dschulze@298 | 1579 | <pre> |
dschulze@298 | 1580 | <g clip-rule="nonzero"> |
dschulze@298 | 1581 | <clipPath id="MyClip"> |
dschulze@298 | 1582 | <path d="..." /> |
dschulze@298 | 1583 | </clipPath> |
dschulze@298 | 1584 | <rect clip-path="url(#MyClip)" clip-rule="evenodd" ... /> |
dschulze@298 | 1585 | </g> |
dschulze@298 | 1586 | </pre> |
dschulze@298 | 1587 | </div> |
dschulze@298 | 1588 | |
dschulze@451 | 1589 | <h3 id="clip-property">The 'clip' property</h3> |
dschulze@451 | 1590 | |
dschulze@451 | 1591 | <table class="propdef"> |
dschulze@451 | 1592 | <tr> |
dschulze@451 | 1593 | <th>Name:</th> |
dschulze@451 | 1594 | <td><dfn id="ClipProperty">clip</dfn></td> |
dschulze@451 | 1595 | </tr> |
dschulze@451 | 1596 | <tr> |
dschulze@451 | 1597 | <th>Value:</th> |
dschulze@451 | 1598 | <td><var><shape></var> | auto</td> |
dschulze@451 | 1599 | </tr> |
dschulze@451 | 1600 | <tr> |
dschulze@451 | 1601 | <th>Initial:</th> |
dschulze@451 | 1602 | <td>see individual properties</td> |
dschulze@451 | 1603 | </tr> |
dschulze@451 | 1604 | <tr> |
dschulze@451 | 1605 | <th>Applies to:</th> |
dschulze@451 | 1606 | <td>Absolutely positioned elements. In SVG, it applies to <a |
dschulze@451 | 1607 | href="http://www.w3.org/TR/SVG2/coords.html#EstablishingANewViewport">elements which |
dschulze@451 | 1608 | establish a new viewport</a>, <a>'pattern element'</a> elements and <a>'marker element'</a> elements.</td> |
dschulze@451 | 1609 | </tr> |
dschulze@451 | 1610 | <tr> |
dschulze@451 | 1611 | <th>Inherited:</th> |
dschulze@451 | 1612 | <td>no</td> |
dschulze@451 | 1613 | </tr> |
dschulze@451 | 1614 | <tr> |
dschulze@451 | 1615 | <th>Percentages:</th> |
dschulze@451 | 1616 | <td>N/A</td> |
dschulze@451 | 1617 | </tr> |
dschulze@451 | 1618 | <tr> |
dschulze@451 | 1619 | <th>Media:</th> |
dschulze@451 | 1620 | <td>visual</td> |
dschulze@451 | 1621 | </tr> |
dschulze@451 | 1622 | <tr> |
dschulze@451 | 1623 | <th>Computed value:</th> |
dschulze@451 | 1624 | <td>as specified</td> |
dschulze@451 | 1625 | </tr> |
dschulze@451 | 1626 | <tr> |
dschulze@451 | 1627 | <th>Animatable:</th> |
dschulze@731 | 1628 | <td>as <a href="http://dev.w3.org/csswg/css3-transitions/#animtype-rect">rectangle</a></td> |
dschulze@451 | 1629 | </tr> |
dschulze@451 | 1630 | </table> |
dschulze@451 | 1631 | |
dschulze@474 | 1632 | <p class=note>With this specification the 'clip' property is deprecated. Authors are encouraged to use the 'clip-path' property instead. |
dschulze@474 | 1633 | UAs must support the 'clip' property. |
dschulze@474 | 1634 | </p> |
dschulze@474 | 1635 | |
dschulze@451 | 1636 | <p> |
dschulze@451 | 1637 | The 'clip' property applies only to absolutely positioned elements. In SVG, it applies to |
dschulze@451 | 1638 | <a href="http://www.w3.org/TR/SVG2/coords.html#EstablishingANewViewport">elements which establish a new viewport</a>, |
dschulze@451 | 1639 | <a>'pattern element'</a> elements and <a>'marker element'</a> elements</td>. Values have the following meanings: |
dschulze@451 | 1640 | </p> |
dschulze@451 | 1641 | |
dschulze@451 | 1642 | <dl> |
dschulze@451 | 1643 | <dt>''auto''</dt> |
dschulze@451 | 1644 | <dd>The element does not clip.</dd> |
dschulze@451 | 1645 | <dt><var><shape></var></dt> |
dschulze@451 | 1646 | <dd> |
dschulze@451 | 1647 | <p> |
dschulze@451 | 1648 | In CSS 2.1, the only valid <shape> value is: rect(<var><top></var>, <var><right></var>, |
dschulze@451 | 1649 | <var><bottom></var>, <var><left></var>) where <var><top></var> and <var><bottom></var> |
dschulze@451 | 1650 | specify offsets from the top border edge of the box, and <var><right></var>, and <var><left></var> |
dschulze@451 | 1651 | specify offsets from the left border edge of the box. Authors should separate offset values with commas. User agents |
dschulze@451 | 1652 | must support separation with commas, but may also support separation without commas (but not a combination), because |
dschulze@451 | 1653 | a previous revision of this specification was ambiguous in this respect. |
dschulze@451 | 1654 | </p> |
dschulze@451 | 1655 | |
dschulze@451 | 1656 | <p><dfn><top></dfn>, |
dschulze@451 | 1657 | <dfn><right></dfn>, <dfn><bottom></dfn>, and <dfn><left></dfn> may either have a |
dschulze@451 | 1658 | <var><length></var> value or ''auto''. Negative lengths are permitted. The value ''auto'' means that a given |
dschulze@451 | 1659 | edge of the clipping region will be the same as the edge of the element's generated border box (i.e., ''auto'' means |
dschulze@451 | 1660 | the same as ''0'' for <var><top></var> and <var><left></var>, the same as the used value of the height |
dschulze@451 | 1661 | plus the sum of vertical padding and border widths for <var><bottom></var>, and the same as the used value of the width |
dschulze@451 | 1662 | plus the sum of the horizontal padding and border widths for <var><right></var>, such that four 'auto' values result in |
dschulze@451 | 1663 | the clipping region being the same as the element's border box). |
dschulze@451 | 1664 | </p> |
dschulze@451 | 1665 | |
dschulze@451 | 1666 | <p> |
dschulze@451 | 1667 | When coordinates are rounded to pixel coordinates, care should be taken that no pixels remain visible when |
dschulze@451 | 1668 | <var><left></var> and <var><right></var> have the same value (or <var><top></var> and |
dschulze@451 | 1669 | <var><bottom></var> have the same value), and conversely that no pixels within the element's border box |
dschulze@451 | 1670 | remain hidden when these values are ''auto''. |
dschulze@451 | 1671 | </p> |
dschulze@451 | 1672 | </dd> |
dschulze@451 | 1673 | </dl> |
dschulze@451 | 1674 | |
dschulze@451 | 1675 | <div class="example"> |
dschulze@451 | 1676 | <p> |
dschulze@451 | 1677 | Example: The following two rules: |
dschulze@451 | 1678 | </p> |
dschulze@451 | 1679 | |
dschulze@451 | 1680 | <pre><code> |
dschulze@451 | 1681 | p#one { clip: rect(5px, 40px, 45px, 5px); } |
dschulze@451 | 1682 | p#two { clip: rect(5px, 55px, 45px, 5px); }</code></pre> |
dschulze@451 | 1683 | |
dschulze@451 | 1684 | <p> |
dschulze@451 | 1685 | and assuming both Ps are 50 by 55 pixel, will create, respectively, the rectangular clipping regions delimited by |
dschulze@451 | 1686 | the dashed lines in the following illustrations: |
dschulze@451 | 1687 | </p> |
dschulze@451 | 1688 | |
dschulze@451 | 1689 | <div class=figure> |
dschulze@451 | 1690 | <img src="images/clip.png" width="292" height="577" alt="Values for rect shape"> |
dschulze@453 | 1691 | <p class=caption>This diagram illustrates two block boxes, one above the other, with rectangular clipping regions of |
dschulze@453 | 1692 | different dimensions. (See <a href="http://www.w3.org/TR/CSS2/images/longdesc/clip-desc.html">long description</a>.) |
dschulze@451 | 1693 | </div> |
dschulze@451 | 1694 | </div> |
dschulze@451 | 1695 | |
dschulze@298 | 1696 | <h3 id="ClipPathElement">The <a>'clipPath element'</a> element</h3> |
dschulze@298 | 1697 | |
dschulze@298 | 1698 | <!--elementsummary clipPath--> |
dschulze@298 | 1699 | |
dschulze@298 | 1700 | <div class="adef-list"> |
dschulze@298 | 1701 | <p><em>Attribute definitions:</em></p> |
dschulze@298 | 1702 | <dl> |
dschulze@298 | 1703 | <dt id="ClipPathElementClipPathUnitsAttribute"><span |
dschulze@298 | 1704 | class="adef">clipPathUnits</span> = |
dschulze@298 | 1705 | "<em>userSpaceOnUse</em> | <em>objectBoundingBox</em>"</dt> |
dschulze@298 | 1706 | <dd>Defines the coordinate system for the contents of the |
dschulze@298 | 1707 | <a>'clipPath'</a>.<br /> |
dschulze@298 | 1708 | If <span class="attr-value">clipPathUnits="userSpaceOnUse"</span>, |
dschulze@298 | 1709 | the contents of the <a>'clipPath'</a> represent values in |
dschulze@298 | 1710 | the current user coordinate system in place at the time |
dschulze@298 | 1711 | when the <a>'clipPath'</a> |
dschulze@298 | 1712 | element is referenced (i.e., the user coordinate system for |
dschulze@298 | 1713 | the element referencing the <a>'clipPath'</a> element via the |
dschulze@298 | 1714 | <a>'clip-path'</a> property).<br /> |
dschulze@298 | 1715 | If <span class="attr-value">clipPathUnits="objectBoundingBox"</span>, |
dschulze@298 | 1716 | then the user coordinate system for the contents of the |
dschulze@298 | 1717 | <a>'clipPath'</a> element is established using the bounding box of |
dschulze@343 | 1718 | the element to which the clipping path is applied (see <span class=index>object bounding box |
dschulze@343 | 1719 | units</span>).<br /> |
dschulze@298 | 1720 | If attribute <a>'clipPathUnits'</a> |
dschulze@298 | 1721 | is not specified, then the effect is as if a value of <span |
dschulze@298 | 1722 | class="attr-value">'userSpaceOnUse'</span> were |
dschulze@298 | 1723 | specified.<br /> |
dschulze@343 | 1724 | <span class="anim-target">Animatable: |
dschulze@298 | 1725 | yes.</span></dd> |
dschulze@298 | 1726 | </dl> |
dschulze@298 | 1727 | </div> |
dschulze@298 | 1728 | |
dschulze@343 | 1729 | <p>CSS properties inherit into the |
dschulze@298 | 1730 | <a>'clipPath'</a> element from its ancestors; properties do <em>not</em> |
dschulze@298 | 1731 | inherit from the element referencing the <a>'clipPath'</a> element.</p> |
dschulze@298 | 1732 | |
dschulze@298 | 1733 | <p><a>'clipPath'</a> elements are never rendered directly; their only usage is |
dschulze@298 | 1734 | as something that can be referenced using the <a>'clip-path'</a> property. The |
dschulze@298 | 1735 | <a>'display'</a> property does not apply to the <a>'clipPath'</a> element; |
dschulze@298 | 1736 | thus, <a>'clipPath'</a> elements are not directly rendered even if the |
dschulze@298 | 1737 | 'display' property is set to a value other than |
dschulze@298 | 1738 | <span class="prop-value">none</span>, and <a>'clipPath'</a> elements are |
dschulze@298 | 1739 | available for referencing even when the <a>'display'</a> property on the |
dschulze@298 | 1740 | <a>'clipPath'</a> element or any of its ancestors is set to |
dschulze@298 | 1741 | <span class="prop-value">none</span>.</p> |
dschulze@298 | 1742 | |
dschulze@298 | 1743 | <p>A <a>'clipPath'</a> element can contain <a>'path'</a> elements, |
dschulze@298 | 1744 | <a>'text'</a> elements, <a>basic shapes</a> (such as |
dschulze@298 | 1745 | <a>'circle'</a>) or a <a>'use'</a> element. If a <a>'use'</a> element is a |
dschulze@298 | 1746 | child of a <a>'clipPath'</a> element, it must directly reference |
dschulze@451 | 1747 | <a>'path'</a>, <a>'text'</a> or <a>basic shapes</a> elements. |
birtles@437 | 1748 | Indirect references are an error and the <a>'clipPath'</a> element must be |
birtles@437 | 1749 | ignored.</p> |
dschulze@298 | 1750 | |
dschulze@298 | 1751 | <p>The raw geometry of each child element exclusive of rendering properties |
dschulze@298 | 1752 | such as 'fill', 'stroke', 'stroke-width' within a |
dschulze@298 | 1753 | <a>'clipPath'</a> conceptually defines a 1-bit mask (with the possible |
dschulze@298 | 1754 | exception of anti-aliasing along the edge of the geometry) which represents |
dschulze@298 | 1755 | the silhouette of the graphics associated with that element. Anything outside |
dschulze@298 | 1756 | the outline of the object is masked out. If a child element is |
dschulze@298 | 1757 | made invisible by 'display' or 'visibility' it does not contribute |
dschulze@298 | 1758 | to the clipping path. When the <a>'clipPath'</a> element |
dschulze@298 | 1759 | contains multiple child elements, the silhouettes of the child elements are |
dschulze@298 | 1760 | logically OR'd together to create a single silhouette which is then used to |
dschulze@298 | 1761 | restrict the region onto which paint can be applied. Thus, a point is inside |
dschulze@298 | 1762 | the clipping path if it is inside any of the children of the |
dschulze@298 | 1763 | <a>'clipPath'</a>.</p> |
dschulze@298 | 1764 | |
dschulze@298 | 1765 | <p>For a given graphics element, the actual clipping path used |
dschulze@298 | 1766 | will be the intersection of the clipping path specified by its |
dschulze@298 | 1767 | 'clip-path' property (if any) with any clipping paths on its |
dschulze@298 | 1768 | ancestors, as specified by the 'clip-path' property on the |
dschulze@343 | 1769 | elements |
dschulze@343 | 1770 | which establish a new viewport. (See [[SVG11]])</p> |
dschulze@298 | 1771 | |
dschulze@734 | 1772 | <p>A couple of additions:</p> |
dschulze@298 | 1773 | |
dschulze@298 | 1774 | <ul> |
dschulze@298 | 1775 | <li>The <a>'clipPath'</a> element itself and its child elements do |
dschulze@298 | 1776 | <em>not</em> inherit clipping paths from the ancestors of the |
dschulze@298 | 1777 | <a>'clipPath'</a> element.</li> |
dschulze@298 | 1778 | |
dschulze@298 | 1779 | <li>The <a>'clipPath'</a> element or any of its children can specify |
dschulze@298 | 1780 | property 'clip-path'.<br /> If a valid 'clip-path' reference |
dschulze@298 | 1781 | is placed on a <a>'clipPath'</a> element, the resulting clipping path is the |
dschulze@298 | 1782 | intersection of the contents of the <a>'clipPath'</a> element with the |
dschulze@298 | 1783 | referenced clipping path.<br /> |
dschulze@298 | 1784 | If a valid 'clip-path' reference is placed on one of the children of |
dschulze@298 | 1785 | a <a>'clipPath'</a> element, then the given child element is clipped by the |
dschulze@298 | 1786 | referenced clipping path before OR'ing the silhouette of the child element |
dschulze@298 | 1787 | with the silhouettes of the other child elements.</li> |
dschulze@298 | 1788 | |
dschulze@298 | 1789 | <li>An empty clipping path will completely clip away the element that had the |
dschulze@298 | 1790 | 'clip-path' property applied.</li> |
dschulze@298 | 1791 | </ul> |
dschulze@298 | 1792 | |
dschulze@298 | 1793 | <h3 id="clipPath-geometry">Clipping paths, geometry, and pointer events</h3> |
dschulze@298 | 1794 | |
dschulze@298 | 1795 | <p>A clipping path is conceptually equivalent to a custom viewport for |
dschulze@298 | 1796 | the referencing element. Thus, it affects the rendering of an element, |
dschulze@298 | 1797 | but not the element's inherent geometry. The <span class=index>bounding client rect</span> of a clipped |
dschulze@298 | 1798 | element (that is, an element which references a <a>'clipPath'</a> |
dschulze@298 | 1799 | element via a 'clip-path' property, or a child of the |
dschulze@298 | 1800 | referencing element) must remain the same as if it were not clipped.</p> |
dschulze@298 | 1801 | |
birtles@466 | 1802 | <p>By default, <a>pointer events</a> |
dschulze@298 | 1803 | must not be dispatched on the clipped (non-visible) regions of a shape. For |
dschulze@298 | 1804 | example, a circle with a radius of 10 which is clipped to a circle with a radius |
dschulze@298 | 1805 | of 5 will not receive <span class="event-name">'click'</span> events outside the |
dschulze@298 | 1806 | smaller radius. Later versions of this specification may define new properties to enable |
dschulze@298 | 1807 | fine-grained control over the interactions between hit testing and clipping.</p> |
dschulze@273 | 1808 | |
dschulze@473 | 1809 | <h2 id="security">Security</h2> |
dschulze@473 | 1810 | |
dschulze@473 | 1811 | <h3 id="origin-restrictions">Origin Restrictions</h3> |
dschulze@473 | 1812 | |
dschulze@473 | 1813 | <p> |
dschulze@473 | 1814 | External references to resources like <a>'mask element'</a> or <a>'clipPath element'</a> |
dschulze@473 | 1815 | must not violate the same origin restrictions [[!CORS]]. |
dschulze@473 | 1816 | </p> |
dschulze@473 | 1817 | |
dschulze@473 | 1818 | <p>This restriction includes:</p> |
dschulze@473 | 1819 | |
dschulze@473 | 1820 | <ul> |
dschulze@473 | 1821 | <li>Any images, either as content or via styling, that are not exposed with CORS</li> |
dschulze@473 | 1822 | <li>Any tainted canvas</li> |
dschulze@473 | 1823 | <li>Any cross-origin content referenced by ''xlink:href'' or <use></li> |
dschulze@473 | 1824 | </ul> |
dschulze@473 | 1825 | |
dschulze@473 | 1826 | <p> |
dschulze@473 | 1827 | If content falls under this restriction, the resource must be rejected. The element is |
dschulze@473 | 1828 | drawn as if the resource was not specified (i.e. the 'clip-path' or 'mask' property were |
dschulze@473 | 1829 | set to ''none''). |
dschulze@473 | 1830 | </p> |
dschulze@473 | 1831 | |
dschulze@462 | 1832 | <h2 id="DOMInterfaces">DOM interfaces</h2> |
dschulze@462 | 1833 | |
dschulze@462 | 1834 | <h3 id="InterfaceSVGClipPathElement">Interface SVGClipPathElement</h3> |
dschulze@462 | 1835 | |
dschulze@462 | 1836 | <p>The <a>SVGClipPathElement</a> interface corresponds to the <a>'clipPath'</a> element.</p> |
dschulze@462 | 1837 | |
dschulze@628 | 1838 | <pre class="idl">interface <b>SVGClipPathElement</b> : <a>SVGElement</a> { |
birtles@467 | 1839 | readonly attribute <a>SVGAnimatedEnumeration</a> <a href="#SVGClipPathElement__clipPathUnits">clipPathUnits</a>; |
dschulze@628 | 1840 | readonly attribute <a>SVGAnimatedTransformList</a> <a href="#SVGClipPathElement__transform">transform</a>; |
dschulze@462 | 1841 | }; |
dschulze@462 | 1842 | |
dschulze@462 | 1843 | <a>SVGClipPathElement</a> implements <a>SVGUnitTypes</a>;</pre> |
dschulze@462 | 1844 | |
dschulze@462 | 1845 | <dl class="interface"> |
dschulze@462 | 1846 | <dt class="attributes-header">Attributes:</dt> |
dschulze@462 | 1847 | <dd> |
dschulze@462 | 1848 | <dl class="attributes"> |
dschulze@462 | 1849 | |
birtles@467 | 1850 | <dt id="SVGClipPathElement__clipPathUnits" class="attribute first-child"><b>clipPathUnits</b><span class="idl-type-parenthetical"> (readonly <a>SVGAnimatedEnumeration</a>)</span></dt> |
dschulze@462 | 1851 | <dd class="attribute"> |
dschulze@462 | 1852 | <div> |
dschulze@462 | 1853 | Corresponds to attribute <a>'clipPathUnits'</a> on the given |
dschulze@462 | 1854 | <a>'clipPath'</a> element. Takes one of the constants defined in |
dschulze@462 | 1855 | <a>SVGUnitTypes</a>. |
dschulze@628 | 1856 | </div> |
dschulze@628 | 1857 | </dd> |
dschulze@462 | 1858 | |
dschulze@628 | 1859 | <dt id="SVGClipPathElement__transform" class="attribute first-child"><b>transform</b><span class="idl-type-parenthetical"> (readonly <a>SVGAnimatedTransformList</a>)</span></dt> |
dschulze@628 | 1860 | <dd class="attribute"> |
dschulze@628 | 1861 | <div> |
dschulze@628 | 1862 | Corresponds to attribute <a>'transform'</a> on the given element. |
dschulze@462 | 1863 | </div> |
dschulze@462 | 1864 | </dd> |
dschulze@462 | 1865 | </dl> |
dschulze@462 | 1866 | </dd> |
dschulze@462 | 1867 | </dl> |
dschulze@462 | 1868 | |
dschulze@462 | 1869 | <h3 id="InterfaceSVGMaskElement">Interface SVGMaskElement</h3> |
dschulze@462 | 1870 | |
dschulze@462 | 1871 | <p>The <a>SVGMaskElement</a> interface corresponds to the <a>'mask element'</a> element.</p> |
dschulze@462 | 1872 | |
dschulze@618 | 1873 | <pre class="idl">interface <b>SVGMaskElement</b> : <a>SVGElement</a> { |
birtles@467 | 1874 | readonly attribute <a>SVGAnimatedEnumeration</a> <a href="#SVGMaskElement__maskUnits">maskUnits</a>; |
birtles@467 | 1875 | readonly attribute <a>SVGAnimatedEnumeration</a> <a href="#SVGMaskElement__maskContentUnits">maskContentUnits</a>; |
birtles@467 | 1876 | readonly attribute <a>SVGAnimatedLength</a> <a href="#SVGMaskElement__x">x</a>; |
birtles@467 | 1877 | readonly attribute <a>SVGAnimatedLength</a> <a href="#SVGMaskElement__y">y</a>; |
birtles@467 | 1878 | readonly attribute <a>SVGAnimatedLength</a> <a href="#SVGMaskElement__width">width</a>; |
birtles@467 | 1879 | readonly attribute <a>SVGAnimatedLength</a> <a href="#SVGMaskElement__height">height</a>; |
dschulze@462 | 1880 | }; |
dschulze@462 | 1881 | |
dschulze@462 | 1882 | <a>SVGMaskElement</a> implements <a>SVGUnitTypes</a>;</pre> |
dschulze@462 | 1883 | |
dschulze@462 | 1884 | <dl class="interface"> |
dschulze@462 | 1885 | </dd> |
dschulze@462 | 1886 | <dt class="attributes-header">Attributes:</dt> |
dschulze@462 | 1887 | <dd> |
dschulze@462 | 1888 | <dl class="attributes"> |
dschulze@462 | 1889 | |
birtles@467 | 1890 | <dt id="SVGMaskElement__maskUnits" class="attribute first-child"><b>maskUnits</b><span class="idl-type-parenthetical"> (readonly <a>SVGAnimatedEnumeration</a>)</span></dt> |
dschulze@462 | 1891 | <dd class="attribute"> |
dschulze@462 | 1892 | <div> |
dschulze@462 | 1893 | Corresponds to attribute <a>'maskUnits'</a> on the given |
dschulze@462 | 1894 | <a>'mask element'</a> element. Takes one of the constants defined in |
dschulze@462 | 1895 | <a>SVGUnitTypes</a>. |
dschulze@462 | 1896 | </div> |
dschulze@462 | 1897 | </dd> |
dschulze@462 | 1898 | |
birtles@467 | 1899 | <dt id="SVGMaskElement__maskContentUnits" class="attribute"><b>maskContentUnits</b><span class="idl-type-parenthetical"> (readonly <a>SVGAnimatedEnumeration</a>)</span></dt> |
dschulze@462 | 1900 | <dd class="attribute"> |
dschulze@462 | 1901 | <div> |
dschulze@462 | 1902 | Corresponds to attribute <a>'maskContentUnits'</a> on the given |
dschulze@462 | 1903 | <a>'mask element'</a> element. Takes one of the constants defined in |
dschulze@462 | 1904 | <a>SVGUnitTypes</a>. |
dschulze@462 | 1905 | |
dschulze@462 | 1906 | </div> |
dschulze@462 | 1907 | </dd> |
dschulze@462 | 1908 | |
birtles@467 | 1909 | <dt id="SVGMaskElement__x" class="attribute"><b>x</b><span class="idl-type-parenthetical"> (readonly <a>SVGAnimatedLength</a>)</span></dt> |
dschulze@462 | 1910 | <dd class="attribute"> |
dschulze@462 | 1911 | <div> |
dschulze@462 | 1912 | Corresponds to attribute <a>'mask/x'</a> on the given <a>'mask element'</a> |
dschulze@462 | 1913 | element. |
dschulze@462 | 1914 | |
dschulze@462 | 1915 | </div> |
dschulze@462 | 1916 | </dd> |
dschulze@462 | 1917 | |
birtles@467 | 1918 | <dt id="SVGMaskElement__y" class="attribute"><b>y</b><span class="idl-type-parenthetical"> (readonly <a>SVGAnimatedLength</a>)</span></dt> |
dschulze@462 | 1919 | <dd class="attribute"> |
dschulze@462 | 1920 | <div> |
dschulze@462 | 1921 | Corresponds to attribute <a>'mask/y'</a> on the given <a>'mask element'</a> |
dschulze@462 | 1922 | element. |
dschulze@462 | 1923 | |
dschulze@462 | 1924 | </div> |
dschulze@462 | 1925 | </dd> |
dschulze@462 | 1926 | |
birtles@467 | 1927 | <dt id="SVGMaskElement__width" class="attribute"><b>width</b><span class="idl-type-parenthetical"> (readonly <a>SVGAnimatedLength</a>)</span></dt> |
dschulze@462 | 1928 | <dd class="attribute"> |
dschulze@462 | 1929 | <div> |
dschulze@462 | 1930 | Corresponds to attribute <a>'mask/width'</a> on the given |
dschulze@462 | 1931 | <a>'mask element'</a> element. |
dschulze@462 | 1932 | |
dschulze@462 | 1933 | </div> |
dschulze@462 | 1934 | </dd> |
dschulze@462 | 1935 | |
birtles@467 | 1936 | <dt id="SVGMaskElement__height" class="attribute"><b>height</b><span class="idl-type-parenthetical"> (readonly <a>SVGAnimatedLength</a>)</span></dt> |
dschulze@462 | 1937 | <dd class="attribute"> |
dschulze@462 | 1938 | <div> |
dschulze@462 | 1939 | Corresponds to attribute <a>'mask/height'</a> on the given |
dschulze@462 | 1940 | <a>'mask element'</a> element. |
dschulze@462 | 1941 | |
dschulze@462 | 1942 | </div> |
dschulze@462 | 1943 | </dd> |
dschulze@462 | 1944 | </dl> |
dschulze@462 | 1945 | </dd> |
dschulze@462 | 1946 | </dl> |
dschulze@462 | 1947 | |
dschulze@734 | 1948 | <h2 id="conformance"> |
dschulze@734 | 1949 | Conformance</h2> |
dschulze@734 | 1950 | |
dschulze@734 | 1951 | <h3 id="conventions"> |
dschulze@734 | 1952 | Document conventions</h3> |
dschulze@734 | 1953 | |
dschulze@734 | 1954 | <p>Conformance requirements are expressed with a combination of |
dschulze@734 | 1955 | descriptive assertions and RFC 2119 terminology. The key words “MUST”, |
dschulze@734 | 1956 | “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, |
dschulze@734 | 1957 | “RECOMMENDED”, “MAY”, and “OPTIONAL” in the normative parts of this |
dschulze@734 | 1958 | document are to be interpreted as described in RFC 2119. |
dschulze@734 | 1959 | However, for readability, these words do not appear in all uppercase |
dschulze@734 | 1960 | letters in this specification. |
dschulze@734 | 1961 | |
dschulze@734 | 1962 | <p>All of the text of this specification is normative except sections |
dschulze@734 | 1963 | explicitly marked as non-normative, examples, and notes. [[!RFC2119]]</p> |
dschulze@734 | 1964 | |
dschulze@734 | 1965 | <p>Examples in this specification are introduced with the words “for example” |
dschulze@734 | 1966 | or are set apart from the normative text with <code>class="example"</code>, |
dschulze@734 | 1967 | like this: |
dschulze@734 | 1968 | |
dschulze@734 | 1969 | <div class="example"> |
dschulze@734 | 1970 | <p>This is an example of an informative example.</p> |
dschulze@734 | 1971 | </div> |
dschulze@734 | 1972 | |
dschulze@734 | 1973 | <p>Informative notes begin with the word “Note” and are set apart from the |
dschulze@734 | 1974 | normative text with <code>class="note"</code>, like this: |
dschulze@734 | 1975 | |
dschulze@734 | 1976 | <p class="note">Note, this is an informative note.</p> |
dschulze@734 | 1977 | |
dschulze@734 | 1978 | <h3 id="conformance-classes"> |
dschulze@734 | 1979 | Conformance classes</h3> |
dschulze@734 | 1980 | |
dschulze@734 | 1981 | <p>Conformance to CSS Masking |
dschulze@734 | 1982 | is defined for three conformance classes: |
dschulze@734 | 1983 | <dl> |
dschulze@734 | 1984 | <dt><dfn title="style sheet!!as conformance class">style sheet</dfn> |
dschulze@734 | 1985 | <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#style-sheet">CSS |
dschulze@734 | 1986 | style sheet</a>. |
dschulze@734 | 1987 | <dt><dfn>renderer</dfn></dt> |
dschulze@734 | 1988 | <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a> |
dschulze@734 | 1989 | that interprets the semantics of a style sheet and renders |
dschulze@734 | 1990 | documents that use them. |
dschulze@734 | 1991 | <dt><dfn id="authoring-tool">authoring tool</dfn></dt> |
dschulze@734 | 1992 | <dd>A <a href="http://www.w3.org/TR/CSS21/conform.html#user-agent">UA</a> |
dschulze@734 | 1993 | that writes a style sheet. |
dschulze@734 | 1994 | </dl> |
dschulze@734 | 1995 | |
dschulze@734 | 1996 | <p>A style sheet is conformant to CSS Masking |
dschulze@734 | 1997 | if all of its statements that use syntax defined in this module are valid |
dschulze@734 | 1998 | according to the generic CSS grammar and the individual grammars of each |
dschulze@734 | 1999 | feature defined in this module. |
dschulze@734 | 2000 | |
dschulze@734 | 2001 | <p>A renderer is conformant to CSS Masking |
dschulze@734 | 2002 | if, in addition to interpreting the style sheet as defined by the |
dschulze@734 | 2003 | appropriate specifications, it supports all the features defined |
dschulze@734 | 2004 | by CSS Masking by parsing them correctly |
dschulze@734 | 2005 | and rendering the document accordingly. However, the inability of a |
dschulze@734 | 2006 | UA to correctly render a document due to limitations of the device |
dschulze@734 | 2007 | does not make the UA non-conformant. (For example, a UA is not |
dschulze@734 | 2008 | required to render color on a monochrome monitor.) |
dschulze@734 | 2009 | |
dschulze@734 | 2010 | <p>An authoring tool is conformant to CSS Masking |
dschulze@734 | 2011 | if it writes style sheets that are syntactically correct according to the |
dschulze@734 | 2012 | generic CSS grammar and the individual grammars of each feature in |
dschulze@734 | 2013 | this module, and meet all other conformance requirements of style sheets |
dschulze@734 | 2014 | as described in this module. |
dschulze@734 | 2015 | |
dschulze@734 | 2016 | <h3 id="partial"> |
dschulze@734 | 2017 | Partial implementations</h3> |
dschulze@734 | 2018 | |
dschulze@734 | 2019 | <p>So that authors can exploit the forward-compatible parsing rules to |
dschulze@734 | 2020 | assign fallback values, CSS renderers <strong>must</strong> |
dschulze@734 | 2021 | treat as invalid (and <a href="http://www.w3.org/TR/CSS21/conform.html#ignore">ignore |
dschulze@734 | 2022 | as appropriate</a>) any at-rules, properties, property values, keywords, |
dschulze@734 | 2023 | and other syntactic constructs for which they have no usable level of |
dschulze@734 | 2024 | support. In particular, user agents <strong>must not</strong> selectively |
dschulze@734 | 2025 | ignore unsupported component values and honor supported values in a single |
dschulze@734 | 2026 | multi-value property declaration: if any value is considered invalid |
dschulze@734 | 2027 | (as unsupported values must be), CSS requires that the entire declaration |
dschulze@734 | 2028 | be ignored.</p> |
dschulze@734 | 2029 | |
dschulze@734 | 2030 | <h3 id="experimental"> |
dschulze@734 | 2031 | Experimental implementations</h3> |
dschulze@734 | 2032 | |
dschulze@734 | 2033 | <p>To avoid clashes with future CSS features, the CSS2.1 specification |
dschulze@734 | 2034 | reserves a <a href="http://www.w3.org/TR/CSS21/syndata.html#vendor-keywords">prefixed |
dschulze@734 | 2035 | syntax</a> for proprietary and experimental extensions to CSS. |
dschulze@734 | 2036 | |
dschulze@734 | 2037 | <p>Prior to a specification reaching the Candidate Recommendation stage |
dschulze@734 | 2038 | in the W3C process, all implementations of a CSS feature are considered |
dschulze@734 | 2039 | experimental. The CSS Working Group recommends that implementations |
dschulze@734 | 2040 | use a vendor-prefixed syntax for such features, including those in |
dschulze@734 | 2041 | W3C Working Drafts. This avoids incompatibilities with future changes |
dschulze@734 | 2042 | in the draft. |
dschulze@734 | 2043 | </p> |
dschulze@734 | 2044 | |
dschulze@734 | 2045 | <h3 id="testing"> |
dschulze@734 | 2046 | Non-experimental implementations</h3> |
dschulze@734 | 2047 | |
dschulze@734 | 2048 | <p>Once a specification reaches the Candidate Recommendation stage, |
dschulze@734 | 2049 | non-experimental implementations are possible, and implementors should |
dschulze@734 | 2050 | release an unprefixed implementation of any CR-level feature they |
dschulze@734 | 2051 | can demonstrate to be correctly implemented according to spec. |
dschulze@734 | 2052 | |
dschulze@734 | 2053 | <p>To establish and maintain the interoperability of CSS across |
dschulze@734 | 2054 | implementations, the CSS Working Group requests that non-experimental |
dschulze@734 | 2055 | CSS renderers submit an implementation report (and, if necessary, the |
dschulze@734 | 2056 | testcases used for that implementation report) to the W3C before |
dschulze@734 | 2057 | releasing an unprefixed implementation of any CSS features. Testcases |
dschulze@734 | 2058 | submitted to W3C are subject to review and correction by the CSS |
dschulze@734 | 2059 | Working Group. |
dschulze@734 | 2060 | |
dschulze@734 | 2061 | <p>Further information on submitting testcases and implementation reports |
dschulze@734 | 2062 | can be found from on the CSS Working Group's website at |
dschulze@734 | 2063 | <a href="http://www.w3.org/Style/CSS/Test/">http://www.w3.org/Style/CSS/Test/</a>. |
dschulze@734 | 2064 | Questions should be directed to the |
dschulze@734 | 2065 | <a href="http://lists.w3.org/Archives/Public/public-css-testsuite">public-css-testsuite@w3.org</a> |
dschulze@734 | 2066 | mailing list. |
dschulze@734 | 2067 | |
dschulze@273 | 2068 | <h2 class=no-num id="references"> |
dschulze@273 | 2069 | References</h2> |
dschulze@273 | 2070 | |
dschulze@273 | 2071 | <h3 class="no-num" id="normative-references"> |
dschulze@273 | 2072 | Normative references</h3> |
dschulze@273 | 2073 | <!--normative--> |
dschulze@470 | 2074 | <dl> |
dschulze@470 | 2075 | <dt id="ref-svg2"><strong class="normref">[SVG2]</strong></dt> |
dschulze@470 | 2076 | <dd> |
dschulze@731 | 2077 | Cameron McCormack; et al. <a href="http://www.w3.org/TR/2012/WD-SVG2-20120828/"><cite>Scalable |
dschulze@470 | 2078 | Vector Graphics (SVG) 2</cite>.</a> 28 August 2012. W3C Working Draft. (Work in progress.) URL: |
dschulze@470 | 2079 | <a href="http://www.w3.org/TR/2012/WD-SVG2-20120828/">http://www.w3.org/TR/2012/WD-SVG2-20120828/</a> |
dschulze@470 | 2080 | </dd> |
dschulze@470 | 2081 | </dl> |
dschulze@273 | 2082 | |
dschulze@273 | 2083 | <h3 class="no-num" id="other-references"> |
dschulze@273 | 2084 | Other references</h3> |
dschulze@273 | 2085 | <!--informative--> |
dschulze@273 | 2086 | |
dschulze@273 | 2087 | <h2 class="no-num" id="index"> |
dschulze@273 | 2088 | Index</h2> |
dschulze@273 | 2089 | <!--index--> |
dschulze@273 | 2090 | |
dschulze@273 | 2091 | <h2 class="no-num" id="property-index"> |
dschulze@273 | 2092 | Property index</h2> |
dschulze@273 | 2093 | <!-- properties --> |
dschulze@273 | 2094 | |
dschulze@273 | 2095 | </body> |
dschulze@273 | 2096 | </html> |
dschulze@273 | 2097 | <!-- Keep this comment at the end of the file |
dschulze@273 | 2098 | Local variables: |
dschulze@273 | 2099 | mode: sgml |
dschulze@273 | 2100 | sgml-declaration:"~/SGML/HTML4.decl" |
dschulze@273 | 2101 | sgml-default-doctype-name:"html" |
dschulze@273 | 2102 | sgml-minimize-attributes:t |
dschulze@273 | 2103 | sgml-nofill-elements:("pre" "style" "br") |
dschulze@273 | 2104 | sgml-live-element-indicator:t |
dschulze@273 | 2105 | sgml-omittag:nil |
dschulze@273 | 2106 | sgml-shorttag:nil |
dschulze@273 | 2107 | sgml-namecase-general:t |
dschulze@273 | 2108 | sgml-general-insert-case:lower |
dschulze@273 | 2109 | sgml-always-quote-attributes:t |
dschulze@273 | 2110 | sgml-indent-step:nil |
dschulze@273 | 2111 | sgml-indent-data:t |
dschulze@273 | 2112 | sgml-parent-document:nil |
dschulze@273 | 2113 | sgml-exposed-tags:nil |
dschulze@273 | 2114 | sgml-local-catalogs:nil |
dschulze@273 | 2115 | sgml-local-ecat-files:nil |
dschulze@273 | 2116 | End: |
dschulze@273 | 2117 | --> |
dschulze@273 | 2118 | |
dschulze@273 | 2119 |