layout/doc/table_reflow_slides.html

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

michael@0 1 <!-- This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 - License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
michael@0 4
michael@0 5 <!-- vim:sw=2:et:ts=2:tw=72:
michael@0 6 -->
michael@0 7 <!DOCTYPE html public "-//W3C//DTD HTML 4.01 Transitional//EN"
michael@0 8 "http://www.w3.org/TR/html4/loose.dtd">
michael@0 9 <html lang="en-US">
michael@0 10 <head>
michael@0 11 <title>Table Reflow Tech Talk, 2002-08-05</title>
michael@0 12 <style type="text/css">
michael@0 13
michael@0 14 html, body {
michael@0 15 height: 100%;
michael@0 16 overflow: visible;
michael@0 17 }
michael@0 18
michael@0 19 body {
michael@0 20 font-size: 1.4em;
michael@0 21 font-family: Verdana, Arial, Helvetica, sans-serif;
michael@0 22 font-weight: bold;
michael@0 23 background: white;
michael@0 24 color: black;
michael@0 25 }
michael@0 26
michael@0 27 h1, h2, p {
michael@0 28 margin: 0;
michael@0 29 }
michael@0 30
michael@0 31 h1 {
michael@0 32 font: inherit;
michael@0 33 font-size: 1.5em;
michael@0 34 /* text-align: center; */
michael@0 35 margin-bottom: 0.8em;
michael@0 36 border-bottom: 0.1em solid #006;
michael@0 37 color: #006;
michael@0 38 }
michael@0 39
michael@0 40 h2 {
michael@0 41 font: inherit;
michael@0 42 font-size: 1.2em;
michael@0 43 text-align: left;
michael@0 44 margin: 0.15em 0;
michael@0 45 }
michael@0 46
michael@0 47 ul {
michael@0 48 padding: 0 0 0 1.4em;
michael@0 49 margin: 0;
michael@0 50 }
michael@0 51
michael@0 52 li { margin: 0;
michael@0 53 margin-top: 0.5em;
michael@0 54 padding: 0;
michael@0 55 font-size: 1.0em;}
michael@0 56
michael@0 57 div.slide {
michael@0 58 position: relative;
michael@0 59 min-height: 100%;
michael@0 60 }
michael@0 61
michael@0 62 div.nav {
michael@0 63 /*
michael@0 64 position: absolute;
michael@0 65 top: 4px;
michael@0 66 right: 4px;
michael@0 67 */
michael@0 68 float: right;
michael@0 69 margin: 4px;
michael@0 70 }
michael@0 71
michael@0 72 div.nav :link, div.nav :visited, div.nav span {
michael@0 73 text-decoration: none;
michael@0 74 background: #006;
michael@0 75 color: white;
michael@0 76 padding: 0 0.4em 0.2em 0.4em;
michael@0 77 line-height: 1.4em;
michael@0 78 }
michael@0 79
michael@0 80 div.nav :link:hover, div.nav :visited:hover {
michael@0 81 background: #00f;
michael@0 82 }
michael@0 83
michael@0 84 table {
michael@0 85 margin: auto;
michael@0 86 }
michael@0 87
michael@0 88 table.box {
michael@0 89 border-collapse: collapse;
michael@0 90 border: 2px solid black;
michael@0 91 box-sizing: border-box;
michael@0 92 width:98%;
michael@0 93 height:96%;
michael@0 94 }
michael@0 95
michael@0 96 row {
michael@0 97 border: 2px solid black;
michael@0 98 }
michael@0 99 row.title {
michael@0 100 border: hidden;
michael@0 101 }
michael@0 102
michael@0 103 table td {
michael@0 104 /*text-align: center;*/
michael@0 105 empty-cells: hide;
michael@0 106 }
michael@0 107
michael@0 108 table td.box {
michael@0 109 height:100%;
michael@0 110 border: 2px solid black;
michael@0 111 }
michael@0 112
michael@0 113 table td.title {
michael@0 114 border-top: hidden;
michael@0 115 border-right: hidden;
michael@0 116 border-left: hidden;
michael@0 117 font-size: .5em;
michael@0 118 }
michael@0 119
michael@0 120 table td.title2 {
michael@0 121 border-bottom: hidden;
michael@0 122 border-right: hidden;
michael@0 123 border-left: hidden;
michael@0 124 font-size: .5em;
michael@0 125 }
michael@0 126
michael@0 127 table.tree tr:not(.arrows) td {
michael@0 128 font-family: monospace;
michael@0 129 border: 0.1em solid;
michael@0 130 font-size: .7em;
michael@0 131 text-align:center;
michael@0 132 }
michael@0 133
michael@0 134 table td.left-arrow {
michael@0 135 text-align: right;
michael@0 136 }
michael@0 137
michael@0 138 table td.right-arrow {
michael@0 139 text-align: left;
michael@0 140 }
michael@0 141
michael@0 142 table td.center-arrow {
michael@0 143 text-align: center;
michael@0 144 }
michael@0 145
michael@0 146 span.html {
michael@0 147 color:purple;
michael@0 148 }
michael@0 149
michael@0 150 table td.space {
michael@0 151 width: 5%;
michael@0 152 }
michael@0 153
michael@0 154 table td.frame {
michael@0 155 width: 22%;
michael@0 156 }
michael@0 157
michael@0 158 span.comment {
michael@0 159 color: red;
michael@0 160 }
michael@0 161
michael@0 162 </style>
michael@0 163 </head>
michael@0 164 <body>
michael@0 165
michael@0 166 <div class="slide" id="s0">
michael@0 167 <div class="nav">
michael@0 168 <a href="#s28">&lt;</a>
michael@0 169 <a href="#s1">&gt;</a>
michael@0 170 </div>
michael@0 171 <table style="margin: auto"><tr><td>
michael@0 172 <center>
michael@0 173 <h1>Table Reflow Internals<br>Tech Talk</h1>
michael@0 174 <p>Aug 5, 2002</p>
michael@0 175 <p style="margin-top: 0.5em">Chris Karnaze</a></p>
michael@0 176 </center>
michael@0 177 </td></tr></table>
michael@0 178
michael@0 179 </div>
michael@0 180
michael@0 181 <div class="slide" id="s1">
michael@0 182 <div class="nav">
michael@0 183 <a href="#s0">&lt;</a>
michael@0 184 <a href="#s2">&gt;</a>
michael@0 185 </div>
michael@0 186 <h1>Overview</h1>
michael@0 187 <ul>
michael@0 188 <li>Review of reflow</li>
michael@0 189 <li>Table frames</li>
michael@0 190 <li>Table reflow</li>
michael@0 191 <li>Intro to paginated reflow</li>
michael@0 192 <li>Table paginated reflow</li>
michael@0 193 </ul>
michael@0 194 </div>
michael@0 195
michael@0 196 <div class="slide" id="s2">
michael@0 197 <div class="nav">
michael@0 198 <a href="#s1">&lt;</a>
michael@0 199 <a href="#s3">&gt;</a>
michael@0 200 </div>
michael@0 201 <h1>Review of Reflow</h1>
michael@0 202 <ul>
michael@0 203 <li>Reflow process starts when
michael@0 204 <ul>
michael@0 205 <li>An html document starts loading (the frame tree contains only viewport, scroll(s), canvas, html, body).</li>
michael@0 206 <li>The initial chunk of an xml doc is loaded.</li>
michael@0 207 <li>The initial chunk of an html doc (or a subsequent chunk of an xml doc) is loaded. The container posts a
michael@0 208 dirty reflow command with itself as the target. </li>
michael@0 209 <li>Content is inserted, appended, or deleted through the DOM. The container posts a dirty reflow command
michael@0 210 with itself as the target.</li>
michael@0 211 <li>Style changes through the DOM - javascript, browser change font (CTRL+/-), a preference changes, etc.</li>
michael@0 212 </ul>
michael@0 213 </li>
michael@0 214 </ul>
michael@0 215 </div>
michael@0 216
michael@0 217 <div class="slide" id="s3">
michael@0 218 <div class="nav">
michael@0 219 <a href="#s2">&lt;</a>
michael@0 220 <a href="#s4">&gt;</a>
michael@0 221 </div>
michael@0 222 <h1>Review of Reflow</h1>
michael@0 223 <ul>
michael@0 224 <li>Reflow starts with pres shell
michael@0 225 <ul>
michael@0 226 <li>Which reflows the reflow root (usually the view port frame),</li>
michael@0 227 <li>Which reflows it children, etc.</li>
michael@0 228 </ul>
michael@0 229 </li>
michael@0 230 <li>Ususally it starts when the pres shell processes its queue of reflow commands.</li>
michael@0 231 <li>The reflower
michael@0 232 <ul>
michael@0 233 <li>Positions reflowee (if it can) before actually reflowing in case views are involved
michael@0 234 (e.g. absolutely positioned elements) </li>
michael@0 235 <li>Reflows reflowee and passes a reflow state (in) and a reflow metrics (in/out)</li>
michael@0 236 </ul>
michael@0 237 </li>
michael@0 238 </ul>
michael@0 239 </div>
michael@0 240
michael@0 241 <div class="slide" id="s4">
michael@0 242 <div class="nav">
michael@0 243 <a href="#s3">&lt;</a>
michael@0 244 <a href="#s5">&gt;</a>
michael@0 245 </div>
michael@0 246 <h1>Review of Reflow</h1>
michael@0 247 <ul>
michael@0 248 <li>The reflow state:
michael@0 249 <ul>
michael@0 250 <li>Is a node in a tree structurally equivalent to the frame tree of reflow participants</li>
michael@0 251 <li>contains:
michael@0 252 <ul>
michael@0 253 <li>reflow type,</li>
michael@0 254 <li>avail size,</li>
michael@0 255 <li>various computed values,</li>
michael@0 256 <li>resolved style structs</li>
michael@0 257 <li>possible request for preferred size and more.</li>
michael@0 258 </ul>
michael@0 259 </li>
michael@0 260 </ul>
michael@0 261 </li>
michael@0 262 </ul>
michael@0 263 </div>
michael@0 264
michael@0 265 <div class="slide" id="s5">
michael@0 266 <div class="nav">
michael@0 267 <a href="#s4">&lt;</a>
michael@0 268 <a href="#s6">&gt;</a>
michael@0 269 </div>
michael@0 270 <h1>Review of Reflow</h1>
michael@0 271 <ul>
michael@0 272 </li>
michael@0 273 <li>the reflow metrics contains:
michael@0 274 <ul class=nested>
michael@0 275 <li>max element size (if requested) - the minimum size it can be</li>
michael@0 276 <li>preferred size (if requested) - the size it would like to be given no size constraints.</li>
michael@0 277 <li>desired size - the size it would like to be given the avail size. This
michael@0 278 is equivalent to preferred size if the avail size is not constrained.</li>
michael@0 279 </ul>
michael@0 280 </li>
michael@0 281 </ul>
michael@0 282 </div>
michael@0 283
michael@0 284 <div class="slide" id="s6">
michael@0 285 <div class="nav">
michael@0 286 <a href="#s5">&lt;</a>
michael@0 287 <a href="#s7">&gt;</a>
michael@0 288 </div>
michael@0 289 <h1>Review of Reflow</h1>
michael@0 290 <ul>
michael@0 291 <li>The reflowee sets various sizes in the reflow metrics after (possibly) reflowing some or all of its children
michael@0 292 which reflows it children, etc.</li>
michael@0 293 <li>The reflowee returns a reflow status which indicates
michael@0 294 <ul class=nested>
michael@0 295 <li>if it is complete, and thus not have to continue (split)</li>
michael@0 296 <li>breaking status (in the case of some inline frames)</li>
michael@0 297 <li>if there is truncation (it can't fit in the space and can't split). This is just a convience mechanism.</li>
michael@0 298 </ul>
michael@0 299 </li>
michael@0 300
michael@0 301 </div>
michael@0 302
michael@0 303 <div class="slide" id="s7">
michael@0 304 <div class="nav">
michael@0 305 <a href="#s6">&lt;</a>
michael@0 306 <a href="#s8">&gt;</a>
michael@0 307 </div>
michael@0 308
michael@0 309 <h1>Kinds of reflows</h1>
michael@0 310 <ul>
michael@0 311 <li>Initial - reflowee's first reflow must be of this type (reflower's responsibility).</li>
michael@0 312 <li>Resize - reflowee gets a change in available space only. Similar to initial, except it can reoccur.</li>
michael@0 313 <li>Incremental - has a reflow path (tree) where each node has a command with a target frame, <br>reflow command types are:</li>
michael@0 314 <ul class=nested>
michael@0 315 <li>dirty - something changed inside a target (e.g. it gains, loses children)</li>
michael@0 316 <li>style changed - a target changed stylisticly (recall, size is a style property)</li>
michael@0 317 <li>content changed - a target's content changed (e.g. a text run)</li>
michael@0 318 <li>user defined - currently only used for fixed positioned frames </li>
michael@0 319 </ul>
michael@0 320 </li>
michael@0 321 </ul>
michael@0 322 </div>
michael@0 323
michael@0 324 <div class="slide" id="s8">
michael@0 325 <div class="nav">
michael@0 326 <a href="#s7">&lt;</a>
michael@0 327 <a href="#s9">&gt;</a>
michael@0 328 </div>
michael@0 329 <h1>Kinds of reflows</h1>
michael@0 330 <ul>
michael@0 331 <li>Incremental reflow (continued)
michael@0 332 <ul class=nested>
michael@0 333 <li>reflower not allowed to change available size of reflowee</li>
michael@0 334 <li>reflow commands get coalesced to streamline processing</li>
michael@0 335 </ul>
michael@0 336 </li>
michael@0 337 <li>Style change
michael@0 338 <ul class=nested>
michael@0 339 <li>a target changed stylistic if there is a target, otherwise every frame may need to respond</li>
michael@0 340 <li>parent of target usually turns it into an incremental reflow with a style changed command type</li>
michael@0 341 </ul>
michael@0 342 </li>
michael@0 343 </ul>
michael@0 344 </div>
michael@0 345
michael@0 346 <div class="slide" id="s9">
michael@0 347 <div class="nav">
michael@0 348 <a href="#s8">&lt;</a>
michael@0 349 <a href="#s10">&gt;</a>
michael@0 350 </div>
michael@0 351 <h1>Table Frames</h1>
michael@0 352 <BR>
michael@0 353 <table class="tree" width=90%>
michael@0 354 <tr><td class=frame><td class=space style="width:2%"><td class=frame><td class=space style="width:2%">
michael@0 355 <td class=frame><td class=space><td class=frame></tr>
michael@0 356 <tr><td><td><td class=frame><td>
michael@0 357 <td>nsTableOuter Frame<td><td></tr>
michael@0 358 <tr class="arrows"><td><td><td><td class=left-arrow>&#x2199;<td><td class=right-arrow>&#x2198;</tr>
michael@0 359 <tr><td><td><td>nsTable<BR>Frame<td><td><td><td>nsTableCaption<BR>Frame</tr>
michael@0 360 <tr class="arrows"><td><td class=left-arrow>&#x2199;<td><td class=right-arrow>&#x2198;<td><td><td class=center-arrow>&darr;</tr>
michael@0 361 <tr><td>nsTableCol<BR>GroupFrame<td><td><TD><td>nsTableRow<BR>GroupFrame<td><td>nsBlockFrame</tr>
michael@0 362 <tr class="arrows"><td class=center-arrow>&darr;<td><td><td><td class=center-arrow>&darr;</tr>
michael@0 363 <tr><td>nsTableCol<BR>Frame<td><TD><TD><td>nsTableRow<BR>Frame</tr>
michael@0 364 <tr class="arrows"><td><td><td><td><td class=center-arrow>&darr;</tr>
michael@0 365 <tr><td><td><td><TD><td>nsTableCell<BR>Frame</tr>
michael@0 366 <tr class="arrows"><td><td><td><td><td class=center-arrow>&darr;</tr>
michael@0 367 <tr><td><td><td><TD><td>nsBlock<BR>Frame</tr>
michael@0 368 </table>
michael@0 369 </div>
michael@0 370
michael@0 371 <div class="slide" id="s10">
michael@0 372 <div class="nav">
michael@0 373 <a href="#s9">&lt;</a>
michael@0 374 <a href="#s11">&gt;</a>
michael@0 375 </div>
michael@0 376 <h1>Table Reflow</h1>
michael@0 377 <ul>
michael@0 378 <li>Outer table reflows table and caption (if present)</li>
michael@0 379 <li>Table reflows row groups in multiple passes</li>
michael@0 380 <ul class=nested>
michael@0 381 <li>Pass 1 - unconstrained width, height and requests max elem width.</li>
michael@0 382 <li>The table figures out the column widths (balances) given the style width constraints
michael@0 383 on the table, col groups, cols, cells the preferred and max element sizes of the cells
michael@0 384 (from the pass 1 reflow), and considers colspans</li>
michael@0 385 <li>Pass 2 - cell widths are constrained by the column widths (heights are only
michael@0 386 constrained in paginated mode).</li>
michael@0 387 </ul>
michael@0 388 </li>
michael@0 389 </ul>
michael@0 390 </div>
michael@0 391
michael@0 392 <div class="slide" id="s11">
michael@0 393 <div class="nav">
michael@0 394 <a href="#s10">&lt;</a>
michael@0 395 <a href="#s12">&gt;</a>
michael@0 396 </div>
michael@0 397 <h1>Table Reflow</h1>
michael@0 398 <ul>
michael@0 399 <li>Table reflows row groups (continued)</li>
michael@0 400 <ul class=nested>
michael@0 401 <li>The row group figures out the row heights given the its style height constraints
michael@0 402 its rows and cells and the actual heights of its rows and cells from the pass 2 reflow</li>
michael@0 403 <li>If the table has a style height, it allocates extra height to its row groups, rows and cells.</li>
michael@0 404 </ul>
michael@0 405 </li>
michael@0 406 <li>In each pass, row groups reflow rows which reflow cells which reflow cell blocks</li>
michael@0 407 </ul>
michael@0 408 </div>
michael@0 409
michael@0 410 <div class="slide" id="s12">
michael@0 411 <div class="nav">
michael@0 412 <a href="#s11">&lt;</a>
michael@0 413 <a href="#s13">&gt;</a>
michael@0 414 </div>
michael@0 415 <h1>Table Reflow Example</h1>
michael@0 416 <table width=100%>
michael@0 417 <tr>
michael@0 418 <td width=100%>
michael@0 419 <pre style="font-size:.6em;">
michael@0 420 tblO 030176CC r=0 a=8940,UC c=0,0 cnt=429
michael@0 421 tbl 030178C4 r=0 a=8940,UC c=4470,UC cnt=430
michael@0 422 rowG 03017A7C r=0 a=UC,UC c=UC,UC cnt=431
michael@0 423 row 03017C08 r=0 a=UC,UC c=UC,UC cnt=432
michael@0 424 cell 03017DA8 r=0 a=UC,UC c=UC,UC cnt=433
michael@0 425 block 03017E08 r=0 a=UC,UC c=UC,UC cnt=434
michael@0 426 block 03017E08 d=870,300 me=480
michael@0 427 cell 03017DA8 d=930,360 me=540
michael@0 428 cell 0301A8CC r=0 a=UC,UC c=UC,UC cnt=436
michael@0 429 block 0301A92C r=0 a=UC,UC c=UC,UC cnt=437
michael@0 430 block 0301A92C d=1335,300 me=465
michael@0 431 cell 0301A8CC d=1395,360 me=525
michael@0 432 row 03017C08 d=UC,360
michael@0 433 rowG 03017A7C d=UC,360
michael@0 434 rowG 03017A7C r=2 a=4470,UC c=4470,UC cnt=442
michael@0 435 row 03017C08 r=2 a=4470,UC c=4470,UC cnt=443
michael@0 436 cell 03017DA8 r=2 a=1755,UC c=1695,UC cnt=444
michael@0 437 block 03017E08 r=2 a=1695,UC c=1695,UC cnt=445
michael@0 438 block 03017E08 d=1695,300
michael@0 439 cell 03017DA8 d=1755,360
michael@0 440 cell 0301A8CC r=2 a=2625,UC c=2565,UC cnt=446
michael@0 441 block 0301A92C r=2 a=2565,UC c=2565,UC cnt=447
michael@0 442 block 0301A92C d=2565,300
michael@0 443 cell 0301A8CC d=2625,360
michael@0 444 row 03017C08 d=4470,360
michael@0 445 rowG 03017A7C d=4470,360
michael@0 446 tbl 030178C4 d=4500,450
michael@0 447 tblO 030176CC d=4500,450
michael@0 448
michael@0 449 <a href="frame_reflow_debug.html">frame reflow debugging</a> gives instructions
michael@0 450 for turning this on.
michael@0 451 </pre>
michael@0 452 </td>
michael@0 453 <td>
michael@0 454 <pre style="font-size:.7em;">
michael@0 455 &lt;<span class=html>table</span> width=300&gt;
michael@0 456 &lt;<span class=html>tr</span>&gt;
michael@0 457 &lt;<span class=html>td</span>&gt;foo&lt;<span class=html>/td</span>&gt;
michael@0 458 &lt;<span class=html>td</span>&gt;bar zap&lt;<span class=html>/td</span>&gt;
michael@0 459 &lt;<span class=html>/tr</span>&gt;
michael@0 460 &lt;<span class=html>/table</span>&gt;
michael@0 461 </pre>
michael@0 462 <BR>
michael@0 463 <BR>
michael@0 464 <pre style="font-size:.7em;">
michael@0 465 Key:
michael@0 466
michael@0 467 r = reflow reason,
michael@0 468 0 (initial),
michael@0 469 2 (resize)
michael@0 470 a = avail w, h
michael@0 471 c = computed w, h
michael@0 472 d = desired w, h
michael@0 473 me = max elem w
michael@0 474 <pre>
michael@0 475 </td>
michael@0 476 </tr>
michael@0 477 </table>
michael@0 478 </div>
michael@0 479
michael@0 480 <div class="slide" id="s13">
michael@0 481 <div class="nav">
michael@0 482 <a href="#s12">&lt;</a>
michael@0 483 <a href="#s14">&gt;</a>
michael@0 484 </div>
michael@0 485 <h1>Table reflow optimizations</h1>
michael@0 486 <ul>
michael@0 487 <li>If the table is already balanced, pass 1 constrains the width (like a normal pass 2) based on the current
michael@0 488 column widths. The pass 2 will get skipped if the table doesn't need to rebalance. <!--<span class="comment">please clarify when can this happen</span>--></li>
michael@0 489 <li>Nested table reflowed with an unconstrained width (i.e. an ancestor is doing a pass 1 reflow)
michael@0 490 will only do a pass 1 reflow on its children</li>
michael@0 491 <li>Outer table caches last avail width and avoids reflowing children if resize reflow is the same as previous</li>
michael@0 492 <li>Table caches max element, preferred widths in case they are requested and it isn't rebalanced</li>
michael@0 493 <li>Cell caches prior avail width. if this doesn't change, the row may not have to reflow the cell</li>
michael@0 494 </ul>
michael@0 495
michael@0 496 </div>
michael@0 497
michael@0 498 <div class="slide" id="s14">
michael@0 499 <div class="nav">
michael@0 500 <a href="#s13">&lt;</a>
michael@0 501 <a href="#s15">&gt;</a>
michael@0 502 </div>
michael@0 503 <h1>Table incremental reflow</h1>
michael@0 504 <ul>
michael@0 505 <li>Outer table is a target when a caption is added or removed (dirty) or the table or caption margin
michael@0 506 changes (style changed).</li>
michael@0 507 <li>Caption is a target when it changes stylistically (style changed).</li>
michael@0 508 <li>Table, row group, row, col group, col is a target when a child is added or removed (dirty) or it changes
michael@0 509 stylistically (style changed). <!--<span class="comment">please show how the column style change is propagated
michael@0 510 into the cell reflows as the cells are reflowed by their parent rows and not cols</span>--></li>
michael@0 511 <li>In the dirty cases, a target posted the reflow command in AppendFrames, InsertFrames, or DeleteFrame.</li>
michael@0 512 </ul>
michael@0 513 </div>
michael@0 514
michael@0 515 <div class="slide" id="s15">
michael@0 516 <div class="nav">
michael@0 517 <a href="#s14">&lt;</a>
michael@0 518 <a href="#s16">&gt;</a>
michael@0 519 </div>
michael@0 520 <h1>Table incremental reflow</h1>
michael@0 521 <ul>
michael@0 522 <li>In the style change cases where a target is between the table and the cell, the table is told to rebalance.</li>
michael@0 523 <li>When a target is the cell or below and the cell changes size, the row tells the table so it can decide if
michael@0 524 it needs to rebalance</li>
michael@0 525 <li>When a target is inside the cell's block, the cell
michael@0 526 requests max element, preferred sizes of its block in case they change</li>
michael@0 527 <li>After the table reflows the row group(s) containing the targets, if it rebalances, it then does a pass 2 reflow.</li>
michael@0 528 </ul>
michael@0 529 </div>
michael@0 530
michael@0 531 <div class="slide" id="s16">
michael@0 532 <div class="nav">
michael@0 533 <a href="#s15">&lt;</a>
michael@0 534 <a href="#s17">&gt;</a>
michael@0 535 </div>
michael@0 536 <h1>Special height reflow</h1>
michael@0 537 <ul>
michael@0 538 <li>When there is a % height frame inside a cell without a computed height</li>
michael@0 539 <ul class=nested>
michael@0 540 <li>the frame will never get a chance to size based on the final cell height</li>
michael@0 541 <li>in paginated mode when there is a height on the table, the table doesn't allocate
michael@0 542 extra height to rows until after it does a pass 2 reflow and then it is too late</li>
michael@0 543 </ul>
michael@0 544 </li>
michael@0 545 <li>This can be fixed by doing a special 3rd pass reflow</li>
michael@0 546 </ul>
michael@0 547 </div>
michael@0 548 </div>
michael@0 549
michael@0 550 <div class="slide" id="s17">
michael@0 551 <div class="nav">
michael@0 552 <a href="#s16">&lt;</a>
michael@0 553 <a href="#s18">&gt;</a>
michael@0 554 </div>
michael@0 555 <h1>Special Reflow Example</h1>
michael@0 556 <table width=100% style="text-align:left;">
michael@0 557 <tr>
michael@0 558 <td>
michael@0 559 <pre style="font-size:.7em; text-align:left;">
michael@0 560 &lt;<span class=html>table</span> border=2 width=300&gt;
michael@0 561 &lt;<span class=html>tr</span>&gt;
michael@0 562 &lt;<span class=html>td</span>&gt;
michael@0 563 This cell's width is
michael@0 564 constrained by the
michael@0 565 table and image widths.
michael@0 566 Its exact height is
michael@0 567 hard to determine.
michael@0 568 &lt;<span class=html>/td</span>&gt;
michael@0 569 &lt;<span class=html>td</span>&gt;
michael@0 570 &lt;<span class=html>img</span> src=raptor.jpg
michael@0 571 width=200 height=100%>
michael@0 572 &lt;<span class=html>/td</span>&gt;
michael@0 573 &lt;<span class=html>/tr</span>&gt;
michael@0 574 &lt;<span class=html>/table</span>&gt;
michael@0 575 </pre>
michael@0 576 </td>
michael@0 577 <td>
michael@0 578 <table border=2 width=300>
michael@0 579 <tr>
michael@0 580 <td style="font-size:.7em;">This cell's width is constrained
michael@0 581 by the table and image widths. <BR><BR>Its height
michael@0 582 is hard to determine.<BR><BR> The image needs to be as high as the cell.
michael@0 583 <td>
michael@0 584 <!-- need ?raw=1 for lxr to cough up the image data, not a pretty page -->
michael@0 585 <img src="raptor.jpg?raw=1"
michael@0 586 width=200 height=100%>
michael@0 587 </td>
michael@0 588 </tr>
michael@0 589 </table>
michael@0 590
michael@0 591 </tr>
michael@0 592 </table>
michael@0 593 </div>
michael@0 594
michael@0 595
michael@0 596 <div class="slide" id="s18">
michael@0 597 <div class="nav">
michael@0 598 <a href="#s17">&lt;</a>
michael@0 599 <a href="#s19">&gt;</a>
michael@0 600 </div>
michael@0 601 <h1>Special height reflow</h1>
michael@0 602 <ul>
michael@0 603 <li>The reflow state holds an observer and initiator</li>
michael@0 604 <li>Observer</li>
michael@0 605 <ul class=nested>
michael@0 606 <li>is the table cell used as the height basis</li>
michael@0 607 <li>set by frame without computed height in DidReflow</li>
michael@0 608 <li>gives its block a computed height during 3rd pass</li>
michael@0 609 <li>doesn't change height during 3rd pass</li>
michael@0 610 </ul>
michael@0 611 </li>
michael@0 612 <li>Initiator</li>
michael@0 613 <ul class=nested>
michael@0 614 <li>is the table containing the observer</li>
michael@0 615 <li>starts the 3rd pass reflow and sets a bit in the reflow state</li>
michael@0 616 <li>gives its block a computed height during 3rd pass</li>
michael@0 617 <li>could also be inside a cell which is an observer</li>
michael@0 618 </ul>
michael@0 619 </li>
michael@0 620 </div>
michael@0 621
michael@0 622 <div class="slide" id="s19">
michael@0 623 <div class="nav">
michael@0 624 <a href="#s18">&lt;</a>
michael@0 625 <a href="#s20">&gt;</a>
michael@0 626 </div>
michael@0 627 <h1>Special height reflow</h1>
michael@0 628 <ul>
michael@0 629 <li>Optimizations</li>
michael@0 630 <ul class=nested>
michael@0 631 <li>only frames needing 3rd pass actually get it</li>
michael@0 632 <li>frames gettting a 3rd pass only get it once</li>
michael@0 633 </ul>
michael@0 634 </li>
michael@0 635 </div>
michael@0 636
michael@0 637 <div class="slide" id="s20">
michael@0 638 <div class="nav">
michael@0 639 <a href="#s19">&lt;</a>
michael@0 640 <a href="#s21">&gt;</a>
michael@0 641 </div>
michael@0 642 <h1>Intro to paginated reflow</h1>
michael@0 643 <ul>
michael@0 644 <li>When a reflowee's available height is constrained, it may not fit and need to either
michael@0 645 split/continue on the next page, or start on the next page.</li>
michael@0 646 <ul class=nested>
michael@0 647 <li>If it can continue, it returns an incomplete status.</li>
michael@0 648 <li>If it can't continue it returns a complete status.</li>
michael@0 649 </ul>
michael@0 650 </li>
michael@0 651 <li>A continuation may also need to be continued</li>
michael@0 652 <li>Continuations are linked together by prevInFlow and nextInFlow pointers </li>
michael@0 653 </ul>
michael@0 654 </div>
michael@0 655
michael@0 656 <div class="slide" id="s21">
michael@0 657 <div class="nav">
michael@0 658 <a href="#s20">&lt;</a>
michael@0 659 <a href="#s22">&gt;</a>
michael@0 660 </div>
michael@0 661 <h1>Pagination Illustration</h1>
michael@0 662 <table class=box style="height:500px">
michael@0 663 <tr><td class="title">nsSimplePageSequence</td></tr>
michael@0 664 <tr>
michael@0 665 <td class=box>
michael@0 666 <table class=box style="height:40%;">
michael@0 667 <tr><td class=title>nsPageFrame</td></tr>
michael@0 668 <tr>
michael@0 669 <td class=box>
michael@0 670 <table class=box style="height:100%;">
michael@0 671 <tr><td class=title>nsPageContentFrame</td></tr>
michael@0 672 <tr>
michael@0 673 <td class=box style="border-bottom: hidden">
michael@0 674 <table class=box style="height:100%; border-bottom:hidden">
michael@0 675 <tr><td class=title>areaFrame (html)</td></tr>
michael@0 676 <tr>
michael@0 677 <td class=box>
michael@0 678 <table class=box style="height:100%; border-bottom:hidden">
michael@0 679 <tr><td class=title>blockFrame (body)</td></tr>
michael@0 680 <tr>
michael@0 681 <td class=box>
michael@0 682 <table class=box style="height:100%; border-bottom:hidden">
michael@0 683 <tr><td class=title>nsTableOuterFrame</td></tr>
michael@0 684 <tr>
michael@0 685 <td class=box></td>
michael@0 686 </tr>
michael@0 687 </table>
michael@0 688 </td>
michael@0 689 </tr>
michael@0 690 </table>
michael@0 691 </td>
michael@0 692 </tr>
michael@0 693 </table>
michael@0 694 </tr>
michael@0 695 </table>
michael@0 696 </td>
michael@0 697 </tr>
michael@0 698 </table>
michael@0 699 <BR>
michael@0 700 <table class=box style="height:40%;">
michael@0 701 <tr>
michael@0 702 <td class=box>
michael@0 703 <table class=box style="height:100%;">
michael@0 704 <tr>
michael@0 705 <td class=box style="border-top: hidden">
michael@0 706 <table class=box style="height:100%; border-top:hidden">
michael@0 707 <tr>
michael@0 708 <td class=box>
michael@0 709 <table class=box style="height:100%; border-top:hidden">
michael@0 710 <tr>
michael@0 711 <td class=box>
michael@0 712 <table class=box style="height:100%; border-top:hidden">
michael@0 713 <tr>
michael@0 714 <td class=box></td>
michael@0 715 </tr>
michael@0 716 <tr><td class=title2>nsTableOuterFrame</td></tr>
michael@0 717 </table>
michael@0 718 </td>
michael@0 719 </tr>
michael@0 720 <tr><td class=title2>blockFrame (body)</td></tr>
michael@0 721 </table>
michael@0 722 </td>
michael@0 723 </tr>
michael@0 724 <tr><td class=title2>areaFrame (html)</td></tr>
michael@0 725 </table>
michael@0 726 </tr>
michael@0 727 <tr><td class=title2>nsPageContentFrame continued</td></tr>
michael@0 728 </table>
michael@0 729 </td>
michael@0 730 </tr>
michael@0 731 <tr><td class=title2>nsPageFrame continued</td></tr>
michael@0 732 </table>
michael@0 733 </td>
michael@0 734 </tr>
michael@0 735 </table>
michael@0 736 </div>
michael@0 737
michael@0 738 <div class="slide" id="s22">
michael@0 739 <div class="nav">
michael@0 740 <a href="#s21">&lt;</a>
michael@0 741 <a href="#s23">&gt;</a>
michael@0 742 </div>
michael@0 743 <h1>Intro to paginated reflow</h1>
michael@0 744 <ul>
michael@0 745 <li>The page sequence starts with one page and reflows it. If the page is incomplete then the page sequence
michael@0 746 creates a continuation for the page and sets it as the page's next sibling (it is also the page's
michael@0 747 nextInFlow).</li>
michael@0 748 <li>The page was incomplete because the page content was incomplete because the doc root was incomplete</li>
michael@0 749 <li>The doc root was incomplete because it contained lines that didn't fit (or if it was mapped to a table,
michael@0 750 because the table didn't fit) becacause a line contained something that didn't fit, etc.</li>
michael@0 751 </ul>
michael@0 752 </div>
michael@0 753
michael@0 754 <div class="slide" id="s23">
michael@0 755 <div class="nav">
michael@0 756 <a href="#s22">&lt;</a>
michael@0 757 <a href="#s24">&gt;</a>
michael@0 758 </div>
michael@0 759 <h1>Intro to paginated reflow</h1>
michael@0 760 <ul>
michael@0 761 <li>If the reflowee is incomplete, the reflower has the responsiblity to:
michael@0 762 <ul>
michael@0 763 <li>Create a continuation for the reflowee</li>
michael@0 764 <li>Ensure that the continuation gets put in the frame hierarchy at the right place
michael@0 765 and gets reflowed at the right time.</li>
michael@0 766 <li>Typically, a reflower accomplishes this by putting the continuation (c) on an overflow
michael@0 767 list which the reflower owns. When the reflower's continuation gets reflowed, it takes c
michael@0 768 and its siblings as children and reflows them.</li>
michael@0 769 </ul>
michael@0 770 </li>
michael@0 771 <li>If the reflowee is complete, truncated (it didn't fit), not at the top of page,
michael@0 772 the reflower should put the reflowee on its overflow list and return an incomplete status.</li>
michael@0 773 </ul>
michael@0 774 </div>
michael@0 775
michael@0 776 <div class="slide" id="s24">
michael@0 777 <div class="nav">
michael@0 778 <a href="#s23">&lt;</a>
michael@0 779 <a href="#s25">&gt;</a>
michael@0 780 </div>
michael@0 781 <h1>Intro to paginated reflow</h1>
michael@0 782 <ul>
michael@0 783 <li>Special assumptions
michael@0 784 <ul>
michael@0 785 <li>There are only initial and (possibly) resize reflows. Incremental
michael@0 786 and style change reflows are not allowed.</li>
michael@0 787 <li>Multiple resize reflows may be necessary (e.g. a child is truncated and gets reflowed on a
michael@0 788 subsequent page) but they should not change the available width from the last time.</li>
michael@0 789 <li>Multiple resize reflows may require special handling if a frame split previously. It may need
michael@0 790 to "pull up" children from a continuation.</li>
michael@0 791 </ul>
michael@0 792 </li>
michael@0 793 </ul>
michael@0 794 </div>
michael@0 795
michael@0 796 <div class="slide" id="s25">
michael@0 797 <div class="nav">
michael@0 798 <a href="#s24">&lt;</a>
michael@0 799 <a href="#s26">&gt;</a>
michael@0 800 </div>
michael@0 801 <h1>Table paginated reflow</h1>
michael@0 802 <ul>
michael@0 803 <li>The block containing the outer table reflows it. If it is incomplete, the block will
michael@0 804 <ul>
michael@0 805 <li>create a continuation for the outer table (which also creates a continuation for the table).</li>
michael@0 806 <li>put the continuation on a new line and place that line on its overflow lines property.</li>
michael@0 807 </ul>
michael@0 808 </li>
michael@0 809 <li>The outer table reflows the table and just returns the status of the table.</li>
michael@0 810 <li>The table does a pass 1 reflow and balances. If it is incomplete,</li>
michael@0 811 <ul>
michael@0 812 <li>it will become the first-in-flow</li>
michael@0 813 <li>it will be the only frame among its continuations to ever balance or calc the cell map, and it only
michael@0 814 does this once</li>
michael@0 815 </ul>
michael@0 816 </li>
michael@0 817 </ul>
michael@0 818 </div>
michael@0 819
michael@0 820 <div class="slide" id="s26">
michael@0 821 <div class="nav">
michael@0 822 <a href="#s25">&lt;</a>
michael@0 823 <a href="#s27">&gt;</a>
michael@0 824 </div>
michael@0 825 <h1>Table paginated reflow</h1>
michael@0 826 <ul>
michael@0 827 <li>The table does a pass 2 reflow constraining both avail heights and widths. If a row group is incomplete, the table
michael@0 828 <ul>
michael@0 829 <li>creates a continuation for the row group</li>
michael@0 830 <li>puts the continuation in its overflow frames property</li>
michael@0 831 </ul>
michael@0 832 </li>
michael@0 833 <li>What follows only applies during the pass 2 reflow.</li>
michael@0 834 <li>The row group</li>
michael@0 835 <ul>
michael@0 836 <li>reflows all of its rows with unconstrained heights and calculates the row heights,</li>
michael@0 837 <li>figures out which row falls on a page boundary and reflows it with a constrained height. If there
michael@0 838 will be a pass 3 reflow then this should (bug) happen at that time instead.</li>
michael@0 839 </ul>
michael@0 840 </li>
michael@0 841 </ul>
michael@0 842 </div>
michael@0 843
michael@0 844 <div class="slide" id="s27">
michael@0 845 <div class="nav">
michael@0 846 <a href="#s26">&lt;</a>
michael@0 847 <a href="#s28">&gt;</a>
michael@0 848 </div>
michael@0 849 <h1>Table paginated reflow</h1>
michael@0 850 <ul>
michael@0 851 <li>The row group (continued)</li>
michael@0 852 <ul>
michael@0 853 <li>creates a continuation for the incomplete row (which also creates continuations for all of its cells
michael@0 854 and all of the cell blocks)</li>
michael@0 855 <li>puts the continuation in its overflow frames property. If the row was truncated and not top of page,
michael@0 856 the row is put in the overflow frames property.
michael@0 857 </ul>
michael@0 858 </li>
michael@0 859 </ul>
michael@0 860 </div>
michael@0 861
michael@0 862 <div class="slide" id="s28">
michael@0 863 <div class="nav">
michael@0 864 <a href="#s27">&lt;</a>
michael@0 865 <a href="#s0">&gt;</a>
michael@0 866 </div>
michael@0 867 <h1>Table paginated reflow</h1>
michael@0 868 <ul>
michael@0 869 <li>The row and cells (getting the constrained height reflow) just reflow their children with a constrained height.
michael@0 870 They don't need an overflow list for continued children because the continuations were created when the
michael@0 871 row group created the row's continutation.</li>
michael@0 872 <li>A cell is incomplete because its block is incomplete. The block uses the overflow lines mechanism
michael@0 873 (mentioned above) for its continued children</li>
michael@0 874 </li>
michael@0 875 <li>There are two splitting scenarios for a table
michael@0 876 <ul>
michael@0 877 <li>An incomplete cells block causes the cell, row, row group, table, outer table to
michael@0 878 be incomplete</li>
michael@0 879 <li>A truncated row or a row that started too far down the page causes the row group,
michael@0 880 table, outer table to be incomplete.</li>
michael@0 881 </ul>
michael@0 882 </li>
michael@0 883 </ul>
michael@0 884 </div>
michael@0 885
michael@0 886
michael@0 887 </body>
michael@0 888 </html>

mercurial