Re: [csswg-drafts] [css-fonts-4] font-display: optional without relayout (#4108)

The CSS Working Group just discussed `font-display: optional`, and agreed to the following:

* `RESOLVED: change normative text for font-display optional to say that the font should never change rendering of the page if it would you'd still just treat the load as failed and don't use it again`
* `RESOLVED: Add notes for implementors and authors to the spec, specific contents TBD`

<details><summary>The full IRC log of that discussion</summary>
&lt;emilio> topic: font-display: optional<br>
&lt;astearns> github: https://github.com/w3c/csswg-drafts/issues/4108<br>
&lt;emilio> TabAtkins: I think we probably have a plan even if WebKit disagrees with this<br>
&lt;emilio> ... I don't think we will get into a deadlock<br>
&lt;emilio> ... As I said, the main goal of optional was to avoid layout shift<br>
&lt;emilio> ... layout shift is really annoying and font-display: optional aims to solve that<br>
&lt;emilio> ... another is performance<br>
&lt;emilio> ... turns out that our data is that our the extra style and layout that the font load triggers delays stable layout significantly<br>
&lt;emilio> ... and if you waited one or two frames you'd just get the final layout faster than if you did everything eagerly<br>
&lt;emilio> ... and getting reasonable assurance about getting local fonts or downloaded fonts getting caches in getting the details of this right<br>
&lt;emilio> ... and interesting quirk I found yesterday, some of our internal teams are using font-display: optional on iOS because caches there are usually faster than most android phone<br>
&lt;emilio> ... so it usually hits the cache faster and if so... that's great<br>
&lt;emilio> myles: I see your strategy :P<br>
&lt;emilio> TabAtkins: Proposal is that for preloaded fonts, as soon as you see the preload tag, or as soon as you see the font-face rule that would refer to them, pull them be into the memory cache<br>
&lt;emilio> ... for normal pages you should be able to get all the fonts you're using<br>
&lt;emilio> ... when you start loading, if any of the loads triggered not from the cache, you're allowed to delay rendering before starting your first layout<br>
&lt;emilio> ... and if you can't (too slow / whatever), then you discard the load and never use them again for the lifetime of the page<br>
&lt;emilio> myles: I don't think any of those changes require any changes to any spec<br>
&lt;emilio> ... the distinction between memory / disk cache is not something that should be on any spec<br>
&lt;emilio> ... and if you use fuzzy words I don't think they would mean anything<br>
&lt;emilio> ... specs doesn't forbid Chrome to delay rendering<br>
&lt;emilio> ... so it's untestable, doesn't need to be in any spec, I'd be ok with no change<br>
&lt;emilio> TabAtkins: I don't think I disagree with you, but it'd be good to hint to other implementations about how you can achieve a high quality implementation for this feature<br>
&lt;emilio> myles: yeah that's good, but shouldn't be normative<br>
&lt;emilio> TabAtkins: ok, compromise proposal: We remove normative text about delaying rendering or what not, and we only state that optional fonts must not cause layout jank<br>
&lt;emilio> ... and then provide notes to implementations<br>
&lt;emilio> chrishtr: I think the spec must be clear that it's acceptable to delay rendering rather to do partial rendering<br>
&lt;emilio> TabAtkins: yeah I'll put that in<br>
&lt;emilio> myles: in the notes<br>
&lt;emilio> TabAtkins: in the notes<br>
&lt;emilio> myles: you can totally describe the intended use case in the spec<br>
&lt;emilio> chrishtr: right now our implementation of font-display: optional can cause two layouts. I don't think it show<br>
&lt;emilio> TabAtkins: yeah that's the normative text described above means<br>
&lt;emilio> ... well as long as pixels don't move you're fine<br>
&lt;emilio> myles: I think that's an important distinction<br>
&lt;emilio> ... if you want you can do layout every frame<br>
&lt;emilio> chrishtr: agreed<br>
&lt;emilio> fremy: when you have sheets in a document you never render before they load right?<br>
&lt;emilio> TabAtkins: if you see them early enough or such<br>
&lt;emilio> fremy: what I want to say is that there is a precedent for this<br>
&lt;emilio> TabAtkins: proposed text is to change normative text for font-display optional to say that the font should never change rendering of the page<br>
&lt;emilio> ... if it would you'd still just treat the load as failed and don't use it again<br>
&lt;emilio> fremy: I don't really understand what's the difference between the font-face behavior and the stylesheet behavior<br>
&lt;emilio> emilio: the main difference is that for stylesheets you statically know it applies, but to determine the fonts you need is that you need to do layout and styling<br>
&lt;emilio> chrishtr: I think the main proposal to web devs is to add a &lt;link rel=preload> for important fonts and then use the font-display: optional to avoid the jank<br>
&lt;fantasai> I think it's important to distinguish it from the block behavior<br>
&lt;emilio> astearns: objections to the proposed resolution<br>
&lt;emilio> ?<br>
&lt;fantasai> You don't want to make the user wait more than a brief, mostly-unnoticeable moment in the case of font-display: optional<br>
&lt;fantasai> otherwise it's not really "optional"<br>
&lt;TabAtkins> fantasai, oh yes it's distinguished already; i'm just gonna remove a bit of semi-normative text<br>
&lt;fantasai> ok<br>
&lt;emilio> RESOLVED: change normative text for font-display optional to say that the font should never change rendering of the page if it would you'd still just treat the load as failed and don't use it again<br>
&lt;emilio> jfkthame: the phrasing about the suggestion about &lt;link rel=preload> about an important font seems a bit off to me<br>
&lt;emilio> ... because tagging it as font-display: optional means that it is _not_ an important font<br>
&lt;emilio> TabAtkins: you'd get the desired thing most of the time assuming a high-quality implementation<br>
&lt;emilio> astearns: there are a couple more assumptions there, like fast network,  fast disk, no contention...<br>
&lt;emilio> chrishtr: we could probably add the &lt;link rel=preload> bit separate from font-display: optional<br>
&lt;emilio> RESOLVED: Add notes for implementors and authors to the spec, specific contents TBD<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4108#issuecomment-578222439 using your GitHub account

Received on Friday, 24 January 2020 17:22:14 UTC