@@ -146,8 +146,8 @@ values other than ''z-index/auto'' create a stacking context even if 'position'
146
146
Box Tree Transformations {#layout-api-box-tree}
147
147
-----------------------------------------------
148
148
149
- The children of a <a>layout API container </a> can act in different ways depending on the value of <a
150
- for="document layout definition"> child display</a> (set by <code> childDisplay</code> on the class).
149
+ The <a>layout API children </a> can act in different ways depending on the value of <a for="document
150
+ layout definition">child display</a> (set by <code> childDisplay</code> on the class).
151
151
152
152
If the value of <a for="document layout definition">child display</a> is <code> "block"</code> the
153
153
'display' value of that child is <a>blockified</a> . This is similar to children of <a>flex
@@ -349,7 +349,8 @@ registerLayout('block-like', class {
349
349
const inlineSize = resolveInlineSize(space, styleMap);
350
350
351
351
const availableInlineSize = inlineSize - edges.all.inline;
352
- const availableBlockSize = resolveBlockSize(constraintSpace, styleMap) - edges.all.block;
352
+ const availableBlockSize =
353
+ resolveBlockSize(constraintSpace, styleMap) - edges.all.block;
353
354
354
355
const childFragments = [];
355
356
const childConstraintSpace = new ConstraintSpace({
@@ -373,9 +374,9 @@ registerLayout('block-like', class {
373
374
blockOffset += fragment.blockSize;
374
375
}
375
376
376
- const contentSize = blockOffset + edges.all.blockEnd;
377
+ const autoBlockSize = blockOffset + edges.all.blockEnd;
377
378
const blockSize = resolveBlockSize(
378
- constraintSpace, styleMap, contentSize );
379
+ constraintSpace, styleMap, autoBlockSize );
379
380
380
381
return {
381
382
inlineSize: inlineSize,
@@ -417,6 +418,7 @@ interface ConstraintSpace {
417
418
readonly attribute double percentageInlineSize;
418
419
readonly attribute double percentageBlockSize;
419
420
421
+ readonly attribute double? blockFragmentationOffset;
420
422
readonly attribute BlockFragmentationType blockFragmentationType;
421
423
422
424
readonly attribute any data;
@@ -432,6 +434,7 @@ dictionary ConstraintSpaceOptions {
432
434
double? percentageInlineSize = null;
433
435
double? percentageBlockSize = null;
434
436
437
+ double? blockFragmentationOffset = null;
435
438
BlockFragmentationType blockFragmentationType = "none";
436
439
437
440
any data = null;
@@ -665,10 +668,10 @@ registerLayout('indent-lines', class {
665
668
}
666
669
}
667
670
668
- const contentSize = blockOffset + edges.all.blockEnd;
671
+ const autoBlockSize = blockOffset + edges.all.blockEnd;
669
672
const blockSize = resolveBlockSize(space,
670
673
styleMap,
671
- contentSize );
674
+ autoBlockSize );
672
675
673
676
// Return our fragment.
674
677
const result = {
@@ -780,13 +783,27 @@ partial interface LayoutWorkletGlobalScope {
780
783
781
784
double resolveBlockSize(ConstraintSpace constraintSpace,
782
785
StylePropertyMapReadOnly styleMap,
783
- optional double contentSize );
786
+ optional double autoBlockSize );
784
787
785
788
double resolveLength(ConstraintSpace constraintSpace, CSSStyleValue value);
786
789
};
787
790
</pre>
788
791
789
- Issue: Specify the behaviour of these functions.
792
+ <div algorithm>
793
+ When the <dfn method for=LayoutWorkletGlobalScope>resolveBlockSize(|constraintSpace|, |styleMap|,
794
+ |autoBlockSize|)</dfn> method is called, the user agent <em> must</em> run the following steps:
795
+
796
+ Issue: Define that this algorithm should do exactly what CSS does for block sizes.
797
+ |constraintSpace|, |styleMap|, |autoBlockSize|.
798
+ </div>
799
+
800
+ <div algorithm>
801
+ When the <dfn method for=LayoutWorkletGlobalScope>resolveLength(|constraintSpace|, |value|)</dfn>
802
+ method is called, the user agent <em> must</em> run the following steps:
803
+
804
+ Issue: Define that this algorithm should do exactly what CSS does for generic lengths.
805
+ |constraintSpace|, |value|.
806
+ </div>
790
807
791
808
Interactions with other Modules {#interactions-with-other-modules}
792
809
==================================================================
@@ -796,7 +813,79 @@ This section describes how other CSS modules interact with the CSS Layout API.
796
813
Sizing {#interaction-sizing}
797
814
----------------------------
798
815
816
+ User agents must use the {{ConstraintSpace}} to communicate to the <a>current layout</a> the size
817
+ they would like the fragment to be.
818
+
819
+ If the user agent wishes to force a size on the box, it can use the
820
+ {{ConstraintSpace/inlineSizeFixed}} and {{ConstraintSpace/blockSizeFixed}} attributes to do so.
821
+
822
+ Issue: Do we want the inlineSize to always be fixed? This would remove the resolveInlineSize call,
823
+ and just rely on the pre-defined behaviour by the user agent.
824
+
825
+ The downside to this is that we won't be able to things like MathML in the initial version of
826
+ the specifcation, which is able to "bubble" up inline sizes to its parent.
827
+
828
+ We can't do a similar thing for the blockSize due to fragmentation. E.g. the size of the
829
+ fragment which is undergoing fragmentation, isn't able to be automatically resolved.
830
+
831
+ If the <a>layout API container</a> is within a <a>block formatting context</a> , is inflow, and has
832
+ an ''width/auto'' inline size, the user agent <em> must</em> set the {{ConstraintSpace/inlineSize}}
833
+ to the <a>stretch-fit inline size</a> .
834
+
835
+ <div class="note">
836
+ Note: In the example below the <a>layout API container</a> has its inline size set to 50.
837
+
838
+ <pre class="lang-html">
839
+ <style>
840
+ #container {
841
+ width: 100px;
842
+ height: 100px;
843
+ box-sizing: border-box;
844
+ padding: 5px;
845
+ }
846
+ #layout-api {
847
+ display: layout(foo);
848
+ margin: 0 20px;
849
+ }
850
+ </style>
851
+ <div id="container">
852
+ <div id="layout-api"></div>
853
+ </div>
854
+ </pre>
855
+ </div>
856
+
857
+ ### Positioned layout sizing ### {#interaction-sizing-positiong-layout}
799
858
859
+ If a <a>layout API container</a> is out-of-flow positioned the user agent <em> must</em> solve the
860
+ positioned size equations ([[css-position-3#abs-non-replaced-width]] ,
861
+ [[css-position-3#abs-non-replaced-height]] ), and set the appropriate fixed
862
+ {{ConstraintSpace/inlineSize}} and {{ConstraintSpace/blockSize}} .
863
+
864
+ <div class="note">
865
+ Note: In the example below the <a>layout API container</a> has its inline and block size fixed
866
+ to 80.
867
+
868
+ <pre class="lang-html">
869
+ <style>
870
+ #container {
871
+ position: relative;
872
+ width: 100px;
873
+ height: 100px;
874
+ }
875
+ #layout-api {
876
+ display: layout(foo);
877
+ top: 10px;
878
+ bottom: 10px;
879
+ left: 10px;
880
+ right: 10px;
881
+ position: absolute;
882
+ }
883
+ </style>
884
+ <div id="container">
885
+ <div id="layout-api"></div>
886
+ </div>
887
+ </pre>
888
+ </div>
800
889
801
890
Positioning {#interaction-positioning}
802
891
--------------------------------------
0 commit comments