1
0
mirror of https://github.com/SerenityOS/serenity synced 2024-07-09 02:50:44 +00:00
Commit Graph

55298 Commits

Author SHA1 Message Date
Sam Atkins
18dfc61280 LibGfx: Expose BitmapFont glyph data as Spans instead of raw pointers 2023-10-10 14:36:25 +02:00
Sam Atkins
80e756daef LibGfx: Load BitmapFont data more safely
Previously, `load_from_memory()` just took a raw pointer to the data,
and then manually calculated offsets from that pointer. Instead, let's
use the MappedFile we already have, to stream in the data, to make
things a bit safer. We also now check that the entire file's data was
read, since if there was data left over, then either the file is bad or
we've done something wrong.

I've moved the code directly into `try_load_from_mapped_file()` since
`load_from_memory()` was only called from there. The extra indirection
wasn't adding anything.
2023-10-10 14:36:25 +02:00
Sam Atkins
253a96277e AK: Add FixedMemoryStream methods for reading values "in place"
When working with FixedMemoryStreams, and especially MappedFiles, you
may don't want to copy the underlying data when you read from the
stream. Pointing into that data is perfectly fine as long as you know
the lifetime of it is long enough.

This commit adds a couple of methods for reading either a single value,
or a span of them, in this way. As noted, for single values you sadly
get a raw pointer instead of a reference, but that's the only option
right now.
2023-10-10 14:36:25 +02:00
Sam Atkins
8e51c7112c LibGfx: Store BitmapFont glyph widths as a Span<u8>
More raw pointer removal.
2023-10-10 14:36:25 +02:00
Sam Atkins
f6c40abdb1 LibGfx: Give GlyphBitmap its rows data as Bytes
Instead of giving it a raw pointer to the start of the font's rows data
and an offset, give it the Bytes for its rows only.
2023-10-10 14:36:25 +02:00
Sam Atkins
a3b91378df LibGfx: Store BitmapFont rows data as Bytes 2023-10-10 14:36:25 +02:00
Sam Atkins
415a024bc8 LibGfx: Store BitmapFont range mask as Bytes instead of pointer and size 2023-10-10 14:36:25 +02:00
Sam Atkins
533ec5a06f LibGfx: Use Core::System helper for BitmapFont memory allocation 2023-10-10 14:36:25 +02:00
Sam Atkins
57497c6ab2 LibCore: Add a Core::System wrapper for memory allocation
Allocating raw memory isn't something we do often, but it does happen.
Let's make it comfier.
2023-10-10 14:36:25 +02:00
Sam Atkins
89ef3ed4ce LibGfx: Mark BitmapFont::try_clone() as virtual 2023-10-10 14:36:25 +02:00
Sam Atkins
a1c24ef3ad LibGfx: Remove infallible BitmapFont::create() factory function
This was only used in TestFontHandling. So, let's remove it, and use
the "create" name for the fallible one.
2023-10-10 14:36:25 +02:00
Tim Ledbetter
2f26a7bb12 LibCompress: Avoid buffer overrun when building canonical Huffman code
Previously, decompressing a DEFLATE stream an invalid canonical
Huffman code could cause a buffer overrun. We now return an error in
this case.
2023-10-10 13:24:05 +02:00
Tim Ledbetter
bc6638682d LibGfx/BMPLoader: Ensure DIB size and offset are within expected range 2023-10-10 05:50:02 +02:00
Tim Schumacher
127f6ed6eb LibCompress: Fix a typo in m_read_final_block 2023-10-09 23:40:10 +02:00
circl
7d391e1397 Meta: Specify we now have over three hundred ports in the README :^) 2023-10-09 19:33:35 +02:00
circl
e46076516b Meta: Use relative path for screenshot in README
GitHub allows relative paths to be used to display images, this should
make the image continue working even when viewing the README from an
earlier commit of the repo in case the location of screenshots is moved.

This is also just a cleaner way to do this.
2023-10-09 19:33:35 +02:00
circl
dacf726579 Meta: Remove spec-related dead links from README
Due to the removal of libjs.dev, replace the test262 link with the
test262.fyi counterpart and remove WASM link.
2023-10-09 19:33:35 +02:00
Andreas Kling
13057812d5 LibJS: Remove inline capacity from MarkedVector
Turns out this was hurting performance instead of helping it.
By removing the inline capacity, we shrink the size of ExecutionContext
by 512 bytes, which substantially reduces the stack pressure created by
JS recursion (each call creates a new ExecutionContext on the stack).

4.4% speed-up on the entire Kraken benchmark :^)
2023-10-09 09:32:24 +02:00
Tim Ledbetter
f10db48bab AK: Avoid overflow when passing i64 minimum value to vformat() 2023-10-09 09:39:02 +03:30
Karol Kosek
2ea45f4881 LibJS: Forward-declare RegexTable and BasicBlock in Executable.h
Previously every file that included Executable.h (which is pretty much
most LibJS and LibHTML files, given that VM.h needs it) had the whole
definition of LibRegex, which was slowing down source parsing.
2023-10-09 07:29:27 +02:00
Karol Kosek
426b7ffa41 LibWeb: Don't include Window.h in Element.h and Document.h
Window.h is a rather heavy file, so let's try not to include it in
header files when we can!

Element.h now also includes LibWeb/Bindings/Intrinsics.h, but that's
just out of my laziness. Most if not all objects call
`Bindings::ensure_web_prototype<>()` anyway, so I don't think we would
gain much by sticking the header to source files instead.
2023-10-09 07:29:27 +02:00
MacDue
43177fd2a1 Tests/LibWeb: Add a ref test for SVG mask with maskUnits=userSpaceOnUse 2023-10-09 07:28:18 +02:00
MacDue
e9fd7c96af Tests/LibWeb: Add ref test for an SVG mask with mask-type: alpha 2023-10-09 07:28:18 +02:00
MacDue
92fc426562 LibWeb: Add basic support for maskUnits=userSpaceOnUse
This still does not use the x, y, width, or height attributes on the
mask, but this allows at least displaying these masks.
2023-10-09 07:28:18 +02:00
MacDue
479451498b LibWeb: Implement mask-type CSS property
This property allows specifying if a mask is an alpha or luminance mask.

See: https://drafts.fxtf.org/css-masking/#the-mask-type
2023-10-09 07:28:18 +02:00
Aliaksandr Kalenik
b0d75ef096 LibWeb: Create navigables only for iframe in a document tree
Navigable should be created for an iframe only, if after insertion, its
root is the document.

Fixes https://github.com/SerenityOS/serenity/issues/21374
2023-10-08 20:03:43 +02:00
Shannon Booth
79ed72adb4 LibWeb: Port HTMLToken::make_start_tag from DeprecatedFlyString 2023-10-08 08:11:48 -04:00
Shannon Booth
7aac7002d1 LibWeb: Port SVG::TagNames from DeprecatedFlyString 2023-10-08 08:11:48 -04:00
Shannon Booth
48f367adbb LibWeb: Port get_element_by_id from DeprecatedFlyString
We needed to keep the old versions of these functions around before all
of the IDL interfaces were ported over to new AK String, but now that is
done, we can remove the deprecated versions of these functions.
2023-10-08 08:11:48 -04:00
Shannon Booth
b37aab1277 LibWeb: Port named_item_value from DeprecatedFlyString 2023-10-08 08:11:48 -04:00
Shannon Booth
c7cd6f2bef LibWeb: Remove some unused DeprecatedFlyString includes 2023-10-08 08:11:48 -04:00
Shannon Booth
c4d841a6b8 LibWeb: Port tag name from DeprecatedString in Dump 2023-10-08 08:11:48 -04:00
Shannon Booth
d8635fe541 LibWeb: Port HTMLParser local name and value from DeprecatedString 2023-10-08 08:11:48 -04:00
Shannon Booth
e4f8c59210 LibWeb: Port AttributeNames to FlyString 2023-10-08 08:11:48 -04:00
Andreas Kling
6a3f27509f LibJS: Avoid IdentifierTable lookup in cached GetGlobal op
When we hit the cache in GetGlobal, we don't need the identifier string
at all, so let's defer fetching it until after the cache miss.

7% speed-up on Kraken/imaging-gaussian-blur.js :^)
2023-10-08 11:55:27 +02:00
Tim Ledbetter
4cc2fc4afa LibGfx/PNGLoader: Remove redundant IHDR bit depth validation 2023-10-08 10:46:00 +02:00
Tim Ledbetter
bc6ae54b59 LibGfx/PNGLoader: Don't allow multiple consecutive IHDR chunks 2023-10-08 10:46:00 +02:00
Andreas Kling
3250a424f0 LibWeb: Don't offset abspos children of flex container by padding twice
We were incorrectly offsetting the static position of abspos children of
flex containers by the padding twice. This was a misguided attempt to
adjust to the abspos containing block being the padding box, not the
content box.

Fixes #21344.
2023-10-08 09:06:30 +02:00
Aliaksandr Kalenik
a86531809e LibWeb: Destroy navigable containers not inserted into document tree
This change fixes the bug where navigable containers related to a
document, but not present in the tree, were never destroyed.

Fixes https://github.com/SerenityOS/serenity/issues/21364
2023-10-08 06:17:40 +02:00
Xexxa
61b6146d5e Base: Modify emoji
👨‍❤️‍👨 - U+1F468 U+200D U+2764 U+200D U+1F468
COUPLE WITH HEART: MAN, MAN
👩‍❤️‍👩 - U+1F469 U+200D U+2764 U+200D U+1F469
COUPLE WITH HEART: WOMAN, WOMAN
👨‍👨‍👦 - U+1F468 U+200D U+1F468 U+200D U+1F466
FAMILY: MAN, MAN, BOY
👨‍👨‍👧 - U+1F468 U+200D U+1F468 U+200D U+1F467
FAMILY: MAN, MAN, GIRL
👨‍👨‍👧‍👦 - U+1F468 U+200D U+1F468 U+200D U+1F467 U+200D U+1F466
FAMILY: MAN, MAN, GIRL, BOY
👨‍👨‍👦‍👦 - U+1F468 U+200D U+1F468 U+200D U+1F466 U+200D U+1F466
FAMILY: MAN, MAN, BOY, BOY
👨‍👨‍👧‍👧 - U+1F468 U+200D U+1F468 U+200D U+1F467 U+200D U+1F467
FAMILY: MAN, MAN, GIRL, GIRL
👩‍👩‍👦 - U+1F469 U+200D U+1F469 U+200D U+1F466
FAMILY: WOMAN, WOMAN, BOY
👩‍👩‍👧 - U+1F469 U+200D U+1F469 U+200D U+1F467
FAMILY: WOMAN, WOMAN, GIRL
👩‍👩‍👧‍👦 - U+1F469 U+200D U+1F469 U+200D U+1F467 U+200D U+1F466
FAMILY: WOMAN, WOMAN, GIRL, BOY
👩‍👩‍👦‍👦 - U+1F469 U+200D U+1F469 U+200D U+1F466 U+200D U+1F466
FAMILY: WOMAN, WOMAN, BOY, BOY
👩‍👩‍👧‍👧 - U+1F469 U+200D U+1F469 U+200D U+1F467 U+200D U+1F467
FAMILY: WOMAN, WOMAN, GIRL, GIRL
👨‍👦 - U+1F468 U+200D U+1F466
FAMILY: MAN, BOY
👨‍👦‍👦 - U+1F468 U+200D U+1F466 U+200D U+1F466
FAMILY: MAN, BOY, BOY
👨‍👧 - U+1F468 U+200D U+1F467
FAMILY: MAN, GIRL
👨‍👧‍👦 - U+1F468 U+200D U+1F467 U+200D U+1F466
FAMILY: MAN, GIRL, BOY
2023-10-07 15:40:47 -04:00
Xexxa
c1f655dfa9 Base: Add more emoji
🦮 - U+1F9AE GUIDE DOG
🐪 - U+1F42A CAMEL
🐫 - U+1F42B TWO-HUMP CAMEL
🦪 - U+1F9AA OYSTER
👘 - U+1F458 KIMONO
🖇️ - U+1F587 LINKED PAPERCLIPS
2023-10-07 15:40:47 -04:00
Ali Mohammad Pur
dc495e299e Shell: Add support for the bashy list literals in POSIX mode
This is currently only allowed in assignments, where x=(...) is parsed
as the assignment of the list (...) to the variable x.
2023-10-07 22:16:35 +03:30
Ali Mohammad Pur
ebe254a6d3 LibWeb/XML: Avoid placing all elements missing an ns in the HTML ns
Also remove the hack for SVG documents, a well-formed SVG document has
the correct xmlns attribute set, which should be automatically picked up
by the builder now.
2023-10-07 20:02:10 +02:00
Ali Mohammad Pur
830f1dbbfe LibWeb/XML: Do not create text nodes for empty text chunks
This corresponds to the empty text node between foo and bar in
`<foo/><bar/>`, which is not supposed to become a text node in HTML.
2023-10-07 20:02:10 +02:00
Andreas Kling
ae4e46a037 LibJS: Do less work in successfully cached GetByValue* ops
If we have a cached environment coordinate that hasn't been screwed
by eval(), we can get the value directly without instantiating a
Reference.

15% speed-up on Octane/zlib.js :^)
2023-10-07 20:01:52 +02:00
Tim Ledbetter
6f1f0710f8 find: Don't canonicalize path operands
The POSIX specification for `find` says that: "Each path operand shall
be evaluated unaltered as it was provided, including all trailing
<slash> characters". This also matches the behavior of `find` on
FreeBSD and Linux.
2023-10-07 11:37:53 +02:00
Tim Ledbetter
881581820f GameOfLife: Allow pressing escape to clear the selected pattern 2023-10-07 11:36:57 +02:00
Tim Ledbetter
f25f2ba047 GameOfLife: Focus on the game board when not editing settings
This makes single key shortcuts work again :^)
2023-10-07 11:36:57 +02:00
Tim Ledbetter
649c7ee11f GameOfLife: Use the GML compiler 2023-10-07 11:36:57 +02:00
Tim Ledbetter
3930702bd2 LibGUI: Make Statusbar::set_segment_count() public
This allows the GML compiler to handle the `segment_count` property
and allows the status bar segment count to be changed after
construction.
2023-10-07 11:36:57 +02:00