Commit Graph

11 Commits

Author SHA1 Message Date
Shannon Booth
5adfd1c43a LibWeb/Bindings: Generate struct definitions from IDL dictionaries
Previously we were inconsistent by generating code for enum definitions
but not generating code for dictionaries. With future changes to the
IDL generator to expose helpers to convert to and from IDL values
this produced circular depdendencies. To solve this problem, also
generate the dictionary definitions in bindings headers.
2026-05-09 10:49:49 +02:00
Callum Law
40ebd94ca9 LibWeb: Update stale ScrollTimelines after layout
This is required by the spec and fixes a flaky test
2026-05-08 22:59:16 +02:00
Callum Law
ad6aa88723 LibWeb: Make ScrollTimeline scroll offset data computation reusable
We will use this in a future commit to check whether scroll timelines
are stale
2026-05-08 22:59:16 +02:00
Callum Law
468a372b66 LibWeb: Only set time once in ScrollTimeline::update_current_time
A later commit will change `set_current_time` from being a simple
setter to handling animation update/event dispatch which we only want to
call once per update
2026-05-08 22:59:16 +02:00
Callum Law
5e3028013c LibWeb: Store AnimationTimeline associated document as Ref
We always had an associated document for the spec defined timelines
(i.e. `DocumentTimeline` and `ScrollTimeline`) but not for the ad-hoc
`InternalAnimationTimeline` so lets store one for that as well and use a
`Ref` instead of a `Ptr`.

This requires `convert_a_timeline_time_to_an_origin_relative_time` to be
implemented for `InternalAnimationTimeline` since it can now be called
where it previously wasn't due to the absence of a document - we just
return an empty optional since it's not used anywhere.
2026-05-08 22:59:16 +02:00
Aliaksandr Kalenik
568b7ce7ea LibWeb: Make Paintable tree ref-counted
The Paintable tree and its supplemental painting data structures were
GC allocated because that was the easiest way to manage it and avoid
leaks introduced by ref cycles. This included the Paintable subclasses
themselves plus StackingContext, ChromeWidget, Scrollbar, ResizeHandle,
and scroll-frame state.

We are now trying to reduce GC allocation churn on layout and painting
updates, so keeping this short-lived rendering tree outside the JS heap
is a better fit. Move Paintable to RefCountedTreeNode, make painting
helpers ref-counted or weakly reference Paintables, and update the
layout and event-handler call sites to use RefPtr/WeakPtr ownership.
2026-05-07 15:03:44 +02:00
Andreas Kling
a146225331 LibWeb: Use unsafe layout/paintable accessors where appropriate
Add unsafe_layout_node(), unsafe_paintable(), and unsafe_paintable_box()
accessors that skip layout-staleness verification. These are for use in
contexts where accessing layout/paintable data is legitimate despite
layout not being up to date: tree construction, style recalculation,
painting, animation interpolation, DOM mutation, and invalidation
propagation.

Also add wrapper APIs on Node to centralize common patterns:
- set_needs_display() wraps if (unsafe_paintable()) ...set_needs_display
- set_needs_paint_only_properties_update() wraps similar
- set_needs_layout_update() wraps if (unsafe_layout_node()) ...

And add Document::layout_is_up_to_date() which checks whether layout
tree update flags are all clear.
2026-02-26 21:09:08 +01:00
Aliaksandr Kalenik
901cc28272 LibWeb: Reduce recompilation impact of DOM/Document.h
Remove 11 heavy includes from Document.h that were only needed for
pointer/reference types (already forward-declared in Forward.h), and
extract the nested ViewportClient interface to a standalone header.

This reduces Document.h's recompilation cascade from ~1228 files to
~717 files (42% reduction). Headers like BrowsingContext.h that were
previously transitively included see even larger improvements (from
~1228 down to ~73 dependents).
2026-02-11 20:02:28 +01:00
Andreas Kling
d92b741128 LibWeb: Fix GCC build in ScrollTimeline::source() 2026-02-11 12:30:04 +01:00
Callum Law
379db7a42c LibWeb: Support animation-timeline scroll() value 2026-02-11 10:49:34 +01:00
Callum Law
23442708d6 LibWeb: Implement ScrollTimeline
Functionality in atypical writing mode contexts is currently lacking due
to larger issues around how we handle scrolling in these contexts.
2026-02-05 16:45:34 +01:00