Commit graph

65304 commits

Author SHA1 Message Date
Borna Lang
201648485f LibGfx: Reimplement from_hsla
- Hue now wraps properly when negative or larger than 360
- The hsl to rgb conversion now closely mirrors the code example from
  the spec.

This fixes a number of WPT tests in
/css/css-color/parsing/color-computed-hsl.html
2024-11-22 12:10:30 +01:00
Timothy Flynn
bc846d933d CI: Use correct path to upload ref test dumps 2024-11-22 09:57:27 +01:00
Timothy Flynn
c6fccc04e1 LibJS: Use Temporal's ISO8601 parser to parse UTC offset strings
We now have the Temporal facilities to implement the Date AOs which
parse UTC offset strings using the ISO8601 parser. This patch updates
those AOs and their callers in accordance with the Temporal spec.
2024-11-21 19:24:25 -05:00
Timothy Flynn
64811ab7b6 LibJS: Implement Temporal.PlainMonthDay.prototype.valueOf 2024-11-21 19:24:25 -05:00
Timothy Flynn
5389acc231 LibJS: Implement Temporal.PlainMonthDay.prototype.with/equals 2024-11-21 19:24:25 -05:00
Timothy Flynn
5bccb36a6f LibJS: Implement stringification Temporal.PlainMonthDay prototypes 2024-11-21 19:24:25 -05:00
Timothy Flynn
1a386e78c3 LibJS: Implement the Temporal.PlainMonthDay constructor
And the simple Temporal.PlainMonthDay.prototype getters, so that the
constructed Temporal.PlainMonthDay may actually be validated.
2024-11-21 19:24:25 -05:00
Timothy Flynn
b3b968bed9 LibJS: Implement several more ISO8601 productions
This started with implementing TemporalMonthDayString. It turns out that
the facilities needed to parse that production includes nearly all the
helpers to parse each of:

    TemporalDateTimeString
    TemporalInstantString
    TemporalMonthDayString
    TemporalTimeString
    TemporalYearMonthString
    TemporalZonedDateTimeString

As most of these invoke the same helpers with different options. So,
all 6 of those productions are implemented here.
2024-11-21 19:24:25 -05:00
Aliaksandr Kalenik
8614e0f856 LibWeb: Dispatch pointer events in EventHandler
Now, along with the mouse events we also dispatch pointerup, pointerdown
and pointermove.

With this change shape painting works on https://excalidraw.com/
2024-11-22 00:32:58 +01:00
rmg-x
e4dc758343 LibWeb/CSS: Check for matching custom properties on parent elements
Previously, we were only checking the current element and not the
parents in `ResolvedCSSStyleDeclaration::custom_property()` which wasn't
correct.
2024-11-22 00:32:19 +01:00
Tim Ledbetter
00f6a2b744 LibWeb: Use ByteString arguments for XMLHttpRequest.setRequestHeader() 2024-11-21 15:49:48 -05:00
Tim Ledbetter
2aee5d7f62 headless-browser: Treat files ending in '.htm' as valid tests 2024-11-21 15:49:48 -05:00
Tim Ledbetter
5d71da1d73 Tests: Skip CSS flexbox test that currently times out
This change disables the `css-flexbox/order-001.htm` test. Previously,
this test wasn't being run because the filename ends with '.htm'.
2024-11-21 15:49:48 -05:00
Tim Ledbetter
19a5780f0c IDLGenerators: Throw TypeError if IDL ByteString contains element > 255 2024-11-21 15:49:48 -05:00
Andreas Kling
6dc61f895d LibWeb: Make getComputedStyle(e).getPropertyValue() see custom props
A lot of WPT tests rely on this mechanism to test unrelated things.
2024-11-21 21:16:03 +01:00
Tim Ledbetter
ea0e434d1d LibWeb: Allow FormData entry list to be mutated within a FormDataEvent
Previously, the list was copied when constructing the FormData object,
then the original list was passed to the event, meaning any changes to
the list that happened within the event would not be reflected outside
of it.
2024-11-21 20:25:26 +01:00
Andrew Kaster
4cb19c65b4 CMake: Check for Swift-aware C++ compiler more robustly
Instead of looking for "AppleClang", we can just check whether the
CMAKE_CXX_COMPILER understands swift_attr and swift_name.
2024-11-21 12:17:44 -07:00
Andreas Kling
fbe9395928 LibWeb: Stop treating intrinsic size keywords as auto in CSS heights
This commit introduces proper handling of three intrinsic size keywords
when used for CSS heights:

- min-content
- max-content
- fit-content

This necessitated a few plumbing changes, since we can't resolve these
values without having access to containing block widths.

This fixes some visual glitches on https://www.supabase.com/ as well
as a number of WPT tests. It also improves the appearance of dialogs.
2024-11-21 19:21:51 +01:00
Jonne Ransijn
f093a8af67 LibWeb: Copy m_resize_observers before iterating
An inopportune garbage collection may cause collected `ResizeObserver`s
to unregister themselves from `m_resize_observers` while we are
iterating over it, resulting in a use-after-free.
2024-11-21 19:18:26 +01:00
Nico Weber
94b97aa365 LibWeb: Plumbing for svg stroke-dasharray 2024-11-21 18:56:45 +01:00
Aliaksandr Kalenik
c0e90a2a68 LibWeb: Dispatch "click" event on input control associated with <label>
For example, in the following HTML:
```html
<label>
    <input type="radio" name="fruit" value="apple" id="radio1">
    <span class="box"></span>
</label>
```

When any descendant of a <label> element is clicked, a "click" event
must be dispatched on the <input> element nested within the <label>, in
addition to the "click" event dispatched on the clicked descendant.

Previously, this behavior was implemented only for text node descendants
by "overriding" the mouse event target using `mouse_event_target()` in
the TextPaintable. This approach was incorrect because it was limited to
text nodes, whereas the behavior should apply to any box. Moreover, the
"click" event for the input control must be dispatched *in addition* to
the event on the clicked element, rather than redirecting it.
2024-11-21 16:11:03 +01:00
Pavel Shliak
001df24935 LibWebSocket: Clean up #include directives
This change aims to improve the speed of incremental builds.
2024-11-21 14:08:33 +01:00
Pavel Shliak
b60cb699a9 LibMedia: Clean up #include directives
This change aims to improve the speed of incremental builds.
2024-11-21 14:08:33 +01:00
Pavel Shliak
8d13115d9a LibCrypto: Clean up #include directives
This change aims to improve the speed of incremental builds.
2024-11-21 14:08:33 +01:00
Pavel Shliak
cd14b215d1 LibDNS: Clean up #include directives
This change aims to improve the speed of incremental builds.
2024-11-21 14:08:33 +01:00
Pavel Shliak
35764db0b7 LibWasm: Clean up #include directives
This change aims to improve the speed of incremental builds.
2024-11-21 14:08:33 +01:00
Pavel Shliak
caf7983039 LibHTTP: Clean up #include directives
This change aims to improve the speed of incremental builds.
2024-11-21 14:08:33 +01:00
Pavel Shliak
cdb54fe504 LibRegex: Clean up #include directives
This change aims to improve the speed of incremental builds.
2024-11-21 14:08:33 +01:00
Psychpsyo
7f989765f5 LibWeb: Fix MouseEvent position values
The clientX and clientY values are, as per the spec, the offset from
the viewport.
This makes them actually be that and also fixes up the calculations
for offsetX, offsetY, pageX and pageY.
I assume all of these got messed up in some sort of refactor in the
past.

The spec comment from the now-removed
compute_mouse_event_client_offset() function sadly has no convenient
place to be anymore so, for now, it is just gone as well.
Personally, I think it'd make sense to refactor a lot of this file so
that not every mouse event repeats a large chunk of (almost) identical
code. That way there'd be a nice place to put the comment without
repeating it all over the file.
But that is out of the scope of this PR.

Also: I know, offsetX and Y are not fully fixed yet, they still
don't ignore the element's CSS transforms but I am working on that
in a new PR.
2024-11-21 13:22:22 +01:00
Aliaksandr Kalenik
41c172c663 LibWeb: Allow custom properties in getPropertyPriority() 2024-11-21 13:16:08 +01:00
Aliaksandr Kalenik
ac5699c8fc LibWeb: Allow custom properties in CSSStyleDeclaration.removeProperty() 2024-11-21 13:16:08 +01:00
Aliaksandr Kalenik
ce26e5d757 LibWeb: Allow custom properties in CSSStyleDeclaration.getPropertyValue 2024-11-21 13:16:08 +01:00
Aliaksandr Kalenik
3a2cc1aa20 LibWeb: Allow custom properties in CSSStyleDeclaration.setProperty()
This change fixes unhoverable toolbar on https://excalidraw.com/
The problem was that React.js uses setProperty() to add style properties
specified in the "style" attribute in the virtual DOM, and we were
failing to add the CSS variable used to set the "pointer-events" value
to "all".
2024-11-21 13:16:08 +01:00
Aliaksandr Kalenik
0448d4d609 LibWeb: Update property_id_from_string() generator to handle ::Custom 2024-11-21 13:16:08 +01:00
Lucas CHOLLET
a1687854ab LibWeb/CSS: Use double in CSSHWB::to_color()
See previous the commit description for more details about the floating
points operations.

The hwb test cases in `css-color-functions` are now rendered identically
to what firefox does (I haven't checked the others tests, but they
aren't affected by this commit).
2024-11-21 11:59:44 +00:00
Lucas CHOLLET
d1120e1809 LibWeb: Make CSSColorValue resolvers return a double
Without this change the math in `CSSHWB::to_color()` is lacking some
precision to generate the correct value to hand to `Color::from_hsv()`.

More precisely, when converting `hwb(120 20 30)`, the HSV's value would
be calculated as `1 - .3`. However, it turns out that `1 - .3f != .7f`
and `1 - .3f` gives bad results down the road in `Color::from_hsv()`.

This example actually only requires `resolve_with_reference_value()` to
return a double. I changed the two others for symmetry.
2024-11-21 11:59:44 +00:00
Lucas CHOLLET
248e4bb517 LibGfx: Round values in Color::with_opacity()
`svg-gradient-userSpaceOnUse` is now rendered to something closer to
what firefox does, so it is at least some progress.
2024-11-21 11:59:44 +00:00
Lucas CHOLLET
b4ba65c6e5 LibGfx: Round values in Color::from_hsv() 2024-11-21 11:59:44 +00:00
devgianlu
009f328308 LibWeb: Implement ECDH.generateKey 2024-11-21 11:45:22 +01:00
Pavel Shliak
d55caff227 LibFileSystem: Fix Windows build
This reverts part of  b3c253e50f
2024-11-21 11:15:49 +01:00
Feng Yu
570c5f8df2 Documentation: Fix broken link in README 2024-11-21 10:42:45 +01:00
Shannon Booth
d6bcd3fb0b LibWeb: Make CallbackType take a realm instead of settings object
In line with the ShadowRealm proposal changes in the WebIDL spec:
webidl#1437 and supporting changes in HTML spec.

This is required for ShadowRealms as they have no relevant settings
object on the shadow realm, so fixes a crash in the QueueingStrategy
test in this commit.
2024-11-20 18:01:21 -07:00
Shannon Booth
d527c5df5d LibWeb: Allow using queuing strategies on globals other than Window
These interfaces are exposed on *, meaning it should work for workers
and our newly added shadow realm global object by being stored on the
universal global scope mixin.
2024-11-20 18:01:21 -07:00
rmg-x
13f349aea2 LibWeb/Fetch: Implement blob range section of scheme fetch specification 2024-11-21 00:26:58 +00:00
rmg-x
84f673515b LibWeb/XHR: Use normalized header value when validating contents
This was not matching specification and caused valid requests to be
rejected.
2024-11-21 00:26:58 +00:00
rmg-x
4e48298414 LibWeb/Fetch: Implement build_content_range(start, end, full_length) 2024-11-21 00:26:58 +00:00
rmg-x
bf5cf720b5 LibWeb/Fetch: Bring parse_single_range_header_value() up to spec
The previous implementation wasn't using the latest specification steps.
2024-11-21 00:26:58 +00:00
Timothy Flynn
488034477a Revert "LibWeb: Set doctype node immediately while parsing XML document"
This reverts commit cd446e5e9c.

This broke about 20k WPT subtests, all related to XML parsing. See:
https://wpt.fyi/results/html/the-xhtml-syntax/parsing-xhtml-documents?diff=&filter=ADC&run_id=5154815472828416&run_id=5090731742199808
2024-11-20 19:11:56 -05:00
Timothy Flynn
f57ff63432 LibJS: Implement Temporal.Duration.prototype.valueOf 2024-11-20 19:04:30 -05:00
Timothy Flynn
c715711f88 LibJS: Implement Temporal.Duration.prototype.total
Until we have re-implemented Temporal.PlainDate/ZonedDateTime, some of
Temporal.Duration.prototype.total (and its invoked AOs) are left
unimplemented.
2024-11-20 19:04:30 -05:00