@@ -1096,6 +1096,7 @@ Values have the following meanings:
10961096 Otherwise, does nothing.
10971097</dl>
10981098
1099+ <!-- Big Text: -order -->
10991100
11001101Determining Fallback Order: the 'position-try-order' property {#position-try-order-property}
11011102----------------------------------
@@ -1128,7 +1129,7 @@ the [=position options list=] will be tried.
11281129 : <dfn>most-inline-size</dfn>
11291130 ::
11301131 For each entry in the [=position options list=] ,
1131- [=determine the position fallback styles=] ,
1132+ [=apply a position option=] using that option to the element ,
11321133 and find the specified [=inset-modified containing block=] size
11331134 that results from those styles.
11341135 Stably sort the [=position options list=]
@@ -1321,6 +1322,9 @@ can be done automatically
13211322with keywords in 'position-try-options' ,
13221323without using ''@position-try'' at all.
13231324
1325+
1326+ <!-- Big Text: -bounds -->
1327+
13241328Applying Stronger Fallback Bounds: the 'position-fallback-bounds' property {#fallback-bounds}
13251329--------------------------------------------------------------------------
13261330
@@ -1385,78 +1389,79 @@ and applying the same constraints as described here,
13851389to ensure proper ordering of layout
13861390
13871391
1392+ <!-- Big Text: apply -->
1393+
13881394Applying Position Fallback {#fallback-apply}
13891395--------------------------
13901396
13911397When a positioned element overflows its [=inset-modified containing block=] ,
13921398and has a non-empty [=position options list=] ,
1393- it selects one entry from the list
1394- as defined below,
1395- and applies those properties to itself as [=used values=] .
1396-
1397- Note: These have to be applied as used values
1398- because we're in the middle of layout right now;
1399- defining how they'd interact with the cascade
1400- would be extremely confusing *at a minimum*,
1401- and perhaps actually circular.
1402- In any case, not worth the cost in spec or impl.
1403-
1404- Issue: This implies that the values can't be transitioned in the usual fashion,
1405- since transitions key off of computed values
1406- and we're past that point.
1407- However, popovers sliding between positions is a common effect in UI libs.
1408- Probably should introduce a <css> smooth</css> keyword
1409- to 'position-fallback'
1410- to trigger automatic "animation" of the fallback'd properties.
1399+ it iterates the [=position options list=] ,
1400+ applying each [=position option's=] styles over the element's base styles,
1401+ and attempts to find an option that avoids overflow.
1402+
1403+ These modified styles are applied to the element via [=style interleaving=] ,
1404+ so they affect [=computed values=]
1405+ (and can trigger transitions/etc)
1406+ even tho they depend on layout and [=used values=] .
1407+ They are applied as part of the [=author origin=] ,
1408+ as part of a theoretical UA-controlled final cascade layer.
14111409
14121410<div algorithm>
1413- To <dfn>determine the position fallback styles</dfn> of an element |el|:
1411+ To <dfn>apply a position option</dfn> to an element |el|,
1412+ given a [=position option=] |new styles|:
14141413
1415- 1. Let |base styles| be the current used styles of |el|.
1414+ 1. With |new styles| inserted into the cascade at the very end of the [=author origin=] ,
1415+ resolve the cascade,
1416+ and perform enough layout to determine |el|'s [=used value|used styles=] .
1417+
1418+ 2. Return |el|'s [=used value|used styles=] .
1419+ </div>
14161420
1417- 2. [=list/For each=] |fallback styles| in the [=position options list=] :
1421+ <div algorithm>
1422+ To <dfn>determine the position fallback styles</dfn> of an element |el|:
14181423
1419- 1. Apply the values of the [=accepted @position-try properties=]
1420- in |fallback styles| to |el|,
1421- overriding the corresponding properties in |base styles|.
1424+ 1. Let |base styles| be the current used styles of |el|.
14221425
1423- Perform any specified/computed/used-value time normalizations
1424- that are required to make the overridden styles into [=used values=]
1425- (such as resolving [=math functions=] , etc).
1426+ 2. [=list/For each=] |option| in the [=position options list=] :
14261427
1427- Let |adjusted styles|
1428- be |el|'s styles after these adjustments.
1428+ 1. Let |adjusted styles| be the result of [=applying a position option=] |option| to |el|.
14291429
1430- 2. Subtract |el|'s [=snapshotted scroll offset=]
1431- from |el|'s margin box' s position.
1430+ 2. Let |el rect| be the size and position of |el|'s margin box,
1431+ when laid out with |adjusted styles|.
1432+ Let |cb rect| be the size and position of |el|'s [=inset-modified containing block=] .
14321433
1433- Also, if any of |el|'s [=inset properties=] are non-auto,
1434- subtract the [=snapshotted scroll offset=] for the appropriate axis
1435- from their values.
1436- Recalculate |el|'s [=inset-modified containing block=]
1437- using these shifted values
1438- to obtain the |scroll-adjusted IMCB|.
1434+ 3. If |el| has a [=snapshotted scroll offset=] ,
1435+ subtract it from the position of both |el rect| and |cb rect|.
14391436
1440- 3. If |el|'s [=margin box=] is not fully contained
1441- within the |scroll-adjusted IMCB|,
1437+ 4. If |el rect| is not fully contained within |cb rect|,
14421438 [=iteration/continue=] .
14431439
14441440 4. If |el| has an [=additional fallback-bounds rect=] ,
1445- and |el|'s [=margin box=] is not fully contained within it,
1441+ and |el rect| is not fully contained within it,
14461442 [=iteration/continue=] .
14471443
1448- 5. Use |adjusted styles| for |el|
1449- and exit this algorithm .
1444+ 5. Set |option| as |el|'s [=last successful position option=] .
1445+ Return |adjusted styles| .
14501446
1451- 3. If the previous step finished without selecting a set of styles,
1452- use the |adjusted styles|
1453- corresponding to the final entry in the [=position options list=] .
1447+ 3. Assert: The previous step finished without finding a [=position option=]
1448+ that avoids overflow.
1449+
1450+ 4. If |el| has a [=last successful position option=] ,
1451+ return the result of [=applying a position option=] ,
1452+ using that option,
1453+ to |el|.
1454+
1455+ 5. Return |base styles|.
14541456
14551457 Note: Descendants overflowing |el|
14561458 don't affect this calculation,
14571459 only |el|'s own [=margin box=] .
14581460</div>
14591461
1462+ Issue: Make sure the snapshotted scroll offset stuff is correct now,
1463+ given interleaving.
1464+
14601465The styles returned by [=determining the position fallback styles=]
14611466are taken as the final values for the specified properties.
14621467
0 commit comments