Commit graph

69883 commits

Author SHA1 Message Date
Callum Law
80ea865b19 LibWeb: Use correct error for invalid rule in nested insertRule
When we try to insert a disallowed (non-nested) statement into a
CSSGroupingRule we should throw a `HierarchyRequestError` as it being
disallowed is a "constraint specified by CSS". Previously we would rely
on `Parser::is_valid_in_the_current_context` and throw a Syntax error.

There are more constraints to be implemented.
2025-06-23 12:52:40 +01:00
Callum Law
ef7ba02842 LibWeb: Throw error in insertRule when rule violates constraints 2025-06-23 12:52:40 +01:00
Callum Law
6144154e4f LibWeb: Ensure valid placement of @import and @namespace rules
These rules should appear before all other rules (excluding @layer
statements and @charset) with @import appearing first.
2025-06-23 12:52:40 +01:00
Glenn Skrzypczak
6b84cd8d11 LibWeb/HTML: Correctly set base elements frozen base url
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This commit implements the fallback to the documents fallback base url
if the href of the first base element is a data or javascript url.

Additionally the frozen base url is set, if a base element becomes the
first base element with an href content attribute because the previous
one got removed.
2025-06-23 18:56:42 +12:00
Aliaksandr Kalenik
4ed9f6fcc0 LibWeb: Collapse auto-fit tracks in middle of tracks definition [GFC]
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
`collapse_auto_fit_tracks_if_needed()` had a check that does collapsing
only if auto-fit is used like
`grid-template-columns: repeat(auto-fit, 1px);`, and it didn't work for
valid cases when `repeat(auto-fit)` is placed in the middle of
definition like `grid-template-columns: 1px repeat(auto-fit, 1px) 1px;`.
2025-06-23 02:29:45 +02:00
Aliaksandr Kalenik
c333d0876c LibWeb: Simplify resolve_definite_track_size() [GFC] 2025-06-23 02:29:45 +02:00
Aliaksandr Kalenik
b315e80142 LibWeb: Don't use get_free_space() to count auto-fill/fit tracks [GFC]
Spec says that definite grid container size should be used as free space
so there's no need to use `get_free_space()` that does iteration over
tracks and subtracts definite sizes from available space.
2025-06-23 02:29:45 +02:00
Tim Ledbetter
ea29877385 Meta: Add --force option to WPT import script to update existing tests 2025-06-22 23:53:14 +02:00
Tim Ledbetter
689dff3ee8 Tests: Synchronize imported tests with the WPT repository 2025-06-22 23:51:34 +02:00
Tim Ledbetter
11e5cd5048 Meta: Don't lint imported WPT crash tests with prettier 2025-06-22 23:51:34 +02:00
Andrew Kaster
ca293af184 AK: Propagate delayload linker option for dbghelp.dll
When building a static liblagom-ak.a, the delayload link option gets
dropped on the floor if it's a PRIVATE link option. Use an interface
one instead.

This fixes the TestDelayLoadWindows unit test in static windows
builds.
2025-06-22 13:33:33 -06:00
Andrew Kaster
5783caf68e CMake: Add windows vcpkg triplet files to minimize port builds
Now we won't be building both debug and release for all ports when
using a release, distribution, or sanitizer preset.

Eventually we can use this to build all our ports with clang-cl.exe.
That doesn't work at all out of the box, and needs a bunch of extra
legwork. Likely legwork for every port we build.
2025-06-22 13:33:33 -06:00
Andrew Kaster
ffd946d47d CMake: Use cmake_path to check if vcpkg triplets are ours
This makes the check work with possibly-normalized windows paths
2025-06-22 13:33:33 -06:00
Andrew Kaster
b4cc34d0ae CMake: Prepend space to VCPKG_{C,CXX}_FLAGS in icu port overlay
When updating these variables, the appender is responsible for the
preceeding space. Otherwise, flags get jammed together.
2025-06-22 13:33:33 -06:00
Aliaksandr Kalenik
6ec6e755b2 LibWeb: Merge consecutive grid lines in GridTrackSizeList
Fixes a bug where consecutively defined grid lines were not merged
during serialization.
2025-06-22 21:15:40 +02:00
Jelle Raaijmakers
1be79a2b7b CI: Move nightly Windows build to nightly-lagom
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Since lagom-template supports Windows builds now, we no longer need a
separate nightly-windows workflow.
2025-06-22 12:47:28 +02:00
Jelle Raaijmakers
60ced8197e CI: Move Windows CI to a separate workflow
Having the pull_request 'labeled' event trigger the main CI is much too
impactful, since it cancels running jobs and does not start anything if
the label is anything else than 'windows'. Let's go with a different
approach and put the Windows CI job in a separate workflow.

How this works:

  * Jobs are only run if the 'windows' label is present on the PR.
  * If a PR is opened or updated, existing jobs are canceled.
  * If a PR is (un)labeled, existing jobs are only canceled if the label
    was 'windows'. Other labels cause the job to be rescheduled.

As far as I can see, there's no way to prevent the job from being
rescheduled when labels other than 'windows' are being added or removed.
However, by not canceling the existing Windows job, we can try to create
a cache so the next run will be much quicker.
2025-06-22 12:47:28 +02:00
Jelle Raaijmakers
c6d848b100 CI: Disable the Windows CI job by using a boolean exclusion
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
CI / Windows, x86_64, Windows_Sanitizer_CI, ClangCL (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Each matrix item now defines whether it is enabled, and if not, the job
conditionally disables itself. Apparantly we cannot use expressions in
`matrix.exclude`, but it should work in the items' definitions.

This has the added benefit that this makes the job show up as "skipped",
which could serve as a hint that it could be run on a PR.
2025-06-22 10:35:11 +02:00
Jelle Raaijmakers
b9d630edbc CI: Trigger Windows build on PR label 'windows'
Our CI matrix now includes Windows if the 'windows' label is added to
the PR. The job still takes too long to include it for every PR, but it
is certainly useful to have it run on Windows-specific PRs and PRs that
might break Windows builds.
2025-06-22 09:17:11 +02:00
Jelle Raaijmakers
433bbcfe19 CI: Make lagom-template.yml work for Windows builds 2025-06-22 09:17:11 +02:00
Jelle Raaijmakers
8493f74be1 CI: Remove PR-specific step from nightly Windows build 2025-06-22 09:17:11 +02:00
Jelle Raaijmakers
d73d768c12 AK: Define tzname for Windows in Time.cpp
Unbreaks the Windows build.

Co-authored-by: R-Goc <ryszardgoc@gmail.com>
2025-06-22 09:17:11 +02:00
Psychpsyo
3ab14f5595 Meta: Enforce doctypes on layout tests
Some checks failed
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Build Dev Container Image / build (push) Has been cancelled
2025-06-21 22:58:01 +02:00
Aliaksandr Kalenik
e6dabdcebe LibWeb: Serialize grid line names in GridFormattingContext
`getComputedStyle()` for grid tracks returns style value produced during
layout. This is needed to return resolved track sizes values which are
thrown away after layout is done. Now GFC produces more correct style
value by not ignoring grid line names.
2025-06-21 22:07:08 +02:00
Aliaksandr Kalenik
af602b2555 LibWeb: Align CSS Grid properties parsing with the specification
Reimplements `grid`, `grid-template`, `grid-template-rows`, and
`grid-template-columns` in a way that uses a separate function for each
grammar rule defined in the specification. This change results in many
additional passing tests from the already imported WPT suite. Most of
the remaining test failures are related to incorrect serialization of
grid properties.
2025-06-21 22:07:08 +02:00
Aliaksandr Kalenik
7b077595c3 Tests: Reimport css/css-grid/parsing/grid-template-columns-computed.html
Sync this test with upstream WPT where they added a new subtest in this
file.
2025-06-21 22:07:08 +02:00
Philipp Dreher
c414f0c43e Meta: Switch to different source for pre-commit feature in dev-container 2025-06-21 20:18:23 +02:00
Tim Ledbetter
dede92aa78 Tests: Update WPT testharness.js to the most recent version
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This ensures that our test output looks the same as that shown in the
WPT runner.
2025-06-21 14:58:02 +02:00
Psychpsyo
c0e44820e9 Tests: Add doctypes to remaining test cases 2025-06-21 14:09:47 +02:00
Callum Law
d7036daa89 LibWeb: Disallow trailing tokens in @supports(<declaration>) 2025-06-21 11:49:43 +01:00
Jelle Raaijmakers
22bda8e5e2 LibWeb: Stub Geolocation API
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
2025-06-21 10:00:29 +02:00
Jelle Raaijmakers
f3c1dfb2f1 LibWeb: Import geolocation/idlharness.https.window.html WPT test 2025-06-21 10:00:29 +02:00
Jelle Raaijmakers
63fd4cf9e4 LibWeb: Add the EpochTimestamp IDL typedef 2025-06-21 10:00:29 +02:00
Jelle Raaijmakers
8f3fe0c39e LibWeb: Support nullable attributes in generated toJSON()
Any optional or nullable attribute will end up in an `if/else` branch
when we collect the attribute values, and this is inherently
incompatibly with an `auto {attr}_wrapped = ...` expression. Define the
variable as an `JS::Value` before generating the wrap statement so we
can properly support `toJSON()` for an attribute like:

  readonly attribute double? altitude;
2025-06-21 10:00:29 +02:00
Jelle Raaijmakers
30efcd0d00 LibWeb: Prevent time-traveling leading inline metrics
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
In `InlineLevelIterator`, whenever we call `skip_to_next()` and enter a
node with box model metrics, we could potentially accumulate leading and
trailing metrics. This lead to a weird situation where an element with
`display: inline-block` could adopt the leading metrics of an inline
element that follows it, since we perform the call to
`add_extra_box_model_metrics_to_item()` too late.

Move `skip_to_next()` down so it no longer interferes with the `Item`
we're creating.

The test expectation for
`atomic-inline-with-percentage-vertical-align.html` is updated, although
neither the old nor new results are 100% accurate since either box jumps
one pixel to the right.
2025-06-20 19:59:32 +02:00
Jelle Raaijmakers
de24bc5d26 Meta: Update CA certificates to version 2025-05-20
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
2025-06-20 07:11:44 -04:00
Tim Ledbetter
9c28fe42e8 WebContent: Fix typo in find_element_from_shadow_root() spec text
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This typo was recently fixed in the WebDriver spec.
2025-06-20 09:27:22 +02:00
Tomasz Strejczek
7278a17e87 LibCore: Remove DateTime::to_string() and to_byte_string()
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
2025-06-19 18:42:45 -06:00
Tomasz Strejczek
6fb2be96bf Everywhere: Replace DateTime::to_string() with UnixDateTime::to_string()
Replace LibCore::DateTime::to_string() with
AK::UnixDateTime::to_string().
Remove unncessary #include <LibCore/DateTime.h>.
2025-06-19 18:42:45 -06:00
Tomasz Strejczek
8f8e51b1fc AK: Implement AK::UnixDateTime::to_string()
Copy implementation of LibCore::DateTime::to_string()
to AK.
Rename TestDuration.cpp to TestTime.cpp and add
there tests for to_string().
2025-06-19 18:42:45 -06:00
Andreas Kling
63d862219e LibWeb: Avoid expensive Vector::insert() in innerText & outerText
Some checks failed
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Build Dev Container Image / build (push) Has been cancelled
When expanding "required line breaks", we now write directly into the
final StringBuilder instead of doing a pass of Vector remove/insert
operations first.

This removes a hot profile item on https://serpapi.com/
2025-06-19 17:31:22 +02:00
Chase Knowlden
326a8399a4 Meta: Update vcpkg to latest master 2025-06-19 16:20:59 +02:00
Tim Ledbetter
70f9eb9d8f LibWeb: Remove Document::validate_qualified_name()
This is no longer used and appears to have been removed from the
specification.
2025-06-19 15:06:58 +02:00
Tim Ledbetter
16dbb44de2 LibWeb: Update DOMImplementation.createDocumentType() name validation
This now follows the latest specification steps.
2025-06-19 07:55:47 -04:00
Sam Atkins
f98312d022 LibWeb/DOM: Move pseudo-element scroll offsets into PseudoElement 2025-06-19 12:35:31 +01:00
Sam Atkins
2c7310553a LibWeb/Layout: Reuse create_pseudo_element_if_needed() for ::backdrop 2025-06-19 12:35:31 +01:00
Sam Atkins
9c656dd7d1 LibWeb/Layout: Only apply ::before/::after creation rules to them 2025-06-19 12:35:31 +01:00
Sam Atkins
c1d4323cf7 LibWeb: Support counter-* properties on pseudo-elements
There are multiple things happening here which are interconnected:

- We now use AbstractElement to refer to the source of a counter, which
  means we also need to pass that around to compute `content`.

- Give AbstractElement new helper methods that are needed by
  CountersSet, so it doesn't have to care whether it's dealing with a
  true Element or PseudoElement.

- The CountersSet algorithms now walk the layout tree instead of DOM
  tree, so TreeBuilder needs to wait until the layout node exists
  before it resolves counters for it.

- Resolve counters when creating a pseudo-element's layout node. We
  awkwardly compute the `content` value up to twice: Once to figure out
  what kind of node we need to make, and then if it's a string, we do
  so again after counters are resolved so we can get the true value of
  any `counter()` functions. This will need adjusting in the future but
  it works for now.
2025-06-19 12:35:31 +01:00
Sam Atkins
a6df9e1bac LibWeb/Layout: Store computed style for ::marker
This lets us refer to its properties later, for example to resolve its
counters.
2025-06-19 12:35:31 +01:00
Sam Atkins
67241d6419 LibWeb/DOM: Give PseudoElement a CountersSet
This is not yet used
2025-06-19 12:35:31 +01:00