Commit Graph

15185 Commits

Author SHA1 Message Date
Timothy Flynn
96f409ec1e LibWeb+WebContent: Do not reference-count file request objects
There is currently a memory leak with these file request objects due to
the callback on_file_request_finish referencing itself in its capture
list. This object does not need to be reference counted or allocated on
the heap. It is only ever stored in a HashMap until a response is
received from the browser, and it is not shared.
2023-02-01 14:04:44 +00:00
Nico Weber
c8832807d6 LibGfx+Tests: Remove code unnecessary after 9e7c16d0a4 2023-02-01 08:56:56 -05:00
Ali Mohammad Pur
c045d09840 LibLine: Quit event loop when an error occurs on update
Previously we were crashing, which was excessive, if we can't read
anymore, we should just return with an error.
2023-02-01 01:04:42 +03:30
Andreas Kling
ce6636e78e LibGfx: Make glyph ID lookup faster with a cache
This patch adds a "GlyphPage" cache which stores the mapping between
code points and glyph IDs in a segmented table of "pages".

This makes Font::glyph_id_for_code_point() significantly faster by
not reparsing the font tables every time you call it.

In the future, we can add more information to GlyphPage (such as
horizontal metrics for each glyph) to further reduce time spent in
text layout and painting.
2023-01-31 17:14:57 +01:00
Timothy Flynn
e74e8381d5 LibJS: Allow "approximately" results to differ in plural form
This is a normative change in the Intl.NumberFormat V3 spec. See:
https://github.com/tc39/proposal-intl-numberformat-v3/commit/08f599b

Note that this didn't seem to actually affect our implementation. The
Unicode spec states:

https://www.unicode.org/reports/tr35/tr35-53/tr35-numbers.html#Plural_Ranges
"If there is no value for a <start,end> pair, the default result is end"

Therefore, our implementation did not have the behavior noted by the
issue this normative change addressed:

    const pr = new Intl.PluralRules("en-US");
    pr.selectRange(1, 1); // Is "other", should be "one"

Our implementation already returned "one" here because there is no such
<start=one, end=one> value in the CLDR for en-US. Thus, we already
returned the end value of "one".
2023-01-30 14:10:07 -05:00
Jelle Raaijmakers
5c1038e54f LibSoftGPU: Remove DeprecatedString usage 2023-01-30 13:49:52 -05:00
Jelle Raaijmakers
a8cb70c0c4 LibGPU: Remove DeprecatedString usage 2023-01-30 13:49:52 -05:00
Jelle Raaijmakers
e3f8ac2c05 LibGL: Remove DeprecatedString usage
We only use it for the extension string, which we now convert into a
`ByteBuffer` object containing the null-terminated bytes :^)
2023-01-30 13:49:52 -05:00
Timothy Flynn
6a50fb465c LibJS: Make use of the Intl MV in more Intl.NumberFormat AOs
This is an editorial change in the Intl.NumberFormat V3 spec. See:
https://github.com/tc39/proposal-intl-numberformat-v3/commit/c24b33e

Note our implementation was already using the Intl MV in these AOs just
due to C++ type safety.
2023-01-30 12:19:14 -05:00
Timothy Flynn
a283daaab7 LibJS: Refactor the Intl.NumberFormat GetStringOrBooleanOption AO
This is an editorial change in the Intl.NumberFormat V3 spec. See:
https://github.com/tc39/proposal-intl-numberformat-v3/commit/654bfad
2023-01-30 12:19:14 -05:00
Timothy Flynn
be347f67dc LibJS: Shorten some spec text for BestAvailableLocale
This is an editorial change in the Intl.NumberFormat V3 spec. See:
https://github.com/tc39/proposal-intl-numberformat-v3/commit/654bfad
2023-01-30 12:19:14 -05:00
Timothy Flynn
4475f21e9e LibJS: Allow locale approximately signs to be empty in Intl.NumberFormat
This is a normative change in the Intl.NumberFormat V3 spec. See:
https://github.com/tc39/proposal-intl-numberformat-v3/commit/23e69cf

This isn't particularly testable because every locale in the CLDR has a
non-empty "approximatelySign" field in cldr-numbers-modern. The issue
for this change seems to be considering the "miscPatterns/approximately"
field instead, which has different semantics. But as noted on the CLDR
issue https://unicode-org.atlassian.net/browse/CLDR-14918, the ICU uses
the "approximatelySign" field (as do our implementation).
2023-01-30 12:19:14 -05:00
Timothy Flynn
5b3b14be0a LibJS: Move resolution of some Intl.NumberFormat options to a common AO
This is a normative change in the Intl.NumberFormat V3 spec. See:
https://github.com/tc39/proposal-intl-numberformat-v3/commit/29acfc6

This is to allow Intl.PluralRules to use these options, as they were in-
effect required by later AOs anyways.
2023-01-30 12:19:14 -05:00
Tim Schumacher
093cf428a3 AK: Move memory streams from LibCore 2023-01-29 19:16:44 -07:00
Tim Schumacher
2470dd3bb5 AK: Move bit streams from LibCore 2023-01-29 19:16:44 -07:00
Tim Schumacher
94f139c111 AK: Move buffered streams from LibCore 2023-01-29 19:16:44 -07:00
Tim Schumacher
8464da1439 AK: Move Stream and SeekableStream from LibCore
`Stream` will be qualified as `AK::Stream` until we remove the
`Core::Stream` namespace. `IODevice` now reuses the `SeekMode` that is
defined by `SeekableStream`, since defining its own would require us to
qualify it with `AK::SeekMode` everywhere.
2023-01-29 19:16:44 -07:00
Tim Schumacher
5f2ea31816 AK: Move Handle from LibCore and name it MaybeOwned
The new name should make it abundantly clear what it does.
2023-01-29 19:16:44 -07:00
Tim Schumacher
ae64b68717 AK: Deprecate the old AK::Stream
This also removes a few cases where the respective header wasn't
actually required to be included.
2023-01-29 19:16:44 -07:00
Nico Weber
fef15becb2 LibGfx: Support ICCs in JPEGs that are split across several tags
Most jpegs that use multi-tag ICCs are in CMYK format, so running
`icc` on them still produces

    Runtime error: Unsupported number of components in SOF

but it no longer prints several

    jpg: Ignoring ICC profile spanning several chunks (1/9)

lines before that.

(And if I manually comment out that error message, the profile
is printed fine. But we can't decode the actual pixel data yet.)
2023-01-29 19:17:35 +00:00
Timothy Flynn
78def34c5e LibSQL: Use kill to exit forked SQLServer processes to avoid Qt issues
In order to daemonize the SQLServer process for Ladybird, we double-fork
and exit the first child process to ensure the grandchild process is in
a detached state to become SQLServer. After commit c05fcd5, this happens
after Ladybird's QApplication is created. QApplication seems to hook up
some `exit` handling that makes the call to `exit(0)` here not actually
exit the child process.

Instead, using `kill` with SIGTERM will actually terminate the child
process.
2023-01-29 18:32:21 +00:00
thankyouverycool
08456be9dc LibGUI+LibGfx: Add Tray ColorRole helpers to Palette 2023-01-29 18:27:34 +00:00
Tim Schumacher
89a4a9c7a7 LibDebug: Correct a (un-)signed mixup in the DWARF abbreviations map
I accidentally replaced this with `read_unsigned` in
908b88db34, now it's correct again.
2023-01-29 18:21:11 +00:00
MacDue
d11baf48ae LibGfx: Fix constructor initialisation style in GradientPainting 2023-01-29 13:49:35 +00:00
MacDue
285bd7a37a LibGfx: Stop passing color stop spans by const reference
No idea why I did this, possibly because these were once vectors?
Anyway, the const reference is pointless here.
2023-01-29 13:49:35 +00:00
Nico Weber
e9dcc49f9c LibGfx: Validate tag types of AToBNTag, BToANTag, gamutTag, previewNTag
Also rewrite a few of the existing tag type checks using a new helper.
2023-01-29 11:40:14 +00:00
Nico Weber
bd4078ad45 LibGfx: Make ICC EMatrix3x3::operator[] a bit less silly 2023-01-29 11:35:37 +00:00
Nico Weber
1329799d20 LibGfx: Rename EMatrix to EMatrix3x3 in ICC code
There will be an EMatrix3x4 in a future change.
2023-01-29 11:35:37 +00:00
Nico Weber
f63ec8de68 LibGfx: Use auto more in ICC code 2023-01-29 11:35:37 +00:00
MacDue
489fe49321 LibWeb: Fix parsing/to_string for "switch" ARIA role
I accidentally regressed this in 890b4d7, this role needs to be
handled specially due to the clash with the C++ 'switch' keyword.
2023-01-29 00:57:41 +00:00
Linus Groh
476d4b4963 LibWeb: Remove no longer needed DeprecatedFlyString.h includes
ARIA roles no longer use DeprecatedFlyString, replace them with the
forwarding header, and StringView.h in one case, for other things from
AK used in those headers.
2023-01-29 00:02:55 +00:00
Linus Groh
8556d47240 LibWeb: Move ARIA-related code into the Web::ARIA namespace
ARIA has its own spec and is not part of the DOM spec, which is what the
Web::DOM namespace is for (https://www.w3.org/TR/wai-aria-1.2/).

This allows us to stay closer to the spec with function names and don't
have to add the word "ARIA" to identifiers constantly - the namespace
now provides that clarity.
2023-01-29 00:02:55 +00:00
Timothy Flynn
8414734a2d LibJS: Propagate the OOM error from setting the String length property 2023-01-29 00:02:45 +00:00
Timothy Flynn
b75b7f0c0d LibJS+Everywhere: Propagate Cell::initialize errors from Heap::allocate
Callers that are already in a fallible context will now TRY to allocate
cells. Callers in infallible contexts get a FIXME.
2023-01-29 00:02:45 +00:00
Timothy Flynn
109b190a19 LibJS: Fully qualify the use of AK::is in MUST_OR_THROW_OOM
This is to allow using this macro in contexts that have defined `is`
already. For example, in ObjectConstructor, there is a native function
`is` which would trip up the compiler without this change.
2023-01-29 00:02:45 +00:00
Timothy Flynn
2b5054c903 LibJS: Add a method to ThrowCompletionOr to drop allocation errors
This should solely be used to ignore completions from Heap::allocate in
currently-infallible contexts. It's mostly meant to let us both ignore
these errors and mark them with a FIXME in one go.
2023-01-29 00:02:45 +00:00
Timothy Flynn
2692db8699 LibJS+Everywhere: Allow Cell::initialize overrides to throw OOM errors
Note that as of this commit, there aren't any such throwers, and the
call site in Heap::allocate will drop exceptions on the floor. This
commit only serves to change the declaration of the overrides, make sure
they return an empty value, and to propagate OOM errors frm their base
initialize invocations.
2023-01-29 00:02:45 +00:00
Timothy Flynn
1c1b902a6a LibJS+LibWeb: Move headers around to allow including Value from Cell
The goal here is to allow Cell::initialize to return a ThrowCompletion,
to handle OOM for example. Cell.h will then need to include Completion.h
which must include Value.h. This currently can't happen because Value.h
includes BigInt.h, which in turn includes Cell.h. So we would have an
include cycle.

This removes BigInt.h from Value.h, as it is forward-declarable (it is
only referred to with a reference or pointer). Then the Value overload
for Cell::Visitor::visit is moved to Cell.h, and missing BigInt.h
includes as peppered as needed.
2023-01-29 00:02:45 +00:00
Timothy Flynn
b0a4df76de LibJS: Define Date constants such that translation units don't copy them
Variables that are constexpr must be delcared inline in the global
namespace to prevent copying them.

The static keyword is meaningless on variables in headers in the global
namespace. Declare the static bigint as extern and define it out-of-line
instead.
2023-01-29 00:02:45 +00:00
Linus Groh
e4158d8555 LibJS: Replace some deprecated_string() with utf8_string() in Temporal
The remaining ones are needed for PropertyKey, which is not yet String
compatible.
2023-01-28 22:58:03 +00:00
Linus Groh
b41e7b7e86 LibJS: Replace to_deprecated_string() with to_string() in Temporal
Turns out all of these can already be replaced with no further changes!
2023-01-28 22:54:44 +00:00
MacDue
890b4d7980 LibWeb: Replace ARIA role static FlyStrings with an enum
This replaces the FlyStrings for ARIA roles that were constructed in
a [[gnu::constructor]] with a single enum. I came across this as the
DOM inspector was crashing due to a null FlyString for an ARIA role.

After fixing that, I was confused as to why these roles were not an
enum. Looking at the spec there's a fixed list of roles and switching
from references to static strings to an enum was pretty much an
exercise in find and replace :).

No functional changes (outside of fixing the mentioned crash).
2023-01-28 22:09:18 +00:00
Linus Groh
3a9225608a LibAudio: Remove try_ prefix from fallible LoaderPlugin methods 2023-01-28 22:41:36 +01:00
Linus Groh
ee0297d9ec LibAudio: Remove try_ prefix from fallible LoaderPlugin methods 2023-01-28 22:41:36 +01:00
Linus Groh
108ea2b921 LibCore: Remove try_ prefix from fallible SharedCircularQueue methods 2023-01-28 22:41:36 +01:00
Linus Groh
9c08bb9555 AK: Remove try_ prefix from FixedArray creation functions 2023-01-28 22:41:36 +01:00
Nico Weber
909c2a73c4 LibGfx+icc: Read and display lut16Type and lut8Type ICC tag types 2023-01-28 21:40:45 +00:00
Nico Weber
a0513a360a LibGfx: Use AssertSize<> in ICC/Profile.cpp 2023-01-28 21:40:45 +00:00
Sam Atkins
53ebe607f8 LibWasm: Implement data.drop instruction 2023-01-28 22:57:25 +03:30
Sam Atkins
a2f42512c2 LibWasm: Move memory.init code together with other memory.foo impls
And add a spec link while I'm at it.
2023-01-28 22:57:25 +03:30