Skip to content

Commit 863d2dc

Browse files
committed
[typed-om] Kill CSSResourceValue and CSSURLImageValue, remove all details from CSSImageValue, so it's just an opaque handle to an image, suitable for Custom Paint. Fixes #716.
1 parent 372f85c commit 863d2dc

File tree

1 file changed

+36
-84
lines changed

1 file changed

+36
-84
lines changed

css-typed-om/Overview.bs

Lines changed: 36 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Editor: Naina Raisinghani, Google, nainar@google.com, w3cid 100915
1414
Repository: w3c/css-houdini-drafts
1515
Inline Github Issues: title
1616
Ignored Vars: type, unit
17-
Ignored Terms: Drawable, paint image definition, list-valued property, list-valued property iteration, parse a CSSStyleValue, values to iterate over, CSS, PseudoElement
17+
Ignored Terms: Drawable, paint image definition, list-valued property, list-valued property iteration, parse a CSSStyleValue, values to iterate over, CSS, PseudoElement, style
1818
Markup Shorthands: markdown yes
1919
</pre>
2020

@@ -91,6 +91,7 @@ spec:dom; type:interface;
9191
text:Document
9292
text:Element;
9393
spec:geometry-1; type:dfn; for:DOMMatrixReadOnly; text:stringification behavior
94+
spec:html; type:element; text:style
9495
spec:infra;
9596
type: dfn;
9697
text: list
@@ -2684,55 +2685,6 @@ The {{CSSPositionValue/x}} attribute expresses the offset from the left edge of
26842685
</pre>
26852686
</div>
26862687

2687-
<!--
2688-
████████ ████████ ██████ ███████ ██ ██ ████████ ██████ ████████
2689-
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
2690-
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
2691-
████████ ██████ ██████ ██ ██ ██ ██ ████████ ██ ██████
2692-
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
2693-
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
2694-
██ ██ ████████ ██████ ███████ ███████ ██ ██ ██████ ████████
2695-
-->
2696-
2697-
{{CSSResourceValue}} objects {#resourcevalue-objects}
2698-
-----------------------------------------------------
2699-
2700-
<pre class='idl'>
2701-
enum CSSResourceState {"unloaded", "loading", "loaded", "error"};
2702-
2703-
[Exposed=(Window, Worker, PaintWorklet, LayoutWorklet)]
2704-
interface CSSResourceValue : CSSStyleValue {
2705-
readonly attribute CSSResourceState state;
2706-
};
2707-
2708-
</pre>
2709-
2710-
{{CSSResourceValue}} objects represent CSS values that may require an asynchronous network fetch
2711-
before being usable.
2712-
2713-
A {{CSSResourceValue}} is in one of the following states, as reflected in the value of the
2714-
{{CSSResourceValue/state}} attribute:
2715-
2716-
: "unloaded"
2717-
:: The resource is not ready and is not actively being fetched
2718-
: "loading"
2719-
:: The resource is not ready, but is in the process of being fetched
2720-
: "loaded"
2721-
:: The resource is ready for rendering
2722-
: "error"
2723-
:: The resource can't be fetched, or the fetched resource is invalid
2724-
2725-
{{CSSResourceValue}} objects that do not require network data (for example linear and radial gradients)
2726-
are initialized with {{CSSResourceValue/state}} "loaded".
2727-
2728-
<div class='example'>
2729-
For example, images that match the <<url>> production can be used immediately, but will not result
2730-
in a visual change until the image data is fetched. {{CSSResourceValue}} objects represent this by
2731-
providing values that track loaded state via the {{CSSResourceState}} enum.
2732-
</div>
2733-
2734-
Issue(186): CSSResourceValues constructed within Worklets should be "unloaded".
2735-
27362688
<!--
27372689
████ ██ ██ ███ ██████ ████████
27382690
██ ███ ███ ██ ██ ██ ██ ██
@@ -2748,50 +2700,50 @@ Issue(186): CSSResourceValues constructed within Worklets should be "unloaded".
27482700

27492701
<pre class='idl'>
27502702
[Exposed=(Window, Worker, PaintWorklet, LayoutWorklet)]
2751-
interface CSSImageValue : CSSResourceValue {
2752-
readonly attribute double? intrinsicWidth;
2753-
readonly attribute double? intrinsicHeight;
2754-
readonly attribute double? intrinsicRatio;
2755-
};
2756-
2757-
[Exposed=(Window, Worker, PaintWorklet, LayoutWorklet),
2758-
Constructor(USVString url)]
2759-
interface CSSURLImageValue : CSSImageValue {
2760-
readonly attribute USVString url;
2703+
interface CSSImageValue : CSSStyleValue {
27612704
};
2762-
27632705
</pre>
27642706

27652707
{{CSSImageValue}} objects represent values for properties that take <<image>> productions,
27662708
for example 'background-image', 'list-style-image', and 'border-image-source'.
27672709

2768-
If the {{CSSImageValue}}'s {{CSSResourceValue/state}} is "loaded",
2769-
and the resource has an intrinsic width, height, or aspect ratio,
2770-
then {{CSSImageValue/intrinsicWidth}}, {{CSSImageValue/intrinsicHeight}}, and {{CSSImageValue/intrinsicRatio}} must reflect the resource's corresponding value.
2771-
In this case, {{CSSImageValue/intrinsicWidth}} and {{CSSImageValue/intrinsicHeight}} has units `px`.
2772-
In all other cases, the attributes must be <code>null</code>.
2773-
2774-
Issue(186): Does the loading lifecycle need to be described here?
2710+
Note: This object is intentionally opaque,
2711+
and exposes no details of what kind of image it contains,
2712+
or any aspect of the image.
2713+
This is because having *something* to represent images is necessary for Custom Paint,
2714+
but there are sufficient complexities in getting URL-handling and loading specified firmly
2715+
that it's not realistically possible to specify in the timeline of this specification.
2716+
This will be expanded on in future levels.
27752717

2776-
{{CSSURLImageValue}} objects represent {{CSSImageValue}}s that match the <<url>> production. For these
2777-
objects, the {{CSSURLImageValue/url}} attribute contains the URL that references the image.
2718+
If a {{CSSImageValue}} object represents an <<image>> that involves a URL
2719+
(such as ''url()'' or ''image()''),
2720+
the handling of such values is identical to how CSS currently handles them.
2721+
In particular, resolving relative URLs or fragment URLs
2722+
has the same behavior as in normal CSS.
27782723

2779-
<div algorithm>
2780-
The <dfn constructor for=CSSURLImageValue>CSSURLImageValue(|url|)</dfn> constructor must,
2781-
when called,
2782-
perform the following steps:
2783-
2784-
1. Return a new {{CSSURLImageValue}}
2785-
with its {{CSSURLImageValue/url}} internal slot
2786-
set to |url|.
2787-
</div>
2788-
2789-
<div algorithm="CSSURLImageValue.url">
2790-
The getter for the <dfn attribute for=CSSURLImageValue>url</dfn> attribute
2791-
of a {{CSSURLImageValue}} must return its {{CSSURLImageValue/url}} internal slot.
2724+
<div class=example>
2725+
For example, relative URLs are resolved against the URL of the stylesheet they're within
2726+
(or the document's URL, if they're specified in a <{style}> element or <{html-global/style}> attribute).
2727+
This resolution doesn't happen eagerly at parse-time,
2728+
but at some currently-unspecified point during value computation.
2729+
2730+
Thus, if an element's style is set to ''background-image: url(foo);'',
2731+
and that specified value is extracted via the Typed OM
2732+
and then set on an element in a different document,
2733+
both the source and destination elements
2734+
will resolve the URL differently,
2735+
as they provide different base URLs.
2736+
2737+
On the other hand,
2738+
if the extracted value was a [=computed value=]
2739+
(from {{computedStyleMap()}}),
2740+
then it would already be resolved to an absolute URL,
2741+
and thus would act identically no matter where you later set it to.
2742+
(Unless it was a fragment URL,
2743+
which CSS treats differently and never fully resolves,
2744+
so it always resolves against the current document.)
27922745
</div>
27932746

2794-
Issue(159): Spec up ColorValue
27952747

27962748
<!--
27972749
██████ ██████ ██████ ██ ███████ ██ ██

0 commit comments

Comments
 (0)