Release 1.1.0 - #237
Open
FlorianRappl wants to merge 18 commits into
Open
Conversation
CssMediaQueryList.ComputeMatched returned a constant false, so window.matchMedia(...).IsMatched answered false for every query, including "all" and the empty query, which always match. It now validates the media list against the render device from the browsing context, reusing the very same evaluation that @media rules already go through for the cascade, and falls back to DefaultRenderDevice when no device is registered - the same fallback GetComputedStyle uses. Reported in AngleSharp/AngleSharp#1307. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NqCcJrL3MJecCPRBMQsZyC
CssColorValue always serializes through rgba(), so an opaque color comes out as rgba(r, g, b, 1) where the CSSOM serialization rules ask for rgb(r, g, b). Changing that by default would be breaking, so this adds UseSpecSerialization next to UseHex: off by default, and when switched on an opaque color serializes as rgb(r, g, b) while anything with an alpha below 1 keeps rgba(r, g, b, a). UseHex still wins when both are active. Reducing a color that was written as a named color back to its name is a separate step and is not part of this change. Closes #227. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NqCcJrL3MJecCPRBMQsZyC
Evaluate the media query list in matchMedia against the render device
Add an opt-in switch for CSSOM-compliant color serialization
Adds IRenderDevicePreferences, a small interface with a single IReadOnlyDictionary<String, String> Preferences member that DefaultRenderDevice implements, so a host can say which user preferences its device carries without every existing IRenderDevice implementation having to change. A generic PreferenceFeatureValidator is registered for prefers-color-scheme, prefers-reduced-motion, prefers-reduced-transparency, prefers-contrast, prefers-reduced-data, forced-colors and display-mode, and hover/any-hover and pointer/any-pointer now read the dictionary when it carries them, while keeping their previous answer when it does not. A key that is not set leaves its feature unknown, i.e., the query does not match. Fixes #234 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NqCcJrL3MJecCPRBMQsZyC
Review feedback on #235: the convenience layer over IRenderDevice is useful to hosts that configure a DefaultRenderDevice, so the class is public and documented. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NqCcJrL3MJecCPRBMQsZyC
Answer the user-preference media features from the render device
The calc add/sub/mul/div expressions create the resulting metric value via Activator.CreateInstance(x.GetType(), result). The trimmer cannot see that call target, so the single-Double constructors of the built-in metric values were removed, making every calc() computation throw MissingMethodException in NativeAOT (and trimmed) applications. The reflection call now lives in a single helper that roots the public constructors of all built-in metric values via DynamicDependency, so the behavior matches the JIT one. ICssMetricValue is public, hence external implementations stay supported - they just have to preserve their own constructor. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: a2612f6f-7d43-40de-a31f-96a2600e6f81
Fix calc() computation in trimmed / NativeAOT applications
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.
Types of Changes
Prerequisites
Please make sure you can check the following two boxes:
Contribution Type
What types of changes does your code introduce? Put an
xin all the boxes that apply:Description
Thanks to all the contributors in this one we have fixed a set of bugs and added some great enhancements. Most importantly, we improved media queries and fixed some CSS computation bugs w.r.t. media features / types, as well as in the CSS variables (
calc) space.Through the new
IRenderDevicePreferencesinterface we are capable of dynamically adding platform descriptors, which are then used throughout the CSS evaluation (right now exclusive to media computations).