Commit graph

46341 commits

Author SHA1 Message Date
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
Ben Wiederhake e147d0b572 AK: Fix all quadratic-time append-loops over ByteBuffer 2023-01-31 16:58:25 +01:00
Iman Seyed 0ebcc99e12 AK: Remove unused network ordered 'address' variable 2023-01-31 12:42:49 +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 11550f582b Tests: Remove the 10KB file read test for AllocatingMemoryStream
When we move the test to AK (together with the actual stream
implementation), finding the input file to read from is going to become
significantly harder, since the test also runs outside of SerenityOS.

Since this was just a smoke test during early development (and we should
now have reasonable coverage with actual usages in the other parts of
the OS), let's just remove that test instead of trying to make input
file lookups work.
2023-01-29 19:16:44 -07:00
Tim Schumacher 22f0d04f43 AK: Provide a fallback definition for std::nothrow 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 5fa590de71 AK: Remove Buffered 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
Andreas Kling 230cb3b0cb AK: Add DeprecatedString::from_utf8()
This will be used in Jakt to help transition off of DeprecatedString.
2023-01-29 23:41:42 +01:00
Andreas Kling 6b497b8710 AK: Add two helpers to DeprecatedStringCodePointIterator 2023-01-29 23:41:42 +01:00
Nico Weber f4c1269d4c Tests: Modernize TestImageDecoder a bit
- Use MUST() instead of checking plugin_decoder_or_error.is_error()
- Use MappedFile::bytes()
- Don't use EXPECT_EQ when comparing to fixed bools

No intended behavior change.
2023-01-29 22:37:37 +00:00
Nico Weber 10ae570ac5 Tests: Make LibGfx tests not depend on LibGUI
As far as I can tell, that's not needed and never was.
2023-01-29 22:36:13 +00: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 4b8bae8151 Welcome: Rename m_initial_tip_index=>m_tip_index 2023-01-29 18:27:34 +00:00
thankyouverycool 883abffa25 Welcome: Load banner font in a fallible manner
And simplify painting logic by using the banner widget's relative
rect and tray_text() ColorRole.
2023-01-29 18:27:34 +00:00
thankyouverycool 08456be9dc LibGUI+LibGfx: Add Tray ColorRole helpers to Palette 2023-01-29 18:27:34 +00:00
thankyouverycool bfc08bc84b Welcome: Replace instances of DeprecatedString with String 2023-01-29 18:27:34 +00:00
thankyouverycool c216d71b6c Welcome: Use fallible try_create() 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
MacDue a75f9273b4 PixelPaint: Increase default window height by 10px
This stops the clone and gradient tools from being cut off the side
bar.
2023-01-29 13:38:27 +01:00
Jan200101 141e5d6f20 Ports: Use absolute path of port_include
This ensures that .port_include will always import other scripts from
the correct location.
2023-01-29 13:11:22 +01:00
Jan200101 4eae5de499 Ports: Document how to declare external port directories 2023-01-29 13:11:22 +01:00
Jan200101 9b7e217dda Ports: Support multiple port directories
This allows Ports unfit for the main repository to be put elsewhere.
2023-01-29 13:11:22 +01:00
Liav A 722ae35329 Kernel/FileSystem: Simplify the ProcFS inode code
This is done by merging all scattered pieces of derived classes from the
ProcFSInode class into that one class, so we don't use inheritance but
rather simplistic checks to determine the proper code for each ProcFS
inode with its specific characteristics.
2023-01-29 12:59:30 +01: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
Aliaksandr Kalenik 78b503946c Tests: Add LibWeb layout tests 2023-01-29 11:33:33 +00:00
Aliaksandr Kalenik c05fcd54bb Ladybird: Do not connect SQL server in layout dump output mode 2023-01-29 11:33:33 +00:00
Aliaksandr Kalenik 0c6b942ca9 Ladybird: Flush stdout before exit in layout dump output mode 2023-01-29 11:33:33 +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