Commit graph

3983 commits

Author SHA1 Message Date
Jonne Ransijn
a0fb092d94 LibWeb: Transform PaintableBox::hit_test positions
Elements with transforms were tested on their pre-transformed
positions, causing incorrect hits.

Copy the position transformation done in `StackingContext::hit_test`
to ensure that hit tests are done on the _actual_ position.
2024-11-23 22:06:32 +01:00
Andreas Kling
69367194a6 LibWeb: Make HTML tokenizer stop at insertion point after state switch
If we reach the insertion point at the same time as we switch to another
tokenizer state, we have to bail immediately without proceeding with the
next code point. Otherwise we'd fetch the next token, get an EOF marker,
and then proceed as if we're at the end of the input stream, even though
more data may be coming (with more calls to document.write()..)
2024-11-23 19:19:31 +01:00
Andreas Kling
701ed8470d Tests: Import a bunch of WPT tests related to dynamic markup insertion 2024-11-23 19:19:31 +01:00
Shannon Booth
e565e3c557 LibWeb: Implement BroadcastChannel.postMessage
The repository being in static storage is a bit of a hodgepodge, but in
line with how our current storage partitioning is done. We should
eventually move this, along with other across browsing context APIs to a
proper location at a later stage. But for now, this makes progress on
the meat of the BroadcastChannel API.
2024-11-23 16:43:55 +01:00
Andreas Kling
d3ee49b092 LibWeb: Avoid an infinite recursion in replaced element sizing
In the case where we had a preferred aspect ratio and a natural height
but no natural width, we'd get into ping-ponging infinite recursion by
trying to find the width to resolve the height to resolve the width to
resolve the height...
2024-11-23 16:39:45 +01:00
Andreas Kling
30fb2bf2e1 Tests: Skip html/rendering/pixel-length-attributes.html for now
This test is too slow for GCC CI.
2024-11-23 14:41:41 +01:00
Andreas Kling
1b4763f75f LibWeb: Allow border="0" on HTMLObjectElement 2024-11-23 14:41:41 +01:00
Andreas Kling
6e85363a84 LibWeb: Allow border="0" on HTMLInputElement 2024-11-23 14:41:41 +01:00
Andreas Kling
1288452bc3 LibWeb: Honor border attribute on HTMLImageElement 2024-11-23 14:41:41 +01:00
Andreas Kling
e781aab274 LibWeb: Honor the various margin attributes in HTMLBodyElement
This one is particularly weird as there's a priority order, and we even
have to look at attributes from the container element if we're inside a
subframe.
2024-11-23 14:41:41 +01:00
Andreas Kling
97aa608c13 Tests: Import WPT test for pixel length attributes 2024-11-23 14:41:41 +01:00
Psychpsyo
3e536a4cd7 LibWeb: Implement more IntersectionObserver attributes 2024-11-23 09:52:32 +01:00
Gingeh
7444f76b0d LibWeb: Make querySelectorAll match each element at most once 2024-11-23 09:49:33 +01:00
Gingeh
bb678e75f9 LibWeb: Reject selectors with named namespaces in querySelectorAll 2024-11-23 09:49:33 +01:00
Gingeh
ba0cc7fe46 LibWeb: Use correct case-sensitivity when matching attribute selectors
Also removed get_attribute_with_lowercase_qualified_name
because it was buggy, duplicated logic, and now unused.
2024-11-23 09:49:33 +01:00
Gingeh
a2cf1d17fd LibWeb: Require CSS combinators to be followed by a simple selector 2024-11-23 09:49:33 +01:00
Gingeh
bb5678a175 LibWeb: Don't allow trailing commas in selector lists
comma-separated list != #-multiplier
2024-11-23 09:49:33 +01:00
sideshowbarker
8965698ce7 LibWeb: Support accessible-name computation for SVG elements
This change adds support for computing accessible names for SVG
elements, per the https://w3c.github.io/svg-aam/#mapping_additional_nd
spec requirements. Otherwise, without this change, accessible names for
SVG elements don’t get exposed as expected.
2024-11-23 04:34:23 +00:00
Psychpsyo
b22341fc77 LibGfx: Support AVIF images with missing pixi property 2024-11-23 03:57:54 +00:00
Shannon Booth
3fffd1129c LibWeb: Implement overload resolution for sequence types
Fixes: #2508
2024-11-23 02:38:21 +00:00
Andreas Kling
9a7c9286c4 LibWeb: Support individual scale CSS property 2024-11-22 20:06:44 +01:00
Andreas Kling
66a821e731 LibWeb: Support individual translate CSS property 2024-11-22 20:06:44 +01:00
Andreas Kling
d6f7fccf49 Tests: Import a bunch of WPT tests from /css/css-transforms 2024-11-22 20:06:44 +01:00
Psychpsyo
3f5fff79ae LibWeb: Update checkbox focus lost test 2024-11-22 13:58:36 +00:00
Psychpsyo
c75dda8f8b LibWeb: Stop radio buttons firing change events when losing focus 2024-11-22 13:58:36 +00:00
Shannon Booth
75b7a3e413 LibWeb: Add definitions for PointerEvent event handlers
Also removing a FIXME about not covering all of the event names as it is
not exactly clear when such a FIXME would be addressed, especially as
these come from multiple specifications.
2024-11-22 14:33:58 +01:00
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
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
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
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
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
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
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
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
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
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
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
Andreas Kling
063cd68bf4 LibWeb: Mark image elements for layout before firing their load event
This removes a long-standing source of flakiness seen for example in
WPT's /referrer-policy/ tests.
2024-11-20 19:04:37 +01:00