Skip to content

LibWeb: Implement some missing IDL interface members - #10967

Merged
gmta merged 8 commits into
LadybirdBrowser:masterfrom
tcl3:libweb_trivial_idl_gaps
Aug 3, 2026
Merged

LibWeb: Implement some missing IDL interface members#10967
gmta merged 8 commits into
LadybirdBrowser:masterfrom
tcl3:libweb_trivial_idl_gaps

Conversation

@tcl3

@tcl3 tcl3 commented Aug 2, 2026

Copy link
Copy Markdown
Member

This PR adds a smattering of APIs, which are supported by every other engine and were easily implementable.

Found by scouring: https://cxbyte.me/are-we-web-yet.html.

See individual commits for details.

NB: A few of the css-view-transitions WPTs complained when I tried to import them because they were referencing missing scripts. I've put up a fix for that here (web-platform-tests/wpt#61680). I've stripped the missing scripts from the imports here too.

tcl3 added 7 commits August 2, 2026 21:50
The active view transition is already tracked on the document. It is now
reachable from script.
Transition events are already dispatched. They could only be observed
through addEventListener until now.
The attribute behaves identically on both style elements. Its
implementation now lives on the shared style element base. SVG 2
declares the attribute without defining its behavior, so it follows the
HTML `style` element.
The method returns a new, detached `SVGNumber` whose value is zero.
Transition events now carry the `CSSTransition` that produced them.
The attribute reports whether the user agent displayed a cached rendered
state of the entry being traversed to.
The attribute carries the data being inserted for input types that
insert rich content. It is initialized from the event init dictionary.
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds CSS transition animation references, transition handlers, view-transition and history event properties, stylesheet controls, SVG factories, and InputEvent data transfer and target-range support. It also adds Web Platform Tests and IDL harness coverage.

Changes

Web platform API additions

Layer / File(s) Summary
CSS transition event animation support
Libraries/LibWeb/CSS/*, Libraries/LibWeb/DOM/Document.cpp, Libraries/LibWeb/HTML/GlobalEventHandlers.h, Libraries/LibWeb/HTML/AttributeNames.h, Tests/LibWeb/Text/input/wpt-import/css/css-transitions/*, Tests/LibWeb/Text/expected/wpt-import/css/css-transitions/*
TransitionEvent stores and exposes its associated CSSTransition. Transition dispatch passes the animation into event initialization. Transition lifecycle handlers and tests are added.
View and history transition event state
Libraries/LibWeb/DOM/Document.idl, Libraries/LibWeb/HTML/PopStateEvent.*, Tests/LibWeb/Text/input/wpt-import/css/css-view-transitions/*, Tests/LibWeb/Text/input/wpt-import/html/browsers/browsing-the-web/history-traversal/*
Document.activeViewTransition and PopStateEvent.hasUAVisualTransition are exposed and tested across their lifecycle and default states.
Stylesheet and SVG DOM APIs
Libraries/LibWeb/DOM/StyleElementBase.*, Libraries/LibWeb/HTML/HTMLStyleElement.*, Libraries/LibWeb/SVG/*, Tests/LibWeb/Text/input/SVG/*, Tests/LibWeb/Text/expected/SVG/*
Stylesheet disabled accessors move to StyleElementBase. SVGStyleElement.disabled and SVGSVGElement.createSVGNumber() are implemented and tested.
InputEvent data transfer and target ranges
Libraries/LibWeb/UIEvents/InputEvent.*, Tests/LibWeb/Text/input/UIEvents/*, Tests/LibWeb/Text/input/wpt-import/input-events/*, Tests/LibWeb/Text/input/wpt-import/interfaces/input-events.idl, Tests/LibWeb/Text/expected/UIEvents/*, Tests/LibWeb/Text/expected/wpt-import/input-events/*
InputEvent stores, exposes, initializes, and traces nullable DataTransfer values. Input event construction preserves target ranges. IDL harness and browser tests cover the additions.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description explains that the PR adds missing web APIs and notes related WPT import adjustments, which match the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
Tests/LibWeb/Text/input/wpt-import/input-events/idlharness.window.js (1)

10-12: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a behavior test for constructor initialization.

The current harness creates only new InputEvent("foo"). It verifies that dataTransfer exists, but it does not verify that a supplied InputEventInit.dataTransfer is preserved or that the default is null.

Add a LibWeb-owned regression test for both cases. Based on learnings, keep the imported WPT fixture focused on upstream IDL coverage and place the behavior test outside Tests/LibWeb/Text/input/wpt-import/.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Tests/LibWeb/Text/input/wpt-import/input-events/idlharness.window.js` around
lines 10 - 12, Add a separate LibWeb-owned behavior test outside the imported
WPT fixture directory that constructs InputEvent with an InputEventInit
dataTransfer value and asserts it is preserved, then constructs one without
dataTransfer and asserts the property defaults to null. Keep the existing
idl_array setup in input-events/idlharness.window.js limited to upstream IDL
coverage.

Source: Learnings

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Libraries/LibWeb/UIEvents/InputEvent.idl`:
- Around line 19-21: The InputEventInit definition and construction path omit
targetRanges. Add the sequence<StaticRange> targetRanges member with its empty
default to InputEventInit in InputEvent.idl, then update
InputEvent::construct_impl() to read and pass it into the InputEvent constructor
so getTargetRanges() preserves values supplied to new InputEvent().

In `@Tests/LibWeb/Text/expected/wpt-import/css/css-transitions/idlharness.txt`:
- Around line 38-45: Update the imported CSS Transitions IDL definition for
TransitionEvent to include the animation attribute, then regenerate the
corresponding idlharness expected output so it contains the animation attribute
and inherited-property checks; do not edit the generated expected file before
updating the IDL source.

---

Nitpick comments:
In `@Tests/LibWeb/Text/input/wpt-import/input-events/idlharness.window.js`:
- Around line 10-12: Add a separate LibWeb-owned behavior test outside the
imported WPT fixture directory that constructs InputEvent with an InputEventInit
dataTransfer value and asserts it is preserved, then constructs one without
dataTransfer and asserts the property defaults to null. Keep the existing
idl_array setup in input-events/idlharness.window.js limited to upstream IDL
coverage.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1fd32c28-e54d-4668-a9d8-bcb28b340c47

📥 Commits

Reviewing files that changed from the base of the PR and between ea5999e and 52fd414.

📒 Files selected for processing (42)
  • Libraries/LibWeb/CSS/TransitionEvent.cpp
  • Libraries/LibWeb/CSS/TransitionEvent.h
  • Libraries/LibWeb/CSS/TransitionEvent.idl
  • Libraries/LibWeb/DOM/Document.cpp
  • Libraries/LibWeb/DOM/Document.idl
  • Libraries/LibWeb/DOM/StyleElementBase.cpp
  • Libraries/LibWeb/DOM/StyleElementBase.h
  • Libraries/LibWeb/HTML/AttributeNames.h
  • Libraries/LibWeb/HTML/GlobalEventHandlers.h
  • Libraries/LibWeb/HTML/HTMLStyleElement.cpp
  • Libraries/LibWeb/HTML/HTMLStyleElement.h
  • Libraries/LibWeb/HTML/PopStateEvent.cpp
  • Libraries/LibWeb/HTML/PopStateEvent.h
  • Libraries/LibWeb/HTML/PopStateEvent.idl
  • Libraries/LibWeb/SVG/SVGSVGElement.cpp
  • Libraries/LibWeb/SVG/SVGSVGElement.h
  • Libraries/LibWeb/SVG/SVGSVGElement.idl
  • Libraries/LibWeb/SVG/SVGStyleElement.idl
  • Libraries/LibWeb/UIEvents/InputEvent.cpp
  • Libraries/LibWeb/UIEvents/InputEvent.h
  • Libraries/LibWeb/UIEvents/InputEvent.idl
  • Tests/LibWeb/TestConfig.ini
  • Tests/LibWeb/Text/expected/SVG/svg-create-svg-number.txt
  • Tests/LibWeb/Text/expected/SVG/svg-style-element-disabled.txt
  • Tests/LibWeb/Text/expected/wpt-import/css/css-transitions/events-008.txt
  • Tests/LibWeb/Text/expected/wpt-import/css/css-transitions/idlharness.txt
  • Tests/LibWeb/Text/expected/wpt-import/css/css-transitions/transitionevent-interface.txt
  • Tests/LibWeb/Text/expected/wpt-import/css/css-view-transitions/document-active-view-transition.txt
  • Tests/LibWeb/Text/expected/wpt-import/html/browsers/browsing-the-web/history-traversal/PopStateEvent.txt
  • Tests/LibWeb/Text/expected/wpt-import/input-events/idlharness.window.txt
  • Tests/LibWeb/Text/expected/wpt-import/svg/idlharness.window.txt
  • Tests/LibWeb/Text/input/SVG/svg-create-svg-number.html
  • Tests/LibWeb/Text/input/SVG/svg-style-element-disabled.html
  • Tests/LibWeb/Text/input/wpt-import/css/css-transitions/events-008.html
  • Tests/LibWeb/Text/input/wpt-import/css/css-transitions/idlharness.html
  • Tests/LibWeb/Text/input/wpt-import/css/css-transitions/transitionevent-interface.html
  • Tests/LibWeb/Text/input/wpt-import/css/css-view-transitions/document-active-view-transition.html
  • Tests/LibWeb/Text/input/wpt-import/html/browsers/browsing-the-web/history-traversal/PopStateEvent.html
  • Tests/LibWeb/Text/input/wpt-import/input-events/idlharness.window.html
  • Tests/LibWeb/Text/input/wpt-import/input-events/idlharness.window.js
  • Tests/LibWeb/Text/input/wpt-import/interfaces/css-transitions.idl
  • Tests/LibWeb/Text/input/wpt-import/interfaces/input-events.idl
💤 Files with no reviewable changes (2)
  • Libraries/LibWeb/HTML/HTMLStyleElement.cpp
  • Libraries/LibWeb/HTML/HTMLStyleElement.h

Comment thread Libraries/LibWeb/UIEvents/InputEvent.idl
Target ranges given to the `InputEvent` constructor were discarded.
Scripts saw an empty list from `getTargetRanges()`.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
Tests/LibWeb/Text/input/UIEvents/InputEvent-construction-target-ranges.html (1)

5-24: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for InputEventInit.dataTransfer.

This test covers only targetRanges. Add a case with a non-null DataTransfer and verify that event.dataTransfer returns the expected value. If another test already covers this path, confirm that coverage instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Tests/LibWeb/Text/input/UIEvents/InputEvent-construction-target-ranges.html`
around lines 5 - 24, Extend the existing InputEvent construction test around the
targetRanges case to create a non-null DataTransfer, pass it through
InputEventInit.dataTransfer, and verify event.dataTransfer returns that same
object. If existing coverage already validates this behavior, confirm it instead
of adding duplicate coverage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@Tests/LibWeb/Text/input/UIEvents/InputEvent-construction-target-ranges.html`:
- Around line 5-24: Extend the existing InputEvent construction test around the
targetRanges case to create a non-null DataTransfer, pass it through
InputEventInit.dataTransfer, and verify event.dataTransfer returns that same
object. If existing coverage already validates this behavior, confirm it instead
of adding duplicate coverage.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 098982d6-b463-43b4-bcf8-4a2969e5c326

📥 Commits

Reviewing files that changed from the base of the PR and between 52fd414 and 87bb628.

📒 Files selected for processing (4)
  • Libraries/LibWeb/UIEvents/InputEvent.cpp
  • Libraries/LibWeb/UIEvents/InputEvent.idl
  • Tests/LibWeb/Text/expected/UIEvents/InputEvent-construction-target-ranges.txt
  • Tests/LibWeb/Text/input/UIEvents/InputEvent-construction-target-ranges.html
🚧 Files skipped from review as they are similar to previous changes (1)
  • Libraries/LibWeb/UIEvents/InputEvent.idl

@gmta
gmta merged commit 8e042b1 into LadybirdBrowser:master Aug 3, 2026
15 checks passed
@tcl3
tcl3 deleted the libweb_trivial_idl_gaps branch August 3, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants