Skip to content

Release 1.1.0 - #237

Open
FlorianRappl wants to merge 18 commits into
mainfrom
devel
Open

Release 1.1.0#237
FlorianRappl wants to merge 18 commits into
mainfrom
devel

Conversation

@FlorianRappl

Copy link
Copy Markdown
Contributor

Types of Changes

Prerequisites

Please make sure you can check the following two boxes:

  • I have read the CONTRIBUTING document
  • My code follows the code style of this project

Contribution Type

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Bug fix (non-breaking change which fixes an issue, please reference the issue id)
  • New feature (non-breaking change which adds functionality, make sure to open an associated issue first)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

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 IRenderDevicePreferences interface we are capable of dynamically adding platform descriptors, which are then used throughout the CSS evaluation (right now exclusive to media computations).

lahma and others added 18 commits September 2, 2026 18:40
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
@FlorianRappl FlorianRappl added this to the v1.1.0 milestone Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants