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.
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.
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.
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.
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.
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.
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.
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. :^)
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. :^)
`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.
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`.
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>()`.
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.
`SysFSComponentRegistry`, `ProcFSComponentRegistry` and
`attach_null_device` "just work" already; let's include them to match
x86_64 as closely as possible.
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.
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.
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.
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.
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.
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.