--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
Console warning is easy enough to implement since the code to track if a sheet would be impacted by the change is all in one place. I can also query the Alexa top-500k in Big Query from the HTTP Archive and get a sense for how often it shows up in the static HTML but that would only catch landing pages.As far as spec goes, I'm not aware of any progress on it but the Firefox and Edge implementations are different enough that one of them would have to change to get consistency. Feedback from Firefox on my earlier intent to implement the parser-blocking behavior of edge was positive though with a preference to implement Firefox's behavior. There was no public opinion from Edge. This is a necessary first step if we end up deciding to converge on the Edge behavior instead of the Firefox behavior.
Reliably at runtime I can detect when a script-blocking stylesheet is activated after the body has started. I can't detect if that will trigger a FOUC because there's no way to tell if the sheet includes any styles relevant to content in the viewport. At best I can over-count and detect cases where it COULD cause a FOUC that wouldn't have been there before but not necessarily that it WILL cause one.
Edge (and I'm pretty sure IE) actually block the parser. This is observable by running a setTimeout loop and observing the DOM. See the snippets I posted on this bug.
The WebKit/Blink behavior today is confusing since we do some funny things around the first forced layout. The doc on the FOUC sanity meta bug describes this.
Long term we should either be async in the body or block the parser. I think the Edge behavior is least likely to break content and make it blink though. :)
I don't think we should worry too much about the current html imports. The only reason they need to block painting is because of the behavior where imports can apply stylesheets. That behavior will never be added to the future html modules (which can't apply styles and are deferred by default).
We should continue with the FOUC avoidance sanity plan:
- don't block the parser until we undefer commits. This code is now in core so it's easy to connect to the parser.
- never block the parser on html imports
- don't undefer commits until parser inserted imports or sheets that were inserted before the body are done loading.
That will avoid FOUC, keep the parallelism for all html imports, and greatly simplify the system. It also shouldn't have any FOUC risks like making all sheets async.
On 5/30/16 9:15 AM, Philip Jägenstedt wrote:
but are there worthwhile things that could be
achieved if there was no blocking at all?
Absolutely. Consider this, in <body>:
<link rel="stylesheet" href="sheet1.css">
Various stuff not including <script>.
<link rel="stylesheet" href="sheet2.css">
More stuff
When do the loads of subresources sheet2 links to (e.g. @imports or background images from it) start loading?
If you block the parser on sheet 1, they can't start loading until sheet1 is loaded without adding some sort of special codepaths to prefetch those subresources.
And those specialy codepaths might not work correctly for background images anyway, since those loads tend to only happen when some node matches the rule...
If you don't block, things from sheet2 can load in the normal way.
In other words, blocking inherently gives up some parallelism.
Parts of it can probably be recovered with enough pain and suffering by UAs, using various non-standardized heuristics and whatnot. But it adds significant implementation complexity and more nonstandard things that are needed in practice to create a useful UA...
On 5/31/16 3:38 PM, Elliott Sprehn wrote:
@import is loaded by the preload scanner
Last I checked this is only the case for <style> in Blink, no? Not for external stylesheets. Please do look at the actual example I suggested.
background images are deferred
until the first style recalc that would match that rule.
Precisely, and if you block the content that would match that rule from being in the DOM, you don't get that style recalc until much later.
If you block the parser on sheet 1, they can't start loading until
sheet1 is loaded without adding some sort of special codepaths to
prefetch those subresources.
That already exists, it's the preload scanner, and I believe all
browsers have it in some manner.
See above.
Note that Gecko's preload scanner does not parse inline stylesheets, by the way. We can obviously fix that, but my larger point is that blocking the parser requires a lot more than the sort of preload scanner browsers typically already have, simply to get the parallelism you get for free with not blocking the parser.
Indeed, browsers only fetch resources declared in style rules on the
first usage of them. This is what authors expect as well. Anything that
started prefetching images from sheets without waiting on other pending
sheets would likely start download images in rules that have overrides
in other sheets.
That's actually not terribly likely to be a problem in practice, I expect.
I don't think there's anything inherent about it
See above.
I don't think this is any worse than needing a preload scanner, which
everyone has already.
It's definitely worse, because it involves a lot more than just scanning the HTML.
so most browsers are not fetching resources in the situations you
describe.
That's not true for @import in non-inline sheets.
Patrick, so what do you want to do with this intent? Do you want to move forward with this as planned? I tend to agree with Elliot's point that it's probably OK to experiment with some changes here before we worry too much about locking down the spec.
Yeah on an internal sheet. I can run the tests again checking external sheets too. I'll get my test setup up on github so folks can try it as well.
- E
lgtm3
The long term plan here was to change Blink to:- Block painting on all sheets in the head.- Block the parser on sheets in the <body>.- Don't start running requestAnimationFrame until we start painting.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
Following up on this intent now that the implementation has evolved. As of the end of January (2017) our experimental implementation has matched the Edge behavior where in-body external stylesheets block the parser (and render) for content after the link tag but content before it is free to continue rendering. As of this morning WebKit implements similar behavior and only blocks render for elements defined after the body stylesheets.
To be clear, my LGTM from June still stands. Moving closer to Edge seems low enough risk that I don't personally see any reason why we'd need to block shipping on improving the spec situation here (though we definitely need to be on the look-out for reports of issues in the wild and be ready to re-evaluate). But Chris had some concerns with that plan back in June. Chris, what's your current thinking on what specifically you'd like to see before we try shipping a change here?
Also note I was wrong about this being a paint-team thing (sorry - forgot the history and skimmed the thread too quickly). I do still want to know what team owns this space long term. I.e. who owns the decision of what spec / interop work, if any, will be prioritized over the next year or so after we've realized the performance win?
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
To get all of the browsers fully aligned would span at least a few different specs and probably some areas that aren't spec'd. It covers the intersection of the parser, building the DOM and building a render tree.Specifically, when a stylesheet is parsed in the body of a document (either link or style tags) and before it has been loaded and processed:- Should DOM elements discovered after the stylesheet be added to the DOM? (IE/Edge: No, Firefox and Safari: Yes, Chrome CL: No)- Should elements discovered after the stylesheet be added to a render tree (causing FOUC)? (IE/Edge/Chrome CL: N/A, Firefox: Yes , Safari: No)- Should Layout/Render/Paint continue for elements discovered before the stylesheet? (Everyone: Yes - Shipping Chrome/Safari: No)In general, anything about when to paint (or allow paint) isn't spec'd and is mostly tuned by everyone to minimize re-doing work as much as possible, reduce FOUC and still display content to the user as soon as possible but pretty much nothing about when rendering is or isn't supposed to happen lies in any specs (that I'm aware of anyway).
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
If we're wanting to go down the Safari TP model, we could do it like this:
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
You received this message because you are subscribed to a topic in the Google Groups "blink-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/a/chromium.org/d/topic/blink-dev/QC5iefctcag/unsubscribe.
To unsubscribe from this group and all its topics, send an email to blink-dev+unsubscribe@chromium.org.
Reviving the somewhat-beaten horse since the fix for the last-known issue with the existing experiment just landed yesterday.The current implementation (behind a flag) matches the Edge behavior:- Pauses the parser for in-body stylesheets (but not head stylesheets)- Does not block layout/paint for in-body stylesheetsAs far as web developers are concerned, it should have the same effect as Safari and Edge where critical css can be inlined in the head for the viewport and an external css can be loaded in the body for the content later in the page (or site-wide css).Long-term (after imports have been fully deprecated and removed) the plan is to pause the parser for all stylesheets, including those in the head which will allow for the removal of all of the FOUC avoidance logic. I'd rather not wait for that to happen to ship the developer-facing functionality though because it will probably be another year before we're at that point.Any opinions on the best way to move the experiment forward from this point? The bulk of the code has been running on the bots and as an experimental web platform feature for the last year. If we roll out using a finch experiment we may be able to see some FCP metrics improve in UKM if we can identify a few sites that include external styles in their body but for the most part the only way I expect we'll hear if it is breaking things or not is through developer feedback.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAFUtAY_-xQCCKt1uA0hZ7b-rVxALktac52XvaC%2BO%3Do3dX58SEQ%40mail.gmail.com.
Argh. I'll ping the Edge team to see if the change was intentional and when it happened. I'm seeing the same thing with http://test.patrickmeenan.com/css/css_middle.html where it is now aligned with the Firefox behavior.I don't have a Mac handy but I'll look at STP when I get home.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CACPgMqVt%2BQN%2BPLPEjj5FJah8XpGmBhd6znV2QkgjTuJmJXsRpw%40mail.gmail.com.
Proposed plan:- After m68 branch, switch the feature from experimental to stable- File a launch blocker bug for M69 to flip the flag back if not launch-approved- Watch the relevant metrics through Canary/Dev/Beta
pme...@chromium.org None External stylesheets in the body of the document or that get activated after the body has started to be parsed will no longer block paint. The parser will still block at a script tag until all prior stylesheets have loaded, including those in the body.This change was implemented in Chrome 52 behind the Experimental Web Platform Features flag. This change allows for performance optimizations that the web performance community has been advocating for for a long time where developers can split their css between critical and below-the-fold and inline the critical css while loading the below-the-fold css after the above-the fold content. In principle that allows for rendering the critical part of the page with no additional round trips but in practice Blink blocks all rendering, even of the above-the-fold content as soon as it discovers the lower late-body css (usually well before it has painted any content at all).There are Javascript hacks to work around the render blocking like loadcss and the proposed change matches the existing Firefox behavior (with Edge providing a slightly different variation but still allowing paint).Firefox: Shipped Edge: No public signals Safari: No public signals Web developers: Strongly positive There is minimal risk of breaking any existing content. At worst there will be a flash of unstyled content for sites that have external sheets in the body. Those same sites will already encounter FOUC's with Firefox. None Yes Nonecrbug for paint-blocking issue: http://crbug.com/481122 https://www.chromestatus.com/features/5696805480169472 Yes
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/5c4a955d-dab9-49e5-a4bb-565717fe6686%40chromium.org.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CACuPfeQsc097uOUL92AwAnw7MGZcqUyC%3DKtTGGyfOADBBLLTBA%40mail.gmail.com.
This was enabled for M69. I see that chromestatus was not updated: https://www.chromestatus.com/feature/5696805480169472