ladybird/Libraries/LibWeb/CSS/StyleValues
Callum Law 8ebdaeab69 LibWeb: Transfer animation ownership to AnimatedBitmapDecodedImageData
Previously animation ownership was a messy split between
`AnimatedBitmapDecodedImageData` and the consumers (i.e.
`ImageStyleValueResource`, `HTMLImageElement`, and `SVGImageElement`)
with `AnimatedBitmapDecodedImageData` owning the frames and a current
frame index, and the consumers owning the rest of the state (e.g. loop
count, timers to drive the animation forward, their own current index).

This had a couple of main issues:
 - While `AnimatedDecodedImageData` partially synchronized animations by
   dropping unexpected advancement notifications, this didn't apply to
   other animation state which meant, for instance, that a later started
   consumer could drive the animation of an earlier one past the max
   loop count (albeit without invalidating the earlier consumer).
 - Multiple consumers didn't share frame timings, meaning animations
   could be up to a full frame out of sync visually.
 - Animations were paused depending on whether there were any consumers,
   this is different to the behavior in other browsers (where they
   continue regardless of whether there are any consumers).
 - It was an overgeneralization of how animations need to work - only
   `AnimatedBitmapDecodedImageData` works with an indexed frame model,
   with animated SVGs (although not yet implemented) relying on their
   internal event loop to be driven forward.

Given the above the new approach implemented in this commit is:
 - The API for `DecodedImageData` is animation system agnostic, only
   exposing `default_frame`, `current_frame`, and `restart_animation`
   methods not reliant on providing a specific frame index.
 - `AnimatedBitmapDecodedImageData` owns its own timer, loop count,
   etc. The animation starts when the first consumer registers and ends
   when the document is hidden or becomes inactive (or completes in the
   case of finite animations).
 - Consumers are invalidated by `AnimatedBitmapDecodedImageData` when
   required.

Tests have been added for:
 - Animations being paused when the document becomes inactive and
   restarted when it becomes active again.
 - Frame timings being synchronized across consumers.
 - Restarts triggered by `HTMLImageElement` applying to all consumers.
 - Processing ending once a non-infinite animation plays to completion.

The tests to ensure animations are cancelled when consumers are removed
(e.g. `animated-background-image-timer-stops-when-hidden.html`) have
been updated to assert the inverse since animation state is now per
resource not per consumer.
2026-06-18 10:44:25 +02:00
..
AbstractImageStyleValue.cpp LibWeb: Store custom property names as UTF-16 2026-06-09 11:48:02 +02:00
AbstractImageStyleValue.h LibWeb: Store custom property names as UTF-16 2026-06-09 11:48:02 +02:00
AbstractNonMathCalcFunctionStyleValue.h LibWeb: Don't pass unnecessary PropertyComputationDependencies struct 2025-10-22 00:01:30 +02:00
AnchorSizeStyleValue.cpp LibWeb: Reduce recompilation from editing Enums.json 2026-02-19 11:27:06 +00:00
AnchorSizeStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
AnchorStyleValue.cpp LibWeb: Pass StringBuilder around during StyleValue serialization 2026-01-09 10:00:58 +01:00
AnchorStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
AngleStyleValue.cpp LibWeb: Use StringBuilder when serializing more CSS types 2026-01-09 10:00:58 +01:00
AngleStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
BackgroundSizeStyleValue.cpp LibWeb: Pass StringBuilder around during StyleValue serialization 2026-01-09 10:00:58 +01:00
BackgroundSizeStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
BasicShapeStyleValue.cpp LibWeb: Support border-radius in clip-path: inset() 2026-03-21 02:44:49 +00:00
BasicShapeStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
BorderImageSliceStyleValue.cpp LibWeb: Pass StringBuilder around during StyleValue serialization 2026-01-09 10:00:58 +01:00
BorderImageSliceStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
BorderRadiusRectStyleValue.cpp LibWeb: Pass StringBuilder around during StyleValue serialization 2026-01-09 10:00:58 +01:00
BorderRadiusRectStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
BorderRadiusStyleValue.cpp LibWeb: Pass StringBuilder around during StyleValue serialization 2026-01-09 10:00:58 +01:00
BorderRadiusStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
CalculatedStyleValue.cpp LibWeb: Store custom property names as UTF-16 2026-06-09 11:48:02 +02:00
CalculatedStyleValue.h LibWeb: Store custom property names as UTF-16 2026-06-09 11:48:02 +02:00
ColorFunctionStyleValue.cpp LibWeb: Drop unnecessary ColorFunctionStyleValue constructor 2026-04-22 11:52:56 +01:00
ColorFunctionStyleValue.h LibWeb: Drop unnecessary ColorFunctionStyleValue constructor 2026-04-22 11:52:56 +01:00
ColorInterpolationMethodStyleValue.cpp LibWeb: Add a generic <color-interpolation-method> parsing method 2026-03-18 13:21:57 +00:00
ColorInterpolationMethodStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
ColorMixStyleValue.cpp LibWeb: Remove libweb-* colors 2026-06-05 12:59:00 +01:00
ColorMixStyleValue.h LibWeb: Normalize color-mix() percentages at resolution time 2026-03-31 21:02:57 +02:00
ColorSchemeStyleValue.cpp LibWeb: Pass StringBuilder around during StyleValue serialization 2026-01-09 10:00:58 +01:00
ColorSchemeStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
ColorStyleValue.cpp LibWeb: Route rgb()/rgba() through unified ColorFunctionStyleValue 2026-04-22 11:52:56 +01:00
ColorStyleValue.h LibWeb: Remove LightDark and ColorMix from the ColorType enum 2026-04-22 11:52:56 +01:00
ComputationContext.h LibWeb: Resolve container-relative length units 2026-06-01 08:27:17 +01:00
ConicGradientStyleValue.cpp LibWeb: Move CSS image loading state to Document 2026-06-06 23:29:48 +02:00
ConicGradientStyleValue.h LibWeb: Move CSS image loading state to Document 2026-06-06 23:29:48 +02:00
ContentStyleValue.cpp LibWeb/CSS: Remove redundant has_alt_text() from ContentStyleValue 2026-03-31 13:48:50 +01:00
ContentStyleValue.h LibWeb/CSS: Remove redundant has_alt_text() from ContentStyleValue 2026-03-31 13:48:50 +01:00
ContrastColorStyleValue.cpp LibWeb/CSS: Implement contrast-color() function 2026-06-09 17:23:26 +02:00
ContrastColorStyleValue.h LibWeb/CSS: Implement contrast-color() function 2026-06-09 17:23:26 +02:00
CounterDefinitionsStyleValue.cpp LibWeb: Pass StringBuilder around during StyleValue serialization 2026-01-09 10:00:58 +01:00
CounterDefinitionsStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
CounterStyleStyleValue.cpp LibWeb: Make @counter-style tree-scoped 2026-04-15 11:07:38 +01:00
CounterStyleStyleValue.h LibWeb: Make @counter-style tree-scoped 2026-04-15 11:07:38 +01:00
CounterStyleSystemStyleValue.cpp LibWeb: Reduce recompilation from editing Enums.json 2026-02-19 11:27:06 +00:00
CounterStyleSystemStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
CounterStyleValue.cpp LibWeb: Make @counter-style tree-scoped 2026-04-15 11:07:38 +01:00
CounterStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
CursorStyleValue.cpp LibWeb+WebContent+WebWorker: Drop display list player type selection 2026-06-18 10:25:44 +02:00
CursorStyleValue.h LibWeb: Remove LRC from various resolved value cache keys 2026-05-20 09:47:17 +01:00
CustomIdentStyleValue.cpp LibWeb: Store custom property names as UTF-16 2026-06-09 11:48:02 +02:00
CustomIdentStyleValue.h LibWeb: Store custom property names as UTF-16 2026-06-09 11:48:02 +02:00
DimensionStyleValue.cpp LibWeb: Store custom property names as UTF-16 2026-06-09 11:48:02 +02:00
DimensionStyleValue.h LibWeb: Store custom property names as UTF-16 2026-06-09 11:48:02 +02:00
DisplayStyleValue.cpp LibWeb: Store custom property names as UTF-16 2026-06-09 11:48:02 +02:00
DisplayStyleValue.h LibWeb: Store custom property names as UTF-16 2026-06-09 11:48:02 +02:00
EasingStyleValue.cpp LibWeb: Reduce recompilation from editing Enums.json 2026-02-19 11:27:06 +00:00
EasingStyleValue.h LibWeb: Remove FooOrCalculated classes 2026-03-30 14:05:10 +01:00
EdgeStyleValue.cpp LibWeb: Reduce recompilation from editing Enums.json 2026-02-19 11:27:06 +00:00
EdgeStyleValue.h LibWeb: Track compound inherited style dependencies 2026-05-25 19:18:10 +02:00
EmptyOptionalStyleValue.h Meta: Enable exit-time destructor warnings for libraries 2026-06-04 19:20:49 +02:00
FilterValueListStyleValue.cpp LibWeb: Clamp calculated values in FiltervalueListSV ::absolutized() 2026-04-22 14:24:12 +01:00
FilterValueListStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
FlexStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
FontSourceStyleValue.cpp LibWeb: Reduce recompilation from editing Enums.json 2026-02-19 11:27:06 +00:00
FontSourceStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
FontStyleStyleValue.cpp LibWeb/CSS: Update a couple of font-related comments 2026-02-24 10:05:09 +00:00
FontStyleStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
FrequencyStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
FunctionStyleValue.cpp LibWeb: Add generic FunctionStyleValue 2026-04-24 07:34:54 +01:00
FunctionStyleValue.h LibWeb: Add generic FunctionStyleValue 2026-04-24 07:34:54 +01:00
GridAutoFlowStyleValue.cpp LibWeb: Omit "row" when serializing grid-auto-flow as "dense" 2026-02-09 17:36:12 +01:00
GridAutoFlowStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
GridTemplateAreaStyleValue.cpp LibWeb: Validate grid-template-areas rectangles at parse time 2026-02-21 21:46:34 +01:00
GridTemplateAreaStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
GridTrackPlacementStyleValue.cpp LibWeb: Use StringBuilder when serializing basic grid types 2026-01-09 10:00:58 +01:00
GridTrackPlacementStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
GridTrackSizeListStyleValue.cpp LibWeb: Use StringBuilder when serializing basic grid types 2026-01-09 10:00:58 +01:00
GridTrackSizeListStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
GuaranteedInvalidStyleValue.h Meta: Enable exit-time destructor warnings for libraries 2026-06-04 19:20:49 +02:00
ImageSetStyleValue.cpp LibWeb: Scale image-set() natural size by the selected resolution 2026-06-13 21:27:40 +02:00
ImageSetStyleValue.h LibWeb: Scale image-set() natural size by the selected resolution 2026-06-13 21:27:40 +02:00
ImageStyleValue.cpp LibWeb: Transfer animation ownership to AnimatedBitmapDecodedImageData 2026-06-18 10:44:25 +02:00
ImageStyleValue.h LibWeb: Transfer animation ownership to AnimatedBitmapDecodedImageData 2026-06-18 10:44:25 +02:00
IntegerStyleValue.cpp LibWeb: Take UTF-16 names in Typed OM property maps 2026-06-09 11:48:02 +02:00
IntegerStyleValue.h LibWeb: Store custom property names as UTF-16 2026-06-09 11:48:02 +02:00
KeywordStyleValue.cpp LibWeb: Store custom property names as UTF-16 2026-06-09 11:48:02 +02:00
KeywordStyleValue.h LibWeb: Store custom property names as UTF-16 2026-06-09 11:48:02 +02:00
LengthStyleValue.cpp Meta: Enable exit-time destructor warnings for libraries 2026-06-04 19:20:49 +02:00
LengthStyleValue.h LibWeb: Resolve container-relative length units 2026-06-01 08:27:17 +01:00
LightDarkStyleValue.cpp LibWeb: Remove LightDark and ColorMix from the ColorType enum 2026-04-22 11:52:56 +01:00
LightDarkStyleValue.h LibWeb: Remove LightDark and ColorMix from the ColorType enum 2026-04-22 11:52:56 +01:00
LinearGradientStyleValue.cpp LibWeb: Move CSS image loading state to Document 2026-06-06 23:29:48 +02:00
LinearGradientStyleValue.h LibWeb: Move CSS image loading state to Document 2026-06-06 23:29:48 +02:00
NumberStyleValue.cpp LibWeb: Take UTF-16 names in Typed OM property maps 2026-06-09 11:48:02 +02:00
NumberStyleValue.h LibWeb: Store custom property names as UTF-16 2026-06-09 11:48:02 +02:00
OpacityValueStyleValue.cpp LibWeb: Store custom property names as UTF-16 2026-06-09 11:48:02 +02:00
OpacityValueStyleValue.h LibWeb: Store custom property names as UTF-16 2026-06-09 11:48:02 +02:00
OpenTypeTaggedStyleValue.cpp LibWeb: Pass StringBuilder around during StyleValue serialization 2026-01-09 10:00:58 +01:00
OpenTypeTaggedStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
OverflowClipMarginStyleValue.cpp LibWeb: Add dedicated overflow-clip-margin style value 2026-05-12 14:09:13 +02:00
OverflowClipMarginStyleValue.h LibWeb: Add dedicated overflow-clip-margin style value 2026-05-12 14:09:13 +02:00
PendingSubstitutionStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
PercentageStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
PositionStyleValue.cpp LibWeb: Resolve keywords in basic shape position at compute time 2026-04-15 08:04:02 +02:00
PositionStyleValue.h LibWeb: Resolve keywords in basic shape position at compute time 2026-04-15 08:04:02 +02:00
RadialGradientStyleValue.cpp LibWeb: Move CSS image loading state to Document 2026-06-06 23:29:48 +02:00
RadialGradientStyleValue.h LibWeb: Move CSS image loading state to Document 2026-06-06 23:29:48 +02:00
RadialSizeStyleValue.cpp LibWeb: Reduce recompilation from editing Enums.json 2026-02-19 11:27:06 +00:00
RadialSizeStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
RandomValueSharingStyleValue.cpp LibWeb: Add generic number_from_style_value method 2026-02-16 12:09:23 +00:00
RandomValueSharingStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
RatioStyleValue.cpp LibWeb: Store underlying RatioStyleValue values as StyleValues 2026-03-24 14:00:01 +00:00
RatioStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
RectStyleValue.cpp LibWeb: Support calc() within clip: rect() 2026-03-30 14:05:10 +01:00
RectStyleValue.h LibWeb: Support calc() within clip: rect() 2026-03-30 14:05:10 +01:00
RepeatStyleStyleValue.cpp LibWeb: Reduce recompilation from editing Enums.json 2026-02-19 11:27:06 +00:00
RepeatStyleStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
ResolutionStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
ScrollbarColorStyleValue.cpp LibWeb: Absolutize ScrollbarColorStyleValue color values 2026-03-31 21:02:57 +02:00
ScrollbarColorStyleValue.h LibWeb: Absolutize ScrollbarColorStyleValue color values 2026-03-31 21:02:57 +02:00
ScrollbarGutterStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
ShadowStyleValue.cpp LibWeb: Absolutize color in ShadowStyleValue 2026-03-31 21:02:57 +02:00
ShadowStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
ShorthandStyleValue.cpp LibWeb: Handle var() in grid placement shorthands 2026-06-08 01:04:08 +02:00
ShorthandStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
StringStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
StyleValue.cpp LibWeb/CSS: Implement contrast-color() function 2026-06-09 17:23:26 +02:00
StyleValue.h LibWeb: Allocate layout and painting objects with mimalloc 2026-06-13 19:08:08 +02:00
StyleValueList.cpp LibWeb: Store custom property names as UTF-16 2026-06-09 11:48:02 +02:00
StyleValueList.h LibWeb: Store custom property names as UTF-16 2026-06-09 11:48:02 +02:00
SuperellipseStyleValue.cpp LibWeb: Pass StringBuilder around during StyleValue serialization 2026-01-09 10:00:58 +01:00
SuperellipseStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
TextIndentStyleValue.cpp LibWeb: Pass StringBuilder around during StyleValue serialization 2026-01-09 10:00:58 +01:00
TextIndentStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
TextUnderlinePositionStyleValue.cpp LibWeb: Reduce recompilation from editing Enums.json 2026-02-19 11:27:06 +00:00
TextUnderlinePositionStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
TimeStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
TransformationStyleValue.cpp LibGfx+LibWeb: Use matrix helpers in TransformationStyleValue::to_matrix 2026-06-12 01:10:24 +02:00
TransformationStyleValue.h LibWeb: Make TransformationSV::to_matrix infallible 2026-05-21 17:07:58 +01:00
TreeCountingFunctionStyleValue.cpp LibWeb: Pass StringBuilder around during StyleValue serialization 2026-01-09 10:00:58 +01:00
TreeCountingFunctionStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
TupleStyleValue.cpp LibWeb: Add TupleStyleValue 2026-02-20 22:01:44 +00:00
TupleStyleValue.h LibWeb: Track compound inherited style dependencies 2026-05-25 19:18:10 +02:00
UnicodeRangeStyleValue.cpp LibWeb: Pass StringBuilder around during StyleValue serialization 2026-01-09 10:00:58 +01:00
UnicodeRangeStyleValue.h LibWeb: Add computationally independent check for custom properties 2026-03-26 01:11:39 +00:00
UnresolvedStyleValue.cpp LibWeb: Reduce CSS parser token memory usage 2026-06-13 14:57:52 +02:00
UnresolvedStyleValue.h LibWeb: Store custom property names as UTF-16 2026-06-09 11:48:02 +02:00
URLStyleValue.h LibWeb: Absolutize <paint> fallback colors 2026-05-07 10:07:09 +01:00