Commit Graph

3099 Commits

Author SHA1 Message Date
Andreas Kling
2a888ca626 LibGfx: Remove home-grown JPEG codec in favor of libjpeg-turbo 2024-06-17 17:59:54 +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
Timothy Flynn
273694d8de LibJS+LibLocale: Replace date-time formatting with ICU
This uses ICU for the Intl.DateTimeFormat `format` `formatToParts`,
`formatRange`, and `formatRangeToParts`.

This lets us remove most data from our date-time format generator. All
that remains are time zone data and locale week info, which are relied
upon still for other interfaces. So they will be removed in a future
patch.

Note: All of the changes to the test files in this patch are now aligned
with other browsers. This includes:

* Some very incorrect formatting of Japanese symbols. (Looking at the
  old results now, it's very obvious they were wrong.)
* Old FIXMEs regarding range formatting not including the start/end date
  when only time fields were requested, but the dates differ.
* Day period inconsistencies.
2024-06-13 07:42:09 +02:00
Diego
40fcb00c14 LibWasm: Add missing spec-test imports 2024-06-11 02:43:55 +02:00
Tim Ledbetter
1a4b042664 LibURL: Convert ASCII only URLs to lowercase during parsing
This fixes an issue where entering EXAMPLE.COM into the URL bar in the
browser would fail to load as expected.
2024-06-10 20:34:57 -04: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
Diego
7560b640f3 AK: Add AllowSurrogates to UTF-8 validator
The [UTF-8](https://datatracker.ietf.org/doc/html/rfc3629#page-5)
standard says to reject strings with upper or lower surrogates. However,
in many standards, ECMAScript included, unpaired surrogates (and
therefore UTF-8 surrogates) are allowed in strings. So, this commit
extends the UTF-8 validation API with `AllowSurrogates`, which will
reject upper and lower surrogate characters.
2024-06-09 12:16:32 +02:00
Enver Balalic
64e27cb659 LibWasm: test-wasm: Default initialize u128 parameter bits to 0
This fixes 326 tests.

18802 failed without
18476 failed with.
2024-06-09 12:14:59 +02:00
Timothy Flynn
9724a25daf LibJS+LibLocale: Replace canonical locales and display names with ICU
Note: We keep locale parsing and syntactic validation as-is. ECMA-402
places additional restrictions on locales above what is required by the
Unicode spec. ICU doesn't provide methods that let us easily check those
restrictions, whereas LibLocale does. Other browsers also implement
their own validators here.

This introduces a locale cache to re-use parsed locale data and various
related structures (not doing so has a non-negligible performance impact
on Intl tests).

The existing APIs for canonicalization and display names are pretty
intertwined, so they must both be adapted at once here. The results of
canonicalization are slightly different on some edge cases. But the
changed results are actually now aligned with Chrome and Safari.
2024-06-09 10:47:28 +02: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
Andrew Kaster
0c9dced888 Meta: Remove trivially unused Kernel API headers 2024-06-07 09:44:41 +02:00
Timothy Flynn
8362c073f3 Everywhere: Remove LibSQL, SQLServer, and the sql REPL :^)
It is now entirely unused and replaced by sqlite3.
2024-06-06 11:27:03 -04:00
Daniel Bertalan
376b956214 Tests: Stop invoking UB in AK::NeverDestroyed's tests
Instead of attempting a stack use-after-free by reading an out-of-scope
object's data member, let's keep a flag that checks if the destructor
had been called in the outer scope.

Fixes #64
2024-06-05 17:19:14 -06:00
Andrew Kaster
90af26e309 Meta+CMake: Remove unused CMake functions and features
Goodbye, serenity_components and Jakt.
2024-06-05 12:23:54 -04:00
Andreas Kling
254d040ff4 LibGfx: Move Gfx::Painter::ScalingMode => Gfx::ScalingMode
This will allow users to avoid including Painter.h
2024-06-05 15:37:05 +02:00
Andreas Kling
6a96920dbc LibGfx: Remove Bitmap and Painter "scale" concept
We don't need intrinsic scale factors for Gfx::Bitmap in Ladybird,
as everything flows through the CSS / device pixel ratio mechanism.

This patch also removes various unused functions instead of adapting
them to the change.
2024-06-05 15:37:05 +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
cd84d23afa Base+Tests+Ladybird: Remove bitmap fonts 2024-06-04 18:45:30 +02:00
Andreas Kling
1670eda095 Tests/LibWeb: Remove layout test for Gfx::BitmapFont 2024-06-04 18:45:30 +02:00
Andreas Kling
04a6e2f83d LibWeb: Remove Gfx::BitmapFont
This class supported the binary bitmap font file format in SerenityOS,
and isn't something we need in Ladybird.
2024-06-04 18:45:30 +02:00
Andreas Kling
6321e97b09 AK: Remove various unused things 2024-06-04 09:19:39 +02:00
Andreas Kling
e4cd91761d Everywhere: Remove LibMarkdown
This was used to convert markdown into HTML for display in the browser,
but no other browser behaves this way, so let's simplify things by
removing it.

(Yes, we could implement all kinds of "convert to HTML and display" for
every file format out there, but that's far outside the scope of a
browser engine.)
2024-06-04 09:19:39 +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
Andreas Kling
e70d96e4e7 Everywhere: Remove a lot more things we don't need 2024-06-03 10:53:53 +02:00
Andreas Kling
421aa7c475 Everywhere: Remove more unused components 2024-06-03 10:53:53 +02:00
Tim Ledbetter
cc435e7a78 Tests: Remove tests for unused components 2024-06-03 10:53:53 +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
Nico Weber
857750dfed LibGfx/WebPLoader: Survive calling loop_count() before other accessors
Fixes `animation` asserting when reading a webp input.

(The other order of operations is still covered by TestImageWriter.cpp.)
2024-06-03 07:48:53 +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
Diego
d906255cbb LibWasm: Improve table support
Implements `table.get`, `table.set`, `elem.drop`, `table.size`,
and `table.grow`. Also fixes a few issues when generating ref-related
spectests. Also changes the `TableInstance` type to use
`Vector<Reference>` instead of `Vector<Optional<Reference>>`, because
the ability to be null is already encoded in the `Reference` type.
2024-06-01 16:21:03 +02:00
Nico Weber
3ca6dfba48 Tests: Add test for color indexing for single-channel images
The color indexing transform shouldn't make single-channel images
larger (by needlessly writing a palette). If there <= 16 colors
in the single channel, it should make the image smaller.
2024-06-01 14:52:00 +02:00
Timothy Flynn
fe3fde2411 AK+LibUnicode: Implement a case-insensitive variant of find_byte_offset
The existing String::find_byte_offset is case-sensitive. This variant
allows performing searches using Unicode-aware case folding.
2024-06-01 07:37:54 +02:00
Nico Weber
d8103247d9 Tests: Check that color indexing reduces file size 2024-05-31 22:39:25 +02:00
Nico Weber
533b29dde7 LibGfx/WebPWriter: Add a toggle for disabling individual transforms 2024-05-31 22:39:25 +02:00
Nico Weber
4a327d98a4 Tests: Add a test that triggers the webp color indexing saving path 2024-05-31 22:39:25 +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
5740f93ef4 ClangPlugins: Check for strong root fields in GC allocated objects
GC-allocated objects should never have JS::SafeFunction/JS::Handle
fields.

For now the plugin only emits warnings here, as there are many cases
of this occurring in the codebase that aren't trivial to fix. It is also
behind a CMake flag since it is a _very_ loud warning.
2024-05-30 09:29:20 -06:00
Matthew Olsson
f860763c77 Tests: Add tests for ClangPlugin's macro validation 2024-05-30 09:29:20 -06:00
Matthew Olsson
c739ae3e02 ClangPlugins: Change name of variable used for test compile options
This makes it more clear what it is used for
2024-05-30 09:29:20 -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
Nico Weber
ab0219bb08 Tests: Remove a FIXME
This mostly works by accident now (see previous commit), but hey,
it works.
2024-05-29 07:10:00 +01: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
Lucas CHOLLET
09f4032eeb LibGfx/PNG: Read metadata from the eXIf chunk
The test image comes from this WPT test:
http://wpt.live/png/exif-chunk.html
2024-05-26 14:54:43 +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
Lucas CHOLLET
fb79aa6159 LibGfx/GIF: Correctly write frames with a non-null position 2024-05-25 06:42:15 +01:00
Nico Weber
934516d75b Tests/LibGfx: Don't use a color name as an ARGB32 value
...and use a different color name until a (relatively harmless) bug
writing fully-opaque frames to an animation that also has transparent
frames is fixed. (I've had a local fix for that for a while, but
I'm waiting for #24397 to land.)
2024-05-25 06:36:20 +01: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
Matthew Olsson
6a4938a524 ClangPlugins: Convert all warnings to errors
Now that the lambda capture plugin isn't full of false-positives, we can
make the jump and start halting builds for these errors. It also allows
these plugins to be useful in CI.
2024-05-22 21:55:34 -06:00
Matthew Olsson
573bbd47ee Tests: Update ClangPlugins to use C++23 when running Clang 2024-05-22 21:55:34 -06:00
Matthew Olsson
a98ad191c7 Userland: Add ESCAPING annotations to a bunch of places
This isn't comprehensive; just a result of a simple grep search.
2024-05-22 21:55:34 -06:00