css: Respect @layer priority#2983
Merged
Merged
Conversation
Builds ontop of #2719 and adds the missing layer-priority. This can be broken down into two parts. The first is the hot read path. This code is unchanged...same buckets and same u64 priority comparison. What has changed is the build/rebuild step and how / what the VisibilityRule.priority means. priority used to be 32bits for specificity and 32bits for doc order (specificity tie-breaker). Priority is now 12bits for layer rank, 30bits for specificity and 22bits for doc order. Specificity was only using 30bits, and the smaller doc order means we can now only represent 4 million rules (Facebook, which has _a lot_ of rules, has ~50K and like 95% of those are not visibility rules..so we have plenty of space still). But layer ordering is complicated because you need to parse everything before you know the final order. So our build now accumulates intermediary results and does a final iteration through the VisibilityRule to |= the rank_layer bits of their priority. This is no-op if there are no layers (common case for now). Because of this intermediary work, I've added a build_arena that is build/ rebuild specific. Possibly overkill since we don't expect sites to have thousands of layers, but it's cheap to add (except now you need to think: should I use the build_arena or self.arena).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Builds ontop of #2719 and adds the missing layer-priority.
This can be broken down into two parts. The first is the hot read path. This code is unchanged...same buckets and same u64 priority comparison.
What has changed is the build/rebuild step and how / what the VisibilityRule.priority means. priority used to be 32bits for specificity and 32bits for doc order (specificity tie-breaker). Priority is now 12bits for layer rank, 30bits for specificity and 22bits for doc order. Specificity was only using 30bits, and the smaller doc order means we can now only represent 4 million rules (Facebook, which has a lot of rules, has ~50K and like 95% of those are not visibility rules..so we have plenty of space still).
But layer ordering is complicated because you need to parse everything before you know the final order. So our build now accumulates intermediary results and does a final iteration through the VisibilityRule to |= the rank_layer bits of their priority. This is no-op if there are no layers (common case for now). Because of this intermediary work, I've added a build_arena that is build/ rebuild specific. Possibly overkill since we don't expect sites to have thousands of layers, but it's cheap to add (except now you need to think: should I use the build_arena or self.arena).