Skip to content

Commit e437f24

Browse files
committed
[css-layout-api] Allow autoBlockSize as a valid return option, (for block-like sizing).
1 parent 189c8fc commit e437f24

File tree

1 file changed

+30
-11
lines changed

1 file changed

+30
-11
lines changed

css-layout-api/Overview.bs

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,6 +1673,7 @@ Performing Layout {#performing-layout}
16731673
dictionary FragmentResultOptions {
16741674
double inlineSize = 0;
16751675
double blockSize = 0;
1676+
double autoBlockSize = 0;
16761677
sequence<LayoutFragment> childFragments = [];
16771678
any data = null;
16781679
BreakTokenOptions breakToken = null;
@@ -1895,49 +1896,67 @@ following steps:
18951896
8. Let |layoutConstraints| be the result of <a>create a layout constraints object</a> given
18961897
|internalLayoutConstraints|, |box|, and |sizingMode|.
18971898

1898-
8. Let |styleMap| be a new {{StylePropertyMapReadOnly}} populated with <em>only</em> the
1899+
9. Let |styleMap| be a new {{StylePropertyMapReadOnly}} populated with <em>only</em> the
18991900
<a>computed values</a> for properties listed in |inputProperties| for |box|.
19001901

19011902
Issue: We may want to store |styleMap| on |box| instead, similar to |layoutInstance|.
19021903

1903-
9. Let |breakToken| be a new {{BreakToken}} populated with the appropriate information from
1904+
10. Let |breakToken| be a new {{BreakToken}} populated with the appropriate information from
19041905
|internalBreakToken|.
19051906

19061907
If |internalBreakToken| is null, let |breakToken| be null.
19071908

1908-
10. At this stage the user agent may re-use a <a>fragment</a> from a previous invocation if
1909+
11. At this stage the user agent may re-use a <a>fragment</a> from a previous invocation if
19091910
|children|, |styleMap|, |layoutConstraints|, |breakToken| are equivalent to that previous
19101911
invocation. If so let the fragment output be that cached fragment and abort all these steps.
19111912

1912-
11. Let |layoutGeneratorFunction| be |definition|'s <a>layout generator function</a>.
1913+
12. Let |layoutGeneratorFunction| be |definition|'s <a>layout generator function</a>.
19131914

1914-
12. Let |layoutGenerator| be the result of <a>Invoke</a>(|layoutGeneratorFunction|,
1915+
13. Let |layoutGenerator| be the result of <a>Invoke</a>(|layoutGeneratorFunction|,
19151916
|layoutInstance|, «|children|, |edges|, |layoutConstraints|, |styleMap|, |breakToken|»).
19161917

19171918
If an exception is <a>thrown</a> the let |box| fallback to the <a>flow layout</a> and abort
19181919
all these steps.
19191920

1920-
13. Let |fragmentValue| be the result of <a>run a generator</a> given |layoutGenerator|, and
1921+
14. Let |fragmentValue| be the result of <a>run a generator</a> given |layoutGenerator|, and
19211922
<code>"layout"</code>.
19221923

19231924
If <a>run a generator</a> returned failure, then let |box| fallback to the <a>flow
19241925
layout</a> and abort all these steps.
19251926

1926-
14. Let |fragment| be the result of <a>converting</a> |fragmentValue| to a
1927+
15. Let |fragment| be the result of <a>converting</a> |fragmentValue| to a
19271928
{{FragmentResultOptions}}. If an exception is <a>thrown</a>, let |box| fallback to the
19281929
<a>flow layout</a> and abort all these steps.
19291930

1930-
15. <a for=list>For each</a> |childFragment| in |fragment|'s
1931+
16. <a for=list>For each</a> |childFragment| in |fragment|'s
19311932
{{FragmentResultOptions/childFragments}}, perform the following stubsteps:
19321933

19331934
1. If |childFragment|'s {{[[generator]]}} internal slot is not equal to |layoutGenerator|,
19341935
then let |box| fallback to the <a>flow layout</a> and abort all these steps.
19351936

1936-
16. Create a <a>fragment</a> for |box| with:
1937+
17. If |sizingMode| is <code>"block-like"</code>:
19371938

1938-
- The <a>inline size</a> set to |fragment|'s {{FragmentResultOptions/inlineSize}}.
1939+
- Then:
19391940

1940-
- The <a>block size</a> set to |fragment|'s {{FragmentResultOptions/blockSize}}.
1941+
1. Let |inlineSize| be |layoutConstraints|' {{LayoutConstraints/fixedInlineSize}}. (This
1942+
value must be set if we are using <code>"block-like"</code> sizing).
1943+
1944+
2. Let |blockSize| be the result of calculating |box|'s <b>border-box</b>
1945+
<a>block size</a> (relative to |box|'s writing mode) exactly like block containers
1946+
do, given |fragment|'s {{FragmentResultOptions/autoBlockSize}} as the "intrinsic
1947+
height".
1948+
1949+
- Otherwise (|sizingMode| is <code>"manual"</code>):
1950+
1951+
1. Let |inlineSize| be |fragment|'s {{FragmentResultOptions/inlineSize}}.
1952+
1953+
2. Let |blockSize| be |fragment|'s {{FragmentResultOptions/blockSize}}.
1954+
1955+
18. Return a <a>fragment</a> for |box| with:
1956+
1957+
- The <a>inline size</a> set to |inlineSize|.
1958+
1959+
- The <a>block size</a> set to |blockSize|.
19411960

19421961
- The child fragments set to |fragment|'s {{FragmentResultOptions/childFragments}}
19431962
<a>list</a>. The ordering <em>is</em> important as this dictates their paint order

0 commit comments

Comments
 (0)