@@ -785,8 +785,8 @@ registerLayout('example-layout-fragment', class {
785785
786786 // You can set the position of the fragment, e.g. this will set it to the
787787 // top-left corner:
788- fragment.inlineOffset = edges.all. inlineStart;
789- fragment.blockOffset = edges.all. blockStart;
788+ fragment.inlineOffset = edges.inlineStart;
789+ fragment.blockOffset = edges.blockStart;
790790
791791 // Data may be passed from the child layout:
792792 console.log(fragment.data);
@@ -938,9 +938,9 @@ registerLayout('layout-constraints-example', class {
938938 async layout(children, edges, constraints, styleMap) {
939939
940940 // Calculate the available size.
941- const availableInlineSize = constraints.fixedInlineSize - edges.all. inline;
941+ const availableInlineSize = constraints.fixedInlineSize - edges.inline;
942942 const availableBlockSize = constraints.fixedBlockSize ?
943- constraints.fixedBlockSize - edges.all. inline : null;
943+ constraints.fixedBlockSize - edges.inline : null;
944944
945945 // Web developers should resolve any percentages against the percentage sizes.
946946 const value = constraints.percentageInlineSize * 0.5;
@@ -1093,7 +1093,7 @@ Edges {#edges}
10931093
10941094<pre class='idl'>
10951095[Exposed=LayoutWorklet]
1096- interface LayoutEdgeSizes {
1096+ interface LayoutEdges {
10971097 readonly attribute double inlineStart;
10981098 readonly attribute double inlineEnd;
10991099
@@ -1104,33 +1104,17 @@ interface LayoutEdgeSizes {
11041104 readonly attribute double inline;
11051105 readonly attribute double block;
11061106};
1107-
1108- [Exposed=LayoutWorklet]
1109- interface LayoutEdges {
1110- readonly attribute LayoutEdgeSizes border;
1111- readonly attribute LayoutEdgeSizes scrollbar;
1112- readonly attribute LayoutEdgeSizes padding;
1113-
1114- readonly attribute LayoutEdgeSizes all;
1115- };
11161107</pre>
11171108
1118- A {{LayoutEdges}} object is passed into the layout method. This represents the size of the [=box
1119- model edges=] for the current box which is being laid out.
1120-
1121- The {{LayoutEdges}} has {{LayoutEdges/border}} , {{LayoutEdges/scrollbar}} , and
1122- {{LayoutEdges/padding}} attributes. Each of these represent the width of their respective edge.
1123-
1124- The {{LayoutEdges}} has the {{LayoutEdges/all}} attribute. This is a convenience attribute which
1125- represents the sum of the {{LayoutEdges/border}} , {{LayoutEdges/scrollbar}} , {{LayoutEdges/padding}}
1126- edges.
1109+ A {{LayoutEdges}} object is passed into the layout method. This represents the sum of all the [=box
1110+ model edges=] (border, scrollbar, padding), for the current box which is being laid out.
11271111
1128- The {{LayoutEdgeSizes}} object represents the width in CSS pixels of an edge in each of the
1129- [=abstract dimensions=] ({{LayoutEdgeSizes /inlineStart}} , {{LayoutEdgeSizes /inlineEnd}} ,
1130- {{LayoutEdgeSizes/blockStart}} , {{LayoutEdgeSizes /blockEnd}} ).
1112+ Each of the accessors represents the width in CSS pixels of an edge in each of the [=abstract
1113+ dimensions=] ({{LayoutEdges /inlineStart}} , {{LayoutEdges /inlineEnd}} , {{LayoutEdges/blockStart }} ,
1114+ {{LayoutEdges /blockEnd}} ).
11311115
1132- The {{LayoutEdgeSizes /inline}} , and {{LayoutEdgeSizes /block}} on the {{LayoutEdgeSizes }} object are
1133- convenience attributes which represent the sum in that direction.
1116+ The {{LayoutEdges /inline}} , and {{LayoutEdges /block}} on the {{LayoutEdges }} object are convenience
1117+ attributes which represent the sum in that direction.
11341118
11351119<div class="example">
11361120This example shows an node styled by CSS, and what its respective {{LayoutEdges}} could contain.
@@ -1159,10 +1143,11 @@ This example shows an node styled by CSS, and what its respective {{LayoutEdges}
11591143<pre class="lang-javascript">
11601144registerLayout('box-edges' , class {
11611145 async layout(children, edges, constraints, styleMap, breakToken) {
1162- edges.padding.inlineStart; // 5 (as 10% * 50px = 5px).
1163- edges.border.blockEnd; // 2
1164- edges.scrollbar.inlineEnd; // UA-dependent, may be 0 or >0 (e.g. 16).
1165- edges.all.block; // 14 (2 + 5 + 5 + 2).
1146+ edges.inlineStart; // 2 + 5 (as 10% * 50px = 5px).
1147+ edges.blockEnd; // 7 (2 + 5)
1148+ edges.inlineEnd; // UA-dependent, due to scrollbar.
1149+ // Could be 2 + 5 + 0 or 2 + 5 + 16 for example.
1150+ edges.block; // 14 (2 + 5 + 5 + 2).
11661151 }
11671152}
11681153</pre>
@@ -1527,8 +1512,8 @@ When the user agent wants to <dfn>invoke a intrinsic sizes callback</dfn> given
15271512
15281513 2. [=list/Append=] |layoutChild| to |children|.
15291514
1530- 6. Let |edges| be a new {{LayoutEdgeSizes }} populated with the [=computed value=] for all the
1531- [=box model edges=] for |box|.
1515+ 6. Let |edges| be a new {{LayoutEdges }} populated with the [=computed value=] for all the [=box
1516+ model edges=] for |box|.
15321517
15331518 7. Let |styleMap| be the result of [=get a style map=] given |box|, and |inputProperties|.
15341519
@@ -1644,8 +1629,8 @@ following steps:
16441629
16451630 2. <a for=list>Append</a> |layoutChild| to |children|.
16461631
1647- 8. Let |edges| be a new {{LayoutEdgeSizes }} populated with the [=computed value=] for all the
1648- [=box model edges=] for |box|.
1632+ 8. Let |edges| be a new {{LayoutEdges }} populated with the [=computed value=] for all the [=box
1633+ model edges=] for |box|.
16491634
16501635 9. Let |layoutConstraints| be the result of [=create a layout constraints object=] given
16511636 |internalLayoutConstraints|, |box|, and |sizingMode|.
@@ -1900,20 +1885,20 @@ registerLayout('block-like', class {
19001885
19011886 const maxContentSize = childrenSizes.reduce((max, childSizes) => {
19021887 return Math.max(max, childSizes.maxContentSize);
1903- }, 0) + edges.all. inline;
1888+ }, 0) + edges.inline;
19041889
19051890 const minContentSize = childrenSizes.reduce((max, childSizes) => {
19061891 return Math.max(max, childSizes.minContentSize);
1907- }, 0) + edges.all. inline;
1892+ }, 0) + edges.inline;
19081893
19091894 return {maxContentSize, minContentSize};
19101895 }
19111896
19121897 async layout(children, edges, constraints, styleMap) {
19131898 // Determine our (inner) available size.
1914- const availableInlineSize = constraints.fixedInlineSize - edges.all. inline;
1899+ const availableInlineSize = constraints.fixedInlineSize - edges.inline;
19151900 const availableBlockSize = constraints.fixedBlockSize ?
1916- constraints.fixedBlockSize - edges.all. block : null;
1901+ constraints.fixedBlockSize - edges.block : null;
19171902
19181903 const childFragments = [];
19191904 const childConstraints = { availableInlineSize, availableBlockSize };
@@ -1922,19 +1907,19 @@ registerLayout('block-like', class {
19221907 return child.layoutNextFragment(childConstraints);
19231908 }));
19241909
1925- let blockOffset = edges.all. blockStart;
1910+ let blockOffset = edges.blockStart;
19261911 for (let fragment of childFragments) {
19271912 // Position the fragment in a block like manner, centering it in the
19281913 // inline direction.
19291914 fragment.blockOffset = blockOffset;
19301915 fragment.inlineOffset = Math.max(
1931- edges.all. inlineStart,
1916+ edges.inlineStart,
19321917 (availableInlineSize - fragment.inlineSize) / 2);
19331918
19341919 blockOffset += fragment.blockSize;
19351920 }
19361921
1937- const autoBlockSize = blockOffset + edges.all. blockEnd;
1922+ const autoBlockSize = blockOffset + edges.blockEnd;
19381923
19391924 return {
19401925 autoBlockSize,
@@ -1958,21 +1943,21 @@ registerLayout('flex-distribution-like', class {
19581943
19591944 const maxContentSize = childrenSizes.reduce((sum, childSizes) => {
19601945 return sum + childSizes.maxContentSize;
1961- }, 0) + edges.all. inline;
1946+ }, 0) + edges.inline;
19621947
19631948 const minContentSize = childrenSizes.reduce((max, childSizes) => {
19641949 return sum + childSizes.minContentSize;
1965- }, 0) + edges.all. inline;
1950+ }, 0) + edges.inline;
19661951
19671952 return {maxContentSize, minContentSize};
19681953 }
19691954
19701955 async layout(children, edges, constraints, styleMap) {
19711956 // Determine our (inner) available size.
19721957 const availableInlineSize =
1973- constraints.fixedInlineSize - edges.all. inline;
1958+ constraints.fixedInlineSize - edges.inline;
19741959 const availableBlockSize = constraints.fixedBlockSize ?
1975- constraints.fixedBlockSize - edges.all. block : null;
1960+ constraints.fixedBlockSize - edges.block : null;
19761961
19771962 const childConstraints = { availableInlineSize, availableBlockSize };
19781963
@@ -2002,14 +1987,14 @@ registerLayout('flex-distribution-like', class {
20021987 let maxChildBlockSize = 0;
20031988 for (let fragment of childFragments) {
20041989 fragment.inlineOffset = inlineOffset;
2005- fragment.blockOffset = edges.all. blockStart;
1990+ fragment.blockOffset = edges.blockStart;
20061991
20071992 inlineOffset += fragment.inlineSize;
20081993 maxChildBlockSize = Math.max(maxChildBlockSize, fragment.blockSize);
20091994 }
20101995
20111996 return {
2012- autoBlockSize: maxChildBlockSize + edges.all. block,
1997+ autoBlockSize: maxChildBlockSize + edges.block,
20131998 childFragments,
20141999 };
20152000 }
@@ -2037,9 +2022,9 @@ registerLayout('indent-lines', class {
20372022 async layout(children, edges, constraints, styleMap, breakToken) {
20382023 // Determine our (inner) available size.
20392024 const availableInlineSize =
2040- constraints.fixedInlineSize - edges.all. inline;
2025+ constraints.fixedInlineSize - edges.inline;
20412026 const availableBlockSize = constraints.fixedBlockSize ?
2042- constraints.fixedBlockSize - edges.all. block : null;
2027+ constraints.fixedBlockSize - edges.block : null;
20432028
20442029 // Detrermine the number of lines to indent, and the indent amount.
20452030 const indent = resolveLength(constraints, styleMap.get('--indent' ));
@@ -2055,7 +2040,7 @@ registerLayout('indent-lines', class {
20552040 children.splice(0, children.indexOf(childBreakToken.child));
20562041 }
20572042
2058- let blockOffset = edges.all. blockStart;
2043+ let blockOffset = edges.blockStart;
20592044 let child = children.shift();
20602045 while (child) {
20612046 const shouldIndent = lines-- > 0;
@@ -2077,7 +2062,7 @@ registerLayout('indent-lines', class {
20772062
20782063 // Position the fragment.
20792064 fragment.inlineOffset = shouldIndent ?
2080- edges.all. inlineStart + indent : edges.all .inlineStart;
2065+ edges.inlineStart + indent : edges.inlineStart;
20812066 fragment.blockOffset = blockOffset;
20822067 blockOffset += fragment.blockSize;
20832068
@@ -2097,7 +2082,7 @@ registerLayout('indent-lines', class {
20972082 }
20982083 }
20992084
2100- const autoBlockSize = blockOffset + edges.all. blockEnd;
2085+ const autoBlockSize = blockOffset + edges.blockEnd;
21012086
21022087 // Return our fragment.
21032088 const result = {
0 commit comments