Skip to content

Commit c207cf0

Browse files
committed
[css-tables] Defined grid, row, column, etc; fixes #603
1 parent a15cb0f commit c207cf0

File tree

1 file changed

+42
-18
lines changed

1 file changed

+42
-18
lines changed

css-tables-3/Overview.bs

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ spec:css22; type:property; text:display
114114

115115
To summarize, an instance of the table model consists of:
116116
<ul class="compact">
117-
<li>Its <a href="#table-root-element">table-root element</a> containing:
117+
<li>Its <a href="#table-root-element">table-root</a> containing:
118118
<ul>
119119
<li>Zero, one or more <a href="#table-row">table rows</a>, optionally in <a href="#table-row-grouping-element">row groups</a>,
120120
<ul><li>Each of them contaning one or more <a href="#table-cell">table cells</a></li></ul>
@@ -268,15 +268,35 @@ spec:css22; type:property; text:display
268268
A sequence of sibling boxes is consecutive
269269
if each box in the sequence is consecutive to the one before it in the sequence.
270270

271-
<dt><dfn id="table-slot">slot</dfn>
271+
<dt><dfn id="table-grid">table grid</dfn>
272272
<dd>
273-
A <a>slot</a> is an available space created
274-
by the intersection of a row and a column in the table grid.
273+
A matrix
274+
containing as many <dfn id="row">rows</dfn> and <dfn id="column">columns</dfn>
275+
as needed to describe the position of all the <a>table-rows</a> and <a>table-cells</a> of a <a>table-root</a>,
276+
as determined by the <a href="#dimensioning-the-row-column-grid">grid-dimensioning algorithm</a>.
277+
278+
Each row of the grid might correspond to a <a>table-row</a>, and each column to a <a>table-column</a>.
279+
280+
<dt><dfn id="slot">slot</dfn> of the table grid.
281+
<dd>
282+
A <a>slot</a> <code>(r,c)</code> is an available space created
283+
by the intersection of a row <code>r</code> and a column <code>c</code> in the <a>table grid</a>.
284+
285+
Each slot of the table grid is covered by at least one <a>table-cell</a> (<a href="#missing-cells-fixup">some of them anonymous</a>), and at most two.
286+
Each table-cell of a table-root covers at least one slot.
287+
288+
Table-cells that cover more than one slot do so densely,
289+
meaning the set of slots it covers can always be described as a set of four strictly-positive integers <code>(rowMin, colMin, rowSpan, colSpan)</code>
290+
such that a slot <code>(r,c)</code> is covered by the table-cell
291+
if and only if <code>r</code> lies in the interval between <code>rowMin</code> (included) and <code>rowMin+rowSpan</code> (not included),
292+
and <code>c</code> lies in the interval between <code>colMin</code> (included) and <code>colMin+colSpan</code> (not included);
293+
294+
Such table-cell is said to <dfn>originate</dfn> from row <code>rowMin</code> and column <code>colMin</code> (and, by extension, the corresponding table-tracks).
295+
296+
Such table-cell is said to <dfn>span</dfn> all rows <code>r</code> and columns <code>c</code> matching the above condition (and, by extension, the corresponding table-tracks).
275297

276298
</dl>
277299

278-
ISSUE(603): Define the table grid
279-
280300
<!--
281301
████████ ████ ██ ██ ██ ██ ████████
282302
██ ██ ██ ██ ██ ██ ██ ██
@@ -295,10 +315,10 @@ spec:css22; type:property; text:display
295315
Any descendant of a <a>table-root</a> that is not table-internal
296316
must have a set of ancestors in the table consisting of
297317
at least three nested objects corresponding to
298-
a <a>table</a>/<a>inline-table</a> element,
299-
a <a>table-row</a> element, and
300-
a <a>table-cell</a> element.
301-
Missing elements cause the generation of <a href="#fixup-boxes">anonymous boxes</a> according to the following rules:
318+
a <a>table</a>/<a>inline-table</a>,
319+
a <a>table-row</a>, and
320+
a <a>table-cell</a>.
321+
Missing boxes cause the generation of <a href="#fixup-boxes">anonymous boxes</a> according to the following rules:
302322

303323
<!--——————————————————————————————————————————————————————————————————————————-->
304324
<h4 id="fixup-algorithm">Fixup Algorithm</h4>
@@ -581,12 +601,20 @@ spec:css22; type:property; text:display
581601
Like mentioned in the <a href="#table-structure">Table structure</a> section,
582602
how many rows and columns a table has
583603
can be determined from the table structure.
584-
Both dimensioning the row/column grid and assigning table-cells their <nobr>slot(s)</nobr> in that grid
604+
Both dimensioning the row/column <a>grid<a> and assigning table-cells their <nobr><a>slot</a>(s)</nobr> in that grid
585605
do require running the HTML Algorithms for tables.
586606

607+
<h4 id="dimensioning-the-row-column-grid--step1">HTML Algorithm</h4>
587608
<p class="note">
588609
CSS Boxes that do not originate from an HTML table element equivalent to their display type
589-
need to be converted to their HTML equivalent before we can apply this algorithm.
610+
need to be converted to their HTML equivalent before we can apply this algorithm, see below.
611+
There is no way to specify the <a>span</a> of a cell in css only in this level of the spec,
612+
the use of an HTML td element is required to do so.
613+
614+
Apply the <a href="https://www.w3.org/TR/html5/tabular-data.html#forming-a-table">HTML5 Table Formatting algorithm</a>,
615+
where boxes act like <a href="#display-types">the HTML element equivalent to their display type</a>,
616+
and use the attributes of their originating element if and only if it is an HTML element of the same type
617+
(otherwise, they act like if they didnt't have any attribute).
590618

591619
<div class="example">
592620
<xmp class="lang-markup">
@@ -661,11 +689,7 @@ spec:css22; type:property; text:display
661689

662690
</div>
663691

664-
Apply the <a href="https://www.w3.org/TR/html5/tabular-data.html#forming-a-table">HTML5 Table Formatting algorithm</a>,
665-
where boxes act like <a href="#display-types">the HTML element equivalent to their display type</a>,
666-
and use the attributes of their originating element only if it as an HTML element of the same type
667-
(otherwise, they act like they didnt't have any attribute).
668-
692+
<h4 id="dimensioning-the-row-column-grid--step2">Track merging</h4>
669693
<p class="note">
670694
The HTML Table Formatting algorithm sometimes generates more tracks than necessary to layout the table properly.
671695
Those tracks have historically been ignored by user agents,
@@ -686,7 +710,7 @@ spec:css22; type:property; text:display
686710
For tables <a>in fixed mode</a>, only rows are eligible to be merged that way; which means that every column is preserved.
687711

688712
Finally, assign to the <a>table-root</a> element its correct number of rows and columns (from its mapped element),
689-
and to each <a>table-cell</a> element its accurate table-row-start/table-column-start/table-row-span/table-column-span (from its mapped element).
713+
and to each <a>table-cell</a> element its accurate <a href="#slot">rowMin/colMin/rowSpan/colSpan</a> (from its mapped element).
690714

691715
<!--——————————————————————————————————————————————————————————————————————————-->
692716
<h3 id="missing-cells-fixup">Missing cells fixup</h3>

0 commit comments

Comments
 (0)