Commit graph

43891 commits

Author SHA1 Message Date
Andreas Kling 1f909d24b6 LibJS: Shrink MemberExpression by rearranging members slightly
By putting m_computed in the padding hole after our base class,
we shrink MemberExpression by 8 bytes. :^)
2022-12-08 23:36:17 +00:00
Andreas Kling e70f944e11 LibJS: Rearrange ASTNode members so there's a padding hole at the end
ASTNode inherits from RefCounted, which has a single 32-bit member.
This means that there's a 32-bit padding hole after RefCounted,
where we are free to put something (or it will go to waste!)

This patch moves ASTNode::m_start_offset into that padding hole,
and we now have a 32-bit padding hole at the end of ASTNode instead.

This will allow ASTNode subclasses to put things in the ASTNode hole
by moving them to the head of the member list.
2022-12-08 23:36:17 +00:00
FrHun e647ad2ce3 LibGUI: Add OpacitySlider to ColorPicker dialog 2022-12-09 00:25:30 +01:00
FrHun 59028515c0 LibGUI: Split OpacitySlider into vertical and horizontal helper classes 2022-12-09 00:25:30 +01:00
FrHun 99624a8df4 LibGUI: Implement vertical orientation for OpacitySlider 2022-12-09 00:25:30 +01:00
FrHun 42feb0233a LibGfx: Make Rect by orientation methods generic 2022-12-09 00:25:30 +01:00
Timothy Flynn 63e2aa962d AK: Disallow implicit pointer-to-boolean conversion in JsonValue
Similar to how LibJS and LibSQL used to behave, the boolean constructor
of JsonValue is currently allowing pointers to be used to construct a
boolean value. Explicitly disallow such construction.
2022-12-09 00:05:30 +01:00
Timothy Flynn 174062e0c5 LibGUI: Register GUI icon path setters as write-only
The getters passed to REGISTER_STRING_PROPERTY are never invoked. But if
they were, they would errantly incur an implicit pointer-to-boolean cast
when their return type (Gfx::Bitmap*) is used to construct a JsonValue.
2022-12-09 00:05:30 +01:00
Timothy Flynn 746364d7c1 LibCore: Support write-only Object properties
Some properties are set and then never retrieved, e.g. GUI icon paths.
Add a helper to create such properties, similar to the read-only helper.
2022-12-09 00:05:30 +01:00
Maciej 58f5deba70 AK: Unref old m_data in String's move assignment
We were overridding the data pointer without unreffing it,
causing a memory leak when assigning a String.
2022-12-09 00:02:53 +01:00
Lucas CHOLLET 741138c585 LibGUI: Add a prefix to IncrementalSearchBanner's widgets name
Widget's name are the current way to retrieve them when using GML.
Presently, there is no way to differentiate two items that share the
same name.

`IncrementalSearchBanner` uses common names as "close_button" or
"next_button", prepend them with `incremental_search_banner_` avoid
collisions.

This fixes a bug where the close button of `CrashReporter` was confused
with the one of the search banner.

However, This solution isn't perfect, down the road, we should probably
find a way to warn about equal names and introduce something like
namespace to avoid huge prefixes.
2022-12-08 17:20:51 +01:00
Lucas CHOLLET f14006637d CrashReporter: Factorize exiting behavior to window->close() 2022-12-08 17:20:51 +01:00
Timothy Flynn fef255ee22 Browser: Store cookies in a LibSQL database :^)
Currently, cookies are ephemeral and only survive for the lifetime of
Browser instance. This will make Browser instead store cookies in a SQL
database for persisted access.
2022-12-08 17:14:48 +01:00
Timothy Flynn bf060adcf9 Browser+LibWebView+WebContent: Do not domain match on cookie updates
Updating cookies through these hooks happens in one of two manners:
1. Through the Browser's storage inspector.
2. Through WebDriver's delete-cookies operation.

In (1), we should not restrict ourselves to being able to delete cookies
for the current page. For example, it's handy to open the inspector from
the welcome page and be able to delete cookies for any domain.

In (2), we already are only interacting with cookies that have been
matched against the document URL.
2022-12-08 17:14:48 +01:00
Timothy Flynn 949f5460fb AK: Add formatters for Span<T> and Span<T const>
This generalizes the formatter currently used for Vector to be usable
for any Span.
2022-12-08 17:14:48 +01:00
Timothy Flynn c372012842 LibSQL+SQLServer+SQLStudio+sql: Give ID types a distinct name
Makes it clearer what is being stored, especially in future clients that
will store a bunch of statement IDs.
2022-12-08 17:14:48 +01:00
Timothy Flynn 44ff3a374f LibSQL: Mark SQLClient's constructor as public
Similar to WebContent, this is needed to construct the SQLClient
manually in Ladybird.
2022-12-08 17:14:48 +01:00
Timothy Flynn 517742d6f9 LibSQL+SQLServer: Generate SQLServer's IPC sources with LibSQL on Lagom
Exclude SQLServer from Lagom, and instead generate its IPC sources with
LibSQL.
2022-12-08 17:14:48 +01:00
Timothy Flynn b3e287342f SQLServer: Store LibSQL database files in the standard data directory
This also allows for overriding the path. Ladybird will want to store
the database files in a subdirectory of the standard data directory that
contains the Ladybird application name.

Fixes #16000.
2022-12-08 17:14:48 +01:00
Timothy Flynn 49d74ee288 LibCore: Add a standard path for application data 2022-12-08 17:14:48 +01:00
Timothy Flynn 4609477ac0 LibCore: Support XDG_CONFIG_HOME when determing the user's config path
And default to a path commonly used depending on the operating system.
2022-12-08 17:14:48 +01:00
Linus Groh ae0606711c LibWeb/Fetch: Remove redundant timingInfo variables
This is an editorial change in the Fetch spec.

See: https://github.com/whatwg/fetch/commit/e8b67b0
2022-12-08 15:37:19 +00:00
Linus Groh a06b97dae0 LibWeb/Fetch: Share validation logic in the Headers class
This is an editorial change in the Fetch spec.

See: https://github.com/whatwg/fetch/commit/f435978
2022-12-08 15:37:19 +00:00
Linus Groh 3414a6ba20 LibWeb/Fetch: Remove Authorization header upon cross-origin redirect
This is a change in the Fetch spec.

See: https://github.com/whatwg/fetch/commit/9004f4e
2022-12-08 15:37:19 +00:00
Linus Groh 2f1bda3347 LibWeb/Fetch: Tweak wording in some spec comments
This is a change in the Fetch spec.

See: https://github.com/whatwg/fetch/commit/223ca89
2022-12-08 15:37:19 +00:00
Linus Groh a156722744 LibWeb/Fetch: Update spec comment to decode bytes to string
This is a change in the Fetch spec.

See: https://github.com/whatwg/fetch/commit/a04d096
2022-12-08 15:37:19 +00:00
Linus Groh 1c9bb2d8b4 LibWeb/Fetch: Refactor forbidden request-headers
This is a change in the Fetch spec.

See:
- https://github.com/whatwg/fetch/commit/92e6c91
- https://github.com/whatwg/xhr/commit/494431a
2022-12-08 15:37:19 +00:00
Linus Groh 011f6a6cb4 LibWeb/Fetch: Use tuple syntax for headers in spec comments
This is an editorial change in the Fetch spec.

See: https://github.com/whatwg/fetch/commit/b482186
2022-12-08 15:37:19 +00:00
Andreas Kling b3b51a5001 LibGfx: Use a FixedArray for the dummy scanline in PNGWriter
PNGWriter sets up one dummy scanline with the same width as the other
scanlines in order to allow addressing the "previous scanline" without
complicating the code.

By using a FixedArray instead of a VLA, we sidestep the risk of stack
overflow and instead get something that can signal OOM.
2022-12-08 13:01:11 +00:00
Andreas Kling e19c8897ee LibGfx: Propagate errors that occur internally in PNGWriter
This patch basically uses the TRY() macro throughout PNGWriter instead
of relying on the MUST()'ing wrappers in Vector and ByteBuffer.

One FIXME was killed in the making of this patch. :^)
2022-12-08 13:01:11 +00:00
Andreas Kling d88c7fee32 LibGfx+Userland: Make PNGWriter::encode() return ErrorOr<ByteBuffer>
This is a first step towards handling PNG encoding failures instead of
just falling over and crashing the program.

This initial step will cause encode() to return an error if the final
ByteBuffer copy fails to allocate. There are more potential failures
that will be surfaced by subsequent commits.

Two FIXMEs were killed in the making of this patch. :^)
2022-12-08 13:01:11 +00:00
Andreas Kling 95b4ffad39 Mandelbrot: Make it possible for export_image to return an error
...and if we do get an error, present it to the user.
2022-12-08 13:01:11 +00:00
Tim Schumacher 2fc2025f49 LibCore: Move Core::Stream::File::exists() to Core::File
`Core::Stream::File` shouldn't hold any utility methods that are
unrelated to constructing a `Core::Stream`, so let's just replace the
existing `Core::File::exists` with the nicer looking implementation.
2022-12-08 12:52:14 +00:00
Sam Atkins bd272e638c LibWeb: Introduce CSSPixels and DevicePixels classes
These are an attempt to separate the internal "pixel" used by CSS from
the actual "pixel" that exists on the display. Because of things like
2x display scaling, the ratio between these can vary, so having
distinct types will help prevent errors when converting from one unit
to the other.

`CSSPixels` refers to the `px` unit used on the web, which depending on
the device may or may not map to 1 pixel on the physical display. It's
a wrapper around `float`, and will be used by LibWeb for size and
position values up until we go to paint them to the screen.

`DevicePixels` on the other hand is a 1-to-1 pixel on the physical
display. It's a wrapper around `int`.
2022-12-08 12:46:03 +00:00
Sam Atkins 83f31cb4a7 LibGfx: Add int overloads for (AntiAliasing)Painter float methods
Without this change, the upcoming LibWeb pixel types will require a
silly doubled conversion in some places.

eg: `some_rect.to_type<int>().to_type<float>()`

With these overloads, we can get away with `some_rect.to_type<int>()`.
2022-12-08 12:46:03 +00:00
Poseydon42 d2334957ba Tests: Add tests for Checked<> decrement operator 2022-12-08 07:20:14 -05:00
Lucas CHOLLET 1ac0aaa555 CrashReporter: Disable save button until it is ready to use 2022-12-08 07:12:01 -05:00
Filiph Sandström 01cdd3f181 WindowServer+MouseSettings: Improve buttons_switched naming
Before this commit it was a bit ambiguous which buttons the function
name were referring to; this instead now makes it clear that it's
related to mouse input. Additionally, this also fixes incorrect getter
naming leftover from yesteryear.
2022-12-08 07:04:09 -05:00
Filiph Sandström 83380ebebc Kernel/aarch64: Initialize components that are already working
`SysFSComponentRegistry`, `ProcFSComponentRegistry` and
`attach_null_device` "just work" already; let's include them to match
x86_64 as closely as possible.
2022-12-08 09:20:27 +00:00
Andreas Kling d6a3be1615 LibPDF: Add missing character quirk for WinAnsiEncoding fonts
Fonts with the encoding name "WinAnsiEncoding" should render missing
characters above character code 040 (octal) as a "bullet" character.

This patch adds Encoding::should_map_to_bullet(char_code) which is then
called by char_code_to_code_point() to check if the given char code
should be displayed as a bullet instead.

I didn't have a good way to test this, so I've only verified that it
works by manually overriding inputs to the function during the rendering
stage.

This takes care of a FIXME in the Annex D part of the PDF specification.
2022-12-08 09:54:20 +01:00
Xexxa f4f5b045ca Base: Add more emoji
🫷 - U+1FAF7 LEFTWARDS PUSHING HAND
🫸 - U+1FAF8 RIGHTWARDS PUSHING HAND
⛷️ - U+26F7 SKIER
🫏 - U+1FACF DONKEY
🐔 - U+1F414 CHICKEN
🌹 - U+1F339 ROSE
🪻 - U+1FABB HYACINTH
🗺️ - U+1F5FA WORLD MAP
🚏 - U+1F68F BUS STOP
🛥️ - U+1F6E5 MOTOR BOAT
🎗️ - U+1F397 REMINDER RIBBON
🥅 - U+1F945 GOAL NET
🪇 - U+1FA87 MARACAS
✏️ - U+270F PENCIL
✒️ - U+2712 BLACK NIB
🗂️ - U+1F5C2 CARD INDEX DIVIDERS
⚒️ - U+2692 HAMMER AND PICK
🔩 - U+1F529 NUT AND BOLT
⚖️ - U+2696 BALANCE SCALE
🔗 - U+1F517 LINK
🛋️ - U+1F6CB COUCH AND LAMP
2022-12-07 23:47:27 +00:00
Xexxa b63ce06604 Base: Adjust emoji
🖕 - U+1F595 MIDDLE FINGER
🖋️ - U+1F58B FOUNTAIN PEN
Remove left padding
✈️ - U+2708 AIRPLANE
Make plane motors symmetrical
2022-12-07 23:47:27 +00:00
Sam Atkins 81fe2ef178 FileManager: Silence the "not found" error when setting no wallpaper
If we're setting the path to "" then we can just set the wallpaper to
nullptr and carry on with our day. :^)
2022-12-07 17:12:45 +00:00
Aliaksandr Kalenik f0ab127a41 LibWeb: Consider strut while calculating baseline for a line
Strut should be taken in account while computing baseline of
a line. Otherwise it results in wrong alignment in boxes that
has inline elements without any text.

This also fixes red box in Acid 2.
2022-12-07 17:50:13 +01:00
Timothy Flynn d37d6b3479 LibJS: Protect CanonicalIndex against double-to-integer overflow
Explicitly disallow constructing a CanonicalIndex from a floating point
type without going through a factory method that will throw when the
provided index cannot fit in a u32.
2022-12-07 16:43:19 +00:00
Timothy Flynn 8f46cb83c7 LibJS: Put CanonicalIndex in the JS namespace 2022-12-07 16:43:19 +00:00
Timothy Flynn 8f1f794bbd LibJS: Change an error message used by %TypedArray%.prototype.with
ErrorType::InvalidIndex does not encapsulate the reasons why an index
may be invalid. For example:

    let array = new Uint8Array([1, 2, 3, 4, 5]);
    array.with(10, 0);

Will currently yield:

    [RangeError] Index must be a positive integer

Which is misleading because 10 *is* a positive integer.
2022-12-07 16:43:19 +00:00
Linus Groh 1dd8655514 LibJS: Replace standalone js_symbol() with Symbol::create() 2022-12-07 16:43:06 +00:00
Linus Groh 525f22d018 LibJS: Replace standalone js_string() with PrimitiveString::create()
Note that js_rope_string() has been folded into this, the old name was
misleading - it would not always create a rope string, only if both
sides are not empty strings. Use a three-argument create() overload
instead.
2022-12-07 16:43:06 +00:00
Linus Groh 5db38d7ba1 LibJS: Replace standalone js_bigint() with BigInt::create()
Three standalone Cell creation functions remain in the JS namespace:

- js_bigint()
- js_string()
- js_symbol()

All of them are leftovers from early iterations when LibJS still took
inspiration from JSC, which itself has jsString(). Nowadays, we pretty
much exclusively use static create() functions to construct types
allocated on the JS heap, and there's no reason to not do the same for
these.
Also change the return type from BigInt* to NonnullGCPtr<BigInt> while
we're here.

This is patch 1/3, replacement of js_string() and js_symbol() follow.
2022-12-07 16:43:06 +00:00