1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-07 21:17:07 +09:00
Commit graph

5258 commits

Author SHA1 Message Date
Psychpsyo
5fad6b1938 Meta: Add doctypes to more layout tests 2025-06-07 11:09:53 +01:00
Gingeh
9ef9f8d38f LibWeb: Implement the request-close command
See: https://github.com/whatwg/html/pull/11045
2025-06-07 04:06:01 +01:00
Gingeh
fc35229dab LibWeb: Implement the ToggleEvent.source attribute
See: https://github.com/whatwg/html/pull/11186
2025-06-07 04:06:01 +01:00
R-Goc
9ec26058d1 LibTest/Tests: Build and run test-js on windows
This commit allows test-js to build and run, also in CI.

Co-authored-by: Andrew Kaster <andrew@ladybird.org>
2025-06-05 22:00:55 -06:00
Aliaksandr Kalenik
39fff3cf8a LibWeb: Don't early return when masking area of StackingContext is empty
An early return was occurring between the emission of
PushStackingContext and PopStackingContext, resulting in a
PushStackingContext without a corresponding PopStackingContext in the
display list, which caused broken painting.

Fixes black screen on Discord login page.
2025-06-06 00:52:19 +02:00
Aliaksandr Kalenik
7efdd1c1ec LibWeb: Stub CacheStorage interface
With this change we can again open login form https://discord.com/login
instead of failing in js because `caches.open()` is not defined.
2025-06-05 23:02:21 +02:00
stasoid
28bfe701b7 Tests/LibThreading: Port to Windows 2025-06-05 10:16:03 -06:00
InvalidUsernameException
1d0cfdc839 LibWeb: Consider margins during fit-content sizing in BFC
`BlockFormattingContext::compute_width()` stores the left and right
margins in the layout state at the very end of the function. However,
before doing so, it calls `FormattingContext::calculate_inner_width()`
which ends up calling `FormattingContext::calculate_stretch_fit_width()`
if the current box has `width: fit-content`.

Due to this, `calculate_stretch_fit_width()` would always see the
margins from the layout state as zero and therefore not take them into
account. Subsequently, the calculated width ended up being wrong.

Saving margins on the layout state earlier, before calling
`calculate_inner_width()`, makes sure that the width is calculated
correctly.
2025-06-05 17:56:19 +02:00
InvalidUsernameException
ede84567f1 Tests/LibWeb: Regression test for auto margin on max-width container
An earlier variant of the commit following this one introduced a
regression for the behavior tested here, but did not fail any in-tree
tests. So lets add an explicit regression test to make that easier to
catch in the future.
2025-06-05 17:56:19 +02:00
stelar7
7f2362643c LibWeb: Use a BFC for MathML
While this is not correct, it makes MathML text render atleast
2025-06-05 12:37:52 +01:00
Sam Atkins
5a1c73d7e2 LibGfx+LibWeb: Update definitions of supported font formats and features
Based very scientifically on what's listed here:
https://harfbuzz.github.io/what-does-harfbuzz-do.html

I've moved the code into LibGfx because including a HarfBuzz header
directly from LibWeb is a little unpleasant. But the Gfx::FontTech enum
follows the CSS definitions for font features for simplicity.

TrueType collections are supported. SVG and Embedded OpenType are not,
but they're not widely supported by other browsers so that's fine.

Most of the features are completely supported by HarfBuzz, so we can
just return true. Graphite support is optional (and it appears we use a
build of HarfBuzz without it) but there's a define we can check.
Incremental Font Transfer is a whole separate thing that we definitely
don't support yet.
2025-06-05 12:10:29 +01:00
Sam Atkins
d611806f18 LibWeb/CSS: Parse and use tech() in @font-face { src } 2025-06-05 12:10:29 +01:00
Callum Law
670c247937 LibWeb: Resolve FIXME around shorthand properties in remove_property()
This exposes some false-positive sub-tests in the font-computed.html
test which are now correctly marked as failed.
2025-06-04 16:34:31 +01:00
Ruben
88da6250f9 LibWeb: Use the correct definition of separated-borders mode
We previously checked the cell's computed values for the border-collapse
property, but a cell is only in separated-borders mode if the table has
border-collapse set to separate. Curiously in some other placed where
this mode is checked we already did the correct thing.
2025-06-04 15:02:42 +01:00
Callum Law
50cce72ab9 LibWeb: Implement text-wrap CSS property
This resolves an issue introduced in 94f5a51 with the
tab-size-text-wrap test
2025-06-04 12:48:36 +01:00
Callum Law
9ba74316d2 LibWeb: Implement text-wrap-style CSS property 2025-06-04 12:48:36 +01:00
Timothy Flynn
7d99a92135 LibWeb: Absolutize CSS image URLs for computed style resolution
For getComputedStyle(), we must return an absolute URL for image style
values. We currently return the raw parsed URL.

This fixes loading the marker icons on https://usermap.serenityos.org.
2025-06-03 19:30:43 -04:00
Andreas Kling
6dba720370 LibWeb: Invalidate layout tree at nearest non-anonymous ancestor
When marking a part of the layout tree for rebuild, if the subtree root
that we're marking has an anonymous parent, we now mark from the nearest
non-anonymous ancestor instead.

This ensures that subtrees inside anonymous wrappers don't just get
duplicated (i.e recreated but inserted instead of replaced).
2025-06-04 00:43:23 +02:00
aplefull
3781c132aa LibWeb: Fix grid item placement when only grid-column-end is specified 2025-06-03 22:22:24 +02:00
Psychpsyo
4c54a28c45 Meta: Add doctypes to a few more layout tests 2025-06-03 11:03:19 +01:00
Manuel Zahariev
f972342c27 LibWeb/CSS: Unit tests for changes to counter definitions 2025-06-03 03:51:42 +02:00
aplefull
486602e796 LibRegex: Fix handling of + quantifier with zero-width matches
Small change that allows quantifiers using Fork* forms (e.g., +) to
succeed after one match, even if that match has zero width.
2025-06-02 15:52:26 +02:00
Tim Ledbetter
17f14a277b LibWeb: Don't crash when interpolating single-value repeatable lists
Previously, when interpolating a repeatable list from a list with
multiple values to a single value, we would crash.
2025-06-02 11:33:01 +01:00
Timothy Flynn
8ded0c65dc LibJS+LibUnicode: Change time zones in a way that works on Windows
On Windows, ICU does not look at the TZ environment variable at all. So
to support changing time zones in test-js, let's set ICU's default time
zone directly.

Note that we no longer deal with "null" time zone strings. We just cache
whatever ICU thinks is the current time zone before attempting to change
it, for which we never have a null result.

Co-authored-by: Andrew Kaster <andrew@ladybird.org>
2025-06-01 18:48:58 -04:00
stasoid
8d33a97630 Tests/LibURL: Port to Windows 2025-06-01 16:42:19 -06:00
Tim Ledbetter
e2d0d8e2b9 LibWeb/CSS: Implement the scrollbar-color property
This allows the user to set the scrollbar thumb and track colors.
2025-06-02 00:17:51 +02:00
InvalidUsernameException
417f4edc46 Tests/LibWeb: Print properties without indexes
The test CSSStyleDeclaration-has-indexed-property-getter is a frequent
source of merge conflicts between PRs that are adding to or otherwise
modifying the list of supported CSS properties.

This is primarily because the test prints out a numeric index of each
property along with the property. As far as I can tell the indexes are
inconsequential for what the test is trying to verify. So lets modify
the printout to only contain the properties without indexes.
2025-06-01 19:09:10 +01:00
Aliaksandr Kalenik
4b4d960cba LibWeb: Cancel previous animation if new animation-name is "none"
"none" value should be interpreted as "no animation" to trigger the path
that cancels previous animation if it exists.
2025-06-01 05:02:12 +02:00
Shannon Booth
caf959f06c LibWeb/FileAPI: Handle an aborted stream in Blob::get_stream() close
The streams AO that we were calling to close the stream would assert
if it was not in a readable state. This version of close is exported
publicly in the streams specification, and properly handles this
situation.

Fixes a crash in the imported test, and happens to fix some others!
2025-05-31 09:12:57 -04:00
InvalidUsernameException
52ba40f161 Tests/LibWeb: Fix flaky css background test
This test was introduced in 70b52e0994 and
was flaky in CI and on my local machine.
2025-05-30 12:03:25 -04:00
InvalidUsernameException
456608cf03 Tests: Fix flaky test
This flake was introduced in 164afdcc59.
2025-05-30 00:12:27 -04:00
Timothy Flynn
7ce88eb4cd Everywhere: Document use of ladybird.py over ladybird.sh 2025-05-29 16:24:17 -04:00
InvalidUsernameException
164afdcc59 LibWeb: Ensure scroll offset is applied to mask-images
When recording the display list for a stacking context, the following
operations (relevant to this bug) happened:
* push a stacking context
  * as part of that push a None-value to the scroll frame id stack
* apply filters
* apply masking
* paint recursively

This meant that mask-images were always recorded without scroll frame
id, causing them to be painted without any scroll offset. As a result
mask-images would break as soon as the website using them was scrolled.

Instead, push to the scroll frame id stack later to solve the problem:
* push a stacking context
* apply filters
* apply masking
* push a None-value to the scroll frame id stack
* paint recursively
2025-05-29 22:02:07 +02:00
Callum Law
ed65d5b342 LibWeb: Serialize CSS declarations as shorthands where applicable
When serializing CSS declarations we now support combining multiple
properties into a single shorthand property in some cases.

This comes with a healthy dose of FIXMEs, including work to be done
around supporting:
 - Nested shorthands (e.g. background, border, etc)
 - Shorthands which aren't represented by the ShorthandStyleValue type
 - Subproperties pending substitution

This gains us a bunch of new test passes, both for WPT and in-tree
2025-05-29 12:04:28 +02:00
Callum Law
94f5a51820 LibWeb: Convert white-space CSS property to shorthand
This exposed a few bugs which caused the following tests to behave
incorrectly:
- `tab-size-text-wrap.html`: This previously relied on a bug where we
  incorrectly treated `white-space: pre` as allowing text wrapping. The
  fix here is to implement the text-wrap CSS shorthand property.

- `execCommand-preserveWhitespace.html`: We don't correctly serialize
  shorthand properties. This is covered by an existing FIXME in
  `CSSStyleProperties::serialized()`

- `white-space-shorthand.html`: The last 5 subtests here fail as we
  don't correctly handle shorthand properties in
  `CSSStyleProperties::remove_property()`. This is covered by an
  existing FIXME in said function.
2025-05-29 12:04:28 +02:00
Callum Law
45689936f2 LibWeb: Support shorthand properties as presentational hints 2025-05-29 12:04:28 +02:00
Callum Law
9480b1fc5c LibWeb: Parse and propagate white-space-trim CSS property 2025-05-29 12:04:28 +02:00
Callum Law
50bdd2cb85 LibWeb: Parse and propagate text-wrap-mode CSS property 2025-05-29 12:04:28 +02:00
Callum Law
ea30356fba LibWeb: Parse and propagate white-space-collapse CSS property 2025-05-29 12:04:28 +02:00
R-Goc
3989059227 Libraries/Utilities/Tests: Build and test js.exe
This commit enables building and testing js.exe for windows. Needed
libraries are built in CI, and tests for those which pass were added.
Tests for LibJS which don't require javascripttestrunner were added but
the rest need to wait for that to be ported to windows.
2025-05-29 03:26:23 -06:00
Aliaksandr Kalenik
c2c9348636 LibWeb: Print FIXME instead of throwing NotSupportedError in WebAudio
This allows us to browse https://pierre.co/ instead of being navigated
to error screen.
2025-05-28 20:37:35 +02:00
Andrew Kaster
c5071c9025 Tests: Re-enable TestLibCoreMappedFile and TestLibCoreStream
These tests previously only ran on SerenityOS. They needed test input
location changes. The Stream tests also needed to explicitly set
SO_REUSEADDR for the tcp servers.
2025-05-27 20:34:47 -06:00
Ruben
3263b629c6 LibWeb: Correct the calculation for right float intrusion
We used to subtract the maximum right margin of any containing box,
but we want to subtract the entire right margin instead. This yielded
incorrect intrusions for right floats not placed in the root.
2025-05-27 17:31:47 +02:00
Tim Ledbetter
b16f34767e LibWeb: Ensure discrete interpolated properties are non-transitionable
If a property is uses discrete interpolation and TransitionBehavior is
not set to `AllowDiscrete` that property should be non-transitionable.

This is now true for properties whose animation type is not discrete,
but the animation type falls back to discrete.
2025-05-27 13:33:29 +02:00
Khaled Lakehal
9a071c9e89 LibWeb/HTML: Fix behavior when removing multiple from select element
This change ensures correct behavior when the `multiple` attribute is
removed from a `select` element, reducing the number of selected
`option` elements to one.

Fixes a failing WPT test:
https://wpt.live/html/semantics/forms/the-select-element/select-multiple.html
2025-05-27 18:58:31 +12:00
Shannon Booth
556acd82ee LibWeb/Editing: Handle no active range in queryCommandState
Fixes a crash when this is invoked if no range is active for the
document.
2025-05-26 23:36:44 +02:00
Shannon Booth
7c7fec5e00 LibWeb/Editing: Pass normalized command name to editing AOs
As the internal algorithms perform case sensitive matching.
Fixes a crash in the included test, seen on gmail.com.
2025-05-26 23:36:44 +02:00
Rocco Corsi
70abe99bfd Tests: Add test for MimeType sniffing from filenames 2025-05-26 14:23:43 -06:00
Chris Mulder
09463f147d LibWeb: Do not clear the selection, when query is not found
Fixes #4743
2025-05-26 11:22:48 +02:00
Sam Atkins
f5cd853597 LibWeb/CSS: Avoid calling to_font_weight() when serializing font
This function attempts to resolve `lighter` and `bolder`, which we don't
want to do when serializing - that should happen in style computation.

This has the unexpected bonus of 37 more WPT passes!
2025-05-24 13:35:30 +01:00