Commit graph

62816 commits

Author SHA1 Message Date
Andreas Kling 9f1a853cc8 LibGfx: Add ability to pass NonnullRefPtr<Gfx::Bitmap> over IPC 2024-07-18 09:05:10 +02:00
Alec Murphy 20e2cc12a8 Documentation: Add missing Fedora dependency
This PR adds the dependency `zlib-ng-compat-static` which is required
for building on Fedora.
2024-07-18 07:36:38 +01:00
Daniel Bertalan a4645060e6 CMake: Add hardening flags
- `-fstack-protection-strong` enables stack canaries for functions where
  addresses of local variables are taken or arrays/structures
  containing arrays are allocated on the stack.
- `-fstrict-flex-arrays=2` causes the compiler to only treat arrays with
  unknown bounds (`[]`) or zero-length-arrays (`[0]`) as *flexible array
  members*, allowing the sanitizers to emit bounds checks for structs
  with proper arrays as their last member.

More rigorous options (such as AArch64 pointer authentication, Control
Flow Integrity, _FORTIFY_SOURCE) should be investigated in the future,
however this is a good baseline.
2024-07-17 21:51:29 +02:00
Daniel Bertalan c62240aa80 Everywhere: Warn on function definitions without prototypes
If no header includes the prototype of a function, then it cannot be
used from outside the translation unit it was defined in. In that case,
it should be marked as `static`, in order to avoid possible ODR
problems, unnecessary exported symbols, and allow the compiler to better
optimize those.

If this warning triggers in a function defined in a header, `inline`
needs to be added, otherwise if the header is included in more than one
TU, it will fail to link with a duplicate definition error.

The reason this diff got so big is that Lagom-only code wasn't built
with this flag even in Serenity times.
2024-07-17 21:51:29 +02:00
Daniel Bertalan 7fe82a1cda CMake: Add back stricter warnings used in Serenity builds
These used to be enabled in `serenity_compile_options.cmake` for
Serenity builds and were removed in 9b05fb98. This is a slightly more
conservative subset of those, with ones that are enabled by default
omitted.

This should prevent our code quality regressing in the long run.
2024-07-17 21:51:29 +02:00
Jamie Mansfield 0961d68ebc LibWeb: Stub Text.wholeText 2024-07-17 18:19:09 +01:00
Jamie Mansfield 807e63faaf LibWeb: Implement MouseEvent.initMouseEvent 2024-07-17 18:19:09 +01:00
Jamie Mansfield 3845d174e3 LibWeb: Implement KeyboardEvent.initKeyboardEvent 2024-07-17 18:19:09 +01:00
Jamie Mansfield aefab1de38 LibWeb: Short-circuit UIEvent.initMouseEvent if dispatched
This fixes some bugs on wpt.dom/events/Event-init-while-dispatching.html,
although the test still fails due to [GH-23722].

[GH-23722]: https://github.com/SerenityOS/serenity/issues/23722
2024-07-17 18:19:09 +01:00
Jamie Mansfield 87880e9b81 LibWeb/HTML: Remove FIXMEs from HTMLTrackElement constants 2024-07-17 18:19:09 +01:00
Jamie Mansfield 66c3388b16 LibWeb: Implement Performance.toJSON 2024-07-17 18:19:09 +01:00
Jamie Mansfield e8fe7c0ee3 LibWeb: Prevent infinite loop in create_an_inheritance_stack
This would continually loop on the same interface.

Co-authored-by: Matthew Olsson <matthewcolsson@gmail.com>
2024-07-17 18:19:09 +01:00
Jamie Mansfield 116c1f835d LibWeb/DOM: Add FIXMEs for missing functions in Node 2024-07-17 18:19:09 +01:00
Jamie Mansfield 62f74f3b77 LibWeb/DOM: Match order of Node.idl with the spec
This makes it easier to compare with the spec :^)
2024-07-17 18:19:09 +01:00
doctortheemh 0140e5e9cc LibGfx: Decode WebP images with libwebp 2024-07-17 10:04:25 -06:00
Nico Weber 83d0452e69 LibGfx/WebPLoader: Use transparent black as animation background color
This matches libwebp (see ZeroFillCanvas() call in
libwebp/src/demux/anim_decode.c:355 and ZeroFillFrameRect() call
in line 435, but in WebPAnimDecoderGetNext()) and makes files
written e.g. by asesprite look correct -- even though the old
behavior is also spec-compliant and arguably makes more sense.
Now nothing looks at the background color stored in the file.

See PR for an example image where it makes a visible difference.

Cherry-picked from serenityos master
276a904d20ffe260b5544a9ace9841d083e0243
2024-07-17 10:04:25 -06:00
Aliaksandr Kalenik be644e5d5d LibWeb: Use blur_radius / 2 as sigma to blur text shadow using Skia
This change is needed to match behavior of default Gfx::Painter.

Fixes Tests/LibWeb/Ref/text-shadow.html
2024-07-17 18:02:11 +02:00
Aliaksandr Kalenik 3270df476d LibWeb: Fix flexible track sizing in GFC
- Change min track sizing function to be "auto" when flex size is
  specified.
- Never check if min track sizing funciton is flexible, because only
  max is allowed to be flexible.
- Address FIXME in automatic_minimum_size to avoid regressions after
  making two fixes mentioned above.
2024-07-17 18:00:18 +02:00
circl be147ae122 WebContent: Load {allow,block}lists from Ladybird's config directory 2024-07-17 09:57:46 -06:00
circl b61b1374f0 UI: Copy the default config to the user's config directory
Currently only used on the Qt chrome.
2024-07-17 09:57:46 -06:00
circl 5da1dae67e UI/Qt: Use the IniFormat for QSettings
This means that the settings will receive their own directory on all
platforms
2024-07-17 09:57:46 -06:00
circl a443f50807 Base: Move config files out of home/anon and into default-config 2024-07-17 09:57:46 -06:00
circl 4ef0a123ea Meta: Remove home/anon directory from .prettierignore 2024-07-17 09:57:46 -06:00
Timothy Flynn c3f8202d0c LibJS: Create exception messages as Strings
The JS::Error types all store their exception messages as a String. So
by using ByteString, we hit the StringView constructor, and end up
allocating the same string twice.
2024-07-17 11:57:06 -04:00
Hendiadyoin1 144e822de2 LibWasm: Use shuffle_or_0 in for vector swizzles and shuffles
Otherwise we'd hit a VERIFY in AK::SIMD::shuffle() when that operand
contains an out-of-range value, the spec tests indicate that a swizzle
with an out-of-range index should return 0.

(cherry picked from commit cd454a1e3d0bc8b3342ed39891c9b27409ecc829)
2024-07-17 09:56:13 -06:00
Dan Klishch 7e9dc9c1fd AK: Use bit_cast in SIMDExtras.h/AK::Detail::byte_reverse_impl
This necessitates marking bit_cast as ALWAYS_INLINE since emitting it as
a function call there will create an unnecessary potential SSE
registers -> plain registers/memory round-trip.
2024-07-17 09:56:13 -06:00
Hendiadyoin1 9c583154b0 AK: Add generic SIMD shuffle/reverse functions
(cherry picked from commit 1b8fd5c35afda8f797f1e8a39c332fa14950006e)
2024-07-17 09:56:13 -06:00
Hendiadyoin1 873b03f661 AK: Add generic SIMD vector load/store functions
(cherry picked from commit 27c386797df64b9c4dcbe6a27e57d9f54837e9b4)
2024-07-17 09:56:13 -06:00
Hendiadyoin1 9ee334e970 AK: Add introspection helpers to SIMD.h
(cherry picked from commit 8d6028d366c918b3656c0a4c6808a570dcecf8f4)
2024-07-17 09:56:13 -06:00
sideshowbarker cc6d502e88 Tests: Enable WPT/run.sh to run an arbitrary subset of tests
The change causes Tests/LibWeb/WPT/run.sh to run an arbitrary subset of
tests you give it as arguments. If you don’t specify any arguments, it
has the same behavior as it does without this patch: It just runs an
explicit subset of test names hardcoded into the script.

Otherwise without this change, Tests/LibWeb/WPT/run.sh doesn’t have the
ability to run any tests other than the explicit subset of test names
hardcoded into the script
2024-07-17 09:55:11 -06:00
Lawrence Gimenez 7c0aa88e99 Documentation: Fixed typo at BrowsingContextsAndNavigables 2024-07-17 09:48:33 -06:00
Timothy Flynn f29c3684a6 AK: Enable ASSERT in debug builds only
NDEBUG is defined in release builds. So we want to enable the ASSERT
macro when it *isn't* defined.
2024-07-17 09:45:43 -06:00
Aliaksandr Kalenik 3ddacaa705 Ladybird+LibWeb+WebContent: Always use Skia CPU backend in tests mode
Enforce the use of the CPU backend in test mode to ensure that ref-tests
produce consistent results across different computers, as this
consistency cannot be achieved with the GPU backend.
2024-07-17 17:58:53 +03:00
Sam Atkins 9fb44cb057 LibWeb/CSS: Make StringStyleValue hold a FlyString
We already have a FlyString of its value from parsing, and most users
also want a FlyString from it, so let's use that instead of converting
backwards and forwards.

The two users that did want a String are:
- Quotes, which make sense as FlyString instead, so I've converted that.
- Animation names, which should probably be FlyString too, but the code
  currently also allows for other kinds of StyleValue, and I don't want
  to dive into this right now to figure out if that's needed or not.
2024-07-17 15:08:44 +01:00
Sam Atkins d2f04b9f04 LibWeb/CSS: Remove unused StyleProperties::grid_area()
This does not appear to be correct; the `grid-area` property's value is
quite complicated, and not just a string.
2024-07-17 15:08:44 +01:00
simonkrauter b1d7a27468 LibWeb: Rename HTMLInputElement members related to range shadow tree
Choose a better name for private members which were added in
https://github.com/LadybirdBrowser/ladybird/pull/513
2024-07-17 13:11:55 +02:00
Aliaksandr Kalenik 66c88b432f LibWeb: Join text clip paths before application in Skia painter
Each item in clip_paths represents a glyph run, and applying them as a
clip in intersection mode one by one results in an empty clip. Instead,
now all clip paths are joined and applied as a clip together.

This change fixes rendering of "background-clip: text" when an element
has more than one glyph run.

Fixed ref-test: Tests/LibWeb/Ref/css-background-clip-text.html
2024-07-17 14:09:52 +03:00
Braydn dbc2f7ed48 LibJS: Implement CreatePerIterationEnvironment for 'for' statements
Implement for CreatePerIterationEnvironment for 'for' loops per the Ecma
Standard. This ensures each iteration of a 'for' loop has its own
lexical environment so that variables declared in the loop are scoped to
the current iteration.
2024-07-17 11:20:11 +02:00
Jamie Mansfield c8e6a95988 LibWeb/SVG: SVGGradientElement includes SVGURIReference 2024-07-16 21:43:53 +02:00
Jamie Mansfield fbb5bc471d LibWeb/SVG: SVGScriptElement includes SVGURIReference 2024-07-16 21:43:53 +02:00
Jamie Mansfield 796de74956 LibWeb/SVG: SVGAElement includes SVGURIReference 2024-07-16 21:43:53 +02:00
Jamie Mansfield 6ca4c2beb0 LibWeb/SVG: Implement SVGAElement.relList 2024-07-16 21:43:53 +02:00
Jamie Mansfield 7562f89d4e LibWeb/SVG: Implement reflected attributes in SVGAElement
This change implements the download, ping, rel, hreflang, and type
attributes using the [Reflect] annotation in the IDL file.
2024-07-16 21:43:53 +02:00
Jamie Mansfield 5bac8e7730 LibWeb/SVG: Add spec link to SVGAElement 2024-07-16 21:43:53 +02:00
Jamie Mansfield 6f3c5f5ae9 LibWeb/SVG: Implement SVGElement.ownerSVGElement 2024-07-16 21:43:53 +02:00
circl 89531fb115 Tests/LibWeb: Add test for MouseEvent and WheelEvent bubbling 2024-07-16 21:10:16 +03:00
circl f20010c1d3 LibWeb: Restore event characteristics of MouseEvents and WheelEvents
These were accidentally no longer set after
2c396b5378
2024-07-16 21:10:16 +03:00
Aliaksandr Kalenik 5eeb5eb36e LibWeb: Support SVGRadialGradientPaintStyle in Skia painter
Fixes:
Tests/LibWeb/Ref/svg-gradient-spreadMethod.html
Tests/LibWeb/Ref/svg-radialGradient.html
2024-07-16 19:11:56 +03:00
sideshowbarker 15d67f0da2 Meta: Make check-debug-flags.sh runnable in Bash 3.2
This change updates the Meta/check-debug-flags.sh script to avoid an
apparent Bach 3.2 parser bug. Specifically, it takes a comment and some
code of a process substitution and moves it into a separate function.

Otherwise, without this change, trying to run the check-debug-flags.sh
script with Bash 3.2 fails with the following error:

line 39: bad substitution: no closing `)' in <(

...apparently because Bash 3.2 chokes on the comment (and doesn’t choke
if the comment is completely removed).

Relates to https://github.com/LadybirdBrowser/ladybird/issues/283
2024-07-16 09:13:14 -06:00
sideshowbarker 570814a31e Meta: Make all pre-commit CI scripts work with Bash 3.2
This change makes all the pre-commit CI scripts runnable under Bash 3.2,
by replacing “mapfile” invocations in them code that first explicitly
creates an array, and then uses a while loop to populate the array.

Otherwise, without this change, the scripts all fail to run under Bash
3.2 — due to lack of support for “mapfile”.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/283

This also drops bash from the list of homebrew dependencies in the build
instructions — because with this change, homebrew bash (v4) is no longer
needed; things will now work with the Apple-provided bash (v3.2)
2024-07-16 08:56:22 -06:00