Commit graph

68644 commits

Author SHA1 Message Date
devgianlu
1c836588d9 LibWeb: Add some compression WPT tests
These are relevant for the next commits.
2025-03-19 13:46:50 +01:00
devgianlu
1612c1688e LibWeb: Change hardcoded compression test to round trip
As compression is not always deterministic, we cannot hardcode what
it'll be like, do a round trip instead.
2025-03-19 13:46:50 +01:00
devgianlu
3d3e77cd3e Meta: Add explicit vcpkg dependency for zlib
zlib is already included transitively for other dependencies, include it
explicitly and link it with `LibCompress`.
2025-03-19 13:46:50 +01:00
Sam Atkins
d5b9c39a98 LibWeb: Replace webkit meter-state pseudo-elements with pseudo-classes
This also implements the `:high-value` and `:low-value` that are in the
spec.

Same note as before about this being based on the very-drafty CSS Forms
spec. In fact, some of this isn't even in that spec yet. Specifically,
the `:suboptimal-value` and `:even-less-good-value` names are undecided
and subject to change. However, it's clear that this is a pseudo-class
situation, not a pseudo-element one, so I think this is still an
improvement, as it allows styling of the `::fill` pseudo-element
regardless of what state it is in.

Relevant spec issue: https://github.com/openui/open-ui/issues/1130
2025-03-19 10:10:03 +00:00
Sam Atkins
1978578a72 LibWeb: Expose HTMLMeterElement's optimum/suboptimum/etc state
No behaviour change, but this will allow us to switch over to
pseudo-classes for this state.
2025-03-19 10:10:03 +00:00
Sam Atkins
4c3c907041 LibWeb: Implement progress/range-input accent color in CSS
The `AccentColor` keyword does this in a simpler way, and allows authors
to override it.
2025-03-19 10:10:03 +00:00
Sam Atkins
3ebdb64fed LibWeb: Replace ::-webkit pseudo-elements with ones from CSS Forms spec
This spec is very early on, and likely to change. However, it still
feels preferable to use these rather than the prefixed -webkit ones.

Plus, as we have a `::fill` on range inputs, we can use that for styling
the bar instead of inserting CSS from C++.
2025-03-19 10:10:03 +00:00
Jess
f5a6704219 LibJS: Fix UAF in ECMAScriptFunctionObject::internal_construct
Currently, we create `this_argument` with
`ordinary_create_from_constructor`, then we use `arguments_list` to
build the callee_context.

The issue is we don't properly model the side-effects of
`ordinary_create_from_constructor`, if `new_target` is a proxy object
then when we `get` the prototype, arbitrary javascript can run.

This javascript could perform a function call with enough arguments to
reallocate the interpreters m_argument_values_buffer vector. This is
dangerous and leads to a use-after-free, as our stack frame maintains a
pointer to m_argument_values_buffer (`arguments_list`).
2025-03-19 10:31:00 +01:00
Aliaksandr Kalenik
b8fa355a21 LibWeb: Implement "transferred size suggestion" part of GFC spec 2025-03-19 10:21:54 +01:00
Tim Ledbetter
f0917ea150 LibWeb: Ensure shortest serialization is used for grid-column values 2025-03-19 02:08:05 +01:00
Tim Ledbetter
6811264b11 LibWeb: Ensure shortest serialization is used for grid-row values 2025-03-19 02:08:05 +01:00
Tim Ledbetter
83143e3018 LibWeb: Avoid repetition when serializing grid track placement values 2025-03-19 02:08:05 +01:00
Luke Wilde
7643a079c0 LibWeb: Enforce Content Security Policy of Fetch responses 2025-03-19 00:55:14 +01:00
Luke Wilde
51796e2d3a LibWeb: Report CSP violations for request 2025-03-19 00:55:14 +01:00
Luke Wilde
6f771f45e2 LibWeb: Enforce Content Security Policy on Fetch requests 2025-03-19 00:55:14 +01:00
Luke Wilde
86170f4bfd LibWeb/CSP: Introduce the ability to create and report a violation
A violation provides several details about an enforcement failing, such
as the URL of the document, the directive that returned "Blocked", etc.
2025-03-19 00:55:14 +01:00
Luke Wilde
02236be737 LibWeb/CSP: Implement SecurityPolicyViolationEvent
This is used to report violations of policies to the element/global
object that caused it.
2025-03-19 00:55:14 +01:00
Aliaksandr Kalenik
564cd1849b Tests: Disable css/css-lists/list-style-type-string-004.html
259d39cb was not enough to make this test pass reliably, so let's
disable it back for now.
2025-03-19 00:26:40 +01:00
Andrew Kaster
89ecc75ed8 LibCore+Meta: Un-break Swift build on Linux
LibCore's list of ignored header files for Swift was missing the Apple
only files on non-Apple platforms. Additionally, any generic glue code
cannot use -fobjc-arc, so we need to rely on -fblocks only.
2025-03-18 17:15:08 -06:00
Andrew Kaster
01ac48b36f AK: Support storing blocks in AK::Function
This has two slightly different implementations for ARC and non-ARC
compiler modes. The main idea is to store a block pointer as our
closure and use either ARC magic or BlockRuntime methods to manage
the memory for the block. Things are complicated by the fact that
we don't yet force-enable swift, so we can't count on the swift.org
llvm fork being our compiler toolchain. The patch adds some CMake
checks and ifdefs to still support environments without support
for blocks or ARC.
2025-03-18 17:15:08 -06:00
Andrew Kaster
72acb1111f CMake: Add find module for BlocksRuntime on non-Apple platforms 2025-03-18 17:15:08 -06:00
Andrew Kaster
be84ff4f2c AK: Add cast using objective-c __bridge qualifier 2025-03-18 17:15:08 -06:00
Andrew Kaster
0c2f434e69 AK: Add feature detection for -fblocks and -fobjc-arc 2025-03-18 17:15:08 -06:00
Andrew Kaster
1148116a87 CMake: Allow passing test name to serenity_test
This forwards to lagom_test. One day we should simplify this..
2025-03-18 17:15:08 -06:00
Tim Ledbetter
f6a8e5aa68 LibWeb: Use correct canonical serialization for BorderRadiusStyleValue 2025-03-18 21:55:06 +01:00
Tim Ledbetter
85728b297f LibWeb: Ensure the shortest serialization is used for border-radius
This implementation also fixes an issue where the individual components
of the `border-radius` shorthand were always assumed to be of type
`BorderRadiusStyleValue`, which could lead to a crash when CSS-wide
keywords were used.
2025-03-18 21:55:06 +01:00
Tim Ledbetter
040dca0223 AK: Add first_is_equal_to_all_of()
This method returns true if all arguments are equal.
2025-03-18 21:55:06 +01:00
Sam Atkins
97e917bdf5 LibWeb/CSS: Allow bare zero for gradient angles
Corresponds to f952e97da9
2025-03-18 20:04:08 +00:00
Timothy Flynn
4dfc29356d LibWeb: Initialize the Storage byte count upon creation
A Storage object may be created with an existing storage bottle. For
example, if you navigate from site.com/page1 to site.com/page2, they
will have different localStorage objects, but will use the same bottle
for actual storage.

Previously, if page1 set some key/value item, we would initialize the
byte count to 0 on page2 despite having a non-empty bottle. Thus, if
page2 set a smaller value with the same key, we would overflow the
computed byte count, and all subsequent writes would be rejected.

This was seen navigating from the chess.com home page to the daily
puzzle page.
2025-03-18 20:34:13 +01:00
Aliaksandr Kalenik
31da70bbfc Tests/LibWeb: Enable some tests relying on "reftest-wait" 2025-03-18 20:09:46 +01:00
Aliaksandr Kalenik
259d39cbad UI/Headless: Wait for "reftest-wait" class removal before screenshotting
Resolves https://github.com/LadybirdBrowser/ladybird/issues/3984
2025-03-18 20:09:46 +01:00
Aliaksandr Kalenik
394073f611 LibWeb: Rename internals.signalTextTestIsDone() to signalTestIsDone()
In upcoming change this function will be used for ref-tests as well.
2025-03-18 20:09:46 +01:00
Alec Murphy
101a8aef26 LibWeb: Use Super on macOS for page scroll/nav
On macOS, we should use the Cmd (Super) modifier key along with the
arrow keys to scroll to the beginning/end of the document, or navigate
back and forth in the history, rather than the Ctrl or Alt keys.
2025-03-18 15:07:09 -04:00
Shannon Booth
894c51e8e7 LibWeb/HTML: Handle missing second component in datetime-local
We were previously not checking for EOF which meant we were not
handling seconds being missing in the time component.
2025-03-18 15:05:02 -04:00
Shannon Booth
a457ebeec5 LibWeb/HTML: Implement 'convert string to number' for datetime-local 2025-03-18 15:05:02 -04:00
Timothy Flynn
780de1395b LibJS: Merge Intl.DurationFormat style and display fields into a struct
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/d56d624
2025-03-18 11:47:23 -04:00
Timothy Flynn
00d00b84d3 LibJS: Ensure relevant extension keys are included in ICU locale data
This is a normative change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/7508197

In our implementation, we don't have the affected AOs directly, as we
delegate to ICU. So instead, we must ensure we provide ICU a locale with
the relevant extension keys present.
2025-03-18 11:47:23 -04:00
Timothy Flynn
37b8ba96f1 LibJS: Use currency digits for NumberFormat only for standard notation
This is a normative change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/9140da2
2025-03-18 11:47:23 -04:00
Timothy Flynn
96c059bf67 LibJS: Use correct enum casing in some Intl constructors 2025-03-18 11:47:23 -04:00
Timothy Flynn
ea10470071 LibJS: Correctly print labels for some Intl objects
For example, printing an Intl.Collator object would previously display:

    [Intl.Collator]  numeric:
    "en"  locale:
    "sort"  usage:
    "variant"  sensitivity:
    "upper"  caseFirst:
    "default"  collation:
    false  ignorePunctuation:
    false

We now print:

    [Intl.Collator]
      locale: "en"
      usage: "sort"
      sensitivity: "variant"
      caseFirst: "upper"
      collation: "default"
      ignorePunctuation: false
      numeric: false
2025-03-18 11:47:23 -04:00
Sam Atkins
6d3534ae9c Tests: Disable fDAT-inherits-cICP.html test that uses "reftest-wait"
We don't support this mechanism in our test runner yet, which makes this
test flaky.
2025-03-18 14:56:02 +00:00
Aliaksandr Kalenik
4a7b947c5d LibWeb: Clamp content-based minimum size by limited max track size [GFC]
Progress on https://wpt.live/css/css-grid/grid-items/grid-minimum-size-grid-items-022.html
2025-03-18 15:01:02 +01:00
Shannon Booth
ec3c545426 LibURL+LibWeb: Ensure opaque paths always roundtrip
Corresponds to: https://github.com/whatwg/url/commit/6c782003
2025-03-18 12:17:19 +00:00
Tim Ledbetter
01d1a9528b LibWeb: Calculate the correct resolved value for inset properties
This improves the output of `getComputedStyle()` for the `top`,
`bottom`, `left` and `right` properties, where the used value is now
returned rather than the computed value, where applicable."
2025-03-18 09:27:51 +00:00
Shannon Booth
2022c9e679 Tests/LibWeb: Import the WPT URL test suite 2025-03-18 10:00:33 +01:00
Andrew Kaster
20890d7b70 Meta: Add fontconfig and freetype vcpkg overlays
Temporary until their canonical git forge is back up and running
2025-03-18 00:25:42 -06:00
Shannon Booth
b8adf193f5 LibWeb/SVG: Work around no layout node in SVGCircleElement::get_path
This is clearly not the correct fix, but instead of crashing let's
log an error and bail.

Works around a crash seen on both:

 * https://reddit.com
 * https://www.w3.org/TR/web-animations-1 (#879)
2025-03-17 20:10:11 +01:00
mikiubo
c85df78c4c LibRegex: Remove orphaned save points in nested LookAhead 2025-03-17 16:11:02 +01:00
stasoid
a6935299eb LibWeb: Correctly calculate static position rect when absolutely
positioned element is a descendant of inline-block

Sets inline block offsets in InlineFormattingContext.cpp, but this is
not enough. When static position rect is calculated during layout,
not all ancestors of abspos box may have their offsets calculated yet
(more info here: https://github.com/LadybirdBrowser/ladybird/pull/2583#issuecomment-2507140272).
So now static position rect is calculated relative to static containing
block during layout and calculation relative to actual containing block
is done later in
FormattingContext::layout_absolutely_positioned_element.

Fixes wpt/css/CSS2/abspos/static-inside-inline-block.html
2025-03-17 15:55:06 +01:00
Tim Ledbetter
1821896ecf LibWeb: Implement the HTMLLinkElement.sheet attribute
This returns the link element's associated style sheet.
2025-03-17 14:47:20 +01:00