8364149: Conditional stylesheet imports#2031
Open
mstr2 wants to merge 3 commits intoopenjdk:masterfrom
Open
Conversation
|
👋 Welcome back mstrauss! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
Collaborator
Author
|
/reviewers 2 |
|
@mstr2 has indicated that a compatibility and specification (CSR) request is needed for this pull request. @mstr2 please create a CSR request for issue JDK-8364149 with the correct fix version. This pull request cannot be integrated until the CSR request is approved. |
Webrevs
|
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The
@importrule is extended to support conditional stylesheet imports:Conceptually, a conditional import takes all rules of the referenced stylesheet, literally includes them at the location of the
@importrule, and surrounds them with a@mediarule with the specified<media-query-list>.The implementation of this feature extends media queries with a context-free evaluation function:
This mode of evaluation uses Kleene's strong trivalent logic to determine whether the media query will always match (it's a tautology), will never match (it's a contradiction), or whether it depends on the context or we simply don't know.
Using this mechanism, a conditional stylesheet import that can never match will be skipped at runtime. Similarly, a conditional stylesheet import that will always match doesn't need the
<media-query-list>at all; its rules will be pasted verbatim into the main stylesheet.Note that this mechanism is not meant to be a full-blown theorem solver. It won't detect that, for example, the following import conditions will always match:
Its purpose is an optimization for "obvious" cases. For example, at the moment the built-in themes use hard-coded conditions to include user-agent stylesheets at runtime:
In the future, we might have a way to test for
ConditionalFeatureflags that achieves the same thing, but with a public API available to all theme authors:Progress
Issues
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jfx.git pull/2031/head:pull/2031$ git checkout pull/2031Update a local copy of the PR:
$ git checkout pull/2031$ git pull https://git.openjdk.org/jfx.git pull/2031/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 2031View PR using the GUI difftool:
$ git pr show -t 2031Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/2031.diff
Using Webrev
Link to Webrev Comment