Commit graph

38 commits

Author SHA1 Message Date
Andrew Kaster
076f636667 Meta: Enable Gtk UI on macOS 2026-06-09 17:10:31 +02:00
Shannon Booth
dba62aefc0 LibWeb/Bindings: Port IDL bindings generator to Python
Replace the Lagom C++ bindings generator invocation with the new Python
generator under Meta/Generators/libweb_bindings.

Fold the exposed-interface generation into the same generator entry
point, and keep generated overload metadata using the existing LibIDL
types for now.
2026-06-08 01:11:40 +02:00
sideshowbarker
270024aaad Meta: Retry the vcpkg bootstrap to ride out transient download failures
Problem: CI jobs were very often failing at the install-vcpkg step,
after the prebuilt-vcpkg-tool download fails with an HTTP 504.

Cause: The bootstrap-vcpkg.sh script’s curl call retries span only a few
seconds — too soon to get past an outage — and the build_vcpkg.py script
runs with no retry at all. So one transient 504 hard-fails everything.

Fix: Do the bootstrap in build_vcpkg.py with retries and some backoff —
so one transient download failure no longer breaks the entire build.
2026-06-07 11:34:17 +02:00
Shannon Booth
2e09af3116 Meta: Parse WebIDL declarations into structured objects
Teach the python WebIDL parser to retain typed declarations instead of
keeping or skipping raw text.
2026-06-06 19:16:52 +02:00
Shannon Booth
b09d8966a5 Meta: Handle escaping more cpp types
Handle all which are needed for IDL code generation.
2026-06-06 19:16:52 +02:00
Sam Atkins
693517daa0 LibWeb: Resolve container-relative length units
Add cqw/cqh/cqi/cqb/cqmin/cqmax to the unit tables and generated
helpers, then thread them through the shared length resolution path.

Length::ResolutionContext now carries the subject element and whether
its inline axis is horizontal. Container units need that extra context:
the nearest eligible query container is selected from the subject
element's flat-tree ancestors, and cqi/cqb/cqmin/cqmax map logical axes
through the subject's writing mode before resolving to a physical width
or height.

Teach Length to resolve each axis against the selected container's
content box, fall back to viewport lengths when no eligible container
exists, and mark size-container dependencies so post-layout
recomputation can happen when layout is not up to date.

Also expose the new units through Typed OM, reject them for
computationally independent `@property` initial values, and add focused
font-size coverage.
2026-06-01 08:27:17 +01:00
Shannon Booth
265559c5b5 Meta: Add limited parsing for WebIDL dictionaries
For now, this is limited as we do not parse the contents of the
dictionary and only extract the dictionary names.
2026-05-15 17:52:52 +01:00
Zaggy1024
c0609f4ee1 Meta: Clarify that webidl_parser.py's raise_parse_error() cannot return
This allows functions to skip returning/asserting after calling it.
2026-05-13 08:13:51 -05:00
Zaggy1024
d89e9bb44d Meta: Only kill child process in run_command() if it is bound
Scoping here was backwards, causing 'process' to be possibly used while
unbound.
2026-05-13 08:13:51 -05:00
Zaggy1024
4959bd25e0 Meta: Use Optional instead of the union operator in css_dimensions.py
Fixes a build error on macOS. Union operators aren't supported in
Python 3.9.
2026-05-13 08:13:51 -05:00
Callum Law
099c3fa590 Meta: Handle juxtaposition in CSS value parsing code generation 2026-05-13 11:26:20 +01:00
Callum Law
30e58a48c6 Meta: Handle optionals in CSS value parsing code generation 2026-05-13 11:26:20 +01:00
Callum Law
6361dcaae5 Meta: Handle groups in CSS value parsing code generation
We don't yet support required groups so for the moment these just fall
back to generating the parsing code of their child
2026-05-13 11:26:20 +01:00
Callum Law
b39bcaf1e4 Meta: Optimize keyword alternatives parsing 2026-05-13 11:00:07 +01:00
Callum Law
f578d95be0 LibWeb: Support multiple keywords in parse_specific_keyword_value
This will allow us to combine multiple calls into one and avoid
repeatedly parsing and then discarding `KeywordStyleValue`s
2026-05-13 11:00:07 +01:00
Callum Law
a9d2b1dde6 Meta: Read dimensions from Units.json in CSS grammar parser
Avoids us having to maintain a separate hardcoded list.

This does mean we don't support parsing of `decibel` but it's not used
anywhere yet and will be supported automatically when added to
Units.json
2026-05-13 11:00:07 +01:00
Callum Law
c96e8f15e5 Meta: Make CSS dimension loading reusable
Aside from the existing users this will also be used within the
CSSGrammar parser
2026-05-13 11:00:07 +01:00
Shannon Booth
4b9f6450bd LibWeb: Treat support IDLs like normal bindings inputs
Allow the WebIDL parser to accept files without a top-level interface,
and have the exposed-interface generator skip those modules.

With that in place, register support IDLs through
libweb_js_bindings() as well, including generated CSS IDLs from the
build directory, and remove the separate support-idl plumbing.

This is enabled now that the IDL generator rules have been simplified
so that every IDL file produces a corresponding header and cpp file.
2026-05-10 20:11:46 +02:00
Andreas Kling
02f504f3ce LibWeb/Bindings: Share simple generated interface objects
Many generated Web IDL prototype and constructor objects have no
per-interface storage and no custom virtual behavior. They only differ
by metadata such as their exposed name, parent interface, constructor
hook, and generated initialization functions.

Add shared InterfacePrototypeObject and InterfaceConstructor classes for
these simple interfaces. The generators now emit per-interface metadata
and static helper functions instead of distinct GC::Cell subclasses when
the interface does not need special object behavior.

This avoids creating separate type-isolated GC allocators for hundreds
of otherwise empty prototype and constructor classes, while preserving
constructors, unforgeable attributes, IDL conversions, and immutable
prototypes in the global prototype chain.
2026-05-09 14:36:18 +02:00
Zaggy1024
8f7a4754fe Meta: Change the Token.component_value() check to 'is not None'
Python 3.9 doesn't support isinstance of union types.
2026-04-30 09:32:22 +02:00
Zaggy1024
c5060fb6cf Meta: Forward reference the return type for Token static constructors
Self isn't supported in python 3.9.
2026-04-30 09:32:22 +02:00
Zaggy1024
cce3b03532 Meta: Don't use union operator syntax in generators
These aren't supported in Python 3.9.
2026-04-30 09:32:22 +02:00
Zaggy1024
ccaaefbf27 LibWeb+Meta: Don't require the custom ident blacklist parameter
With a default parameter, we can avoid having to store None for the
blacklist when it's not applicable.
2026-04-30 09:32:22 +02:00
Zaggy1024
d253d53b29 Meta: Add typing to some lists in CSSGrammar
This makes Pylance happier.
2026-04-30 09:32:22 +02:00
Zaggy1024
0b96209a1e Meta: Avoid match statements in CSS generators 2026-04-30 09:32:22 +02:00
Sam Atkins
39c997b102 Meta: Use consume_specific in Python CSS Grammar tokenizer
A stealth merge conflict meant consume_specific_string() and
consume_specific_char() got combined into a single method and no longer
exist.
2026-04-29 13:23:53 +01:00
Shannon Booth
6fc06afc81 Meta: Add a Python WebIDL parser
Add a simple python3 WebIDL parser for the subset of IDL we need for
code generation.

For validation, the parser structure is intentionally very close to the
existing C++ parser, so the control flow and parsing mechanics stay easy
to compare while we continue porting IDL-related generators.

This parser currently focuses on the constructs needed by
GenerateWindowOrWorkerInterfaces, but is meant to serve as a base for
future IDL generator ports as well.
2026-04-29 12:24:00 +01:00
Shannon Booth
af5290b41b Meta: Extend the python lexer with some more APIs
Add a few GenericLexer-style helpers to lexer.py:

* tell()
* ignore()
* next_is()
2026-04-29 12:24:00 +01:00
Shannon Booth
4a9deb3afa Meta: Combine Lexer's consume_specific_char and consume_specific_string
consume_specific_string() already handles 1-character strings correctly.
2026-04-29 12:24:00 +01:00
Callum Law
0d75d66f2e Meta: Handle bracketed range notations in CSS value grammar 2026-04-29 11:42:57 +01:00
Callum Law
521beb5a96 Meta: Implement code generation for CSS keyword values 2026-04-29 11:42:57 +01:00
Callum Law
dd9f0b8838 Meta: Implement code generation for CSS custom ident value blacklists 2026-04-29 11:42:57 +01:00
Callum Law
09418e8c77 Meta: Implement CSS value type parsing code generation
To do this we parse the grammar supplied in `ValueTypes.json` and
generate the appropriate parsing function in `CSS::Parser::Parser`

Only a small subset of the CSS grammar (i.e. types `<foo>` and
alternatives `<foo> | <bar>`) is implemented so far, it will be
expanded in later commits.
2026-04-29 11:42:57 +01:00
Sam Atkins
2ed3868012 Meta: Replace GenerateCSSPropertyID with a python generator
We don't match the C++ output byte-for-byte here, because the key
iteration order is different. So I've taken the opportunity to tidy up
some whitespace too.
2026-04-25 12:02:49 +02:00
Sam Atkins
d3d124b1d8 Meta: Replace GenerateCSSNumericFactoryMethods with a python generator
Adds a new `invoke_py_idl_generator` CMake helper for python scripts
that also produce an IDL file.
2026-04-25 12:02:49 +02:00
Sam Atkins
4de5f3056b Meta: Replace GenerateCSSEnums with a python generator 2026-04-25 12:02:49 +02:00
Timothy Flynn
f5abfedce7 Meta: Add clang-22 to the list of clang candidate compilers
We can build with clang-22 on Linux as of:
309ca11236
2026-04-24 08:25:57 -04:00
Timothy Flynn
ce7b69ff31 Meta: Move utility scripts to a subfolder
The idea is that scripts directly under Meta are meant to be run by
people. Scripts that are only imported or run by other scripts are
moved to a subdirectory.
2026-04-23 12:36:08 -04:00