Skip to content

Commit 3a5e283

Browse files
committed
[css-values-5] Update the cache specifics to the new semantics. Add issue for pseudo-elements.
1 parent bdefa54 commit 3a5e283

File tree

1 file changed

+21
-29
lines changed

1 file changed

+21
-29
lines changed

css-values-5/Overview.bs

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2854,31 +2854,24 @@ Sharing (Or Not) Random Values: the <<random-cache-key>> value</h3>
28542854
* A [=random cache name=] is a [=tuple=] of:
28552855
1. A nullable [=string=] name:
28562856
the value of the <<dashed-ident>>, if specified;
2857-
otherwise <code>"auto"</code> if ''random()/auto'' is specified
2858-
or the <<random-cache-key>> is omitted;
28592857
otherwise null.
2860-
2. A nullable [=string=] property name:
2861-
the name of the property the [=random function=] is used in
2862-
(<em>before</em> shorthand expansion)
2863-
if ''random()/property'' or ''random()/auto'' is specified;
2864-
otherwise null.
2865-
3. A nullable [=integer=] index:
2866-
the index of the [=random function=]
2867-
among other [=random functions=] in the same property value,
2868-
if ''random()/index'' or ''random()/auto'' is specified;
2858+
2. A nullable [=string=] property/index value:
2859+
the value of the <<random-ua-ident>>, if specified/calculated;
28692860
otherwise null.
28702861
4. A nullable "element identifier"
28712862
uniquely identifying the {{Element}} or [=pseudo-element=]
28722863
the style is being applied to,
2873-
if ''random()/element'' or ''random()/auto'' is specified;
2864+
if ''random()/element-scoped'' is specified;
28742865
otherwise null.
28752866
5. A document ID identifying the {{Document}} the styles are from.
28762867

2877-
The "element ID" and "document ID" must have the same lifetimes and equivalence
2868+
The "element ID" and "document ID" must have the same lifetimes and equivalence semantics
28782869
as a JavaScript reference to the {{Element}} or {{Document}}.
28792870

2871+
Issue: The behavior for pseudo-elements needs to be clarified.
2872+
28802873
* The [=random cache name=] and [=random base value=]
2881-
must be determined at [=computed value=] time,
2874+
must be determined by [=computed value=] time,
28822875
before [=inheritance=],
28832876
so that a random function which is unresolved by inheritance time
28842877
(due to containing, for example, a layout-sensitive percentage)
@@ -2892,14 +2885,13 @@ Sharing (Or Not) Random Values: the <<random-cache-key>> value</h3>
28922885
For example:
28932886

28942887
<pre highlight=css>
2895-
.same-tb-and-rl {
2888+
.same-tb-same-rl {
28962889
margin: random(0px, 10px) random(0px, 10px);
28972890
}
28982891
</pre>
28992892

2900-
Here, the "property name" and "index" in the [=random cache names=]
2901-
is <code>"margin"</code> and <code>0</code> for the first instance
2902-
and <code>"margin"</code> and <code>1</code> for the second.
2893+
Here, the <<random-ua-ident>> part of the [=random cache name=]
2894+
is "ua-margin-1" and "ua-margin-2", respectively.
29032895
After expansion, then,
29042896
'margin-top' and 'margin-bottom' will share the same random value,
29052897
and 'margin-left' and 'margin-right' will share a different random value.
@@ -2913,12 +2905,12 @@ Sharing (Or Not) Random Values: the <<random-cache-key>> value</h3>
29132905
}
29142906
</pre>
29152907

2916-
The 'margin-bottom' value has a [=random cache name=] "property name"
2917-
of <code>"margin-bottom"</code>,
2918-
which is different from the 'margin-top' key of <code>"margin"</code>,
2908+
The 'margin-bottom' value has a [=random cache name=] <<random-ua-ident>>
2909+
of <code>"ua-margin-bottom-1"</code>,
2910+
which is different from the 'margin-top' key of <code>"ua-margin-1"</code>,
29192911
so the top and bottom margins will be different random values.
2920-
'margin-left' and 'margin-right' continue to share a third random value,
2921-
as they still share the name <code>"margin"</code> property name and <code>1</code> index.
2912+
'margin-left' and 'margin-right' continue to share a third random value <code>"ua-margin-2"</code>,
2913+
as they still share the name <code>"margin"</code> property name and <code>2</code> index.
29222914
</div>
29232915

29242916
<div class=example>
@@ -2941,14 +2933,13 @@ Sharing (Or Not) Random Values: the <<random-cache-key>> value</h3>
29412933
the ''random()'' function isn't evaluated
29422934
(or even recognized *as* a ''random()'' function)
29432935
in ''--size'',
2944-
so the default rules for an omitted <<dashed-ident>>
2945-
in the <<random-cache-key>> isn't applied.
2936+
so the default rules for an omitted <<random-cache-key>> aren't applied.
29462937
Instead, it's evaluated when it's substituted into 'width' and 'height',
29472938
so each gets a distinct [=random cache name=],
29482939
and this ends up defining a random <em>rectangle</em>,
29492940
rather than a square.
29502941

2951-
Similarly, ''random()/element'' in the <<random-cache-key>>
2942+
Similarly, ''random()/element-scoped'' in the <<random-cache-key>>
29522943
won't cause the function to determine its "element identifier"
29532944
until substitution actually happens,
29542945
which might be <em>after</em> '--size' has inherited through multiple elements,
@@ -2964,7 +2955,8 @@ Sharing (Or Not) Random Values: the <<random-cache-key>> value</h3>
29642955
Both issues can be resolved
29652956
by instead using a [=registered custom property=]
29662957
with a non-universal grammar,
2967-
so the ''random()'' function will be parsed and evaluated in the [=custom property=],
2958+
so the ''random()'' function will be parsed and evaluated in the [=custom property=]
2959+
(gaining a <<random-ua-ident>> of "ua---size-1"),
29682960
and then the resolved random value will be substituted into each property.
29692961
</div>
29702962

@@ -3010,8 +3002,8 @@ Simplification</h4>
30103002
even if you read and then set the value back.
30113003
</div>
30123004

3013-
The [=random base value=] of a [=random function=] is known at [=specified value=] time,
3014-
at the latest,
3005+
The [=random base value=] of a [=random function=]
3006+
is generally known at [=specified value=] time,
30153007
once it's known which element the function is being applied to.
30163008
As a [=math function=], a ''random()'' function can be [=simplify a calculation tree|simplified=]
30173009
as soon as its argument [=calculations=]

0 commit comments

Comments
 (0)