Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
18 changes: 9 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# 0.11.4

Released on tbd.
Released on Monday, November 16 2026.

- Improved frames of pages animating the `transform`, `opacity` or `filter` of boxes (e.g. a glow turning forever behind the cards of smapiot.com, or a carousel sliding): the last frame is painted with the box under its new values, without a layout (about 3 ms instead of 400 ms per frame there), as long as the box keeps the scopes it was painted in; a box animating its transform or opacity is painted under them all along (at the identity, too), as browsers make it a stacking context; this also holds for CSS transitions and for changes of the style attribute
- Improved frames of pages animating the `transform`, `opacity` or `filter` of boxes: the last frame is painted with the box under its new values, without a layout, as long as the box keeps the scopes it was painted in; a box animating its transform or opacity is painted under them all along (at the identity, too), as browsers make it a stacking context; this also holds for CSS transitions and for changes of the style attribute
- Improved scrolling pages with sticky boxes (e.g. a sticky header): the frame is moved to the scroll position with the sticky boxes stuck anew, also for hit testing, instead of laying out the page again
- Improved changes of what is never rendered (e.g. WP Rocket changing the type and src of scripts to load them, or scripts added to the head or the body): the frame stays, unless a selector of an attribute or of the siblings may match otherwise
- Improved reading the geometry of a page shown in frames after a change that cannot be patched: the page is laid out as its next frame, which the next frame then is, instead of being laid out for the read and once more for the frame
Expand All @@ -20,14 +20,14 @@ Released on tbd.

Released on Friday, November 13 2026.

- Improved frames of pages changing the styles of positioned boxes by script, e.g. a game moving its sprites (Mario 5: about 10 ms instead of 150 ms per frame): changes of the same attribute between two frames are taken as one (more than 256 changes dropped the update of the frame, so every frame was laid out as a whole); a box moved by its inset (`left`, `top`, `right` or `bottom` in pixels, with the opposite one `auto`) is moved in the frame instead of laid out again with its content; a style attribute change that only paints differently (e.g. the `background-position` of a sprite) is painted again without a layout, also when the box moved at the same time; a box moved again is moved without computing its style when only its insets changed in its style attribute; the map of what can be hit is updated for the moved boxes only (a box that transitions or animates is laid out as before)
- Improved drawing images into a canvas at a fractional position, scaled or rotated (e.g. a game following its ship: about 1.5 ms instead of 12 ms for 512x512 pixels, which let Spaceshoot fall behind until the page froze): edges are anti-aliased only if the image is rotated or skewed, and images are smoothed bilinearly (the default `imageSmoothingQuality` of `low`), as in Chromium
- Improved frames after a script removes an absolutely positioned box (e.g. a coin of Mario 5 disappearing, one of hundreds of sprites in the same parent: about 30 ms instead of 150 to 230 ms): its commands are taken out of the frame instead of its parent being laid out again, unless a selector matching by siblings or children (e.g. `:nth-child`, `:last-child`, `+`, `~` or `:empty`) may match the parent or one of its children
- Improved painting a canvas into the page by sampling its snapshot bilinearly, without mipmaps built again for each frame (Spaceshoot: about 33 ms instead of 60 ms per frame)
- Fixed a box removed after a change of its style attribute (e.g. a coin of Mario 5 disappearing) making the next frame a full layout
- Improved frames of pages changing the styles of positioned boxes by script, e.g. a game moving its sprites: changes of the same attribute between two frames are taken as one (more than 256 changes dropped the update of the frame, so every frame was laid out as a whole); a box moved by its inset (`left`, `top`, `right` or `bottom` in pixels, with the opposite one `auto`) is moved in the frame instead of laid out again with its content; a style attribute change that only paints differently (e.g. the `background-position` of a sprite) is painted again without a layout, also when the box moved at the same time; a box moved again is moved without computing its style when only its insets changed in its style attribute; the map of what can be hit is updated for the moved boxes only (a box that transitions or animates is laid out as before)
- Improved drawing images into a canvas at a fractional position, scaled or rotated: edges are anti-aliased only if the image is rotated or skewed, and images are smoothed bilinearly (the default `imageSmoothingQuality` of `low`), as in Chromium
- Improved frames after a script removes an absolutely positioned box: its commands are taken out of the frame instead of its parent being laid out again, unless a selector matching by siblings or children (e.g. `:nth-child`, `:last-child`, `+`, `~` or `:empty`) may match the parent or one of its children
- Improved painting a canvas into the page by sampling its snapshot bilinearly, without mipmaps built again for each frame
- Fixed a box removed after a change of its style attribute making the next frame a full layout
- Fixed a box shown in a box moved by its inset in the same frame (e.g. a figure appearing while the world of a game scrolls) being painted at its former position, as the moved box did not include it in its translation
- Fixed a box removed while its parent is laid out again (e.g. a coin of Mario 5 disappearing right after another one appeared) leaving the frame with the wrong commands
- Fixed a positioned box in a box that is no stacking context (e.g. a tooltip in a floated button, or in an inline-block or a block) being painted below the blocks after that box: it paints with the positioned boxes of the flow around it (CSS 2.2 Appendix E), unless a box around it clips it or applies an effect (e.g. opacity or a transform); its boxes without a stacking context are laid out with their enclosing box in frames since
- Fixed a box removed while its parent is laid out again leaving the frame with the wrong commands
- Fixed a positioned box in a box that is no stacking context being painted below the blocks after that box: it paints with the positioned boxes of the flow around it (CSS 2.2 Appendix E), unless a box around it clips it or applies an effect (e.g. opacity or a transform); its boxes without a stacking context are laid out with their enclosing box in frames since
- Fixed a canvas flickering while a script draws into it (e.g. a game clearing and painting its canvas in every step): a frame showed the bitmap as it was when the frame was rasterized, possibly half drawn, instead of as it was when the frame was prepared, between the tasks of the event loop
- Fixed `arc()` and `ellipse()` drawing nothing for a full turn against their direction (e.g. `arc(x, y, r, 0, 2 * Math.PI, true)`), which is the whole circle
- Fixed a float being painted and hit below a later in-flow block overlapping it (e.g. floated buttons followed by a block starting at the same height could not be clicked): floats paint above the in-flow blocks of their flow and below its positioned boxes (CSS 2.2 Appendix E)
Expand Down
28 changes: 23 additions & 5 deletions src/AngleSharp.Renderer.Tests/AnimatedImageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,38 @@ public sealed class AnimatedImageTests
[Fact]
public async Task AnimatedGifShowsItsFramesInTurn()
{
// red for 100 ms, then blue for 2 s, forever
var gif = CreateGif(loop: true, (0, 10), (1, 200));
// red for 100 ms, then blue for 2 s
var gif = CreateGif(loop: false, (0, 10), (1, 200));
var harness = await OpenAsync($"""<img src="data:image/gif;base64,{Convert.ToBase64String(gif)}" style="width:40px;height:40px">""");

var frame = harness.PrepareFrame();
var first = PixelAt(frame.Rasterize(), 20, 20);
var remaining = frame.GetTimeToNextImageFrame();
await Task.Delay(remaining!.Value + TimeSpan.FromMilliseconds(20));
var second = PixelAt(frame.Rasterize(), 20, 20);

Assert.NotNull(remaining);
Assert.InRange(remaining.Value, TimeSpan.Zero, TimeSpan.FromMilliseconds(100));
Assert.Equal(((byte)255, (byte)0), first);

var second = first;
while (second == first)
{
var timeToNext = frame.GetTimeToNextImageFrame();
if (timeToNext is null)
{
second = PixelAt(frame.Rasterize(), 20, 20);
break;
}

await Task.Delay(timeToNext.Value);
second = PixelAt(frame.Rasterize(), 20, 20);
}

Assert.Equal(((byte)0, (byte)255), second);
Assert.InRange(frame.GetTimeToNextImageFrame()!.Value, TimeSpan.Zero, TimeSpan.FromSeconds(2));

if (frame.GetTimeToNextImageFrame() is { } nextFrameDelay)
{
Assert.InRange(nextFrameDelay, TimeSpan.Zero, TimeSpan.FromSeconds(2));
}
}

[Fact]
Expand Down
3 changes: 2 additions & 1 deletion src/AngleSharp.Renderer.Tests/CaseRenderingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public async Task RenderCasesAtDesktopViewport()
{
var projectRoot = FindProjectRoot();
var casesPath = Path.Combine(projectRoot, "cases");
var outputPath = Path.Combine(projectRoot, "rendered-cases");
var targetFramework = new DirectoryInfo(AppContext.BaseDirectory).Name;
var outputPath = Path.Combine(projectRoot, "rendered-cases", targetFramework);
Directory.CreateDirectory(outputPath);

var caseFiles = Directory.GetFiles(casesPath, "*.html")
Expand Down
Loading