Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1f6bcc6
Enhancements for Acid2
FlorianRappl Nov 19, 2026
6170137
Added Acid1 test for conformance
FlorianRappl Nov 19, 2026
e5bd6e6
Fixes for improving Acid3
FlorianRappl Nov 19, 2026
a62b560
Regenerate visual snapshot baselines for all platforms
github-actions[bot] Nov 20, 2026
4a1ec0d
Merge pull request #66 from AngleSharp/hotfix/acid3
FlorianRappl Nov 21, 2026
8c05975
Fixed height computation and hit resolution
FlorianRappl Nov 21, 2026
b99dd8e
Updated version
FlorianRappl Nov 22, 2026
a5c6ed9
Rendering fixes for Houdini and some test pages
FlorianRappl Nov 22, 2026
d1a3f4a
Declared min version
FlorianRappl Nov 22, 2026
8563255
Docs update for new input pickers API
FlorianRappl Nov 22, 2026
1a39471
Implemented input pickers and improved text selection
FlorianRappl Nov 22, 2026
234874f
Fixes and improvements, e.g., for details rendering
FlorianRappl Nov 22, 2026
ed8f2f1
Improvements for animations and transitions
FlorianRappl Nov 22, 2026
a48b164
Updated minimum version of AngleSharp.Css
FlorianRappl Nov 23, 2026
6b5be7d
Added loading of images
FlorianRappl Nov 23, 2026
0a71fb1
Updated version
FlorianRappl Nov 23, 2026
d8df365
Improved image loading
FlorianRappl Nov 23, 2026
f396d58
Updated AngleSharp
FlorianRappl Nov 23, 2026
56cf63b
Prepare for 1.11
FlorianRappl Nov 24, 2026
b08faf6
Updated version
FlorianRappl Nov 24, 2026
92ec823
Improved font rendering
FlorianRappl Nov 24, 2026
c5c3811
Added AoT compatible flag
FlorianRappl Nov 24, 2026
a7d5e8c
Improvements and fixes for more exotic cases
FlorianRappl Nov 24, 2026
0c7559a
Prepare for AoT
FlorianRappl Nov 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 2 additions & 41 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,12 @@ on: [push, pull_request]

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCS_PATH: ${{ secrets.DOCS_PATH }}
DOCS_BRANCH: ${{ secrets.DOCS_BRANCH }}
# Snapshot baselines are per-platform and committed; a missing one is a gap, never a pass.
ANGLESHARP_SNAPSHOT_STRICT: 1
ANGLESHARP_VERSION: 1.10.0
ANGLESHARP_CSS_VERSION: 1.4.1
ANGLESHARP_VERSION: 1.11.0
ANGLESHARP_CSS_VERSION: 1.6.0

jobs:
can_document:
runs-on: ubuntu-latest
outputs:
value: ${{ steps.check_job.outputs.value }}
steps:
- name: Checks whether documentation can be built
id: check_job
run: |
echo "value: ${{ env.DOCS_PATH != null && github.ref == env.DOCS_BRANCH }}"
echo "::set-output name=value::${{ env.DOCS_PATH != null && github.ref == env.DOCS_BRANCH }}"

documentation:
needs: [can_document]
runs-on: ubuntu-latest
if: needs.can_document.outputs.value == 'true'

steps:
- uses: actions/checkout@v5

- name: Use Node.js
uses: actions/setup-node@v5
with:
node-version: "20.x"
registry-url: 'https://registry.npmjs.org'

- name: Install Dependencies
run: |
cd $DOCS_PATH
npm install

- name: Deploy Doclet
run: |
cd $DOCS_PATH
npx pilet publish --fresh --url https://feed.piral.cloud/api/v1/pilet/anglesharp --api-key ${{ secrets.PIRAL_FEED_KEY }}

# Every platform that has committed snapshot baselines has to run them. Skia rasterizes
# glyphs through a different scaler per platform, so a baseline is only ever exercised by
# the platform it was recorded on. The runner images are pinned on purpose: bumping one
Expand All @@ -73,7 +36,6 @@ jobs:
uses: actions/setup-dotnet@v6
with:
dotnet-version: |
8.0.x
10.0.x

- name: Test
Expand Down Expand Up @@ -109,7 +71,6 @@ jobs:
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
10.0.x

# Exchanges the GitHub OIDC token for a short-lived (1 hour) NuGet API key.
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-snapshots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ permissions:
contents: write

env:
ANGLESHARP_VERSION: 1.10.0
ANGLESHARP_CSS_VERSION: 1.4.1
ANGLESHARP_VERSION: 1.11.0-beta.982
ANGLESHARP_CSS_VERSION: 1.6.0-beta.466

jobs:
# Keep this matrix identical to the `test` matrix in ci.yml, images included - a baseline
Expand Down
17 changes: 10 additions & 7 deletions AGENTS.md

Large diffs are not rendered by default.

58 changes: 58 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,61 @@
# 0.13.0

Released on Tuesday, November 24 2026.

- Fixed variable web fonts always being drawn with their default instance, bolder weights synthesized
- Fixed `@font-face` matching ignoring weight ranges
- Fixed `background-clip: text` on inline boxes painting the whole box instead of only its glyphs
- Fixed images picked from a `srcset` being as large as their pixels; they are divided by their density
- Fixed the caret of a focused text input or textarea always being painted at the end of its text instead of at its cursor (`selectionStart`/`selectionEnd`), and the selected text of one not being highlighted
- Fixed adjoining vertical margins collapsing pairwise instead of all together, e.g. those of an empty block with a negative margin inside (75px and -72px with 48px before them are 3px, not 48px)
- Fixed the bottom margin of a block being left out before inline content following it, and before a float or an absolutely positioned box placed after it
- Fixed `min-height` not winning over `max-height`
- Fixed `position: relative` with only `bottom` or `right` not moving the box
- Fixed `background-attachment: fixed` being ignored: such a background is positioned in the viewport, where it stays while the page scrolls
- Fixed atomic inlines (e.g. an image overflowing a block of no height) being painted below the floats they overlap, as all inline content paints above the floats
- Fixed the background showing through where two border sides of different colors meet on a diagonal
- Fixed `data:` images whose base64 is percent-encoded (e.g. `%2F` for `/`) not being shown
- Fixed an `object` with data that failed to load (e.g. a 404) showing it instead of its fallback content
- Fixed an `object` showing a page (e.g. `text/html`) showing its fallback content; it is an empty box of the size of an iframe
- Fixed the document of an empty iframe (e.g. 0 by 0) keeping the viewport of 300 by 150
- Fixed generated content being hit as the pseudo-element (in the hit-test map, `elementFromPoint` and for `:hover`) instead of its element, e.g. a link's `::after` stretched over a whole card did not act as the link
- Fixed grid items with a percentage `height` (e.g. `height: 100%` cards) in an auto row being as tall as the grid is wide; such a height contributes as `auto` to the row and then fills it
- Fixed text right in a grid container (e.g. the label of an icon with `display: grid; place-items: center`) not being an anonymous grid item: it stayed at the top left instead of being placed in a cell and aligned
- Fixed `row-reverse` and `column-reverse` packing the items at the end without reversing their order
- Fixed `grid-auto-columns` being ignored for implicit columns
- Fixed the edges of a gradient `border-image` of a box with a fractional size being drawn with seams and a washed out side
- Fixed `::marker` and `::first-line` colors being ignored
- Fixed an absolutely positioned box with `height: fit-content` (e.g. a popover) being stretched between `top` and `bottom`, and centering one of an automatic height with `margin: auto`
- Fixed `scrollWidth` and `scrollHeight` leaving out text extending beyond its box (e.g. cut off by an ellipsis)
- Fixed text before and after a relatively positioned inline box (e.g. a `strong` with `position: relative`) being painted as one, where the box was
- Fixed a `paint()` image not being drawn anew when only the custom properties it uses changed, and not at all when its box was only painted again
- Fixed opaque shadow colors (e.g. `box-shadow: 0 2px 3px #fff`) being painted black while AngleSharp.Css serializes colors as the spec says (`rgb(255, 255, 255)`)
- Fixed an absolutely positioned `::before` of a positioned box painting above the positioned content after it in frames of the interactive harness
- Fixed absolutely positioned boxes with a negative `z-index` sized by their containing block
- Fixed percentage heights of the items of a flex container that got its height from its own flex container being treated as `auto`
- Fixed a positioned pseudo-element covering its element being hit instead of the positioned boxes in that element
- Fixed the bounding box of SVG `image` elements being unknown
- Improved repainting an animated inline SVG
- Updated minimum version of AngleSharp to 1.11.0
- Updated to use a minimum of AngleSharp.Css 1.6.0
- Updated the document of an iframe to keep the render device of its browsing context, if it has one of its own
- Updated `Element.animate` to take typed arguments instead of a plain object
- Updated loading the image of an `img`: the renderer loads the source its render node picked (`srcset`, `sizes`, `picture`) once it lays the image out
- Added color hints and color interpolation methods (e.g. `in oklch`, `in hsl longer hue`) of gradients
- Added `loading=lazy` for images: a frame loads one once it is within 1250px of the viewport and of every scroll container around it
- Added `subgrid` for `grid-template-columns` and `grid-template-rows` (tracks, gaps and line names of the parent grid, row sizes from the subgrid's items)
- Added `background-clip: text`
- Added `object` elements showing an image instead of their fallback content
- Added `align-items: baseline` (and `align-self`) for flex items in a row: an item without text sits on the baseline with the bottom of its border box (e.g. a rule after a heading's text), where it was at the top of the line
- Added `getImageData()`, `putImageData()` and `createImageData()` of the canvas (`ImageData`)
- Added `paint()` background images of the CSS Painting API
- Added pickers of `color`, `date`, `datetime-local`, `month`, `time` and `week` inputs (`OpenInputPicker`): a color picker, a calendar of days, weeks or months, and columns of hours and minutes, which a host shows on top of a frame like the list of a dropdown, setting the value with `input` and `change` events; `min`, `max` and `step` disable the days, weeks, months and times they don't allow (`InputValueConstraints`)
- Added `IInputControl` for showing inputs in other ways: a control sizes an input whose `width` or `height` is `auto`, paints its content and creates its picker, and is registered per input type with `WithInputControl` (the built-in ones are `ColorInputControl` and `DateTimeInputControl`)
- Added the `disclosure-open` and `disclosure-closed` list markers (e.g. of `summary`)
- Added `drawFocusIfNeeded()` of the canvas
- Added animations and transitions of registered custom properties (`@property`, `CSS.registerProperty`), which are part of the cascade, so what uses them follows, e.g. a `var()` in a gradient or the input properties of a paint worklet
- Added `RendererDom.Register`, the DOM of this library declared for a scripting engine

# 0.12.0

Released on Wednesday, November 18 2026.
Expand Down
82 changes: 82 additions & 0 deletions docs/general/02-Interactivity.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,88 @@ switch (audio.GetMediaControlAt(x, y))
}
```

## Input Pickers

The `color`, `date`, `datetime-local`, `month`, `time` and `week` inputs open a picker as in a
browser: a color picker (saturation and brightness area, hue slider, the suggestions of the input's
`list` or a few common colors), a calendar (of days, weeks with their ISO numbers, or months; with
columns of hours, minutes and AM/PM for `datetime-local`), or the columns of a time. Like the list of
a dropdown (`SelectPopup`), a picker is not part of the layout: a host opens it, shows it on top of a
frame and forwards the pointer and the keyboard to it, in viewport coordinates:

```cs
var picker = input.OpenInputPicker(); // null if the input has none, or is disabled or read-only
frame = frame.WithOverlay(picker.Render());

// a press on the picker; a press anywhere else closes it with picker.Close()
var result = picker.PointerDown(x, y);
// also PointerMove, PointerUp, Wheel(x, y, deltaY) and KeyDown("ArrowLeft", "Enter", "Escape", ...)

switch (result)
{
case InputPickerResult.Repaint:
frame = frame.WithOverlay(picker.Render());
break;
case InputPickerResult.Close:
// hide the picker
break;
}
```

Choosing sets the input's value and fires `input`; `change` is fired when the picker closes with a
value other than the one it opened with. `picker.Close(cancel: true)` (and Escape) brings that value
back. `min`, `max` and `step` disable what they don't allow: days, weeks or months off the step
(counted from `min`, else the `value` attribute) are greyed out, and the time columns only list
the hours, minutes and seconds the step allows (a seconds column appears when the step isn't a
whole number of minutes); a chosen time moves to the nearest allowed one. `step="any"` allows
everything. `InputValueConstraints.For(input)` gives custom pickers the same rules. The picker follows the color scheme of the
input (as the list of a dropdown does) and its `accent-color`. `InputPickerOptions` sets where the
viewport of the input's document is (for an input in an iframe), the page's device and the current
time, which marks today and is shown when the input has no value.

### Custom Controls

How an input is shown is up to its `IInputControl`: `GetIntrinsicSize` gives its size when `width`
or `height` is `auto`, `Paint` paints the content of the input (its border, padding and background
come from the style sheets) and `CreatePicker` creates its picker. A size is of the content box
(padding and border are added, as for a text field) or of the border box
(`InputControlSizeBox.BorderBox`, as for the swatch of a color input); a side left null, or a null
size, is the built-in one of the type. The built-in ones are
`ColorInputControl` and `DateTimeInputControl` with the pickers `ColorPicker`, `CalendarPicker` and
`TimePicker`; all of them can be derived from. Another control is registered with the configuration,
for any input type:

```cs
var config = Configuration.Default
.WithCss()
.WithRenderDevice(device)
.WithInputControl("color", new MyColorControl()); // the other types keep the built-in controls

sealed class MyColorControl : ColorInputControl
{
public override InputControlSize? GetIntrinsicSize(InputControlSizeContext context) =>
new(context.MeasureText("#000000") + 40f, context.LineHeight);

public override void Paint(InputControlPaintContext context)
{
// what to paint, in the coordinates of context.DisplayList
context.DisplayList.FillRect(context.ContentBox, MyColors.Parse(context.Value));
context.DrawText(context.Value, context.ContentBox.X + 4f, context.TextBaseline);
}

public override IInputPicker? CreatePicker(InputPickerContext context) => new MyColorPicker(context);
}
```

`InputControlPaintContext` measures and paints text as the input's text is painted (`MeasureText`,
`DrawText`). `InputPickerContext` gives the input's place in the viewport (`Anchor`, and `Place` for
putting a picker below or above it), its font, the colors of its scheme (`Palette`) and a text
measurer. Deriving from `InputPicker` brings setting the value with its events (`SetValue`,
`Choose`), closing, and painting text in the input's font. `WithInputControls(provider)` replaces
the registry with any `IInputControlProvider`; returning null for an input leaves it to the
built-in control of its type, if any. The painting happens during layout, so it must only depend on
the state of the input.

## Scrolling

The same harness also tracks per-element scroll position, read and set through the standard
Expand Down
15 changes: 14 additions & 1 deletion docs/tutorials/01-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ section: "AngleSharp.Renderer"

## Configuration

A browsing context needs AngleSharp.Css and a render device. `WithRendering()` adds the services for `<canvas>` (its 2D context) and for `<img>` data:
A browsing context needs AngleSharp.Css and a render device. `WithRendering()` adds the services for `<canvas>` (its 2D context) and for `<img>` data. The renderer loads the image of an `<img>` it lays out (the source its render node picked for the device from `srcset`, `sizes` and the sources of a `<picture>`, see `ElementRenderNode.ImageSource`), as AngleSharp's image element requests nothing by itself; a render waits for it, while a frame of an interactive harness paints it once it has loaded, and loads a lazy one (`loading=lazy`, with scripting) only once it is within 1250px of the viewport and of the scroll containers around it. Its natural size (also `naturalWidth` and `naturalHeight`) is divided by the density of the picked candidate (e.g. `2x`). An image not in a document (e.g. `new Image()` of a script) is loaded once it has a source:

```cs
using AngleSharp;
Expand All @@ -20,6 +20,19 @@ var context = BrowsingContext.New(config);

The render device's `ViewPortWidth` and `ViewPortHeight` are the size of the viewport, and so of the rendered image (800×600 when the context has no render device); `FontSize` is the default font size. Images are rendered at one device pixel per CSS pixel.

## Scripting Without Reflection

AngleSharp.Js finds the DOM of this library by reflecting over its DOM attributes by default. A trimmed or natively compiled (AoT) application can instead hand it the registration generated for this library at build time, `AngleSharp.Renderer.RendererDom.Register` (a `DomRegistration` of AngleSharp). It declares the layout members of the library (`getBoundingClientRect`, `offsetWidth`, ...), the observers, animations and the 2D canvas, which replace the stubs of AngleSharp.Js as they do by reflection:

```cs
var config = Configuration.Default
.WithCss()
.WithRendering()
.WithJs(RendererDom.Register);
```

The registration describes the version of the library in use, so it never has to be kept in sync by hand. Several libraries are combined with `DomRegistrations.Combine`.

## Rendering A Document

`document.RenderToPng()` renders the viewport of a document with the render device of its context:
Expand Down
28 changes: 0 additions & 28 deletions src/AngleSharp.Renderer.Docs/docs.config.json

This file was deleted.

58 changes: 0 additions & 58 deletions src/AngleSharp.Renderer.Docs/package.json

This file was deleted.

7 changes: 0 additions & 7 deletions src/AngleSharp.Renderer.Docs/src/index.tsx

This file was deleted.

25 changes: 0 additions & 25 deletions src/AngleSharp.Renderer.Docs/tsconfig.json

This file was deleted.

Loading
Loading