Commit graph

55222 commits

Author SHA1 Message Date
Tim Ledbetter 9788576936 LibVideo/VP9: Ensure color space is not set to reserved value 2023-10-11 14:35:47 -04:00
Andrew Kaster 9a3e9047a5 Meta: Update GN build for recent changes
9a026fc8d5
ae1ac9871b
07b332e17c

And some missed changes from the past that weren't hit because no one
was referencing those symbols :^).
2023-10-11 10:56:24 -06:00
Andrew Kaster c8cf361bbd LibWeb: Install generated CSS/PseudoClass.h file the same as the others 2023-10-11 12:35:35 -04:00
Andrew Kaster 99ffc935ef Lagom: Include all generated installed files on library targets
Do this with INSTALL_INTERFACE genex include directory rules. We should
really standardize where the generated headers *actually* get installed
to though.
2023-10-11 12:35:35 -04:00
Martin Janiczek efa5fb5c3a AK: Fix one-off error in BitmapView::find_first and find_one_anywhere
The mentioned functions used m_size / 8 instead of size_in_bytes()
(division with ceiling rounding mode), which resulted in an off-by-one
error such that the functions didn't search in the last not-fully-8-bits
byte.

Using size_in_bytes() instead of m_size / 8 fixes this.
2023-10-11 15:58:16 +02:00
Sam Atkins 2e615b5316 LibCards: Move Play cards closer together horizontally
With the recent adjustments to how cards are painted, this felt too
spaced out.
2023-10-11 10:56:43 +01:00
Sam Atkins ff8969bd5f GamesSettings: Center cards vertically after recent size change 2023-10-11 10:56:43 +01:00
Sam Atkins eff25f9116 LibCards: Stop calling the card back image a "background" image
It's not a background, past me!
2023-10-11 10:56:43 +01:00
Sam Atkins d8e8b300c8 GamesSettings+LibCards: Add setting for card-front image sets 2023-10-11 10:56:43 +01:00
Sam Atkins 020b858fd0 LibCards: Paint images and number pips on card fronts :^) 2023-10-11 10:56:43 +01:00
Nico Weber c8510b58a3 LibPDF: Cache fonts per page
Previously, every time a page switched fonts, we'd completely
re-parse the font.

Now, we cache fonts in Renderer, effectively caching them per page.

It'd be nice to have an LRU cache across pages too, but that's a
bigger change, and this already helps a lot.

Font size is part of the cache key, which means we re-parse the same
font at different font sizes. That could be better too, but again,
it's a big help as-is already.

Takes rendering the 1310 pages of the PDF 1.7 reference with

    Build/lagom/bin/pdf --debugging-stats \
        ~/Downloads/pdf_reference_1-7.pdf

from 71 s to 11s :^)

Going through pages especially in the index is noticeably snappier.

(On the PDF 2.0 spec, ISO_32000-2-2020_sponsored.pdf, it's less
dramatic: From 19s to 16s.)
2023-10-11 07:10:19 +02:00
Tim Ledbetter e6d9bb0774 LibTLS: Don't attempt to read past EOF when parsing TBSCertificate
This allows the decoder to fail gracefully when reading a partial or
malformed TBSCertificate. We also now ensure that the certificate data
is valid before making a copy of it.
2023-10-11 07:08:22 +02:00
Aliaksandr Kalenik 65b50ecc1a LibWeb/CSS: Parser should treat calc() with flex values as invalid
Fixes crash on https://signal.org/
2023-10-11 07:07:29 +02:00
Sam Atkins 1132c858e9 LibWeb: Stop inserting inline nodes into a generated wrapper box
493dd5d93c caused the `::before`
pseudo-element node to be inserted before the element's content, which
caused issues with how we determine where to insert inline nodes into
the layout tree. At the time, I noticed the issue with contents of flex
containers, and prevented them from merging into a `::before` box.

However, a similar situation happens when we're not in a flex container,
but the pseudo-element has `display: block`. This commit fixes that
situation by using the same logic in both places, so a similar mistake
can't be made again.

This fixes the tab text being invisible on GitHub project pages. :^)
2023-10-11 07:05:23 +02:00
Tim Ledbetter 068f6771ad LibVideo/VP9: Check for invalid subsampled block sizes
Previously, a corrupted block could cause
`Parser::get_subsampled_block_size()` to return an invalid value. We
now return an error in this case.
2023-10-10 23:47:13 +01:00
Tim Ledbetter 569e7173cc LibVideo/VP9: Avoid integer overflow during in place butterfly rotation 2023-10-10 23:47:13 +01:00
Tim Ledbetter fd3837c63b LibVideo/VP9: Return error for frames with invalid subsampling format
Previously, the program would crash if this condition was encountered.
We now return a decoder error allowing for graceful failure.
2023-10-10 23:47:13 +01:00
Nico Weber 409eb644c8 MacPDF: Unbreak persisting the current page
I broke this when moving from a xib file to creating the UI in code.

https://developer.apple.com/documentation/appkit/nsuserinterfaceitemidentification/1396829-identifier
says:

"Identifiers are used during window restoration operations to uniquely
identify the windows of the application. [...] If you create an item in
Interface Builder and do not set a value for this string, a unique value
is created for the item when the nib file is loaded. For
programmatically created views, you typically set this value after
creating the item but before adding it to a window."

Without this, encodeRestorableStateWithCoder: / restoreStateWithCoder:
in MacPDFView weren't getting called.
2023-10-10 09:50:28 -04:00
Nico Weber a75f876ec0 MacPF: Add a small group header in front of the outline
This has to be part of the data source, which makes things a bit
annoying.

For PDFs that have no outline, it says "(No outline)".
2023-10-10 09:50:08 -04:00
Nico Weber fee50cb387 MacPDF: Switch from a cell-based outline view to a view-based one
The documentation is very loud about cell-based things being
deprecated, but it's fairly hidden what to actually do to switch to
the non-deprecated way (implement a certain delegate method).

Session 120 from WWDC 2011 has some notes on this. Apple's official
site no longer seems to have that, but it's e.g. here:
https://docs.huihoo.com/apple/wwdc/2011/session_120__view_based_nstableview.pdf
2023-10-10 09:50:08 -04:00
Nico Weber 25515322e5 MacPDF: Remove outline view header
Just setting headerView to nil removes the header, but also has
the effect of no longer drawing the outline view with a sidebar
background ¯\_(ツ)_/¯.

But also setting drawsBackground to NO on the scroll view restores
the sidebar look, so do that too.

With this, it is no longer necessar to explicitly set style.
The default NSTableViewStyleAutomatic now seems to resolve to
NSTableViewStyleSourceList, so stop explicitly setting it.
(This part has no behavior change.)
2023-10-10 09:50:08 -04:00
Nico Weber e7d41480fc MacPDF: Make clicking outline items have an effect
Clicking an item in the outline now opens that page.

This requires giving the outline view a delegate, which for some
reason also has th effect of indenting expandable items ¯\_(ツ)_/¯
The vertical alignment of text still looks off, though.
2023-10-10 09:50:08 -04:00
Nico Weber 185301c027 MacPDF: Add PDF outline to sidebar
The outline has drawing artifacts, but it is somewhat functional:
You can click on disclosure triangles to open outline items, and
if the outline doesn't fit in the sidebar, it's scrollable.

The outline view has the correct sidebar look: gray with a slightly
transparent glass effect.

Clicking items doesn't have an effect yet.
2023-10-10 09:50:08 -04:00
Nico Weber 79bba20efc MacPDF: Add an NSOutlineViewDataSource for the PDF outline
Not used yet.
2023-10-10 09:50:08 -04:00
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