Commit Graph

1572 Commits

Author SHA1 Message Date
simonkrauter
191531b7b1 LibWeb: Use correct default value for <input type=range>
Previously the input element was displayed with value 0, when no value
was set in the HTML. Now it uses `value_sanitization_algorithm()`, which
will calculate the default value.
In `value_sanitization_algorithm()` there was a logical mistake/typo.
The comment from the spec says "unless the maximum is less than the
minimum".
The added layout test would fail without the code changes.
Fixes #520
2024-07-11 11:56:13 +02:00
Kenneth Myhra
907dc84c1e LibWeb: Implement min option for ReadableStreamBYOBReader.read()
When the min option is given the read will only be fulfilled when there
are min or more elements available in the readable byte stream.

When the min option is not given the default value for min is 1.
2024-07-11 11:55:15 +02:00
BenJilks
bee42160c5 LibWeb: When solving abspos lengths, use min max constrained height
Solving using the unconstrained height, when solving for bottom, would
either leave a gap over overflow its container.
2024-07-10 19:41:12 +02:00
Colin Reeder
449f81bfbe LibWeb: Add support for -webkit-text-fill-color 2024-07-10 10:25:04 -06:00
Dennis Camera
033057683c Everywhere: Don't install code generators and test binaries 2024-07-10 10:13:21 -06:00
Colin Reeder
d427344f39 LibWeb: Handle inline-start and inline-end as float values
Should resolve #449 for LTR languages at least
2024-07-10 17:41:18 +02:00
Jamie Mansfield
9d1ea4c7e0 LibWeb: Implement SVGElement.className 2024-07-10 10:28:43 +02:00
Andreas Kling
4e7558c88b LibWeb: Don't fire resize event until document actually resizes once
The first time Document learns its viewport size, we now suppress firing
of the resize event.

This fixes an issue on multiple websites that were not expecting resize
events to fire so early in the loading process.
2024-07-10 10:27:31 +02:00
rmg-x
629068c2a7 LibWeb: Ensure normal line-height on HTMLInputElement
Previously, setting CSS `line-height: 0` on an `input` element would
result in no text being displayed.

Other browsers handle this by setting the minimum height to the
"normal" value for single line inputs.
2024-07-10 07:05:52 +02:00
Maciej
d890be6e0f LibWeb: Prepare script when src is set the first time
From https://html.spec.whatwg.org/multipage/scripting.html#script-processing-model:
When a script element el that is not parser-inserted experiences one
of the events listed in the following list, the user agent must
immediately prepare the script element el:
- [...]
- The script element is connected and has a src attribute set where
  previously the element had no such attribute.
2024-07-09 20:30:27 +01:00
Maciej
65d8d205ee LibWeb: Implement HTML DragEvent class
This just defines the class, drag events aren't actually fired yet.
2024-07-09 11:28:32 +01:00
Luke Warlow
63a5ff70e5 LibWeb: Implement :modal pseudo class
Adds the :modal pseudo class which matches dialogs opened with
showModal().
2024-07-08 11:34:06 +02:00
Tim Ledbetter
34b9873664 LibWeb: Populate filename in WindowOrWorkerGlobalScope.reportError()
Previously, when `WindowOrWorkerGlobalScope.reportError()` was called
the `filename` property of the dispatched error event was blank. It is
now populated with the full path of the active script.
2024-07-08 11:26:24 +02:00
Natsuki Ikeguchi
ccb3a2f7ad LibWeb: Add initial implementation of global.reportError() 2024-07-07 13:53:01 +01:00
simonkrauter
cbc4832a53 LibWeb: Extend meter test 2024-07-07 08:07:19 +02:00
Tim Ledbetter
21eefb788b Tests/WPT: Enable Qt neworking when running WPT tests 2024-07-06 14:50:26 -06:00
Gingeh
e1c61d654f LibWeb/CSS: Add tests for color functions 2024-07-06 05:18:00 -06:00
Jamie Mansfield
ecad28657a LibWeb/HTML: Implement TextTrackList IDL interface 2024-07-06 11:41:13 +02:00
Aziz Berkay Yesilyurt
13cd653d1c LibWeb/HTML: Update Text Input Styling
So that it is closer to the spec.
https://www.w3.org/TR/css-ui-4/#input-rules
2024-07-06 10:21:35 +02:00
Arthur Hartwig Carlsson
9ed2669fc8 LibWeb: Don't insert out-of-flow elements into block pseudo elements
Like 1132c858e9, out-of-flow elements such
as float elements would get inserted into block level `::before` and
`::after` pseudo-element nodes when they should instead be inserted as a
sibling to the pseudo element. This change fixes that.

This fixes a few layout issues on the swedish tax agency website
(skatteverket.se). :^)
2024-07-06 10:02:29 +02:00
Arthur Hartwig Carlsson
c84ff9f693 Tests: Make rebaseline-libweb-test OS aware
This makes it so that `rebaseline-libweb-test` can be run on *nix or
MacOS as the path to `headless-browser` on MacOS is
`./bin/Ladybird.app/Contents/MacOS/headless-browser` while it is
`./bin/headless-browser` on *nix.
2024-07-05 16:29:00 -06:00
BenJilks
47aee289d8 LibWeb: Change flex remaining space distribution to include gap
The remaining space is in addition to, not of in place of the
main gap.
2024-07-05 21:31:41 +02:00
Caitlin Potter
80cd3712c2 LibWeb: Implement WebIDL constructor flow for derived classes
Following the rules in the algorithm from
https://webidl.spec.whatwg.org/#js-platform-objects, "To Internally
create a new object implementing the interface interface", this change
incorporates the steps to load a prototype from new.target, and write
it to the created instance returned from constructor_impl(). This
mirrors the code for generate_html_constructor(), which incorporates
additional steps needed by Custom Elements.

Bug #334
2024-07-05 21:04:27 +02:00
Tim Ledbetter
23eba28c22 Everywhere: Remove Serenity specific code from tests
We no longer run our tests on Serenity.
2024-07-05 07:29:51 +02:00
Jamie Mansfield
67e3ac8916 LibWeb/HTML: Stub TextTrack IDL interface 2024-07-05 07:15:04 +02:00
Luke Warlow
a9669639ce LibWeb: Implement popover property and attribute
The popover property now reflects the attribute.

It cannot currently use the Reflect IDL concept because the empty string
value is special cased.
2024-07-05 07:14:50 +02:00
Bastiaan van der Plaat
c81a640f3e LibWeb/CSS: Serialize transform scale percentage values as numbers 2024-07-04 14:41:35 +02:00
Tim Ledbetter
34741d09c6 LibWeb: Update Range::set_base_and_extent() to the latest spec text
This allows it to work with content inside shadow roots.
2024-07-04 14:38:56 +02:00
Luke Warlow
6623177265 LibWeb: Implement support for scrollbar-gutter
This property is now correctly parsed.

Ladybird always uses overlay scrollbars so this property does nothing.
2024-07-04 13:22:40 +02:00
Bastiaan van der Plaat
bff6c0680a LibWeb/Geometry: Make DOMRect doubles unrestricted 2024-07-01 21:30:52 +01:00
Tim Ledbetter
bdaa7f0e8e LibWeb: Implement the HTMLTrackElement.kind attribute
This reflects the HTML `kind` attribute.
2024-06-30 13:08:42 +02:00
Andreas Kling
4db05ecf69 LibWeb: Set the correct prototype for SVGAElement instances 2024-06-28 17:10:52 +02:00
Andreas Kling
a84261ee7a Tests/LibWeb: Add test that dumps all global JS constructors 2024-06-28 17:10:52 +02:00
Tim Ledbetter
c4d5ae28ea LibWeb: Implement a minimal version of Window.find()
This is a non-standard API that other browsers implement, which
highlights matching text in the current window.

This is just a thin wrapper around our find in page functionality, the
main motivation for adding this API is that it allows us to write tests
for our find in page implementation.
2024-06-27 10:09:39 +02:00
Tim Ledbetter
9585da37ad Tests: Skip css-keyframe-fill-forwards.html ref test
This test is currently causing intermittent CI failures.

(cherry picked from commit 24c75922d8476b5096657acb5a1b4c71454ca616)
2024-06-26 18:56:33 -06:00
Andreas Kling
7ce350b8c0 Tests: Add a basic test for Declarative Shadow DOM 2024-06-25 19:22:35 +02:00
circl
63fa32416d Base: Move test-webm.webm out of /home/anon 2024-06-24 09:45:41 -06:00
Andreas Kling
85a4cfc59b LibWeb: Add the bare minimum to render SVGAElement (<a>) 2024-06-23 19:15:24 +02:00
Andreas Kling
ae906ca497 LibWeb: Treat width: {min,max,fit}-content as auto if ratio unresolvable
This appears to match other engines.
2024-06-23 19:15:24 +02:00
Andreas Kling
db1faef786 LibWeb: Fix overeager fallback to stretch-fit width for some flex items
If a flex item has a preferred aspect ratio and the flex basis is not
definite, we were falling back to using stretch-fit for the main size,
since that appeared to match other browsers.

However, we missed the case where we actually have a definite cross size
through which the preferred aspect ratio can be naturally resolved.
2024-06-23 19:15:24 +02:00
Andreas Kling
9c02ace897 LibWeb: Allow flex-basis: {min,max,fit}-content 2024-06-23 19:15:24 +02:00
Edwin Hoksberg
2b30414c1d LibWeb: Add attribute list that must always be compared without casing 2024-06-22 15:52:04 +02:00
Tim Ledbetter
31d7fa2442 LibWeb: Fire auxclick event on middle click
Previously, no event was fired on middle click. This change also allows
the UI to open a link in a new tab on middle click.
2024-06-22 14:57:36 +02:00
Andreas Kling
63f8feb9a4 LibWeb: Implement RecordingPainter::draw_text() via draw_text_run()
To get away from the ancient (and buggy) text layout code in
Gfx::Painter, we want to remove all the uses of Painter::draw_text().

As a first step towards this, we implement the draw_text() display list
command in terms of the draw_text_run() command by performing the very
simple necessary layout in draw_text() beforehand.
2024-06-21 10:31:13 +02:00
Matthew Olsson
667e313731 LibWeb: Parse easing values manually
The values aren't that complex, so it doesn't make much sense to have a
dedicated generator for them. Parsing them manually also allows us to
have much more control over the produced values, so as a result of this
change, EasingStyleValue becomes much more ergonomic.
2024-06-16 07:12:46 +02:00
Andreas Kling
4c94202e97 LibWeb: Remove unnecessary FIXME marker for CSSStyleDeclaration.cssFloat 2024-06-14 20:45:37 +02:00
Andreas Kling
19fa630fa7 LibWeb: Make CSSKeyframeRule.parentRule actually point to parent rule 2024-06-14 20:45:37 +02:00
Andreas Kling
7f2c833a39 LibWeb: Implement CSSKeyframesRule.cssRuleList
To make this straightforward, CSSKeyframesRule now uses a CSSRuleList
for internal storage.
2024-06-14 20:45:37 +02:00
Andreas Kling
a12d28fd30 LibWeb: Implement CSSStyleDeclaration.parentRule
This readonly attribute returns the containing CSS rule, or null (in the
case of element inline style).
2024-06-14 20:45:37 +02:00
circl
dbc94ce92e Tests/LibWeb: Add test to verify correctness of getImageData 2024-06-14 16:54:32 +02:00
Andreas Kling
c14369e2e3 Tests: Update rebaseline-libweb-test script with new paths 2024-06-14 16:28:32 +02:00
Aliaksandr Kalenik
b2dcdf0096 LibWeb: Use button layout for input elements with button type 2024-06-14 07:58:55 +02:00
Aliaksandr Kalenik
8feaecd5c8 LibWeb: Create BlockContainer layout node for <input type="button">
...and shadow tree with TextNode for "value" attribute is created.
This means InlineFormattingContext is used, and button's text now
respects CSS text-decoration properties and unicode-ranges.
2024-06-14 07:58:55 +02:00
Hexeption
7ac6fd2746 LibWeb: Added HTMLLinkElement.as Tests 2024-06-13 07:58:11 +02:00
Kenneth Myhra
e70886595a LibWeb: Implement and wire up TransformStream's cancel callback 2024-06-09 21:27:26 -04:00
Kenneth Myhra
fc37bc328e Test/LibWeb: Add test to prove a ReadableStream can be cancelled 2024-06-09 21:27:26 -04:00
Kenneth Myhra
0ec0e92b10 LibWeb: Implement static method ReadableStream.from(asyncIterable) 2024-06-09 10:12:46 +02:00
Jamie Mansfield
0c683af57e LibWeb: Test referrerPolicy attribute on all elements 2024-06-08 08:01:42 +02:00
Jamie Mansfield
fdb4e05d7f LibWeb: Use a single test for loading attribute 2024-06-08 08:01:42 +02:00
Jamie Mansfield
1dda129fe1 LibWeb: Test fetchPriority attribute on all elements 2024-06-08 08:01:42 +02:00
Tim Ledbetter
2fed064791 Tests/LibWeb: Wait until document fully loaded before simulating click
This makes the `form-image-submission.html` test pass more reliably.
2024-06-08 07:59:21 +02:00
Andreas Kling
533eea1958 Tests: Skip Text/input/HTML/form-image-submission.html (flaky)
Issue: https://github.com/LadybirdWebBrowser/ladybird/issues/100
2024-06-07 19:39:45 +02:00
Jamie Mansfield
53d7aa53a2 LibWeb: Use Enumerated for HTMLScriptElement.referrerPolicy 2024-06-07 09:54:19 +02:00
Aliaksandr Kalenik
5285e22f2a LibWeb+WebContent: Move scrollbar painting into WebContent
The main intention of this change is to have a consistent look and
behavior across all scrollbars, including elements with
`overflow: scroll` and `overflow: auto`, iframes, and a page.

Before:
- Page's scrollbar is painted by Browser (Qt/AppKit) using the
  corresponding UI framework style,
- Both WebContent and Browser know the scroll position offset.
- WebContent uses did_request_scroll_to() IPC call to send updates.
- Browser uses set_viewport_rect() to send updates.

After:
- Page's scrollbar is painted on WebContent side using the same style as
  currently used for elements with `overflow: scroll` and
  `overflow: auto`. A nice side effects: scrollbars are now painted for
  iframes, and page's scrollbar respects scrollbar-width CSS property.
- Only WebContent knows scroll position offset.
- did_request_scroll_to() is no longer used.
- set_viewport_rect() is changed to set_viewport_size().
2024-06-05 07:03:42 +02:00
Jamie Mansfield
2ffda00347 LibWeb: Implement HTMLImageElement.crossOrigin 2024-06-05 05:42:47 +01:00
Jamie Mansfield
d7d60268ec LibWeb: Implement HTMLLinkElement.crossOrigin 2024-06-05 05:42:47 +01:00
Jamie Mansfield
8315ad6759 LibWeb: Implement HTMLImageElement.fetchPriority 2024-06-05 05:42:47 +01:00
Andrew Kaster
c6e9f0e7b5 Meta+Documentation: Switch default build dir to Build/Ladybird
Also prefer using the new top-level CMakeLists.txt
2024-06-04 13:44:22 -06:00
Andreas Kling
1670eda095 Tests/LibWeb: Remove layout test for Gfx::BitmapFont 2024-06-04 18:45:30 +02:00
Timothy Flynn
41c9cb032f Test: Skip flakey Text/input/WebAnimations/misc/DocumentTimeline test
Ref https://github.com/LadybirdWebBrowser/ladybird/issues/19
2024-06-03 11:42:18 -06:00
Timothy Flynn
bdbe2fdcc5 Everywhere: Replace SERENITY_SOURCE_DIR with LADYBIRD_SOURCE_DIR
In order to have checkouts of both SerenityOS and Ladybird, we need to
use a different environment variable for Ladybird.
2024-06-03 15:57:59 +02:00
Andrew Kaster
d057d24d72 Tests: Add log-file option to WPT runner script
Always dropping the log file in /tmp isn't the greatest DX for debugging
failures
2024-06-03 10:55:12 +02:00
Matthew Olsson
b5c682bc2e LibWeb: Copy the keyframes in KeyframeEffect's copy constructor 2024-06-03 10:53:32 +02:00
Matthew Olsson
37322baf54 LibWeb: Ensure all DocumentTimeline objects have the same time value
The DocumentTimeline constructor used the current millisecond time to
initialize its currentTime, but that means that a newly created timeline
would always have a different time value than other timelines that have
been through the update_animations_and_send_events function.
2024-06-03 10:53:32 +02:00
Jamie Mansfield
295c4ef51a LibWeb/Fetch: Use MimeType in DataURL 2024-06-02 19:55:53 +02:00
Matthew Olsson
0acf89234c LibWeb: Try to fix a flaky animation test
Not sure if this'll fix it fully, as the flake has only ever been
observed on CI.
2024-06-02 16:07:12 +02:00
Matthew Olsson
73aadddbc1 LibWeb: Reject invalid keyframe offset values 2024-06-02 16:07:12 +02:00
Matthew Olsson
e13cd914a9 LibWeb: Handle animating the 'all' property 2024-06-02 16:07:12 +02:00
Matthew Olsson
6859826e3d LibWeb: Handle persisting an animation after it has been removed 2024-06-02 16:07:12 +02:00
Matthew Olsson
a80af938eb LibWeb: Support subtree option in Animatable.getAnimations() 2024-06-02 16:07:12 +02:00
Matthew Olsson
e2cb25e35c LibWeb: Support interpolation of mixed percentage dimension units 2024-06-02 15:12:17 +02:00
Tim Ledbetter
4f0d6559f6 WPT: Update test expectations to match current test results 2024-05-30 11:03:56 -06:00
Tim Ledbetter
d7ea308664 WPT: Update to latest master
Previously, it was not possible to run `wpt` locally with a python
version >= 3.12.
2024-05-30 11:03:56 -06:00
Matthew Olsson
1965943026 LibWeb: Reject invalid AnimationEffect duration string values 2024-05-29 08:18:24 +02:00
Matthew Olsson
3e221fbb2d IDLGenerators: Handle restricted/unrestricted floating point types 2024-05-29 08:18:24 +02:00
Matthew Olsson
2bd8093449 LibWeb: Detect explicit null timeline given in KeyframeAnimationOptions
We already do this for the timeline argument in the KeyframeEffect
constructor
2024-05-29 08:18:24 +02:00
Tim Ledbetter
bb923983fc LibWeb: Implement WorkerGlobalScope.importScripts()
This method allows workers to synchronously import one or more scripts.
2024-05-29 08:17:18 +02:00
MacDue
f7bf14605c LibWeb: Remove PaintBorders recording painter command
`Painting::paint_all_borders()` only uses `.draw_line()` for simple
borders and `.fill_path()` for more complex cases. These are both
already supported by the `RecordingPainter` so removing this command
simplifies the painting API.

Two test changes:

css-background-clip-text: Borders are now drawn via the AA painter
(which makes them closer to how they appear in other browsers).

corner-clip-inside-scrollable: Borders removed (does not change test)
due to imperceptible sub-pixel changes.
2024-05-29 08:17:01 +02:00
Tim Ledbetter
d6297ec074 LibWeb: Cast to the correct type in Element::auto_directionality()
Previously, we always cast to a HTMLInputElement when getting the value
of an auto directionality form associated element. This caused
undefined behavior when determining the directionality of an element
that wasn't a HTMLInputElement.
2024-05-28 09:51:07 +02:00
Tim Ledbetter
0b0ad5c9db LibWeb: Calculate width property resolved value correctly
This means that relative width values are now correctly resolved when
calling `getComputedStyle()`.
2024-05-28 08:08:31 +02:00
Tim Ledbetter
7d192ed8c1 LibWeb: Don't crash on clicking a label with an associated text input
Previously, we assumed that all label control paintables were of type
`LabelablePaintable`. This caused a crash when clicking on a label with
a text input control.
2024-05-28 08:07:05 +02:00
Shannon Booth
6466fca20a LibWeb: Implement BaseAudioContext.createGain 2024-05-28 08:06:09 +02:00
Kenneth Myhra
dacba5e610 Tests/LibWeb: Initialize 'arrayBuffer' to an UInt8Array
This initializes 'arrayBuffer' to an UInt8Array so that we can
manipulate the contents of 'arrayBuffer'. The test verifies that the
internal buffer is an ArrayBuffer.

Also:
* Correct comparison in test so that we compare arrayBuffer to
  arrayClone, not to itself.
* Remove FIXME, this outputs [object ArrayBuffer] in Firefox and Chrome
  too.
2024-05-27 17:37:27 +02:00
Jamie Mansfield
600daea544 LibWeb: Implement HTMLIFrameElement.loading 2024-05-27 17:34:59 +02:00
Jamie Mansfield
9ee061ea14 LibWeb: Implement HTMLImageElement.loading
Removes some console noise while loading mmu.ac.uk :)
2024-05-27 17:34:59 +02:00
Andreas Kling
802af5ad9d LibWeb: Allow Element.insertAdjacentHTML on the document element
This fixes wpt/domparsing/insert_adjacent_html.html
2024-05-27 17:33:29 +02:00
Andreas Kling
e7febd347b LibWeb: Don't advertise the empty string as HTMLCollection property name
This fixes wpt/dom/collections/HTMLCollection-empty-name.html
2024-05-27 17:33:29 +02:00
Aliaksandr Kalenik
663cc753a7 LibWeb: Fix clip box calculation in PaintableWithLines
All painting commands except SetClipRect are shifted by scroll offset
before command list execution. This change removes scroll offset
translation for sample/blit corner commands in
`PaintableWithLines::paint` so it is only applied once in
`CommandList::apply_scroll_offsets()`.
2024-05-26 16:11:53 +01:00
MacDue
18d39deefe Tests/LibWeb: Add ref test for clip-path: polygon(...) 2024-05-26 07:55:50 +02:00
Shannon Booth
17ae65cedc LibWeb: Implement AudioBuffer.copyToChannel 2024-05-26 07:48:37 +02:00
Shannon Booth
67b1f4af55 LibWeb: Implement HTMLFormElement.encoding 2024-05-26 07:47:59 +02:00
Shannon Booth
aeb815cc66 LibWeb: Implement HTMLFormElement.enctype 2024-05-26 07:47:59 +02:00
Matthew Olsson
a8ef84f8c3 LibWeb: Use LengthPercentage for calc values in Transformation matrix 2024-05-25 22:19:47 +02:00
Aliaksandr Kalenik
e2b2b2439c LibWeb: Apply corner clip before scroll offset for PaintableWithLines
Fixes bug when corner clip mask moves along with the scrolled text.
2024-05-25 22:19:40 +02:00
Matthew Olsson
15a8baee03 LibWeb: Save time for animationcancel event before transitioning to idle
The if statement in the dispatch implies we are in the idle state, so of
course the active time will always be undefined. If this was cancelled
via a call to cancel(), we can save the time at that point. Otherwise,
just send 0.
2024-05-24 07:25:10 +02:00
Andreas Kling
f4636a0cf5 LibWeb: Stop spamming animation events on the wrong event target
This patch fixes two issues:

- Animation events that should go to the target element now do
  (some were previously being dispatched on the animation itself.)
- We update the "previous phase" and "previous iteration" fields of
  animation effects, so that we can actually detect phase changes.
  This means we stop thinking animations always just started,
  something that caused each animation to send 60 animationstart
  events every second (to the wrong target!)
2024-05-23 12:10:06 +02:00
Andrew Kaster
bab546472e LibWeb: Mark FontFaceSet as a setlike IDL interface
And implement more of the constructor logic.
2024-05-23 10:57:34 +02:00
Tim Ledbetter
d2b3007248 IDLGenerators: Use spec-compliant algorithm to parse integer values 2024-05-23 04:15:46 +02:00
Tim Ledbetter
2a7cf1c588 LibWeb: Implement the width and height attributes where missing
This change adds the `width` and `height` properties to
`HTMLVideoElement` and `HTMLSourceElement`. These properties reflect
their respective content attribute values.
2024-05-21 19:28:43 +02:00
Tim Ledbetter
9f9aa62128 LibWeb: Implement the hspace and vspace attributes
These properties reflect their respective content attributes.
2024-05-21 19:28:43 +02:00
Kenneth Myhra
e2c4019bfc LibWeb: Close acquired writer in AO readable_stream_pipe_to()
Also adds a test to prove that the WritableStream's close callback is
called.
2024-05-20 16:57:52 -04:00
Tim Ledbetter
a6d6729034 LibWeb: Implement the MouseEvent.relatedTarget attribute
This returns the secondary target of a mouse event. For `onmouseenter`
and `onmouseover` events, this is the EventTarget the mouse exited
from. For `onmouseleave` and `onmouseout` events, this is the
EventTarget the mouse entered to.
2024-05-20 08:21:41 +02:00
Jamie Mansfield
08a3904309 LibWeb/MimeSniff: Implement "minimize a supported MIME type"
See:
- https://github.com/whatwg/mimesniff/commit/227a469
2024-05-19 16:25:50 +02:00
Shannon Booth
3ccbc83168 LibWeb: Add a stubbed slot for DynamicsCompressorNode.reduction
For now, this slot is always 0 - (the default value per spec). But
once we start actually processing audio streams this internal slot
should be changed correspondingly.
2024-05-19 09:26:20 +02:00
Shannon Booth
cf615cbd1c LibWeb: Add AudioParams for DynamicsCompressorNode 2024-05-19 09:26:20 +02:00
Shannon Booth
ccdf82c9be LibWeb: Implement scrollIntoView with 'center' block position
This fixes a crash on:

https://docs.github.com/en/get-started/learning-about-github/githubs-plans
2024-05-19 07:22:17 +02:00
Shannon Booth
dd20156010 LibWeb: Fix division by zero on a zero-height viewport SVG image 2024-05-19 07:19:42 +02:00
Shannon Booth
d48316ce15 LibWeb: Fix division by zero on a zero-width viewport SVG image
We were previously crashing by a division by zero due to an aspect ratio
of zero on https://comicbookshop.co.nz/
2024-05-19 07:19:42 +02:00
Tim Ledbetter
c36ba450be LibWeb: Generate binding for HTMLObjectElement.contentWindow attribute
This only required adding the appropriate definition to the IDL file,
as `NavigableContainer` already implements the logic that we need.
2024-05-18 18:12:08 +02:00
Tim Ledbetter
2447a25753 LibWeb: Implement the labels attribute for all labelable elements
This returns a `NodeList` of all the labels associated with the given
element.
2024-05-18 18:09:18 +02:00
Tim Ledbetter
3dc86747f0 LibWeb: Implement the HTMLOutputElement.htmlFor attribute
This returns a DOMTokenList that reflects the `for` attribute.
2024-05-18 11:23:20 +02:00
Tim Ledbetter
acc1fa3c62 LibWeb: Generate binding for the HTMLObjectElement.form attribute
This only required adding the appropriate definition to the IDL file,
as `FormAssociatedElement` already implements the logic that we need.
2024-05-18 11:04:04 +02:00
Tim Ledbetter
6bf22075ed LibWeb: Implement the HTMLLabelElement.form attribute
This returns the form element associated with the given label element's
control or null if the label has no control.
2024-05-18 11:04:04 +02:00
Tim Ledbetter
d0555f3176 LibWeb: Flesh out DOMTokenList::supports() implementation
This change makes `DOMTokenList::supports()` work as expected for
`relList` attributes.
2024-05-16 20:31:23 +02:00
Tim Ledbetter
51fc30a191 LibWeb: Implement the HTMLLinkElement.relList attribute
This returns a DOMTokenList that reflects the `rel` attribute.
2024-05-16 08:06:26 +02:00
Tim Ledbetter
fc4e0cf10e LibWeb: Implement the HTMLFormElement.relList attribute
This returns a DOMTokenList that reflects the `rel` attribute.
2024-05-16 08:06:26 +02:00
Tim Ledbetter
0a3e1846f0 LibWeb: Implement the HTMLAreaElement.relList attribute
This returns a DOMTokenList that reflects the `rel` attribute.
2024-05-16 08:06:26 +02:00
Tim Ledbetter
b7fd39c2e6 LibWeb: Implement the HTMLAnchorElement.relList attribute
This returns a DOMTokenList that reflects the `rel` attribute.
2024-05-16 08:06:26 +02:00
Tim Ledbetter
763b7f0e0c LibWeb: Implement the HTMLOptionElement.form attribute
This returns the parent form of a HTMLOptionElement or null if the
element has no parent form.
2024-05-16 08:03:13 +02:00
Andrew Kaster
28f728dfdb LibWeb: Implement FontFace.load() for url() based font sources 2024-05-16 08:02:43 +02:00
MacDue
6c9069fa5d LibWeb: Implement the SVG clip-rule attribute
This controls the fill rule used when rasterizing `<clipPath>` elements.
2024-05-14 23:01:18 +01:00
Andrew Kaster
60b3436ea3 LibWeb: Support loading FontFaces constructed with binary data 2024-05-14 12:31:10 -06:00
Shannon Booth
452ffa56dc LibWeb: Implement BaseAudioContext.createDynamicsCompressor 2024-05-14 13:45:43 -04:00
Shannon Booth
27242c6be6 LibWeb: Implement Document.dir
This was seen getting called on stuff.co.nz (before it crashes due to an
unrelated navigation bug)
2024-05-14 13:35:36 -04:00
Shannon Booth
9b6a1de777 LibWeb: Implement URL.parse
This was an addition to the URL spec, see:

https://github.com/whatwg/url/commit/58acb0
2024-05-13 09:21:12 +02:00
Shannon Booth
5a0f7c5f63 LibWeb/Tests: Add a basic test for a blob URL given to a Worker 2024-05-12 15:46:29 -06:00
Shannon Booth
5e7678d1c6 LibWeb: Implement AudioBuffer.copyFromChannel 2024-05-12 19:11:37 +02:00
Shannon Booth
793cab7357 LibWeb: Add a test for construction of WheelEvent 2024-05-12 14:24:18 +00:00
Shannon Booth
e5206f5529 LibWeb: Only use lowercase attributes on toggle for HTML documents 2024-05-12 07:28:09 +01:00
Shannon Booth
4fd7d58c51 LibWeb/Tests: Add a layout test for insertAdjacentHTML 2024-05-11 12:53:26 +02:00
Andrew Kaster
2bc51f08d9 LibWeb: Implement or stub FontFace interface's attribute getters/setters
We only support parsing half of these, so the ones we don't recognize
get a friendly exception thrown.
2024-05-11 07:30:29 +01:00
Timothy Flynn
1fbf1bc4ac LibWeb: Don't try to click a form image until it has loaded
We are often trying to click the image before it has finished loading.
This results in us trying to click a 0x0 rect. Instead, wait until the
image load event.

This fixes a flake with form-image-submission.html often seen on CI.
2024-05-09 19:29:47 +02:00
Shannon Booth
71819153cb LibWeb: Implement Element::scroll(HTML::ScrollToOptions) 2024-05-07 17:21:52 -06:00
Tim Ledbetter
57f0ea186e LibWeb: Update Element::directionality() to match current spec text
This fixes a crash that occurred when determining the directionality of
input elements.
2024-05-07 16:45:28 -06:00
Jamie Mansfield
8c4dc9476b LibWeb: Precision when using background-size: contain
This ensures that precision is maintained when calculating the image
size when using `background-size: contain`.
2024-05-07 11:15:04 -04:00
Jamie Mansfield
e48cb80a66 LibWeb: Precision when using background-size: cover
This ensures that precision is maintained when calculating the image
size when using `background-size: cover`.
2024-05-07 11:15:04 -04:00
matjojo
cd1eeb3cdd LibWeb: Do not consume scroll event in PaintableBox without overflow
Specifically, without scrollable overflow.

Fixes #24009, both on brave.com and on the reduction.
2024-05-07 14:04:02 +00:00
MacDue
b5a7a8dbfd Tests/LibWeb: Add ref tests for non-local SVG clipPaths 2024-05-04 21:24:37 +02:00
Shannon Booth
f7ba07cc8b LibWeb: Handle non-object JSON in XMLHttpRequest response
This fixes a crash seen on https://web.basemark.com/run/
2024-05-04 14:11:10 +02:00
Shannon Booth
94354ea7fb LibWeb: Clamp AudioParam's value between min and max
The spec isn't _super_ clear on how this is meant to be done, but the
way I understand this is that we should simply clamp the returned
'current value' between 'min' and 'max'.

Firefox does not appear to do this clamping, but Chrome does.
2024-05-04 14:01:38 +02:00
Shannon Booth
e2b5ff2450 LibWeb: Implement OscillatorNode.frequency
Which is an AudioParam clamped by the nyquist_frequency.
2024-05-04 14:01:38 +02:00
Shannon Booth
099c9e4a7e LibWeb: Implement OscillatorNode.type
This is a simple getter and setter of the OscillatorType enum, with
error checking to not allow 'custom', as that should only be changed
through 'setPeriodicWave()'.
2024-05-04 14:01:38 +02:00
Shannon Booth
b48ba823b9 LibWeb: Implement AudioNode.context
This is just a simple getter which returns the audio context that
created this audio node.
2024-05-04 14:01:38 +02:00
Shannon Booth
97576d27b9 LibWeb: Add constructor for OscillatorNode
This is still missing a bunch of spec steps to construct the
audio node based on the parameters of the OscillatorNode, but it is at
least enough to construct an object to be able to add a basic test which
can get built upon as more is implemented.
2024-05-04 14:01:38 +02:00
Shannon Booth
e070309258 LibWeb: Implement Element.outerHTML setter 2024-05-04 13:54:33 +02:00
Andreas Kling
527ad9ac01 LibWeb: Implement XMLHttpRequest.responseURL
This was used on https://twinings.co.uk/ so let's support it :^)
2024-05-01 12:52:03 +02:00
Andreas Kling
34f2cbf202 LibWeb: Honor intrinsic constraints on available space in table widths
When a table's containing block provides min-content or max-content
available space, we now size the table's width accordingly.
2024-05-01 11:13:48 +02:00
Tim Ledbetter
02a8966b61 LibWeb: Serialize empty media rules with a single newline
This deviates from the CSSOM specification but all modern browsers do
this.
2024-05-01 07:21:21 +02:00
Tim Ledbetter
a2cccf9420 LibWeb: Use correct spacing when serializing media features
Previously, there was no space between the media feature name and value.
2024-05-01 07:21:21 +02:00
Andrew Kaster
416eb74fa5 Tests: Skip flaky unicode-range LibWeb Ref test
This seems related to CSS resources and the load event.
2024-04-30 07:18:40 -06:00
Tim Ledbetter
b9f0ea2178 LibWeb: Evaluate media rules for adopted style sheets
Previously, media rules were not evaluated for adopted style sheets.
2024-04-29 08:10:38 +02:00
Tim Ledbetter
f4e0c5395a LibWeb: Don't apply disabled adopted style sheets to the document
Previously, we would apply any adopted style sheet to the document if
its alternate flag was not set. This meant that all adopted style
sheets would be applied, since constructed style sheets never have this
flag set.
2024-04-29 08:10:38 +02:00
Tim Ledbetter
84193f2746 LibWeb: Align StyleSheet title getter with the specification
The CSSOM specification says that StyleSheet.title should return null
if the title field is empty.
2024-04-29 08:10:38 +02:00
Aliaksandr Kalenik
7bea2b68f4 LibWeb: Paint non-positioned SC with z-index=0 in paint_descendants()
Fixes the bug when non-positioned boxes that establish a stacking
context and have z-index=0 are ignored during paint commands recording.
2024-04-28 22:28:18 +02:00
Timothy Flynn
34b446ab34 LibWeb: Assign the Content-Type fetch response header as appropriate
The condition here was inverted.
2024-04-28 12:32:04 +02:00
Aliaksandr Kalenik
613cd6104d LibWeb: Support masking of SVGForeignObjectPaintable 2024-04-27 07:10:20 +02:00
Timothy Flynn
c9a461ee75 LibWeb: Remove OOM propagation from Fetch::Infrastructure::HTTP 2024-04-27 07:08:14 +02:00
Tim Ledbetter
1127fa1e01 IDLGenerators: Set namespace object prototype to Object.prototype
Previously, namespace objects were constructed with no prototype, so
calling methods like `toString()` on them would unexpectedly throw an
exception.
2024-04-26 20:02:42 +02:00
Tim Ledbetter
dda730c46b LibWeb: Exclude [Global] interfaces from legacy platform object method
Previously, [Global] interfaces were not excluded from the
`internal_own_property_keys()` call. This caused a crash when iterating
over the properties of the Window object.
2024-04-26 20:02:21 +02:00
Aliaksandr Kalenik
dc4192c149 LibWeb: Remove CSS transform from InlinePaintable's clip rectangle
Fixes bug when CSS transform is applied twice to clip rect:
- While calculating absolute clip rectangles in `refresh_clip_state()`
- While executing `PushStackingContext` painting command.

Duplicated transform is already removed for PaintableBox and this change
adds this for InlinePaintable.
2024-04-26 18:40:45 +02:00
Shannon Booth
baaaa0008e LibWeb: Look for first ID _or_ name in HTMLCollection::named_item
Previously we would look for a matching ID, and then for a matching
name. If there was an element in the collection which had a matching ID
as well as an element with a matching name, we would always return the
element with a matching ID irrespective of what order that element was
in.
2024-04-26 07:44:01 -04:00
Timothy Flynn
f6407276f7 LibWeb: Stop the video decoder thread when the video element is GC'd
Otherwise, the thread will continue to run and access the media data
buffer, which will have been freed.

The test here is a bit strange, but the issue would only consistently
repro after several GC runs.
2024-04-26 09:49:11 +02:00
Shannon Booth
0c8a98ac94 LibWeb: Begin implementing the interface for AudioBuffer
Implement the constructor and getChannelData function, working towards
the functionality that we need in order to implement
OfflineAudioContext.
2024-04-25 19:26:19 -04:00
goldenzach
65eb7699f4 LibWeb: Resolve vertical padding of inline elements 2024-04-25 12:45:39 +02:00
Aliaksandr Kalenik
988c8451d4 LibWeb: Skip HTMLLinkElement resource fetching for documents without BC
Fixes crashing after following steps:
1. Open https://github.com/SerenityOS/serenity
2. Click on "Pull requests" tab

The problem was `navigable` null pointer dereferencing in
`decode_favicon()`. But navigable is null because the document was
created by `parseFromString()` DOMParser API.

With this change we skip fetching initiated by HTMLLinkElement if
document does not have a browsing context:
- Favicon is not displayed for such documents so no need to fetch.
- Stylesheets fetching won't affect such document because style or
  layout does not run for them.
2024-04-25 09:31:01 +02:00
Cnidarias
1a1e5aaf54 LibWeb: Add null check for get_client_rects() on non paintable elements 2024-04-24 18:04:28 +02:00
Bastiaan van der Plaat
7fa45c5fdf LibWeb: Add map element areas property 2024-04-24 15:23:45 +02:00
Bastiaan van der Plaat
3e507102ea LibWeb: Add datalist element options property 2024-04-24 15:23:45 +02:00
Andrew Kaster
651e78fedb LibWeb: Convert callers of ImageCodecPlugin to the async API
The HTMLLinkElement caller is a bit hairy, so we shove an await() in
there temporarily. This is sure to cause fun times for anyone debugging
task/microtask execution order.
2024-04-23 12:32:04 -06:00
Aliaksandr Kalenik
d4f08fb0a1 LibWeb: Fix division by zero in solve_replaced_size_constraint()
Happened when input_width > 0 but input_height == 0.

Fixes crashing on Discord that happens after clicking on direct
messages conversation.
2024-04-23 16:21:48 +02:00
Aliaksandr Kalenik
a044e9cf4f LibWeb: Add background-clip: text support for InlinePaintable
Moves background mask calculation into `paint_background()` that is
shared between PaintableBox and InlinePaintable.
2024-04-23 12:50:07 +02:00
Tim Ledbetter
3aea14093f LibWeb: Don't crash if the document element is not visible
Previously, setting the `hidden` property on the `<html>` element would
cause a crash.
2024-04-23 11:17:54 +02:00
Aliaksandr Kalenik
dd73cccf8f LibWeb: Fire "scroll" events on DOM elements
Before this change "scroll" events were only fired on document but now
it happens for all elements with scrollable overflow.
2024-04-23 11:00:35 +02:00
Andreas Kling
8e56367092 LibWeb: Allow moving StyleSheets between documents without falling apart
We have to unregister link element stylesheets from the old document's
StyleSheetList when moving them into a new document.

This makes it possible to load GitHub contributor graphs. :^)
2024-04-22 06:43:05 +02:00
Andreas Kling
193fc7ef98 LibWeb: Allow cloneNode() to clone elements with weird attributes
We can't rely on Element.setAttribute() in cloneNode() since that will
throw on weird attribute names. Instead, just follow the spec and copy
attributes into cloned elements verbatim.

This fixes a crash when loading the "issues" tab on GitHub repos.
They are actually sending us unintentionally broken markup, but we
should still support cloning it. :^)
2024-04-21 19:51:24 +02:00
Aliaksandr Kalenik
23d683cf6b LibWeb: Update document url after same-document back/forward navigation
Seems like a specification bug, but other browsers update url before
popstate event is fired and so should we.

Fixes back/forward navigation on GitHub.
2024-04-21 12:41:36 +02:00
Aliaksandr Kalenik
9540af6489 LibWeb: Fix nodesToRemove collecting traversal in Range::delete_contents
With this change children are no longer skipped in tree traversal when
start node of range equals to end node of range.

Fixes https://github.com/SerenityOS/serenity/issues/24036
2024-04-20 13:32:24 +02:00
Aliaksandr Kalenik
d3cfe35fbd LibWeb: Do not destroy document until whole subtree completed unloading
Fixes crashing when "unload" event handler tries to access active
document that has already been destroyed.
2024-04-20 10:22:14 +02:00
Alex
13abb1b2c7 LibWeb: Add name validation and document check to setAttribute
Co-authored-by: Rayyan Hamid <rayyanbwp@gmail.com>
Co-authored-by: Christian Ewing <u1273549@utah.edu>
Co-authored-by: Austin Fashimpaur <austin.fashimpaur@gmail.com>
2024-04-19 06:32:41 -04:00
Andreas Kling
5ef6df79ed LibWeb: Generate a simple error page when XML decode/parse fails
This fixes a regression on Acid3, since we are not expected to "best
effort" parse XML. The test specifically checks that you don't create an
incomplete, incorrect DOM.
2024-04-19 11:44:32 +02:00
PGHales
75626c6cd2 LibWeb/DOM: Implement the Document object's partial attributes 2024-04-19 10:58:45 +02:00
Aliaksandr Kalenik
7b75d0c1f0 LibWeb: Fix height distribution in "vertical-align: baseline" in TFC
This line changes padding top to align cell content to baseline:
`cell.padding_top += m_rows[cell.row_index].baseline - cell.baseline`

Which means available for distribution height `height_diff` could have
changed so it needs to be refreshed before assigning the rest of it to
padding bottom:
`cell_state.padding_bottom += height_diff;`

Fixes https://github.com/SerenityOS/serenity/issues/22032
2024-04-19 10:55:28 +02:00
Andreas Kling
eb2c05e906 Tests/LibWeb: Fix rebaseline-libweb-test after RequestServer changes 2024-04-19 10:53:20 +02:00
Andreas Kling
4a795bef48 Tests/LibWeb: Fix iframe-load-event-for-bad-xml.html test
This was supposed to be an async test (and work correctly, too!)

This fixes up fa43321938
2024-04-18 21:17:01 +02:00
Andreas Kling
fa43321938 LibWeb: Fire iframe load event for frames with badly encoded XML
When loading an XML resource into an iframe and the resource fails to
decode (e.g due to invalid UTF-8), we must still fire a load event.

This fixes the regression in subtest 69 of Acid3.
2024-04-18 15:40:16 +00:00
Aliaksandr Kalenik
bad86ca6b4 LibWeb: Ignore mousewheel events in ViewportPaintable
That allow EventHandler process wheel event on corresponding navigable.
For top-level navigable that means IPC call to let chrome know about
scrollbar position update.

Fixes https://github.com/SerenityOS/serenity/issues/23599
Fixes https://github.com/SerenityOS/serenity/issues/23493
Fixes https://github.com/SerenityOS/serenity/issues/23966
2024-04-18 12:27:24 +02:00
Aliaksandr Kalenik
eb4f36e5a1 Tests/LibWeb: Add a test for iframe load event when src has xml type
Reduction from Acid3 that was fixed by changing
guess_mime_type_based_on_filename() to support xml extension.
2024-04-18 08:10:05 +00:00
Aliaksandr Kalenik
d876f32e5d LibWeb: Skip creating a navigable for <object> not connected to document
Navigation should not run for <object> element until it is inserted into
a document. Spec deoes not seem to explicitely say that, but that
matches other browsers behavior.

Fixes hanging after reloading in Acid3 test.
2024-04-18 08:09:51 +00:00
Andreas Kling
41667f969d LibWeb: Fix two problems where media queries didn't invalidate properly
There were two things going wrong here:

- Transformed text (via CSS text-transform) was not invalidated after a
  `@media` rule changed state.

- Removing the `style` attribute from an element didn't trigger a style
  update.

This fixes the regression in subtest 46 of Acid3.

Fixes #21777
2024-04-17 14:18:31 +02:00
Timothy Flynn
bf1c82724f LibWeb: Default to an empty string when a string attr substitution fails
When a string-type attr() substitution produces no value and no fallback
had been specified, the spec mandates we default to the empty string.
2024-04-17 07:13:26 +02:00