Skip to content

Commit 69379fb

Browse files
committed
Tighten fetch integration, add shape support
1 parent ffc8bf7 commit 69379fb

File tree

4 files changed

+45
-21
lines changed

4 files changed

+45
-21
lines changed

css-cascade-4/Overview.bs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,10 @@ Processing Stylesheet Imports</h3>
281281
with stylesheet |parentStylesheet|,
282282
destination "style",
283283
CORS mode "no-cors",
284-
and processResponse being the following steps given [=/response=] |response|:
284+
and processResponse being the following steps given [=/response=] |response| and
285+
byte stream, null or failure |byteStream|:
285286

286-
1. If |response| is a [=network error=] or its [=response/status=] is not an
287-
[=ok status=], return.
287+
1. If |maybeByteStream| is not a byte stream, return.
288288

289289
2. If |parentStylesheet| is in [=quirks mode=]
290290
and |response| is [=CORS-same-origin=],
@@ -294,8 +294,8 @@ Processing Stylesheet Imports</h3>
294294
3. If |content type| is not <code>"text/css"</code>,
295295
return.
296296

297-
4. Let |importedStylesheet| be the result of [=Parse a stylesheet|parsing=] |response|'s
298-
[=response/body=]'s [=body/stream=] given |parsedUrl|.
297+
4. Let |importedStylesheet| be the result of [=Parse a stylesheet|parsing=] |byteStram|
298+
given |parsedUrl|.
299299

300300
5. Set |importedStylesheet|'s <a spec=cssom>origin-clean flag</a> to
301301
|parentStylesheet|'s <a spec=cssom>origin-clean flag</a>.

css-fonts-4/Overview.bs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2950,13 +2950,12 @@ Font fetching requirements</h4>
29502950
with stylesheet being |rule|'s <a spec=cssom for=CSSRule>parent CSS style sheet</a>,
29512951
destination "font",
29522952
CORS mode "cors",
2953-
and processResponse being the following steps given [=/response=] |res|:
2953+
and processResponse being the following steps given [=/response=] |res| and null, failure or a
2954+
byte stream |stream|:
29542955

2955-
1. Let |body| be |res|'s [=response/body=].
2956+
1. If |stream| is null, return.
29562957

2957-
1. If |body| is null, return.
2958-
2959-
1. ISSUE: Load a font from |body| according to its type.
2958+
2. ISSUE: Load a font from |stream| according to its type.
29602959
</div>
29612960

29622961
Note: The implications of this for authors are that fonts

css-shapes-2/Overview.bs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,27 @@ Shapes from Image</h3>
423423
that determines the relevant pixels to use
424424
(both for defining a shape and for display).
425425

426+
<h2 id="fetching-external-shapes">
427+
Fetching external shapes</h2>
428+
429+
To <dfn>fetch an external resource for a shape</dfn>, either an SVG or an image, given a
430+
{{CSSStyleRule}} |rule|:
431+
1. Let |parsedUrl| be the result of the [=URL parser=] steps with |rule|'s URL and |rule|'s
432+
|parentStylesheet|'s <a spec=cssom>location</a>.
433+
If the algorithm returns an error,
434+
return. [[CSSOM]]
435+
436+
2. [=Fetch a style resource=] given |parsedUrl|,
437+
with stylesheet being |rule|'s <a spec=cssom for=CSSRule>parent CSS style sheet</a>,
438+
destination "image",
439+
CORS mode "cors",
440+
and processResponse being the following steps given [=/response=] |res| and null, failure or
441+
a byte stream |byteStream|:
442+
If |byteStream| is a byte stream,
443+
apply the image or SVG to the appropriate shape-accepting property.
444+
445+
Note: shapes require CORS mode as their effect is detected by the document.
446+
426447

427448
<h2 id="shapes-from-box-values">
428449
Shapes from Box Values</h2>

css-values-4/Overview.bs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,8 @@ URL processing model</h4>
997997
given a {{CSSStyleSheet}} |sheet|,
998998
a string |destination| matching a {{RequestDestination}},
999999
a "no-cors" or "cors" |corsMode|,
1000-
and an algorithm |processResponse| accepting a [=/response=]:
1000+
and an algorithm |processResponse| accepting a [=/response=] and a null, failure or byte
1001+
stream:
10011002

10021003
1. Let |environmentSettings| be |sheet|'s [=relevant settings object=].
10031004

@@ -1009,29 +1010,32 @@ URL processing model</h4>
10091010

10101011
5. Let |referrer| be |documentBase|.
10111012

1012-
6. If |base| is null, set |base| to |documentBase|.
1013+
6. Let |handleResourceFetchDone| be to do nothing.
10131014

1014-
7. Let |parsedUrl| be the result of the [=URL parser=] steps with |url| and |base|.
1015+
7. If |base| is null, set |base| to |documentBase|.
1016+
1017+
8. Let |parsedUrl| be the result of the [=URL parser=] steps with |url| and |base|.
10151018
If the algorithm returns an error, return.
10161019

1017-
8. If |corsMode| is "cors", set |referrer| to |sheet|'s
1020+
9. If |corsMode| is "cors", set |referrer| to |sheet|'s
10181021
<a spec=cssom>location</a>. [[CSSOM]]
10191022

1020-
9. Let |req| be a new [=/request=] whose [=request/url=] is |parsedUrl|, whose
1023+
10. Let |req| be a new [=/request=] whose [=request/url=] is |parsedUrl|, whose
10211024
[=request/destination=] is |destination|, [=request/mode=] is |mode|, [=request/origin=]
10221025
is |environmentSettings|'s [=environment settings object/origin=],
10231026
[=request/credentials mode=] is "same-origin", [=request/use-url-credentials flag=] is
10241027
set, and whose [=request/header list=] is a [=/header list=] containing a [=header=]
10251028
with its [=header/name=] set to "referrer" and its [=header/value=] set to |referrer|.
10261029

1027-
10. [=/Fetch=] |req|, with |taskDestination| set to |global|, and |processResponse| set to
1028-
the following steps given [=/response=] |res|:
1029-
1030-
1. If |sheet|'s <a spec=cssom>origin-clean flag</a> is set, set |handleResourceFetchDone|
1031-
given [=/response=] |res| to [=finalize and report timing=] with |res|, |global|, and
1030+
11. [=/Fetch=] |req|, with |taskDestination| set to |global|, and |processResponseEndOfBody|
1031+
set to the following steps given [=/response=] |res| and Null, failure or byte stream
1032+
|byteStream|:
1033+
1. If |sheet|'s <a spec=cssom>origin-clean flag</a> is set,
1034+
[=finalize and report timing=] with |res|, |global|, and
10321035
<code>"css"</code>. [[CSSOM]]
10331036

1034-
2. Call |processResponseDone| with |res|.
1037+
2. Call |processResponse| with |res| and |byteStream|.
1038+
10351039
</div>
10361040

10371041
<h2 id="numeric-types">

0 commit comments

Comments
 (0)