css-regions/Overview.bs

Sun, 31 Jan 2016 15:42:31 -0800

author
Peter Linss <[email protected]>
date
Sun, 31 Jan 2016 15:42:31 -0800
changeset 16986
5be73fbc8592
parent 16542
27d9df21dcba
child 16989
255258410d1b
permissions
-rw-r--r--

change //dev.w3.org/csswg/ urls to //drafts.csswg.org/

florian@15817 1 <h1>CSS Regions Module Level 1</h1>
florian@15817 2
florian@15817 3 <pre class='metadata'>
florian@15817 4 Status: ED
florian@15817 5 Work Status: Exploring
florian@15817 6 Shortname: css-regions
florian@15817 7 Level: 1
florian@15817 8 Group: csswg
florian@15817 9 TR: http://www.w3.org/TR/css-regions-1/
dbaron@16542 10 Previous Version: http://www.w3.org/TR/2014/WD-css-regions-1-20141009/
florian@15817 11 Previous Version: http://www.w3.org/TR/2014/WD-css3-regions-20140218/
peter@16986 12 ED: https://drafts.csswg.org/css-regions/
florian@15817 13 Editor: Rossen Atanassov, Microsoft Corporation, [email protected]
florian@15817 14 Editor: Alan Stearns, Adobe Systems&#44; Inc., [email protected]
florian@15817 15 Former Editor: Vincent Hardy, Adobe Systems&#44; Inc., [email protected]
florian@15817 16 !Issues list: <a href="https://www.w3.org/Bugs/Public/buglist.cgi?query_format=advanced&amp;product=CSS&amp;component=Regions&amp;resolution=---&amp;cmdtype=doit">In Bugzilla</a>
florian@15817 17 Abstract: The CSS Regions module allows content from one or more elements to flow through one or more boxes called CSS Regions, fragmented as defined in [[!CSS3-BREAK]]. This module also defines CSSOM to expose both the inputs and outputs of this fragmentation.
florian@15817 18 Link Defaults: css21 (property) max-height, dom-core-ls (interface) range
florian@15817 19 Ignored Terms: document, element, eventtarget
florian@15817 20 </pre>
florian@15817 21
florian@15817 22 <h2 id="introduction">
florian@15817 23 Introduction</h2>
florian@15817 24
florian@15817 25 <em>This section is non-normative.</em>
florian@15817 26
florian@15817 27 The core concept behind CSS Regions
florian@15817 28 is the ability to say,
florian@15817 29 "Display <em>this</em> content (a <a>named flow</a>)
florian@15817 30 over <em>there</em> (a <a>region chain</a>)."
florian@15817 31 The simplest example is:
florian@15817 32
florian@15817 33 <div class="example">
florian@15817 34 <pre><code>
florian@15817 35 #this {
florian@15817 36 flow-into: my-flow;
florian@15817 37 }
florian@15817 38
florian@15817 39 #there {
florian@15817 40 flow-from: my-flow;
florian@15817 41 }
florian@15817 42 </code></pre>
florian@15817 43 </div>
florian@15817 44
florian@15817 45 These two declarations will take
florian@15817 46 the element that matches <code>#this</code>,
florian@15817 47 put it into a flow named "my-flow",
florian@15817 48 and display the contents of "my-flow"
florian@15817 49 in the box from the element that matches <code>#there</code>.
florian@15817 50 This example has a single content source for the <a>named flow</a>,
florian@15817 51 and a single box for the <a>region chain</a>.
florian@15817 52 <a>Named flows</a> can also have multiple sources
florian@15817 53 and use multiple boxes for the <a>region chain</a>.
florian@15817 54
florian@15817 55 The <a>named flow</a> mechanism can be used
florian@15817 56 in several different ways -
florian@15817 57 some of which are
florian@15817 58 custom overflow handling,
florian@15817 59 aggregating content,
florian@15817 60 linked display boxes,
florian@15817 61 magazine-style layout,
florian@15817 62 and flowing content through areas in a paginated view.
florian@15817 63
florian@15817 64 <div class="example">
florian@15817 65 Linked display boxes can be created
florian@15817 66 to display article content above and below
florian@15817 67 other content on a page.
florian@15817 68 Given markup like this:
florian@15817 69
florian@15817 70 <pre><code class="html">
florian@15817 71 &lt;article&gt; ...some content... &lt;/article&gt;
florian@15817 72 &lt;aside&gt; ad or image content &lt;/aside&gt;
florian@15817 73 </code></pre>
florian@15817 74
florian@15817 75 The &lt;aside&gt; content will be displayed
florian@15817 76 below all of the article content.
florian@15817 77 On a large screen the page might display without scrolling,
florian@15817 78 but on a small screen the &lt;aside&gt; content
florian@15817 79 might not be visible until the view scrolls.
florian@15817 80 If it's important to show at least some
florian@15817 81 of the &lt;aside&gt; content in the initial view,
florian@15817 82 CSS Regions can fragment the article content across two boxes -
florian@15817 83 one above the &lt;aside&gt; and one below.
florian@15817 84
florian@15817 85 In this example (for simplicity's sake)
florian@15817 86 we create the boxes with additional elements:
florian@15817 87
florian@15817 88 <pre><code class="html">
florian@15817 89 &lt;article&gt; ...some content... &lt;/article&gt;
florian@15817 90
florian@15817 91 &lt;div class="top region"&gt;&lt;/div&gt;
florian@15817 92 &lt;aside&gt; ad or image content &lt;/aside&gt;
florian@15817 93 &lt;div class="region"&gt;&lt;/div&gt;
florian@15817 94 </code></pre>
florian@15817 95
florian@15817 96 <pre><code>
florian@15817 97 article {
florian@15817 98 flow-into: article-flow;
florian@15817 99 }
florian@15817 100 .region {
florian@15817 101 flow-from: article-flow;
florian@15817 102 }
florian@15817 103 .top {
florian@15817 104 max-height: 80vh;
florian@15817 105 }
florian@15817 106 </code></pre>
florian@15817 107
florian@15817 108 So the top box in the <a>region chain</a>
florian@15817 109 is limited to 80% of the viewport height.
florian@15817 110 If the article content doesn't fit in that box,
florian@15817 111 the article will continue
florian@15817 112 in the second box after the &lt;aside&gt; content.
florian@15817 113
florian@15817 114 <figure style="float:left; margin:1em;">
florian@15817 115 <img alt="Article and aside rendering without CSS Regions"
florian@15817 116 src="images/linked-boxes-before.png"/>
florian@15817 117 <figcaption>
florian@15817 118 Rendering without CSS Regions
florian@15817 119 </figcaption>
florian@15817 120 </figure>
florian@15817 121
florian@15817 122 <figure style="float:left; margin:1em;">
florian@15817 123 <img alt="Article and aside rendering with CSS Regions"
florian@15817 124 src="images/linked-boxes-after.png"/>
florian@15817 125 <figcaption>
florian@15817 126 Rendering with CSS Regions
florian@15817 127 </figcaption>
florian@15817 128 </figure>
florian@15817 129
florian@15817 130 <p style="clear:left;">In the images above,
florian@15817 131 the gray area represents
florian@15817 132 the content below the screen edge
florian@15817 133 in the initial view.
florian@15817 134
florian@15817 135 This example links just two boxes together,
florian@15817 136 but more boxes could be added to the <a>region chain</a>
florian@15817 137 to regularly interleave other content with the article.
florian@15817 138 </div>
florian@15817 139
florian@15817 140 <div class="example">
florian@15817 141
florian@15817 142 Custom overflow handling can be accomplished by linking a separate overflow box. In this example, the overflow box is nestled inside a menu in the markup, and only displays if the menu is toggled.
florian@15817 143
florian@15817 144 <pre><code class="html">
florian@15817 145 &lt;nav&gt; ...some links... &lt;/nav&gt;
florian@15817 146
florian@15817 147 &lt;div class="menu"&gt;
florian@15817 148 &lt;nav&gt;&lt;/nav&gt;
florian@15817 149 ...some more links...
florian@15817 150 &lt;/div&gt;
florian@15817 151 </code></pre>
florian@15817 152
florian@15817 153 If the links in the main nav element are placed in a <a>named flow</a>, that flow can be directed through both the main nav element and the overflow nav box in the menu:
florian@15817 154
florian@15817 155 <pre><code>
florian@15817 156 nav a {
florian@15817 157 flow-into: nav-link-flow;
florian@15817 158 }
florian@15817 159 nav {
florian@15817 160 flow-from: nav-link-flow;
florian@15817 161 }
florian@15817 162 </code></pre>
florian@15817 163
florian@15817 164 Then the main nav element and the menu can be arranged with constraints such that when the screen is too narrow for the main nav element to display all of the navigation links, the overflow moves to the menu.
florian@15817 165
florian@15817 166 <figure>
florian@15817 167 <img alt="Wide nav bar showing all of the links"
florian@15817 168 src="images/menu-wide.png"/>
florian@15817 169 <figcaption>
florian@15817 170 Wide rendering with menu shown
florian@15817 171 </figcaption>
florian@15817 172 </figure>
florian@15817 173
florian@15817 174 <figure>
florian@15817 175 <img alt="Narrow nav bar with some of the links in the menu"
florian@15817 176 src="images/menu-narrow.png"/>
florian@15817 177 <figcaption>
florian@15817 178 Narrow rendering with menu shown
florian@15817 179 </figcaption>
florian@15817 180 </figure>
florian@15817 181
florian@15817 182 </div>
florian@15817 183
florian@15817 184 <div class="example">
florian@15817 185
florian@15817 186 Since content is assigned to a <a>named flow</a> using a CSS selector, the content can come from multiple sources. The resulting aggregation can be displayed in a single box or flowed through multiple boxes as above.
florian@15817 187
florian@15817 188 So given this markup:
florian@15817 189
florian@15817 190 <pre><code class="html">
florian@15817 191 &lt;div class="breaking-news"&gt;&lt;/div&gt;
florian@15817 192
florian@15817 193 &lt;article&gt;News story&lt;/article&gt;
florian@15817 194 &lt;article class="breaking"&gt;Sports story&lt;/article&gt;
florian@15817 195 &lt;article&gt;News story&lt;/article&gt;
florian@15817 196 &lt;article class="breaking"&gt;Entertainment story&lt;/article&gt;
florian@15817 197 &lt;article&gt;Sports story&lt;/article&gt;
florian@15817 198 </code></pre>
florian@15817 199
florian@15817 200 You can take the "breaking" stories and display them above all the others using two lines of CSS:
florian@15817 201
florian@15817 202 <pre><code>
florian@15817 203 .breaking {
florian@15817 204 flow-into: breaking-news;
florian@15817 205 }
florian@15817 206 .breaking-news {
florian@15817 207 flow-from: breaking-news;
florian@15817 208 }
florian@15817 209 </code></pre>
florian@15817 210
florian@15817 211 Given more data accessible to CSS selectors, you could rearrange the articles in other ways (sports on top, etc.) depending on the user's preferences.
florian@15817 212
florian@15817 213 </div>
florian@15817 214
florian@15817 215 <div class="note"><span class="note-prefix">Note </span>
florian@15817 216
florian@15817 217 <strong><a>CSS Regions</a> are independent from layout</strong>
florian@15817 218
florian@15817 219 Any of the CSS layout facilities can be used
florian@15817 220 to create, position and size boxes that can become <a>CSS Regions</a>.
florian@15817 221
florian@15817 222 The CSS Regions module does not
florian@15817 223 define a layout mechanism
florian@15817 224 and is meant to integrate
florian@15817 225 with existing and future CSS layout facilities.
florian@15817 226 </div>
florian@15817 227
florian@15817 228 <div class="note"><span class="note-prefix">Note </span>
florian@15817 229
florian@15817 230 <strong><a>CSS Regions</a> do not have to be elements</strong>
florian@15817 231
florian@15817 232 The CSS Regions module is independent
florian@15817 233 of the layout of boxes and
florian@15817 234 the mechanisms used to create them.
florian@15817 235
florian@15817 236 For simplicity,
florian@15817 237 our examples tend to
florian@15817 238 use elements to define the boxes.
florian@15817 239 Any other mechanism available
florian@15817 240 in markup or style
florian@15817 241 to create stylable boxes could be used instead,
florian@15817 242 such as pseudo-elements
florian@15817 243 or the @slot rule proposed
florian@15817 244 by the CSS Page Template Module [[CSS3-PAGE-TEMPLATE]].
florian@15817 245
florian@15817 246
florian@15817 247 The only requirement
florian@15817 248 for box to become a <a>CSS Region</a>
florian@15817 249 is that the 'flow-from' property applies to the box.
florian@15817 250 </div>
florian@15817 251
florian@15817 252 <h2 id="css-regions-concepts">
florian@15817 253 CSS Regions concepts</h2>
florian@15817 254
florian@15817 255 <h3 id="regions">
florian@15817 256 Regions</h3>
florian@15817 257
florian@15819 258 A <dfn export>CSS Region</dfn>
florian@15817 259 is a block container
florian@15817 260 that has an associated
florian@15817 261 <em><a>named flow</a></em>
florian@15817 262 (see the 'flow-from' property).
florian@15817 263
florian@15817 264 <h3 id="region-chain-section">
florian@15817 265 Region chain</h3>
florian@15817 266
florian@15819 267 A <dfn export>region chain</dfn>
florian@15817 268 is the sequence of regions
florian@15817 269 that are associated with
florian@15817 270 a <a>named flow</a>.
florian@15817 271 <a>CSS Regions</a> in a
florian@15817 272 <a>region chain</a> receive content from the
florian@15817 273 <a>named flow</a> following their order in the chain.
florian@15817 274 <a>CSS Regions</a> are organized
florian@15817 275 into a <a>region chain</a>
florian@15817 276 according to the document order.
florian@15817 277
florian@15817 278 <h3 id="named-flow-section">
florian@15817 279 Named flows</h3>
florian@15817 280
florian@15817 281 A <dfn>named flow</dfn> is the ordered sequence of content
florian@15817 282 associated with a flow with a given identifier.
florian@15817 283 Contents in a <a>named flow</a> are ordered
florian@15817 284 according to the document order.
florian@15817 285
florian@15817 286 Content is placed into a <a>named flow</a>
florian@15817 287 with the 'flow-into' property.
florian@15817 288 The content in a <a>named flow</a> is laid out
florian@15817 289 in the <a>region chain</a>
florian@15817 290 that is associated with this <a>named flow</a>
florian@15817 291 using the 'flow-from' property.
florian@15817 292
florian@15817 293 Content from a <a>named flow</a>
florian@15817 294 is broken up between regions
florian@15817 295 according to the regions flow breaking rules.
florian@15817 296
florian@15817 297 A <a>named flow</a> is created when
florian@15817 298 some content is moved
florian@15817 299 into the flow with the given identifier
florian@15817 300 or when at least one <a>CSS Region</a>
florian@15817 301 requests content from that flow.
florian@15817 302
florian@15817 303 <h3 id="regions-flow-breaking-rules">
florian@15817 304 Regions flow breaking rules</h3>
florian@15817 305
florian@15817 306 Breaking a <a>named flow</a> across a <a>region chain</a>
florian@15817 307 is similar to breaking a document's content across pages
florian@15817 308 (see [[CSS3PAGE]])
florian@15817 309 or a multi-column element's content across column boxes
florian@15817 310 (see [[CSS3COL]]).
florian@15817 311 One difference is that page boxes are generated
florian@15817 312 based on the available content
florian@15817 313 whereas a <a>region chain</a> is a set of recipient boxes
florian@15817 314 for the <a>named flow</a> content
florian@15817 315 whose dynamic generation is not in the scope
florian@15817 316 of this specification.
florian@15817 317
florian@15817 318 Each <a>CSS Region</a> in turn
florian@15817 319 consumes content from its associated <a>named flow</a>.
florian@15817 320 The <a>named flow</a> content is positioned
florian@15817 321 in the current region
florian@15817 322 until a natural or forced region break occurs,
florian@15817 323 at which point the next region
florian@15817 324 in the <a>region chain</a>
florian@15817 325 becomes the current region.
florian@15817 326 If there are no more <a>CSS Regions</a>
florian@15817 327 in the <a>region chain</a>
florian@15817 328 and there is still content in the flow,
florian@15817 329 the positioning of the remaining content
florian@15817 330 is controlled by the 'region-fragment' property
florian@15817 331 on the last <a>CSS Region</a> in the chain.
florian@15817 332
florian@15817 333 The CSS regions module follows
florian@15817 334 the fragmentation rules defined
florian@15817 335 in the CSS Fragmentation Module Level 3
florian@15817 336 (see [[!CSS3-BREAK]]).
florian@15817 337
florian@15817 338
florian@15817 339 <h2 id="properties">
florian@15817 340 Properties</h2>
florian@15817 341
florian@15817 342 <h3 id="the-flow-into-property">
florian@15817 343 The 'flow-into' property</h3>
florian@15817 344
florian@15817 345 <div class="issue-marker wrapper">
florian@15817 346 <div class="issue-marker">
florian@15817 347 <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=16527">Issue-16527</a>
florian@15817 348 <div class="issue-details">
florian@15817 349 <p class="short-desc">[Shadow]: getFlowByName and shadow DOM</p>
florian@15817 350 </div>
florian@15817 351 </div>
florian@15817 352 </div>
florian@15817 353
florian@15817 354 The ‘flow-into’ property can place an element
florian@15817 355 or its contents
florian@15817 356 into a <a>named flow</a>.
florian@15817 357 Content that belongs to the same flow
florian@15817 358 is laid out in the <a>region chain</a>
florian@15817 359 associated with that flow.
florian@15817 360
florian@15817 361 <pre class='propdef'>
florian@15817 362 Name: flow-into
florian@15817 363 Value: none | <<ident>> [element|content]?
florian@15817 364 Initial: none
florian@15817 365 Applies To: All elements, but not <a href="http://www.w3.org/TR/selectors/#pseudo-elements">pseudo-elements</a> such as <code>::first-line</code>, <code>::first-letter</code>, <code>::before</code> or <code>::after</code>.
florian@15817 366 Inherited: no
florian@15817 367 Computed Value: as specified
florian@15817 368 Media: visual
florian@15817 369 </pre>
florian@15817 370
florian@15817 371 <dl>
florian@15817 372 <dt>none</dt>
florian@15817 373
florian@15817 374 <dd>
florian@15817 375 The element is not moved
florian@15817 376 to a <a>named flow</a>
florian@15817 377 and normal CSS processing takes place.
florian@15817 378 </dd>
florian@15817 379
florian@15817 380 <dt><a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a></dt>
florian@15817 381
florian@15817 382 <dd>
florian@15817 383 If the keyword <dfn>element</dfn> is present
florian@15817 384 or neither keyword is present,
florian@15817 385 then the element is taken out
florian@15817 386 of its parent's flow
florian@15817 387 and placed into the flow
florian@15817 388 with the name '<a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a>'.
florian@15817 389 If the keyword <dfn>content</dfn> is present,
florian@15817 390 then only the element's contents
florian@15817 391 are placed into the named flow.
florian@15817 392 The element or content is said to have
florian@15817 393 a <dfn id="specified-flow">specified flow</dfn>.
florian@15817 394 The values <code class=css>none</code>, <code class=css>inherit</code>, <code class=css>default</code>, <code class=css>auto</code> and <code class=css>initial</code>
florian@15817 395 are invalid flow names.
florian@15817 396 </dd>
florian@15817 397 </dl>
florian@15817 398
florian@15817 399 The 'flow-into' property affects
florian@15817 400 the visual formatting of elements or contents
florian@15817 401 placed into a <a>named flow</a>
florian@15817 402 and of the <a>region chain</a> laying out content
florian@15817 403 from a <a>named flow</a>.
florian@15817 404 The 'flow-into' property does not affect
florian@15817 405 the CSS cascade and inheritance
florian@15817 406 for the elements on which it is specified.
florian@15817 407 The 'flow-into' property does not affect the
florian@15817 408 <a href="http://www.w3.org/TR/2012/WD-dom-20120405/#introduction-to-the-dom">DOM</a>
florian@15817 409 [[!DOM]] position of an element or its contents.
florian@15817 410 The 'flow-into' property does not affect ordering
florian@15817 411 in non-visual media
florian@15817 412 (such as <a href="http://www.w3.org/TR/css3-speech/">speech</a>).
florian@15817 413 Likewise, 'flow-into' does not affect
florian@15817 414 the default traversal order
florian@15817 415 of sequential navigation modes
florian@15817 416 (such as cycling through links,
florian@15818 417 see e.g. <a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#sequential-focus-navigation-and-the-tabindex-attribute"><code>tabindex</code></a> [[HTML40]]).
florian@15817 418
florian@15817 419 A <a>named flow</a> needs to be associated
florian@15817 420 with a <a>region chain</a>
florian@15817 421 (one or more <a>CSS Regions</a>)
florian@15817 422 for its content to be visually formatted.
florian@15817 423 If no <a>region chain</a> is associated
florian@15817 424 with a given <a>named flow</a>,
florian@15817 425 the content in the <a>named flow</a>
florian@15817 426 is not rendered:
florian@15817 427 it does not generate boxes
florian@15817 428 and is not displayed.
florian@15817 429
florian@15817 430 The children of an element or content
florian@15817 431 with a specified flow
florian@15817 432 may themselves have a specified flow,
florian@15817 433 in which case they become
florian@15817 434 the next sibling of the latest element
florian@15817 435 or content collected in that flow.
florian@15817 436 In some cases,
florian@15817 437 the child can become the next sibling
florian@15817 438 for one of its ancestors in the same flow.
florian@15817 439
florian@15817 440 Content in a <a>named flow</a>
florian@15817 441 is sequenced in document order.
florian@15817 442 The visual formatting model
florian@15817 443 uses the relationships between content
florian@15817 444 in the named flow as input,
florian@15817 445 rather than the contents&rsquo; position
florian@15817 446 in the DOM.
florian@15817 447
florian@15817 448 Each <a>CSS Region</a> in a <a>region chain</a>
florian@15817 449 establishes a containing block for absolutely positioned
florian@15817 450 elements in the <a>named flow</a> (see [[!CSS21]]).
florian@15817 451 That first <a>CSS Region</a> in a <a>region chain</a>
florian@15817 452 establishes the initial containing block for such absolutely
florian@15817 453 positioned elements.
florian@15817 454 <span>Regions</span> don't establish a containing block for
florian@15817 455 fixed positioned elements in the <a>named flow</a>.
florian@15817 456 Such fixed positioned elements are still positioned relative
florian@15817 457 to the viewport or the page area even if they have been
florian@15817 458 redirected into a named flow
florian@15817 459
florian@15817 460 The first region defines the principal
florian@15817 461 <a href="http://www.w3.org/TR/css3-writing-modes/#writing-mode">writing mode</a>
florian@15817 462 for the entire flow.
florian@15817 463 The writing mode
florian@15817 464 on subsequent regions is ignored.
florian@15817 465
florian@15817 466 <div class="note"><span class="note-prefix">Note </span>
florian@15817 467
florian@15817 468 The 'flow-into' property moves an element into the flow
florian@15817 469 and the interplay with selectors should be considered carefully.
florian@15817 470
florian@15817 471 For example,
florian@15817 472
florian@15817 473 <pre>table {flow-into: table-content}</pre>
florian@15817 474
florian@15817 475 will move all tables in the "table-content"
florian@15817 476 <a>named flow</a>.
florian@15817 477 However, the
florian@15817 478
florian@15817 479 <pre>table &gt; * {flow-into: table-content} ...</pre>
florian@15817 480
florian@15817 481 selector will move all immediate children
florian@15817 482 of all table elements
florian@15817 483 into the "table-content" <a>named flow</a>
florian@15817 484 (which may be useful as it will usually result,
florian@15817 485 if the immediate children are rows,
florian@15817 486 in merging rows of multiple tables),
florian@15817 487 but the
florian@15817 488
florian@15817 489 <pre>table * {flow-into: table-content}</pre>
florian@15817 490
florian@15817 491 selector will move all descendants
florian@15817 492 of table elements into the "table-content" <a>named flow</a>,
florian@15817 493 transforming the element tree
florian@15817 494 into a flat list in order of opening tags
florian@15817 495 (which is probably not intentional).
florian@15817 496 This will make all the descendants
florian@15817 497 of table elements siblings
florian@15817 498 in the <a>named flow</a>.
florian@15817 499 Having the descendants become siblings
florian@15817 500 in the <a>named flow</a>
florian@15817 501 results in a different processing
florian@15817 502 (see <a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/tables.html#anonymous-boxes">CSS 2.1's anonymous table objects</a>).
florian@15817 503 This note illustrates how authors must exercise caution
florian@15817 504 when choosing a particular selector
florian@15817 505 for setting the 'flow-into' property
florian@15817 506 to avoid unintended results.
florian@15817 507 </div>
florian@15817 508
florian@15817 509 <div class="note"><span class="note-prefix">Note </span>
florian@15817 510
florian@15817 511 Another consequence of moving elements
florian@15817 512 into <a>named flows</a> is that surrounding whitespace
florian@15817 513 is not moved into the named flow.
florian@15817 514 If you have code like this:
florian@15817 515
florian@15817 516 <pre>
florian@15817 517 span {flow-into: span-content}
florian@15817 518 &lt;span&gt;one&lt;/span&gt;
florian@15817 519 &lt;span&gt;two&lt;/span&gt;
florian@15817 520 </pre>
florian@15817 521
florian@15817 522 Then the "span-content" named flow contents
florian@15817 523 will contain this:
florian@15817 524
florian@15817 525 <pre>
florian@15817 526 &lt;span&gt;one&lt;/span&gt;&lt;span&gt;two&lt;/span&gt;
florian@15817 527 </pre>
florian@15817 528
florian@15817 529 Which will change the display
florian@15817 530 from "one two" to "onetwo".
florian@15817 531 If whitespace is significant,
florian@15817 532 then moving the parent
florian@15817 533 that contains the whitespace
florian@15817 534 to the named flow
florian@15817 535 is required.
florian@15817 536 </div>
florian@15817 537
florian@15817 538 <h3 id="flow-from">
florian@15817 539 The 'flow-from' property</h3>
florian@15817 540
florian@15817 541 The 'flow-from' property makes
florian@15817 542 a block container a region
florian@15817 543 and associates it with
florian@15817 544 a <a>named flow</a>.
florian@15817 545
florian@15817 546 <pre class='propdef'>
florian@15817 547 Name: flow-from
florian@15817 548 Value: <<ident>> | none | inherit
florian@15817 549 Initial: none
florian@15817 550 Applies To: Non-replaced <a href="http://www.w3.org/TR/CSS21/visuren.html#block-boxes">block containers</a>. <br/> This might be expanded in future versions of the specification to allow other types of containers to receive flow content.
florian@15817 551 Inherited: no
florian@15817 552 Computed Value: as specified
florian@15817 553 Media: visual
florian@15817 554 </pre>
florian@15817 555
florian@15817 556 <dl>
florian@15817 557 <dt><strong>none</strong></dt>
florian@15817 558
florian@15817 559 <dd>
florian@15817 560 The block container is not a <a>CSS Region</a>.
florian@15817 561 </dd>
florian@15817 562
florian@15817 563 <dt><strong><a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a></strong></dt>
florian@15817 564
florian@15817 565 <dd>
florian@15817 566 The block container becomes a <a>CSS Region</a>
florian@15817 567 (except as detailed in the text below),
florian@15817 568 and is ordered in a <a>region chain</a>
florian@15817 569 according to its document order.
florian@15817 570 The content from the flow
florian@15817 571 with the <a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a>
florian@15817 572 name will be <a href="#region-flow-break">broken
florian@15817 573 into fragments</a> and visually formatted in the
florian@15817 574 <a href="http://www.w3.org/TR/CSS21/visuren.html#principal-box">principal boxes</a>
florian@15817 575 of the <span>regions</span>
florian@15817 576 in the <a>region chain</a>.
florian@15817 577 <br/>
florian@15817 578 If there is no flow with name
florian@15817 579 <a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a>,
florian@15817 580 then the block container does not
florian@15817 581 format any content visually.
florian@15817 582 </dd>
florian@15817 583 </dl>
florian@15817 584
florian@15817 585 If the 'content' property computes
florian@15817 586 to something else than ''content/normal''
florian@15817 587 (or ''content/none'' for a pseudo-element),
florian@15817 588 the block container does not become
florian@15817 589 a <a>CSS Region</a>.
florian@15817 590 If the 'display' property
florian@15817 591 of the block container
florian@15817 592 or one of its ancestors
florian@15817 593 computes to ''display/none'',
florian@15817 594 the block container does not become
florian@15817 595 a <a>CSS Region</a>.
florian@15817 596
florian@15817 597 A <a>CSS Region</a>&rsquo;s document children
florian@15817 598 are not visually formatted
florian@15817 599 unless they are directed
florian@15817 600 to a <a>named flow</a>
florian@15817 601 with an associated <a>region chain</a>.
florian@15817 602
florian@15817 603 Block container pseudo-elements where
florian@15817 604 the value of 'flow-from' computes to an
florian@15817 605 <a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a>
florian@15817 606 and the value of 'content' computes to ''content/none''
florian@15817 607 are generated as <a>CSS Regions</a>,
florian@15817 608 which is an update to the behavior
florian@15817 609 described in [[!CSS21]].
florian@15817 610
florian@15817 611 <div class="note"><span class="note-prefix">Note </span>
florian@15817 612
florian@15817 613 A block container becomes a <a>CSS Region</a>
florian@15817 614 when its 'flow-from' property is set
florian@15817 615 to a valid <a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a> value,
florian@15817 616 even if there is no content contributing
florian@15817 617 to the referenced flow.
florian@15817 618 For example:
florian@15817 619
florian@15817 620 <pre>
florian@15817 621 &lt;style&gt;
florian@15817 622 .article{
florian@15817 623 flow-into: thread;
florian@15817 624 }
florian@15817 625 .region{
florian@15817 626 flow-from: thread;
florian@15817 627 }
florian@15817 628 &lt;/style&gt;
florian@15817 629 &lt;html&gt;
florian@15817 630 &lt;body&gt;
florian@15817 631 &lt;div class=region&gt;div content&lt;/div&gt;
florian@15817 632 &lt;/body&gt;
florian@15817 633 &lt;/html&gt;
florian@15817 634 </pre>
florian@15817 635
florian@15817 636 There is no element matching
florian@15817 637 the <code>.article</code> selector
florian@15817 638 and therefore no content
florian@15817 639 in the <code>thread</code> flow.
florian@15817 640 However, the block container matching
florian@15817 641 the <code>.region</code> selector
florian@15817 642 is still associated with
florian@15817 643 that empty <a>named flow</a>
florian@15817 644 and, consequently,
florian@15817 645 its children are not formatted visually.
florian@15817 646 </div>
florian@15817 647
florian@15817 648 <div class=note><span class=note-prefix>Note </span>
florian@15817 649
florian@15817 650 At the time of this note-writing, the <code>display</code> values that
florian@15817 651 always result in a non-replaced block container include
florian@15817 652 <code>block</code>, <code>inline-block</code>, <code>table-cell</code>,
florian@15817 653 <code>table-caption</code>, and <code>list-item</code>. All of these
florian@15817 654 display values work as regions with non-replaced elements.
florian@15817 655
florian@15817 656 The <code>flex</code> and <code>grid</code> display values do not
florian@15817 657 result in block containers (they are defined as flex containers and grid
florian@15817 658 elements, respectively). So ‘<a href="#flow-from"><code
florian@15817 659 class=property>flow-from</code></a>’ combined with those display values
florian@15817 660 does not result in a <a>CSS Region</a>.
florian@15817 661 </div>
florian@15817 662
florian@15817 663 <a>CSS Regions</a>
florian@15817 664 create a new
florian@15817 665 <a href="http://www.w3.org/TR/CSS2/visuren.html#z-index">stacking context</a>.
florian@15817 666 <a>CSS Regions</a>
florian@15817 667 establish a new
florian@15817 668 <a href="http://www.w3.org/TR/CSS2/visuren.html#block-formatting">block formatting Context</a>.
florian@15817 669 Exclusions (see [[CSS3-EXCLUSIONS]])
florian@15817 670 potentially impact the content
florian@15817 671 laid out in <a>region chains</a>,
florian@15817 672 just as for non-regions.
florian@15817 673
florian@15817 674 <div class="note"><span class="note-prefix">Note </span>
florian@15817 675
florian@15817 676 With <a>region chains</a>,
florian@15817 677 an element may be split across multiple boxes
florian@15817 678 and these boxes may overlap
florian@15817 679 (for example if they are absolutely positioned).
florian@15817 680 So fragments of the same element
florian@15817 681 can overlap each other.
florian@15817 682 Since each element has a single z-index,
florian@15817 683 it would be required to find another mechanism
florian@15817 684 to decide in which order
florian@15817 685 the fragments are rendered.
florian@15817 686 Since each <a>CSS Region</a> creates
florian@15817 687 a new stacking context,
florian@15817 688 it is clear that each fragment is rendered separately
florian@15817 689 and their rendering order follows
florian@15817 690 the regular CSS rendering model.
florian@15817 691
florian@15817 692 Fragments rendering separately
florian@15817 693 is also relevant to elements that might normally
florian@15817 694 be rendered as a unit
florian@15817 695 (for example,
florian@15817 696 an element with its own stacking context,
florian@15817 697 or with transparency).
florian@15817 698 Each fragment of these elements
florian@15817 699 is separately contained in the stacking context
florian@15817 700 created by the <a>CSS Region</a>,
florian@15817 701 so each fragment of these elements
florian@15817 702 is rendered separately.
florian@15817 703 </div>
florian@15817 704
florian@15817 705 See the
florian@15817 706 <a href="#regions-visual-formatting-details">regions visual formatting details</a>
florian@15817 707 section for a description of how
florian@15817 708 'width' and 'height' values are resolved
florian@15817 709 for <a>CSS Region</a> boxes.
florian@15817 710
florian@15817 711 <h4 id="circular-dependencies">
florian@15817 712 Cycle Detection</h4>
florian@15817 713
florian@15817 714 <a>named flows</a> containing elements
florian@15817 715 where the value of 'flow-from' computes to an
florian@15817 716 <a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a>
florian@15817 717 can produce nonsensical circular relationships,
florian@15817 718 such as a <a>named flow</a>
florian@15817 719 containing <a>CSS Regions</a>
florian@15817 720 in its own <a>region chain</a>.
florian@15817 721 These relationships can be easily
florian@15817 722 and reliably detected and resolved, however,
florian@15817 723 by keeping track of a dependency graph
florian@15817 724 and using common cycle-detection algorithms.
florian@15817 725
florian@15817 726 The dependency graph consists of edges such that:
florian@15817 727
florian@15817 728 <ul>
florian@15817 729 <li>
florian@15817 730 Every <a>named flow</a> depends on its elements
florian@15817 731 where the value of 'flow-from' computes to an
florian@15817 732 <a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a>.
florian@15817 733 </li>
florian@15817 734 <li>
florian@15817 735 Every element in a <a>named flow</a>
florian@15817 736 where the value of 'flow-from' computes to an
florian@15817 737 <a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a>
florian@15817 738 depends on the <a>named flow</a> with the
florian@15817 739 <a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a>
florian@15817 740 name.
florian@15817 741 </li>
florian@15817 742 </ul>
florian@15817 743
florian@15817 744 If the graph contains a cycle,
florian@15817 745 any elements where the value of 'flow-from'
florian@15817 746 computes to an
florian@15817 747 <a href="http://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#value-def-identifier">&lt;ident&gt;</a>
florian@15817 748 participating in the cycle
florian@15817 749 do not become <a>CSS Regions</a>.
florian@15817 750
florian@15817 751 <div class="note"><span class="note-prefix">Note </span>
florian@15817 752
florian@15817 753 For example, styling like this:
florian@15817 754
florian@15817 755 <pre>
florian@15817 756 #id {
florian@15817 757 flow-into: foolish;
florian@15817 758 flow-from: foolish;
florian@15817 759 }
florian@15817 760 </pre>
florian@15817 761
florian@15817 762 would move the <code>#id</code> element to a "foolish" <a>named flow</a>,
florian@15817 763 and try to make the <code>#id</code> element
florian@15817 764 a <a>CSS Region</a> for the "foolish" <a>named flow</a>.
florian@15817 765 The "foolish" <a>named flow</a> would then contain its own region,
florian@15817 766 creating a cycle.
florian@15817 767 So the <code>#id</code> element does not become a <a>CSS Region</a>.
florian@15817 768 </div>
florian@15817 769
florian@15817 770 <div class="note"><span class="note-prefix">Note </span>
florian@15817 771
florian@15817 772 The content keyword can be used to break cycles in some circumstances:
florian@15817 773
florian@15817 774 <pre>
florian@15817 775 #id {
florian@15817 776 flow-into: not-so-foolish content;
florian@15817 777 flow-from: not-so-foolish;
florian@15817 778 }
florian@15817 779 </pre>
florian@15817 780
florian@15817 781 Here only the contents of the <code>#id</code> element are moved to the <a>named flow</a>, and the box for the <code>#id</code> element <em>does</em> become a <a>CSS Region</a>. Since the <a>named flow</a> does not contain the element itself, there is no cycle. With this declaration the <code>#id</code> element becomes a single-box <a>region chain</a> for its contents, and other boxes could be added to the chain to customize overflow.
florian@15817 782 </div>
florian@15817 783
florian@15817 784 <h4 id="fragmenting-regions">
florian@15817 785 Nested fragmentation contexts</h4>
florian@15817 786
florian@15817 787 A <a>CSS Region</a> that contains
florian@15817 788 a fragment of a <a>named flow</a>
florian@15817 789 can itself be fragmented if it is nested
florian@15817 790 within a fragmentation context [[!CSS3-BREAK]],
florian@15817 791 such as when a layout
florian@15817 792 using a <a>region chain</a> is printed.
florian@15817 793 In these cases break opportunities
florian@15817 794 in the named flow fragment
florian@15817 795 contained by the <a>CSS Region</a>
florian@15817 796 are determined using the standard
florian@15817 797 <a href="http://www.w3.org/TR/css3-break/">fragmentation rules</a>.
florian@15817 798 In other words,
florian@15817 799 each region box and its associated fragment
florian@15817 800 should break as if it were a simple div
florian@15817 801 containing the fragment contents.
florian@15817 802 This can be controlled by using
florian@15817 803 an avoid break value on the <a>CSS Region</a>,
florian@15817 804 if that is desired.
florian@15817 805
florian@15817 806 A <a>CSS Region</a> can be part
florian@15817 807 of the contents of a separate named flow,
florian@15817 808 as long as there are no cycles broken
florian@15817 809 by the <a href="#circular-dependencies">Cycle Detection</a>
florian@15817 810 described above.
florian@15817 811 This case is a <dfn>nested region context</dfn>,
florian@15817 812 which has an effect
florian@15817 813 on the <a href="#regions-visual-formatting-steps">Visual Formatting Steps</a>
florian@15817 814 described below.
florian@15817 815
florian@15817 816 <h3 id="region-flow-break">
florian@15817 817 Region flow break properties: 'break-before', 'break-after', 'break-inside'</h3>
florian@15817 818
florian@15817 819 <div class="note"><span class="note-prefix">Note </span>
florian@15817 820
florian@15817 821 This section is also defined in [[!CSS3-BREAK]].
florian@15817 822 If that specification moves to last call
florian@15817 823 with the region values,
florian@15817 824 the section here can be replaced by a reference.
florian@15817 825 </div>
florian@15817 826
florian@15817 827 User agents laying out content in multiple regions
florian@15817 828 must determine where content breaks occur.
florian@15817 829 The problem of breaking content into fragments fitting in regions
florian@15817 830 is similar to breaking content into pages or columns.
florian@15817 831
florian@15817 832 Each break ends layout in the current region
florian@15817 833 and causes remaining pieces of content
florian@15817 834 from the <a>named flow</a> to be visually formatted
florian@15817 835 in the following region in the <a>region chain</a>,
florian@15817 836 if there is one.
florian@15817 837
florian@15817 838 The following extends
florian@15817 839 the 'break-before', 'break-after' and 'break-inside' properties
florian@15817 840 from the [[!CSS3COL]] specification to account for regions.
florian@15817 841 The additional values are described below.
florian@15817 842
florian@15817 843 <pre class='propdef'>
florian@15817 844 Name: break-before
florian@15817 845 Value: auto | always | avoid | left | right | page | column | region | avoid-page | avoid-column | avoid-region
florian@15817 846 Initial: auto
florian@15817 847 Applies To: block-level elements
florian@15817 848 Inherited: no
florian@15817 849 Computed Value: as specified
florian@15817 850 Media: visual
florian@15817 851 </pre>
florian@15817 852
florian@15817 853 <pre class='propdef'>
florian@15817 854 Name: break-after
florian@15817 855 Value: auto | always | avoid | left | right | page | column | region | avoid-page | avoid-column | avoid-region
florian@15817 856 Initial: auto
florian@15817 857 Applies To: block-level elements
florian@15817 858 Inherited: no
florian@15817 859 Computed Value: as specified
florian@15817 860 Media: visual
florian@15817 861 </pre>
florian@15817 862
florian@15817 863 <pre class='propdef'>
florian@15817 864 Name: break-inside
florian@15817 865 Value: auto | avoid | avoid-page | avoid-column | avoid-region
florian@15817 866 Initial: auto
florian@15817 867 Applies To: block-level elements
florian@15817 868 Inherited: no
florian@15817 869 Computed Value: as specified
florian@15817 870 Media: visual
florian@15817 871 </pre>
florian@15817 872
florian@15817 873 These properties describe page, column and region break behavior
florian@15817 874 before/after/inside the generated box. These values are normatively defined
florian@15817 875 in [[!CSS3COL]]:
florian@15817 876
florian@15817 877 This specification adds the following new values:
florian@15817 878
florian@15817 879 <dl>
florian@15817 880 <dt>region</dt>
florian@15817 881
florian@15817 882 <dd>Always force a region break before (after) the generated box.</dd>
florian@15817 883
florian@15817 884 <dt>avoid-region</dt>
florian@15817 885
florian@15817 886 <dd>Avoid a region break before (after, inside) the generated box.</dd>
florian@15817 887 </dl>
florian@15817 888
florian@15817 889 The behavior of region breaks with regards to regions
florian@15817 890 is identical to the behavior of page breaks with regards to pages,
florian@15817 891 as defined in the [[!CSS21]].
florian@15817 892
florian@15817 893 <h3 id="the-region-fragment-property">
florian@15817 894 The region-fragment property</h3>
florian@15817 895
florian@15817 896 <pre class='propdef'>
florian@15817 897 Name: region-fragment
florian@15817 898 Value: auto | break
florian@15817 899 Initial: auto
florian@15817 900 Applies To: <a>CSS Regions</a>
florian@15817 901 Inherited: no
florian@15817 902 Computed Value: as specified
florian@15817 903 Media: visual
florian@15817 904 </pre>
florian@15817 905
florian@15817 906 The 'region-fragment' property controls the behavior
florian@15817 907 of the <em id="last-region">last region</em>
florian@15817 908 associated with a <a>named flow</a>.
florian@15817 909
florian@15817 910 <dl>
florian@15817 911 <dt>auto</dt>
florian@15817 912
florian@15817 913 <dd>
florian@15817 914 Content flows as it would in a regular content box.
florian@15817 915 If the content exceeds the container box,
florian@15817 916 it is subject to the
florian@15817 917 <a href= "http://www.w3.org/TR/CSS21/visufx.html#propdef-overflow">overflow</a>
florian@15817 918 property's computed value on the <a>CSS Region</a>.
florian@15817 919 Region breaks must be ignored on the last region.
florian@15817 920 </dd>
florian@15817 921
florian@15817 922 <dt>break</dt>
florian@15817 923
florian@15817 924 <dd>
florian@15817 925
florian@15817 926 If the content fits within the <a>CSS Region</a>,
florian@15817 927 then this property has no effect.
florian@15817 928 If the content does not fit within the <a>CSS Region</a>,
florian@15817 929 the content breaks as if flow was going to continue in a subsequent region.
florian@15817 930 See the <a href= "#regions-flow-breaking-rules">breaking rules</a> section.
florian@15817 931 A forced region break takes precedence over a natural break point.
florian@15817 932
florian@15817 933 Flow content that follows the last break in the last region is not rendered.
florian@15817 934 </dd>
florian@15817 935 </dl>
florian@15817 936
florian@15817 937 The 'region-fragment' property does not influence
florian@15817 938 the size of the region it applies to.
florian@15817 939
florian@15817 940 The following code sample illustrates
florian@15817 941 the usage of the 'region-fragment' property.
florian@15817 942
florian@15817 943 <div class="example">
florian@15817 944 <pre>
florian@15817 945 &lt;style&gt;
florian@15817 946 article {
florian@15817 947 flow-into: article-flow;
florian@15817 948 }
florian@15817 949 #region-1, #region-2 {
florian@15817 950 flow-from: article-flow;
florian@15817 951 <strong>region-fragment: break;</strong> /* or auto */
florian@15817 952 <strong>overflow: visible;</strong> /* or hidden */
florian@15817 953 }
florian@15817 954 &lt;/style&gt;
florian@15817 955
florian@15817 956 &lt;body&gt;
florian@15817 957 &lt;article&gt;...&lt;/article&gt;
florian@15817 958 &lt;div id="region-1"&gt;&lt;/div&gt;
florian@15817 959 &lt;div id="region-2"&gt;&lt;/div&gt;
florian@15817 960 &lt;/body&gt;
florian@15817 961 </pre>
florian@15817 962 </div>
florian@15817 963
florian@15817 964 <figure>
florian@15817 965 <table style="border: 1px solid gray;width: 100%;">
florian@15817 966 <tr>
florian@15817 967 <td>article with two<br>
florian@15817 968 overflowing lines</td>
florian@15817 969
florian@15817 970 <td><code>region-fragment: break<br>
florian@15817 971 overflow: visible</code></td>
florian@15817 972
florian@15817 973 <td><code>region-fragment: auto<br>
florian@15817 974 overflow: visible</code></td>
florian@15817 975 </tr>
florian@15817 976
florian@15817 977 <tr>
florian@15817 978 <td rowspan="3" style="vertical-align: top;"><img src=
florian@15817 979 "images/region-overflow-flow.png" alt=
florian@15817 980 "flow content rendering"></td>
florian@15817 981
florian@15817 982 <td><img src="images/region-overflow-break-visible.png" alt=
florian@15817 983 "rendering with region-fragment:break and overflow:visible"></td>
florian@15817 984
florian@15817 985 <td><img src="images/region-overflow-auto-visible.png"
florian@15817 986 alt="rendering with region-fragment:auto and overflow:visible"></td>
florian@15817 987 </tr>
florian@15817 988
florian@15817 989 <tr>
florian@15817 990 <td><code>region-fragment: break<br>
florian@15817 991 overflow: hidden</code></td>
florian@15817 992
florian@15817 993 <td><code>region-fragment: auto<br>
florian@15817 994 overflow: hidden</code></td>
florian@15817 995 </tr>
florian@15817 996
florian@15817 997 <tr>
florian@15817 998 <td><img src="images/region-overflow-break-hidden.png" alt=
florian@15817 999 "rendering with region-fragment:break and overflow:hidden"></td>
florian@15817 1000
florian@15817 1001 <td><img src="images/region-overflow-auto-hidden.png"
florian@15817 1002 alt="rendering with region-fragment:auto and overflow:hidden"></td>
florian@15817 1003 </tr>
florian@15817 1004 </table>
florian@15817 1005
florian@15817 1006 <figcaption>
florian@15817 1007 Combinations of region-fragment and overflow.
florian@15817 1008 </figcaption>
florian@15817 1009 </figure>
florian@15817 1010
florian@15817 1011 <div class="note"><span class="note-prefix">Note </span>
florian@15817 1012
florian@15817 1013 The 'overflow' property is honored on a region:
florian@15817 1014 if region content overflows,
florian@15817 1015 such as the borders of elements
florian@15817 1016 on the last line,
florian@15817 1017 the 'overflow' property controls
florian@15817 1018 the visibility of the overflowing content.
florian@15817 1019 See the 'overflow' property definition ([[CSS21]]).
florian@15817 1020 </div>
florian@15817 1021
florian@15817 1022 <h2 id="cssom_view_and_css_regions">
florian@15817 1023 CSSOM</h2>
florian@15817 1024
florian@15817 1025 Since content may flow into multiple regions,
florian@15817 1026 authors need a way to determine if there are enough regions
florian@15817 1027 to flow all the content from a named flow.
florian@15817 1028 This is especially important considering that the size of regions
florian@15817 1029 or the size of the content may change depending on the display context.
florian@15817 1030 For example,
florian@15817 1031 flowing the same content on a mobile phone with a small screen
florian@15817 1032 may require more regions than on a large desktop display.
florian@15817 1033 Another example is the user changing
florian@15817 1034 the font size of text flowing through regions.
florian@15817 1035 Depending on the change,
florian@15817 1036 new regions may be needed to accommodate for the additional space required
florian@15817 1037 to fit the larger text or some regions may need to be removed for smaller text.
florian@15817 1038
florian@15817 1039 <h3 id="the-namedflow-interface">
florian@15817 1040 The NamedFlow interface</h3>
florian@15817 1041
florian@15817 1042 The following APIs allow scripts
florian@15817 1043 to reference a <a idl>NamedFlow</a>
florian@15817 1044 object representation of a <a>named flow</a>.
florian@15817 1045
florian@15817 1046 An additional attribute on the
florian@15817 1047 <a href= "http://www.w3.org/TR/dom/#interface-document">
florian@15817 1048 <code class= "idl">Document</code></a>
florian@15817 1049 interface provide access to <a>named flows</a>.
florian@15817 1050
florian@15817 1051 <pre class="idl">
florian@15817 1052 partial interface Document {
florian@15817 1053 readonly attribute NamedFlowMap namedFlows;
florian@15817 1054 };
florian@15817 1055 </pre>
florian@15817 1056
florian@15817 1057 The
florian@15817 1058 <dfn id="document-namedflows"><code class="idl">namedFlows</code></dfn>
florian@15817 1059 attribute on the
florian@15817 1060 <a href= "http://www.w3.org/TR/dom/#interface-document">
florian@15817 1061 <code class= "idl">Document</code>
florian@15817 1062 </a>
florian@15817 1063 interface returns a static snapshot
florian@15817 1064 of all the current <a>named flows</a>
florian@15817 1065 in the document.
florian@15817 1066
florian@15817 1067 The <dfn attribute for="Document"><code class="idl">namedFlows</code></dfn>
florian@15817 1068 map must include all <a>named flows</a>
florian@15817 1069 that are currently in the <code>CREATED</code> state.
florian@15817 1070 The list must not include <a>named flows</a>
florian@15817 1071 that are in the <code>NULL</code> state.
florian@15817 1072
florian@15817 1073 The
florian@15817 1074 {{NamedFlowMap}}
florian@15817 1075 interface provides a map of current
florian@15817 1076 <a idl>NamedFlow</a> instances
florian@15817 1077 in the document.
florian@15817 1078 The <a idl>NamedFlowMap</a> object
florian@15817 1079 is a snapshot of the data,
florian@15817 1080 and is read-only.
florian@15817 1081
florian@15817 1082 <pre class="idl">
florian@15817 1083 [MapClass(DOMString, NamedFlow)] interface NamedFlowMap {
florian@15817 1084 NamedFlow? get(DOMString flowName);
florian@15817 1085 boolean has(DOMString flowName);
florian@15817 1086 NamedFlowMap set(DOMString flowName, NamedFlow flowValue);
florian@15817 1087 boolean delete(DOMString flowName);
florian@15817 1088 };
florian@15817 1089 </pre>
florian@15817 1090
florian@15817 1091 The map entries in a
florian@15817 1092 <a idl>NamedFlowMap</a> object
florian@15817 1093 are the named flow idents
florian@15817 1094 paired with their
florian@15817 1095 <a idl>NamedFlow</a> objects.
florian@15817 1096 The <dfn method for="NamedFlowMap">get()</dfn>
florian@15817 1097 and <dfn method for="NamedFlowMap">has()</dfn>
florian@15817 1098 methods return null and false respectively
florian@15817 1099 if there is no <a idl>NamedFlow</a>
florian@15817 1100 with the given ident.
florian@15817 1101 The <dfn method for="NamedFlowMap">set()</dfn>
florian@15817 1102 and <dfn method for="NamedFlowMap">delete()</dfn>
florian@15817 1103 methods always throw an
florian@15817 1104 <code>InvalidAccessError</code> exception,
florian@15817 1105 as this map is read-only.
florian@15817 1106 The <a idl>NamedFlowMap</a> interface
florian@15817 1107 uses the rest of the default map
florian@15817 1108 <a href="http://dev.w3.org/2006/webapi/WebIDL/#es-map-members">class methods</a>.
florian@15817 1109
florian@15817 1110 The {{NamedFlow}}
florian@15817 1111 interface offers a representation
florian@15817 1112 of a <a>named flow</a> instance.
florian@15817 1113
florian@15817 1114 The <a idl>NamedFlow</a> interface
florian@15817 1115 can be used for different purposes.
florian@15817 1116 For example, the <code>getRegionsByContent()</code> method
florian@15817 1117 can help navigate by bookmark:
florian@15817 1118 a script can find the <a>CSS Regions</a>
florian@15817 1119 that display a particular anchor
florian@15817 1120 and bring them to view.
florian@15817 1121
florian@15817 1122 Likewise, the interface allows authors
florian@15817 1123 to check if all content has been fitted
florian@15817 1124 into existing regions.
florian@15817 1125 If it has, the <a idl>overset</a> attribute
florian@15817 1126 would be false.
florian@15817 1127
florian@15817 1128 <pre class="idl">
florian@15817 1129 interface NamedFlow : EventTarget {
florian@15817 1130 readonly attribute DOMString name;
florian@15817 1131 readonly attribute boolean overset;
florian@15817 1132 sequence&lt;Region&gt; getRegions();
florian@15817 1133 readonly attribute short firstEmptyRegionIndex;
florian@15817 1134 sequence&lt;Node&gt; getContent();
florian@15817 1135 sequence&lt;Region&gt; getRegionsByContent(Node node);
florian@15817 1136 };
florian@15817 1137 </pre>
florian@15817 1138
florian@15817 1139 The <dfn attribute for="NamedFlow"><code class="idl">name</code></dfn> attribute
florian@15817 1140 returns the name of the <a idl>NamedFlow</a> instance.
florian@15817 1141
florian@15817 1142 The <dfn attribute for="NamedFlow"><code class="idl">overset</code></dfn>
florian@15817 1143 attribute returns true
florian@15817 1144 if there are <a>named flow</a> fragments
florian@15817 1145 that do not fit
florian@15817 1146 in the associated <a>region chain</a>
florian@15817 1147 (including the case where
florian@15817 1148 there are <a>named flow</a> fragments
florian@15817 1149 but no regions in the <a>region chain</a>).
florian@15817 1150 Otherwise, it returns false.
florian@15817 1151
florian@15817 1152 The <dfn method for="NamedFlow"><code class="idl">getRegions()</code></dfn>
florian@15817 1153 method returns the sequence
florian@15817 1154 of regions in the <a>region chain</a>
florian@15817 1155 associated with the <a>named flow</a>.
florian@15817 1156 Note that the returned values
florian@15817 1157 is a static sequence
florian@15817 1158 in document order.
florian@15817 1159
florian@15817 1160 The <dfn attribute for="NamedFlow">firstEmptyRegionIndex</dfn>
florian@15817 1161 is the index of the first region
florian@15817 1162 in the <a>region chain</a> with the <code>regionOverset</code> attribute
florian@15817 1163 set to <code>empty</code>.
florian@15817 1164 If all regions have the <code>regionOverset</code> attribute
florian@15817 1165 set to <code>fit</code> or <code>overset</code>,
florian@15817 1166 the value for <code>firstEmptyRegionIndex</code> is <code>-1</code>.
florian@15817 1167 If there are no regions in the <a>region chain</a>,
florian@15817 1168 the value is <code>-1</code> as well.
florian@15817 1169
florian@15817 1170 The <dfn method for="NamedFlow">getContent()</dfn>
florian@15817 1171 method returns an ordered collection
florian@15817 1172 of nodes that constitute the <a>named flow</a>.
florian@15817 1173 The returned list is a static snapshot
florian@15817 1174 of the <a>named flow</a> content
florian@15817 1175 at the time the method is invoked.
florian@15817 1176 This list contains the contents
florian@15817 1177 that were moved to the <a>named flow</a>
florian@15817 1178 by the flow-into property
florian@15817 1179 but not any descendants
florian@15817 1180 (unless the descendants are themselves
florian@15817 1181 moved to the <a>named flow</a>).
florian@15817 1182
florian@15817 1183 The <dfn method for="NamedFlow">getRegionsByContent()</dfn>
florian@15817 1184 method returns the sequence of regions
florian@15817 1185 that contain at least part
florian@15817 1186 of the target content node
florian@15817 1187 if it belongs to the <a>named flow</a> directly
florian@15817 1188 or one of its ancestors belongs to the <a>named flow</a>.
florian@15817 1189 Otherwise, the method returns
florian@15817 1190 an empty sequence.
florian@15817 1191 The returned value
florian@15817 1192 is a static sequence
florian@15817 1193 in document order.
florian@15817 1194
florian@15817 1195 The <a>named flow</a> states are :
florian@15817 1196
florian@15817 1197 <ul>
florian@15817 1198 <li>
florian@15817 1199 <code class="idl">NULL</code>: the <a>named flow</a>
florian@15817 1200 contains no conent and has no <a>region chain</a>.
florian@15817 1201 </li>
florian@15817 1202 <li>
florian@15817 1203 <code class="idl">CREATED</code>: the <a>named flow</a>
florian@15817 1204 either contains content or has a <a>region chain</a>.
florian@15817 1205 </li>
florian@15817 1206 </ul>
florian@15817 1207
florian@15817 1208 A <a idl>NamedFlow</a> object is live:
florian@15817 1209 it always represents the <a>named flow</a>
florian@15817 1210 with the corresponding name even if
florian@15817 1211 that <a>named flow</a> has transitioned
florian@15817 1212 to the <code>NULL</code> state.
florian@15817 1213
florian@15817 1214 <h3 id="the-region-interface">
florian@15817 1215 The Region interface</h3>
florian@15817 1216
florian@15817 1217 The {{Region}}
florian@15817 1218 interface is a
florian@15817 1219 <a href="http://www.w3.org/TR/WebIDL/#idl-implements-statements">supplemental interface</a>
florian@15817 1220 which must be implemented by all objects
florian@15817 1221 (<a href="http://www.w3.org/TR/dom/#interface-element">
florian@15817 1222 <code class= "idl">Elements</code></a>,
florian@15817 1223 pseudo-elements or other CSS constructs
peter@16986 1224 such as <a href="https://drafts.csswg.org/css3-page-template/#templates-and-slots">slots</a>) in an implementation which can be <a>CSS Regions</a>.
florian@15817 1225
florian@15817 1226 <pre class="idl">
florian@15817 1227 [NoInterfaceObject]
florian@15817 1228 interface Region {
florian@15817 1229 readonly attribute DOMString regionOverset;
florian@15817 1230 sequence&lt;Range&gt;? getRegionFlowRanges();
florian@15817 1231 };
florian@15817 1232
florian@15817 1233 Element implements Region;
florian@15817 1234 </pre>
florian@15817 1235
florian@15817 1236 The <dfn attribute for="Region"><code class= "idl">regionOverset</code></dfn>
florian@15817 1237 attribute returns one of the following values:
florian@15817 1238
florian@15817 1239 <dl>
florian@15817 1240 <dt>''overset''</dt>
florian@15817 1241
florian@15817 1242 <dd>
florian@15817 1243 The region is the last one in the
florian@15817 1244 <a>region chain</a> and
florian@15817 1245 not able to fit the remaining content from the <a>named flow</a>.
florian@15817 1246 Note that the region's
florian@15817 1247 <a href= "http://www.w3.org/TR/CSS21/visufx.html#overflow">
florian@15817 1248 <code class= "idl">overflow</code></a>
florian@15817 1249 property value can be used to control the
florian@15817 1250 visibility of the overflowing content and the
florian@15817 1251 'region-fragment' property controls whether or not fragmentation happens
florian@15817 1252 on the content that overflows the last region.
florian@15817 1253 </dd>
florian@15817 1254
florian@15817 1255 <dt>''fit''</dt>
florian@15817 1256
florian@15817 1257 <dd>
florian@15817 1258 The region's flow fragment content
florian@15817 1259 fits into the region's
florian@15817 1260 <a href="http://www.w3.org/TR/CSS21/box.html#box-dimensions">content box</a>.
florian@15817 1261 If the region is the last one
florian@15817 1262 in the <a>region chain</a>,
florian@15817 1263 it means that the content
florian@15817 1264 fits without overflowing.
florian@15817 1265 If the region is not the last one
florian@15817 1266 in the <a>region chain</a>,
florian@15817 1267 that means the <a>named flow</a> content
florian@15817 1268 may be further fitted in subsequent regions.
florian@15817 1269 In this last case,
florian@15817 1270 note that the <a>named flow</a> fragment may be empty
florian@15817 1271 (for example if the region is too small
florian@15817 1272 to accommodate any content).
florian@15817 1273 This value is returned if the <a idl>Region</a> object
florian@15817 1274 is not (or no longer) a region.
florian@15817 1275 </dd>
florian@15817 1276
florian@15817 1277 <dt>''empty''</dt>
florian@15817 1278
florian@15817 1279 <dd>
florian@15817 1280 All content from the <a>named flow</a> was fitted in prior regions.
florian@15817 1281 </dd>
florian@15817 1282
florian@15817 1283 </dl>
florian@15817 1284
florian@15817 1285 If there is no content
florian@15817 1286 in the <a>named flow</a>,
florian@15817 1287 all regions associated
florian@15817 1288 with that <a>named flow</a>
florian@15817 1289 should have their <a idl>regionOverset</a>
florian@15817 1290 attribute return ''empty''.
florian@15817 1291 If there is content in the flow
florian@15817 1292 but that content does not
florian@15817 1293 generate any box for visual formatting,
florian@15817 1294 the ''overset'' attribute on the first region
florian@15817 1295 in the <a>region chain</a> associated
florian@15817 1296 with the flow will return ''fit''.
florian@15817 1297
florian@15817 1298 The <dfn method for="Region">getRegionFlowRanges()</dfn> method
florian@15817 1299 returns an array of <a href= "http://www.w3.org/TR/dom/#interface-range">Range</a>
florian@15817 1300 instances corresponding to fragment
florian@15817 1301 from the <a>named flow</a>
florian@15817 1302 that is laid out in the region.
florian@15817 1303 If the region has not received a fragment
florian@15817 1304 because it is too small to accommodate any,
florian@15817 1305 the method returns a single <a idl>Range</a>
florian@15817 1306 where the <code>startContainer</code>
florian@15817 1307 and <code>startOffset</code>
florian@15817 1308 have the same values as
florian@15817 1309 the <code>endContainer</code>
florian@15817 1310 and <code>endOffset</code>
florian@15817 1311 and therefore the collapsed attribute
florian@15817 1312 on the <a idl>Range</a> is true.
florian@15817 1313 In that situation,
florian@15817 1314 if the region is the first
florian@15817 1315 in the <a>region chain</a>,
florian@15817 1316 the <code>startContainer</code>
florian@15817 1317 is the first <code>Node</code>
florian@15817 1318 in the <a>named flow</a>
florian@15817 1319 and the <code>startOffset</code> is zero.
florian@15817 1320 If the region is the last region
florian@15817 1321 in the <a>region chain</a>
florian@15817 1322 (but not the first and only one),
florian@15817 1323 the <code>startContainer</code>
florian@15817 1324 and <code>startOffset</code>
florian@15817 1325 are the same values as
florian@15817 1326 the <code>endContainer</code>
florian@15817 1327 and <code>endOffset</code>
florian@15817 1328 on the previous region
florian@15817 1329 in the <a>region chain</a>.
florian@15817 1330 The method returns null
florian@15817 1331 if the <span>region</span> object
florian@15817 1332 is not (or no longer) a region.
florian@15817 1333
florian@15817 1334 A <a idl>Region</a> instance
florian@15817 1335 may represent an object
florian@15817 1336 that is no longer a <span>region</span>.
florian@15817 1337 This may happen for example
florian@15817 1338 if the 'flow-from' property
florian@15817 1339 on the corresponding pseudo-element,
florian@15817 1340 element or other construct
florian@15817 1341 becomes ''flow-from/none''
florian@15817 1342 but a script is still holding
florian@15817 1343 a reference to the <a idl>Region</a> object.
florian@15817 1344
florian@15817 1345 <h3 id="named-flow-events">
florian@15817 1346 Named flow events</h3>
florian@15817 1347
florian@15817 1348 <a idl>NamedFlow</a>
florian@15817 1349 objects are <a href="http://www.w3.org/TR/dom/#interface-eventtarget">EventTargets</a>
florian@15817 1350 which dispatch the following events
florian@15817 1351 for their respective triggers.
florian@15817 1352 These events are asynchronous,
florian@15817 1353 and fire at the end of the
florian@15817 1354 <a href="#named-flows-layout">regions visual formatting</a>
florian@15817 1355 steps.
florian@15817 1356
florian@15817 1357 The regionfragmentchange event is dispatched
florian@15817 1358 on any change to a named flow's fragmentation through its <a>region chain</a>,
florian@15817 1359 including changes to any overset fragment.
florian@15817 1360
florian@15817 1361 <table class="event-desc" style="border: 1px solid gray">
florian@15817 1362 <tbody>
florian@15817 1363 <tr class="assert must"><th>Type</th>
florian@15817 1364 <td class="eventname"><strong><code>regionfragmentchange</code></strong></td>
florian@15817 1365 </tr>
florian@15817 1366 <tr class="assert must"><th>Interface</th>
florian@15817 1367 <td><code><a href="http://www.w3.org/TR/DOM-Level-3-Events/#events-uievents">UIEvent</a></code> (see [[!DOM-LEVEL-3-EVENTS]])</td>
florian@15817 1368 </tr>
florian@15817 1369 <tr class="assert must"><th>Sync / Async</th> <td>Async</td></tr>
florian@15817 1370 <tr class="assert must"><th>Bubbles</th> <td>No</td></tr>
florian@15817 1371 <tr class="assert must"><th>Target</th>
florian@15817 1372 <td><a idl>NamedFlow</a></td>
florian@15817 1373 </tr>
florian@15817 1374 <tr class="assert must"><th>Cancelable</th> <td>Yes</td></tr>
florian@15817 1375 <tr class="assert must"><th>Default action</th> <td>none</td></tr>
florian@15817 1376 <tr class="assert must"><th>Context info</th>
florian@15817 1377 <td>
florian@15817 1378 <ul>
florian@15817 1379 <li><code class="attribute-name">Event.target</code>:
florian@15817 1380 <a idl>NamedFlow</a> whose fragmentation has changed.
florian@15817 1381 </li>
florian@15817 1382 </ul>
florian@15817 1383 </td>
florian@15817 1384 </tr>
florian@15817 1385 </tbody>
florian@15817 1386 </table>
florian@15817 1387
florian@15817 1388
florian@15817 1389 The regionoversetchange event is dispatched
florian@15817 1390 if any of the regionOverset values change
florian@15817 1391 in a named flow's <a>region chain</a>,
florian@15817 1392 including when regions are added or removed from the chain.
florian@15817 1393
florian@15817 1394 <table class="event-desc" style="border: 1px solid gray">
florian@15817 1395 <tbody>
florian@15817 1396 <tr class="assert must"><th>Type</th>
florian@15817 1397 <td class="eventname"><strong><code>regionoversetchange</code></strong></td>
florian@15817 1398 </tr>
florian@15817 1399 <tr class="assert must"><th>Interface</th>
florian@15817 1400 <td><code><a href="http://www.w3.org/TR/DOM-Level-3-Events/#events-UIEvent">UIEvent</a></code> (see [[!DOM-LEVEL-3-EVENTS]])</td>
florian@15817 1401 </tr>
florian@15817 1402 <tr class="assert must"><th>Sync / Async</th> <td>Async</td></tr>
florian@15817 1403 <tr class="assert must"><th>Bubbles</th> <td>No</td></tr>
florian@15817 1404 <tr class="assert must"><th>Target</th>
florian@15817 1405 <td><a idl>NamedFlow</a></td>
florian@15817 1406 </tr>
florian@15817 1407 <tr class="assert must"><th>Cancelable</th> <td>Yes</td></tr>
florian@15817 1408 <tr class="assert must"><th>Default action</th> <td>none</td></tr>
florian@15817 1409 <tr class="assert must"><th>Context info</th>
florian@15817 1410 <td>
florian@15817 1411 <ul>
florian@15817 1412 <li><code class="attribute-name">Event.target</code>:
florian@15817 1413 <a idl>NamedFlow</a> whose <a>region chain</a> has regionOverset values that have changed.
florian@15817 1414 </li>
florian@15817 1415 </ul>
florian@15817 1416 </td>
florian@15817 1417 </tr>
florian@15817 1418 </tbody>
florian@15817 1419 </table>
florian@15817 1420
florian@15817 1421 <h3 id="cssomview-and-regions">
florian@15817 1422 Clarifications on pre-existing APIs</h3>
florian@15817 1423
florian@15817 1424 <h4 id="cssomview-getclientrects-and-getboundingclientrect">
florian@15817 1425 <code class="idl">getClientRects()</code> and <code>getBoundingClientRect()</code></h4>
florian@15817 1426
florian@15817 1427 The <a href="http://www.w3.org/TR/cssom-view/">CSSOM View Module</a>
florian@15817 1428 defines how user agents compute
florian@15817 1429 the bounding client rectangle
florian@15817 1430 for an element (<code class="idl">getBoundingClientRect()</code>)
florian@15817 1431 and its generated boxes (<code class="idl">getClientRects()</code>).
florian@15817 1432
florian@15817 1433 This definition applies to
florian@15817 1434 the (possibly) multiple boxes
florian@15817 1435 generated for an element in a named flow
florian@15817 1436 flowing through a <a>region chain</a>.
florian@15817 1437 The <code class="idl">getClientRects()</code> method
florian@15817 1438 returns the list of boxes generated
florian@15817 1439 for each of the element fragments
florian@15817 1440 laid out in different regions.
florian@15817 1441 The <code>getBoundingClientRect()</code> method
florian@15817 1442 operates as specified in the
florian@15817 1443 <a href="http://www.w3.org/TR/cssom-view/">CSSOM View Module</a>
florian@15817 1444 as well and is computed
florian@15817 1445 from the set of rectangles
florian@15817 1446 returned by <code class="idl">getClientRects()</code>.
florian@15817 1447
florian@15817 1448 <h4 id="cssomview-offset-attributes">
florian@15817 1449 <code class="idl">offsetTop</code>, <code class="idl">offsetLeft</code>,
florian@15817 1450 <code class="idl">offsetWidth</code>, <code class="idl">offsetHeight</code> and <code class="idl">offsetParent</code></h4>
florian@15817 1451
florian@15817 1452 The computation of the
peter@16986 1453 <a href="https://drafts.csswg.org/cssom-view/#extensions-to-the-htmlelement-interface">offset attributes</a>
florian@15817 1454 for elements laid out in a <a>named flow</a> follow the
peter@16986 1455 <a href="https://drafts.csswg.org/cssom-view/#extensions-to-the-htmlelement-interface">specification</a>
florian@15817 1456 [[!CSSOM]].
florian@15817 1457 For the purpose of these algorithms,
florian@15817 1458 the <em>first CSS layout box</em> associated
florian@15817 1459 with an element laid out in a <a>named flow</a>
florian@15817 1460 is the first box generated for the first region the element is laid out into.
florian@15817 1461 In the offsetParent algorithm,
florian@15817 1462 the nearest ancestor search skips
florian@15817 1463 from the topmost named flow elements directly to the body element.
florian@15817 1464
florian@15817 1465 <h2 id="multi-column-regions">
florian@15817 1466 Multi-column regions</h2>
florian@15817 1467
florian@15817 1468 A
peter@16986 1469 <a href="https://drafts.csswg.org/css3-multicol/#multi-column-element">multi-column</a>
florian@15817 1470 [[CSS3COL]]
florian@15817 1471 element can be
florian@15817 1472 assigned to a <a>region chain</a>.
florian@15817 1473 The element becomes part
florian@15817 1474 of the <a>region chain</a>
florian@15817 1475 for the associated <a>named flow</a>,
florian@15817 1476 and flows its content fragments
florian@15817 1477 through columns according to
florian@15817 1478 the multi-column specification
florian@15817 1479 [[!CSS3COL]].
florian@15817 1480 In particular,
florian@15817 1481 when computing the
florian@15817 1482 <a href="#rfcb-flow-fragment-height-resolution">flow fragment height</a>
florian@15817 1483 of a multi-column element
florian@15817 1484 that is associated with a <em><a>named flow</a></em>,
florian@15817 1485 the 'column-fill'
florian@15817 1486 [[!CSS3COL]]
florian@15817 1487 property is honored
florian@15817 1488 to balance the fragments of content
florian@15817 1489 that would flow through
florian@15817 1490 its columns.
florian@15817 1491
florian@15817 1492 Overflow of multicol regions
florian@15817 1493 is mostly handled
florian@15817 1494 according to the same rules
florian@15817 1495 as other <a>CSS Regions</a>.
florian@15817 1496 If the remainder of the named flow
florian@15817 1497 does not fit
florian@15817 1498 in the multicol region,
florian@15817 1499 then the rest
florian@15817 1500 of the content flows into
florian@15817 1501 the remaining <a>region chain</a>.
florian@15817 1502 However,
florian@15817 1503 if a multicol region
florian@15817 1504 is the last region
florian@15817 1505 in a <a>region chain</a>,
florian@15817 1506 then the multicol region must follow the
peter@16986 1507 <a href="https://drafts.csswg.org/css3-multicol/#overflow-columns">overflow column rules</a>
florian@15817 1508 [[!CSS3COL]].
florian@15817 1509
florian@15817 1510 <div class="example">
florian@15817 1511
florian@15817 1512 The following example:
florian@15817 1513
florian@15817 1514 <pre>
florian@15817 1515 &lt;style&gt;
florian@15817 1516 article {
florian@15817 1517 flow-into: article-flow;
florian@15817 1518 }
florian@15817 1519
florian@15817 1520 #multi-col {
florian@15817 1521 column-count: 2;
florian@15817 1522 flow-from: article;
florian@15817 1523 height: 6em;
florian@15817 1524 column-gap: 1em;
florian@15817 1525 }
florian@15817 1526
florian@15817 1527 #remainder {
florian@15817 1528 flow-from: article;
florian@15817 1529 height: auto;
florian@15817 1530 }
florian@15817 1531 &lt;/style&gt;
florian@15817 1532
florian@15817 1533 &lt;body&gt;
florian@15817 1534 &lt;article&gt;...&lt;/article&gt;
florian@15817 1535 &lt;div id="multicol"&gt&lt;/div&gt;
florian@15817 1536 &lt;div id="remainder"&gt;&lt;/div&gt;
florian@15817 1537 &lt;/body&gt;
florian@15817 1538 </pre>
florian@15817 1539
florian@15817 1540 is equivalent in rendering to, for example:
florian@15817 1541
florian@15817 1542 <pre>
florian@15817 1543 &lt;style&gt;
florian@15817 1544 article {
florian@15817 1545 flow-into: article-flow;
florian@15817 1546 }
florian@15817 1547
florian@15817 1548 #flex {
florian@15817 1549 display: flex;
florian@15817 1550 flex-pack: justify;
florian@15817 1551 height: 6em;
florian@15817 1552 }
florian@15817 1553
florian@15817 1554 #flex > div {
florian@15817 1555 flow-from: article;
florian@15817 1556 width: calc(50% - 0.5em);
florian@15817 1557 }
florian@15817 1558
florian@15817 1559 #remainder {
florian@15817 1560 flow-from: article;
florian@15817 1561 height: auto;
florian@15817 1562 }
florian@15817 1563 &lt;/style&gt;
florian@15817 1564
florian@15817 1565 &lt;body&gt;
florian@15817 1566 &lt;article&gt;...&lt;/article&gt;
florian@15817 1567 &lt;div id="flex"&gt;
florian@15817 1568 &lt;div /&gt;
florian@15817 1569 &lt;div /&gt;
florian@15817 1570 &lt;/div&gt;
florian@15817 1571 &lt;div id="remainder"&gt;&lt;/div&gt;
florian@15817 1572 &lt;/body&gt;
florian@15817 1573 </pre>
florian@15817 1574 </div>
florian@15817 1575
florian@15817 1576 <h2 id="pseudo_elements">
florian@15817 1577 Pseudo-elements</h2>
florian@15817 1578
florian@15817 1579 It can be useful
florian@15817 1580 to visually mark the content
florian@15817 1581 to highlight that a content thread
florian@15817 1582 is flowing through the <a>region chain</a>.
florian@15817 1583 For example, a marker
florian@15817 1584 such as <em>'continued below'</em> clearly indicates,
florian@15817 1585 at the end of a <a>CSS Region</a>,
florian@15817 1586 that there is more content in the flow
florian@15817 1587 which can be found by scrolling past
florian@15817 1588 whatever content interrupts the <a>region chain</a>.
florian@15817 1589
florian@15817 1590 The '::before' and '::after' pseudo-elements (see [[!SELECT]])
florian@15817 1591 let content authors mark the beginning
florian@15817 1592 and end of a region with such markers.
florian@15817 1593
florian@15817 1594 <h2 id="regions-visual-formatting-details">
florian@15817 1595 Regions visual formatting details</h2>
florian@15817 1596
florian@15817 1597 Regions are laid out by CSS and take part in the normal box model and other layout models
florian@15817 1598 offered by CSS modules such as flexible boxes ([[CSS3-FLEXBOX]]). However, <span>regions</span>
florian@15817 1599 lay out a fragment of their <a>named flow</a> instead of laying out descendant content as happens with other
florian@15817 1600 boxes.
florian@15817 1601
florian@15817 1602 This section describes the model for laying out <span>regions</span>
florian@15817 1603 and for laying out <a>named flow</a> content into regions.
florian@15817 1604 The descriptions in this section are biased towards a horizontal writing mode,
florian@15817 1605 using ''width'' for logical width (or measure)
florian@15817 1606 and ''height'' for logical height (or extent)
florian@15817 1607 as <a href="http://www.w3.org/TR/css3-writing-modes/#abstract-dimensions">defined</a>
florian@15817 1608 in the CSS Writing Modes Module [[!CSS3-WRITING-MODES]]).
florian@15817 1609 To use this model in a vertical writing mode apply the principles
florian@15817 1610 <a href="http://www.w3.org/TR/css3-writing-modes/#vertical-layout">described</a>
florian@15817 1611 in that specification.
florian@15817 1612
florian@15817 1613 <h3 id="processing-model">
florian@15817 1614 Processing model</h3>
florian@15817 1615
florian@15817 1616 The '::before' content is laid out
florian@15817 1617 in the region prior to
florian@15817 1618 any other content coming from the flow.
florian@15817 1619
florian@15817 1620 The '::after' content is laid out
florian@15817 1621 in the region after laying out
florian@15817 1622 the flow fragment content into the <span>RFCB</span>.
florian@15817 1623 Then, flow content is removed from the fragment
florian@15817 1624 to accommodate the '::after' content.
florian@15817 1625 Accommodating means that the '::after' content
florian@15817 1626 is laid out without overflowing the region.
florian@15817 1627
florian@15817 1628 If there is not enough room to accommodate
florian@15817 1629 the ::before content,
florian@15817 1630 the '::after' content after removing all flow fragment content,
florian@15817 1631 or a combination of the two,
florian@15817 1632 then the ::before and/or ::after content overflows that region.
florian@15817 1633
florian@15817 1634 <h3 id="regions-flow-content-box">
florian@15817 1635 The Region Flow Content Box (RFCB)</h3>
florian@15817 1636
florian@15817 1637 A region box lays out the following boxes:
florian@15817 1638
florian@15817 1639 <ul>
florian@15817 1640 <li>
florian@15817 1641 The boxes generated by its <code>::before</code> and
florian@15817 1642 <code>::after</code> pseudo-elements, if any.
florian@15817 1643 </li>
florian@15817 1644 <li>
florian@15817 1645 The anonymous <dfn>region flow content box</dfn>
florian@15817 1646 (called <dfn>RFCB</dfn> in this document)
florian@15817 1647 which contains the fragment of the <a>named flow</a>
florian@15817 1648 that the region receives.
florian@15817 1649 </li>
florian@15817 1650 </ul>
florian@15817 1651
florian@15817 1652 <figure>
florian@15817 1653 <img src="images/RFCB.svg" width=600 alt="The ::before, RFCB and ::after boxes contained in the Region Box"/>
florian@15817 1654 <figcaption>
florian@15817 1655 The Region Flow Content Box (RFCB)
florian@15817 1656 </figcaption>
florian@15817 1657 </figure>
florian@15817 1658
florian@15817 1659 Laying out a <span>region</span> box follows the same processing rules
florian@15817 1660 as for any other <a href="http://www.w3.org/TR/CSS2/visuren.html#block-boxes">block container box</a>.
florian@15817 1661
florian@15817 1662 The <span>RFCB</span> is a
florian@15817 1663 <a href="http://www.w3.org/TR/CSS21/visuren.html#block-boxes">block container box</a>
florian@15817 1664 with a computed 'width' of ''width/auto'' and whose used 'height' is resolved as detailed below.
florian@15817 1665
florian@15817 1666 Since the <span>RFCB</span> is a <a href="http://www.w3.org/TR/CSS21/visuren.html#block-boxes">block container box</a>, the ::before box and ::after box will also be block containers, though the contents of ::before and ::after may be inline within those boxes.
florian@15817 1667
florian@15817 1668 <h4 id="rfcb-width-resolution">
florian@15817 1669 RFCB 'width' resolution</h4>
florian@15817 1670
florian@15817 1671 At various points in the visual formatting of documents containing regions,
florian@15817 1672 the used 'width' of RFCBs and regions need to be resolved.
florian@15817 1673 In all cases, the resolution is done following the rules for
florian@15817 1674 <a href="http://www.w3.org/TR/CSS2/visudet.html#Computing_widths_and_margins">calculating widths and margins</a> (see [[!CSS21]]).
florian@15817 1675 Sometimes, resolving the used 'width' value requires
florian@15817 1676 measuring the content's <code>min-content</code>
florian@15817 1677 and <code>max-content</code> values
florian@15817 1678 (as <a href="http://www.w3.org/TR/css3-writing-modes/#orthogonal-auto">defined</a>
florian@15817 1679 in the CSS Writing Modes Module [[!CSS3-WRITING-MODES]]).
florian@15817 1680 or an RFCB, <strong>these measures are made
florian@15817 1681 on the <em>entire</em> associated <a>named flow</a> content</strong>.
florian@15817 1682
florian@15817 1683 As a consequence,
florian@15817 1684 all <span>RFCBs</span> of <span>regions</span> associated
florian@15817 1685 with a given <a>named flow</a>
florian@15817 1686 share the same <code>min-content</code>
florian@15817 1687 and <code>max-content</code> measures.
florian@15817 1688
florian@15817 1689 This approach is consistent with the
florian@15817 1690 <a href="http://www.w3.org/TR/css3-break/#varying-size-boxes">box model for breaking</a> ([[!CSS3-BREAK]]).
florian@15817 1691
florian@15817 1692
florian@15817 1693 <h3 id="regions-visual-formatting-steps">
florian@15817 1694 Regions visual formatting steps</h3>
florian@15817 1695
florian@15817 1696 Formatting documents that contain <a>named flows</a> laid out in regions
florian@15817 1697 is a three-step process:
florian@15817 1698
florian@15817 1699 <ul>
florian@15817 1700 <li>
florian@15817 1701 <em>Step 1: RFCB <dfn>flow fragment height</dfn> resolution</em>.
florian@15817 1702 In this step, the heights of fragments fitting in the regions' RFCBs are resolved.
florian@15817 1703 </li>
florian@15817 1704 <li>
florian@15817 1705 <em>Step 2: document and regions layout</em>.
florian@15817 1706 In this step, the document content and regions are laid out.
florian@15817 1707 However, <a>named flow</a> content is not laid out in regions yet.
florian@15817 1708 </li>
florian@15817 1709 <li>
florian@15817 1710 <em>Step 3: <a>named flow</a> layout</em>.
florian@15817 1711 In this step, the content of <a>named flows</a>
florian@15817 1712 is laid out in their respective <a>region chains</a>.
florian@15817 1713 </li>
florian@15817 1714 </ul>
florian@15817 1715
florian@15817 1716 <figure>
florian@15817 1717 <img src="images/regions-layout-three-steps.svg" width=600 alt="visual representation of the three-step process"/>
florian@15817 1718 <figcaption>
florian@15817 1719 Regions visual formatting steps
florian@15817 1720 </figcaption>
florian@15817 1721 </figure>
florian@15817 1722
florian@15817 1723 <h4 id="rfcb-flow-fragment-height-resolution">
florian@15817 1724 Step 1: RFCB flow fragment height resolution</h4>
florian@15817 1725
florian@15817 1726 Conceptually, resolving the flow fragment height is a two phase process.
florian@15817 1727
florian@15817 1728 <h5 id="rfcb-flow-fragment-height-resolution-phase-1">
florian@15817 1729 RFCB flow fragment height resolution, Phase 1</h5>
florian@15817 1730
florian@15817 1731 The document is laid out with a
florian@15817 1732 <a href="http://www.w3.org/TR/CSS2/cascade.html#used-value">used</a> height of zero
florian@15817 1733 for all <span>RFCB</span>s. In this phase, the content of <a>named flows</a> is not laid out in
florian@15817 1734 <span>regions</span>. This phase yields resolved position and sizes for all regions and
florian@15817 1735 their RFCBs in the document.
florian@15817 1736
florian@15817 1737 <h5 id="rfcb-flow-fragment-height-resolution-phase-2">
florian@15817 1738 RFCB flow fragment height resolution, Phase 2</h5>
florian@15817 1739
florian@15817 1740 <a>named flows</a> are laid out in <span>regions</span>.
florian@15817 1741 The user agent resolves
florian@15817 1742 the <em><span>flow fragment height</span></em>
florian@15817 1743 for the <span>RFCB</span>s
florian@15817 1744 using the remainder of the flow
florian@15817 1745 and accounting for <a href="http://www.w3.org/TR/css3-break/">fragmentation rules</a>.
florian@15817 1746 This process accounts for constraints
florian@15817 1747 such as the 'height' or 'max-height' values,
florian@15817 1748 as described in the CSS 2.1 section
florian@15817 1749 on <a href="http://www.w3.org/TR/CSS2/visudet.html#Computing_heights_and_margins">calculating heights and margins</a>
florian@15817 1750 (see the <a href="http://www.w3.org/TR/CSS2/visudet.html#normal-block">Block-level non-replaced elements in normal flow...</a>
florian@15817 1751 section and the <a href="http://www.w3.org/TR/CSS2/visudet.html#block-root-margin">complicated cases</a> section).
florian@15817 1752 During this phase,
florian@15817 1753 generated content is laid out
florian@15817 1754 according to the <a href="#processing-model">rules</a>
florian@15817 1755 described earlier in this document.
florian@15817 1756
florian@15817 1757 In a <a>nested region context</a>,
florian@15817 1758 this phase will trigger
florian@15817 1759 the beginning of Step 1
florian@15817 1760 for any inner <a>named flows</a>
florian@15817 1761 whose regions are contained
florian@15817 1762 in the outer <a>named flow</a>.
florian@15817 1763 All of Step 1 for inner flows
florian@15817 1764 must recursively complete before Step 1
florian@15817 1765 for an outer flow completes.
florian@15817 1766
florian@15817 1767 <h4 id="regions-boxes-layout">
florian@15817 1768 Step 2: region boxes layout</h4>
florian@15817 1769
florian@15817 1770 In this step, the document is laid out according to the normal CSS layout rules.
florian@15817 1771
florian@15817 1772 If a measure of the content is required to resolve the used 'width' of the region box,
florian@15817 1773 the value is resolved as described in the
florian@15817 1774 <a href="#rfcb-width-resolution">RFCB width resolution</a> section.
florian@15817 1775
florian@15817 1776 If a measure of the content is required to resolve the used height of the RFCB
florian@15817 1777 (for example if the region box is absolutely positioned),
florian@15817 1778 the <span>flow fragment height</span> resolved in Step 1 is used
florian@15817 1779 for the vertical content measure of the RFCB.
florian@15817 1780
florian@15817 1781 At the end of this step,
florian@15817 1782 regions are laid out and ready to receive content
florian@15817 1783 from their associated <a>named flows</a>.
florian@15817 1784
florian@15817 1785 <h4 id="named-flows-layout">
florian@15817 1786 Step 3: named flows layout</h4>
florian@15817 1787
florian@15817 1788 In this final step,
florian@15817 1789 the content of <a>named flows</a>
florian@15817 1790 is laid out in the <span>regions</span>' RFCBs
florian@15817 1791 along with the generated content boxes.
florian@15817 1792
florian@15817 1793 The used 'width' for RFCBs is resolved
florian@15817 1794 <a href="#rfcb-width-resolution">as described before</a>.
florian@15817 1795
florian@15817 1796 The used 'height' of RFCBs is resolved
florian@15817 1797 such that none of the boxes
florian@15817 1798 in the region box's normal flow
florian@15817 1799 overflow the region's box.
florian@15817 1800 In other words,
florian@15817 1801 the RFCB boxes are stretched vertically
florian@15817 1802 to accommodate as much
florian@15817 1803 of the flow as possible
florian@15817 1804 without overflowing the region box
florian@15817 1805 and accounting for
florian@15817 1806 <a href="http://www.w3.org/TR/css3-break/">fragmentation rules</a>
florian@15817 1807 and generated content boxes.
florian@15817 1808
florian@15817 1809 During this phase,
florian@15817 1810 generated content is laid out
florian@15817 1811 according to the <a href="#processing-model">rules</a>
florian@15817 1812 described earlier in this document.
florian@15817 1813
florian@15817 1814 In a <a>nested region context</a>,
florian@15817 1815 this step will trigger Step 2
florian@15817 1816 for inner <a>named flows</a>
florian@15817 1817 whose regions are contained
florian@15817 1818 in the outer <a>named flow</a>.
florian@15817 1819 Fragmentation of the inner regions
florian@15817 1820 may result as they are laid out
florian@15817 1821 in the outer <a>region chain</a>.
florian@15817 1822 Once Step 3 for an outer named flow is complete,
florian@15817 1823 Step 3 for the inner <a>named flows</a> recursively begins.
florian@15817 1824
florian@15817 1825 Once Step 3 for a named flow is complete,
florian@15817 1826 The conditions for the
florian@15817 1827 <a href="#named-flow-events">named flow events</a> are checked,
florian@15817 1828 and if the triggers are met
florian@15817 1829 the events dispatch at this point.
florian@15817 1830
florian@15817 1831 <div class="note"><span class="note-prefix">Note </span>
florian@15817 1832
florian@15817 1833 The model for resolving auto sized regions will cause,
florian@15817 1834 under certain circumstances,
florian@15817 1835 the flow content to be overset or underset.
florian@15817 1836 In other words,
florian@15817 1837 it will not fit tightly.
florian@15817 1838 The model prevents having circular dependencies
florian@15817 1839 in the layout model.
florian@15817 1840 Implementations may decide to apply
florian@15817 1841 further layout steps
florian@15817 1842 to ensure that the whole flow content
florian@15817 1843 is displayed to the user,
florian@15817 1844 even in edge cases.
florian@15817 1845 </div>
florian@15817 1846
florian@15817 1847 <h3 id="regions-visual-formatting-implementation-note">
florian@15817 1848 Regions visual formatting: implementation note</h3>
florian@15817 1849
florian@15817 1850 The process for resolving an RFCB's 'height' and the three-step process used to
florian@15817 1851 lay out documents containing regions and <a>named flows</a> are
florian@15817 1852 <em>conceptual</em> descriptions of what the layout
florian@15817 1853 should yield and implementations should optimize to reduce the number of
florian@15817 1854 steps and phases necessary wherever possible.
florian@15817 1855
florian@15817 1856 <h3 id="regions-visual-formatting-examples">
florian@15817 1857 Regions visual formatting example</h3>
florian@15817 1858
florian@15817 1859 This section is non-normative.
florian@15817 1860
florian@15817 1861 This example considers a document where content flows between three regions,
florian@15817 1862 and region boxes are intermixed with the normal document content.
florian@15817 1863
florian@15817 1864 <div class="example">
florian@15817 1865 <pre>
florian@15817 1866 &lt;style&gt;
florian@15817 1867 article {
florian@15817 1868 flow-into: article;
florian@15817 1869 }
florian@15817 1870
florian@15817 1871 #rA, #rB, #rC {
florian@15817 1872 flow-from: article;
florian@15817 1873 height: auto;
florian@15817 1874
florian@15817 1875 margin: 1em 1em 0em 1em;
florian@15817 1876 padding: 1em;
florian@15817 1877 border: 3px solid #46A4E9;
florian@15817 1878 }
florian@15817 1879
florian@15817 1880 #rA {
florian@15817 1881 width: auto;
florian@15817 1882 }
florian@15817 1883
florian@15817 1884 #rB {
florian@15817 1885 float: left;
florian@15817 1886 width: 15em;
florian@15817 1887 max-height: 150px;
florian@15817 1888 }
florian@15817 1889
florian@15817 1890 #rC {
florian@15817 1891 float: right;
florian@15817 1892 width: 12em;
florian@15817 1893 }
florian@15817 1894
florian@15817 1895 #main-flow {
florian@15817 1896 padding: 0em 1em 0em 1em;
florian@15817 1897 }
florian@15817 1898 &lt;/style&gt;
florian@15817 1899
florian@15817 1900 &lt;body&gt;
florian@15817 1901 &lt;article&gt;
florian@15817 1902 &lt;p style="break-after:region;"&gt;I am not a ... &lt;/p&gt;
florian@15817 1903 &lt;p&gt;...&lt;/p&gt;
florian@15817 1904 &lt;/article&gt;
florian@15817 1905
florian@15817 1906 &lt;div id="rA"&gt;&lt;/div&gt;
florian@15817 1907 &lt;div id="rB"&gt;&lt;/div&gt;
florian@15817 1908 &lt;div id="rC"&gt;&lt;/div&gt;
florian@15817 1909
florian@15817 1910 &lt;div id="main-flow"&gt;
florian@15817 1911 &lt;p&gt;Lorem ipsum dolor ...&lt;/p&gt;
florian@15817 1912 &lt;/div&gt;
florian@15817 1913 &lt;/body&gt;
florian@15817 1914 </pre>
florian@15817 1915 </div>
florian@15817 1916
florian@15817 1917 The following sections and figures illustrate the intermediate results
florian@15817 1918 for the visual formatting process.
florian@15817 1919 In the following, we call RFCB-A, RFCB-B and RFCB-C
florian@15817 1920 the <span>RFCBs</span> for regions rA, rB and rC respectively.
florian@15817 1921
florian@15817 1922 <h4 id="step1-phase1-example">
florian@15817 1923 Step 1 - Phase 1: Laying out RFCBs with used height of zero</h4>
florian@15817 1924
florian@15817 1925 Applying the rules for Step 1, Phase 1,
florian@15817 1926 the computed ''width/auto'' 'width' values for the RFCBs are resolved
florian@15817 1927 to used values according to the normal
florian@15817 1928 <a href="http://www.w3.org/TR/CSS2/visudet.html#Computing_widths_and_margins">CSS layout rules</a>
florian@15817 1929 meaning they stretch to the width
florian@15817 1930 of their containing block's content box.
florian@15817 1931
florian@15817 1932 <ol>
florian@15817 1933 <li>RFCB-A: stretches to fit the rA content box.
florian@15817 1934 <p>Since rA also has an ''width/auto'' 'width', its own used 'width' is stretched to fit the
florian@15817 1935 <code>&lt;body&gt;</code> content box.</p>
florian@15817 1936 </li>
florian@15817 1937 <li>RFCB-B: stretches to fit the <code>rB</code> content box.</li>
florian@15817 1938 <li>RFCB-C: stretches to fit the <code>rC</code> content box.</li>
florian@15817 1939 </ol>
florian@15817 1940
florian@15817 1941 Also applying the rules for Step 1, Phase 1,
florian@15817 1942 the used values for the RFCBs 'height' properties are all zero.
florian@15817 1943
florian@15817 1944 Conceptually, this produces the layout illustrated below.
florian@15817 1945
florian@15817 1946 <figure>
florian@15817 1947 <img src="images/flow-fragment-height-phase-1.png" width=500 alt="Step 1 - Phase 1: Layout RFCBs with used heights of 0"/>
florian@15817 1948 <figcaption>
florian@15817 1949 Step 1 - Phase 1: Layout RFCBs with used heights of 0
florian@15817 1950 </figcaption>
florian@15817 1951 </figure>
florian@15817 1952
florian@15817 1953 <h4 id="step1-phase2-example">
florian@15817 1954 Step 1 - Phase 2: Layout flow to compute the RFCBs' flow fragments heights</h4>
florian@15817 1955
florian@15817 1956 In this second phase of Step 1,
florian@15817 1957 the named flow is laid out in <span>regions</span>
florian@15817 1958 and the height of each fragment falling in each RFCB is computed.
florian@15817 1959
florian@15817 1960 The user agent lays out as much
florian@15817 1961 of the flow into an area with RFCB-A's used 'width'.
florian@15817 1962 rA's 'height' computes to ''width/auto''
florian@15817 1963 and there is no vertical maximum height for RFCA's 'height'.
florian@15817 1964 However, because there is a break after the first paragraph
florian@15817 1965 in the "article" <code>named flow</code>,
florian@15817 1966 only this first paragraph is laid out
florian@15817 1967 in RFCB-A and FH-A (the flow fragment height for RFCB-A)
florian@15817 1968 is resolved by laying out this first paragraph in the used 'width'.
florian@15817 1969
florian@15817 1970 At this point, the user agent lays out as much
florian@15817 1971 of the remaining flow as possible in RFCB-B.
florian@15817 1972 Because rB's 'max-height' computed value is "150px",
florian@15817 1973 the user agent only lays out the "article" named flow
florian@15817 1974 using RFCB-B's used 'width' until the point where
florian@15817 1975 laying out additional content would cause RFCB-B to overflow rB's box.
florian@15817 1976 The fragment height for RFCB-B is resolved: FH-B (<code>150px</code>).
florian@15817 1977
florian@15817 1978 Finally, the user agent lays out the remainder of the flow in RFCB-C.
florian@15817 1979 Because rC has no other constraints and no region breaks,
florian@15817 1980 the remaining content is laid out in RFCB-C's used 'width'.
florian@15817 1981 This results in a resolved flow fragment height: FH-C.
florian@15817 1982
florian@15817 1983 <figure>
florian@15817 1984 <img src="images/flow-fragment-height-phase-2.png" width=370 alt="Step 1 - Phase 2: Measure flow fragments heights"/>
florian@15817 1985 <figcaption>
florian@15817 1986 Step 1 - Phase 2: Measure flow fragments heights
florian@15817 1987 </figcaption>
florian@15817 1988 </figure>
florian@15817 1989
florian@15817 1990 <h4 id="step2-example">
florian@15817 1991 Step 2: Layout document and regions without named flows</h4>
florian@15817 1992
florian@15817 1993 The used 'width' of RFCB-A, RFCB-B and RFCB-C
florian@15817 1994 are resolved as in the previous step.
florian@15817 1995 However, the 'height' is resolved differently.
florian@15817 1996
florian@15817 1997 Resolving the 'height' of rA
florian@15817 1998 <a href="http://www.w3.org/TR/CSS2/visudet.html#normal-block">requires a content measure</a>
florian@15817 1999 which is FH-A (the flow fragment height for RFCB-A).
florian@15817 2000
florian@15817 2001 The 'height' of rB results from first computing its
florian@15817 2002 <a href="http://www.w3.org/TR/CSS2/visudet.html#block-root-margin">content measure</a>
florian@15817 2003 and then applying the
florian@15817 2004 <a href="http://www.w3.org/TR/CSS2/visudet.html#min-max-heights">rules for max-height</a>.
florian@15817 2005 Here, the vertical content measure evaluates to FH-B.
florian@15817 2006 After applying the rules for 'max-height'
florian@15817 2007 and accounting for margins, padding and borders,
florian@15817 2008 the used 'height' of rB is resolved to LH-B
florian@15817 2009 (<code>150px</code>).
florian@15817 2010
florian@15817 2011 The 'height' of rC's box results from
florian@15817 2012 <a href="http://www.w3.org/TR/CSS2/visudet.html#block-root-margin">calculating its content measure</a>:
florian@15817 2013 FH-C becomes rC's used 'height'.
florian@15817 2014
florian@15817 2015 <figure>
florian@15817 2016 <img src="images/regions-visual-formatting-step-2.png" width=370 alt="Step 2: Layout document and regions without named flows"/>
florian@15817 2017 <figcaption>
florian@15817 2018 Step 2: Layout document and regions without <a>named flows</a>
florian@15817 2019 </figcaption>
florian@15817 2020 </figure>
florian@15817 2021
florian@15817 2022 <h4 id="step3-example">
florian@15817 2023 Step 3: named flows layout</h4>
florian@15817 2024
florian@15817 2025 In this final step,
florian@15817 2026 the <code>article</code> <a>named flow</a>
florian@15817 2027 is laid out in its <a>region chain</a>.
florian@15817 2028 The used 'width' for each of the RFCB
florian@15817 2029 is resolved as in step 1 above.
florian@15817 2030
florian@15817 2031 The used 'height' for the RFCB is a result
florian@15817 2032 of laying out the as much of the content
florian@15817 2033 in the <span>region</span> without overflowing its content box
florian@15817 2034 and following the <a href="http://www.w3.org/TR/css3-break/">fragmentation rules</a>.
florian@15817 2035
florian@15817 2036 Because the computed 'width' of the RFCB has not changed
florian@15817 2037 and the fragmentation rules applied are the same as in Phase 1, Step 2,
florian@15817 2038 the used 'height' for RFCB-A, RFCB-B and RFCB-C
florian@15817 2039 are LH-A, LH-B and LH-C, respectively.
florian@15817 2040
florian@15817 2041 There may be situations where the used 'height'
florian@15817 2042 of RFCBs resolved in Step 3 are different
florian@15817 2043 from the <span>flow fragment height</span>
florian@15817 2044 computed in Step 1 Phase 2.
florian@15817 2045
florian@15817 2046 <figure>
florian@15817 2047 <img src="images/regions-visual-formatting-step-3.png" width=370 alt="Step 3: Final result after laying out named flows in regions"/>
florian@15817 2048 <figcaption>
florian@15817 2049 Step 3: Final result after laying out <a>named flows</a> in regions
florian@15817 2050 </figcaption>
florian@15817 2051 </figure>
florian@15817 2052
florian@15817 2053 <h2 id="relation-to-document-events">
florian@15817 2054 Relation to document events</h2>
florian@15817 2055
florian@15817 2056 The CSS Regions module does not alter
florian@15817 2057 the normal processing of events
florian@15817 2058 in the document tree.
florian@15817 2059 In particular,
florian@15817 2060 if an event occurs on an element
florian@15817 2061 that is part of a <a>named flow</a>,
florian@15817 2062 the <a href= "http://www.w3.org/TR/dom/#events">event's bubble and capture phases</a>
florian@15817 2063 happen following the document tree order.
florian@15817 2064
florian@15817 2065 <div class="note"><span class="note-prefix">Note </span>
florian@15817 2066
florian@15817 2067 This means that in most cases
florian@15817 2068 <a>CSS Regions</a>
florian@15817 2069 will not receive user events
florian@15817 2070 that trigger on their named flow content.
florian@15817 2071 Event handlers for named flow content can check
peter@16986 2072 <code><a href="https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface">getElementsFromPoint()</a></code> [[CSSOM-VIEW]]
florian@15817 2073 to find the <a>CSS Region</a>
florian@15817 2074 where the user event occurred.
florian@15817 2075 Future versions of CSS-UI may provide
florian@15817 2076 a more general solution for user event bubbling
florian@15817 2077 where the stack of elements
florian@15817 2078 at the event coordinates
florian@15817 2079
florian@15817 2080 </div>
florian@15817 2081
florian@15817 2082 <h2 id="relation-to-other-specifications">
florian@15817 2083 Relation to other specifications</h2>
florian@15817 2084
florian@15817 2085 This specification is related to other specifications
florian@15817 2086 as described in the references section.
florian@15817 2087 In addition, it is related to the following specifications:
florian@15817 2088
florian@15817 2089 <ol>
florian@15817 2090 <li>
florian@15817 2091 CSS Fragmentation Module Level 3 [[CSS3-BREAK]].
florian@15817 2092 This module defines the rules for fragmenting content over multiple containers
florian@15817 2093 and applies to <a>CSS Regions</a>
florian@15817 2094 in addition to applying to multi-column and paged media.
florian@15817 2095 </li>
florian@15817 2096
florian@15817 2097 <li>
florian@15817 2098 CSS Pagination Templates Module Level 3 [[CSS3-PAGE-TEMPLATE]].
florian@15817 2099 This module defines a syntax to define layout templates
florian@15817 2100 which can be used when paginating content.
florian@15817 2101 The page templates use regions.
florian@15817 2102 </li>
florian@15817 2103
florian@15817 2104 <li>
florian@15817 2105 CSS Exclusions Module [[CSS3-EXCLUSIONS]].
florian@15817 2106 This module defines a generic way to define exclusions
florian@15817 2107 around which content can flow.
florian@15817 2108 This can be seen as an extension to CSS floats.
florian@15817 2109 In advanced layout designs,
florian@15817 2110 it is expected that the CSS Exclusions module
florian@15817 2111 will be commonly combined with the CSS Regions module.
florian@15817 2112 </li>
florian@15817 2113
florian@15817 2114 <li>
florian@15817 2115 CSS Line Grid Module [[CSS3-LINE-GRID]].
florian@15817 2116 This module defines a concept of line grid
florian@15817 2117 to align the position of lines in different elements.
florian@15817 2118 The line grid functionality is related and needed
florian@15817 2119 for aligning content flowing in separate regions.
florian@15817 2120 </li>
florian@15817 2121 </ol>
florian@15817 2122
florian@15817 2123 <h2 id="usecases">
florian@15817 2124 Use Cases</h2>
florian@15817 2125
florian@15817 2126 Use cases are described on
florian@15817 2127 <a href="http://wiki.csswg.org/spec/css3-regions/regions-use-cases">these</a>
florian@15817 2128 <a href="http://wiki.csswg.org/spec/css3-regions/regions-print-use-cases">pages</a>.
florian@15817 2129
florian@15817 2130 <h2 id="changes">
florian@15817 2131 Changes</h2>
florian@15817 2132
florian@15817 2133 <h3 id="changes_from_Feb_18_2014">
florian@15817 2134 Changes from <a href="http://www.w3.org/TR/2014/WD-css3-regions-20140218/">February 18<sup>th</sup> 2014</a> version</h3>
florian@15817 2135
florian@15817 2136 <ul>
florian@15817 2137 <li>Added three simpler examples to the introduction</li>
florian@15817 2138 <li>Moved complex example to the <a href="http://wiki.csswg.org/spec/css3-regions/complex-layout-example">CSSWG wiki</a></li>
florian@15817 2139 </ul>
florian@15817 2140
florian@15817 2141 <h3 id="changes_from_May_28_2013">
florian@15817 2142 Changes from <a href="http://www.w3.org/TR/2013/WD-css3-regions-20130528/">May 28<sup>th</sup> 2013</a> version</h3>
florian@15817 2143
florian@15817 2144 <ul>
florian@15817 2145 <li>Removed region styling from this level</li>
florian@15817 2146 <li>Changed ::region() to ::region</li>
florian@15817 2147 <li>display:none elements do not become CSS Regions</li>
florian@15817 2148 <li>Clarify accessibility interactions with flow-into</li>
florian@15817 2149 <li>Change NamedFlowCollection to NamedFlowMap</li>
florian@15817 2150 <li>Remove mention of run-in and clarify ::before and ::after block containers</li>
florian@15817 2151 <li>Removed custom element syntax from examples</li>
florian@15817 2152 <li>Changed NamedFlowCollection getters back to null when there is no NamedFlow.</li>
florian@15817 2153 <li>Removed issue on user events and added note describing solution(s)</li>
florian@15817 2154 <li>Changed type of NamedFlow.getContent() from NodeList to sequence&lt;Node&gt;</li>
florian@15817 2155 </ul>
florian@15817 2156
florian@15817 2157 <h3 id="changes_from_Aug_28_2012">
florian@15817 2158 Changes from <a href="http://www.w3.org/TR/2012/WD-css3-regions-20120823/">August 28<sup>th</sup> 2012</a> version</h3>
florian@15817 2159
florian@15817 2160 <ul>
florian@15817 2161 <li>Changed @region rule to ::region() functional pseudo-element</li>
florian@15817 2162 <li>Removed CSSRegionStyleRule (see above)</li>
florian@15817 2163 <li>Tied named flow event triggers to visual processing model</li>
florian@15817 2164 <li>Described how visual formatting of nested regions works</li>
florian@15817 2165 <li>Added content and element keywords to flow-into</li>
florian@15817 2166 <li>Added regionoversetchange event</li>
florian@15817 2167 <li>renamed regionlayoutupdate to regionfragmentchange</li>
florian@15817 2168 <li>Defined offsetParent interaction</li>
florian@15817 2169 <li>Removed implication of DOM manipulation</li>
florian@15817 2170 <li>Changed Appendix A to use custom element layout.</li>
florian@15817 2171 <li>Noted change in pseudo-element generation with flow-from.</li>
florian@15817 2172 <li>Changed case of regionlayoutupdate to match other events in [[DOM-LEVEL-3-EVENTS]].</li>
florian@15817 2173 <li>Added section on fragmenting the fragmenters.</li>
florian@15817 2174 <li>Added section on handling circular flow-from and flow-into situations.</li>
florian@15817 2175 <li>Added alignment and justification to region styling properties.</li>
florian@15817 2176 <li>Added timing for regionLayoutUpdate event.</li>
florian@15817 2177 <li>Clarified interaction between content and flow-from for pseudo-elements.</li>
florian@15817 2178 <li>Changed NamedFlowCollection getters to return undefined when there is no NamedFlow.</li>
florian@15817 2179 <li>Changed region-overflow property to region-fragment.</li>
florian@15817 2180 </ul>
florian@15817 2181
florian@15817 2182 <h3 id="changes_from_May_03_2012">
florian@15817 2183 Changes from <a href="http://www.w3.org/TR/2012/WD-css3-regions-20120503/">May 3<sup>rd</sup> 2012</a> version</h3>
florian@15817 2184
florian@15817 2185 <ul>
florian@15817 2186 <li>Removed exceptions from the Region interface.</li>
florian@15817 2187 <li>Changed NamedFlowCollection from live to a static snapshot.</li>
florian@15817 2188 <li>Changed NamedFlow to inherit from EventTarget.</li>
florian@15817 2189 <li>Removed flowFrom from Region interface and changed method name to getComputedRegionStyle().</li>
florian@15817 2190 <li>Region interface is now a supplemental interface with the [NoInterfaceObject] extended attribute.</li>
florian@15817 2191 <li>Added note for regionLayoutUpdate dispatching in nested flows.</li>
florian@15817 2192 <li>Removed Document.getFlowByName() in favor of NamedFlowCollection.namedItem().</li>
florian@15817 2193 <li>Changed to overset:false for NULL NamedFlow.</li>
florian@15817 2194 <li>Changed regionLayoutUpdate to not bubble.</li>
florian@15817 2195 </ul>
florian@15817 2196
florian@15817 2197 <h3 id="older_changes">Older Changes</h3>
florian@15817 2198
florian@15817 2199 Older changelogs are <a href="http://wiki.csswg.org/spec/css3-regions/older-changelogs">archived</a> on the CSSWG wiki.
florian@15817 2200
florian@15817 2201 <h2 class="no-num" id="acknowledgments">
florian@15817 2202 Acknowledgments</h2>
florian@15817 2203
florian@15817 2204 The editors are grateful to the CSS working group
florian@15817 2205 for their feedback and help with the genesis of this specification.
florian@15817 2206
florian@15817 2207 In addition, the editors would like to thank
florian@15817 2208 the following individuals for their contributions,
florian@15817 2209 either during the conception of CSS Regions
florian@15817 2210 or during its development and specification review process:
florian@15817 2211
florian@15817 2212 Erik Arvidsson,
florian@15817 2213 Tab Atkins,
florian@15817 2214 Catalin Badea,
florian@15817 2215 Mihai Balan,
florian@15817 2216 Andrei Bucur,
florian@15817 2217 Razvan Caliman,
florian@15817 2218 Alexandru Chiculita,
florian@15817 2219 Phil Cupp,
florian@15817 2220 Arron Eicholz,
florian@15817 2221 John Jansen,
florian@15817 2222 CJ Gammon,
florian@15817 2223 Dimitri Glazkov,
florian@15817 2224 Daniel Glazman,
florian@15817 2225 Arno Gourdol,
florian@15817 2226 Catalin Grigoroscuta,
florian@15817 2227 David Hyatt,
florian@15817 2228 Brian Heuston,
florian@15817 2229 Ian Hickson,
florian@15817 2230 Jonathan Hoersch,
florian@15817 2231 Michael Jolson,
florian@15817 2232 Brad Kemper,
florian@15817 2233 HÃ¥kon Wium Lie,
florian@15817 2234 Kang-Hao (Kenny) Lu,
florian@15817 2235 Mihai Maerean,
florian@15817 2236 Markus Mielke,
florian@15817 2237 Robert O'Callahan,
florian@15817 2238 Edward O'Connor,
florian@15817 2239 Mihnea Ovidenie,
florian@15817 2240 Virgil Palanciuc,
florian@15817 2241 Olga Popiv,
florian@15817 2242 Christoph Päper,
florian@15817 2243 Anton Prowse,
florian@15817 2244 Florian Rivoal,
florian@15817 2245 Peter Sorotokin,
florian@15817 2246 Elliott Sprehn,
florian@15817 2247 Radu Stavila,
florian@15817 2248 Christian Stockwell,
florian@15817 2249 Eugene Veselov,
florian@15817 2250 Boris Zbarsky,
florian@15817 2251 Stephen Zilles
florian@15817 2252 and the CSS Working Group members.

mercurial