Commit graph

59338 commits

Author SHA1 Message Date
Nico Weber b9a4689af3 LibPDF: In Type0Font, read metrics /DW2 and /W2 for vertical text
Not used for anything yet.
2024-03-02 12:25:09 +01:00
Nico Weber ef5d7b685d LibPDF: In Type0::initialize(), move variable increment next to cause
No behavior change.
2024-03-02 12:25:09 +01:00
Nico Weber fc9b2440bd LibPDF: Add some spec comments in Type0Font::initialize() 2024-03-02 12:25:09 +01:00
Nico Weber 004e47df88 LibPDF: Remove minor duplication in Renderer::text_show_string_array()
This "regressed" in #10080 (back then, the branches were smaller).

No behavior change.
2024-03-02 12:25:09 +01:00
Timothy Flynn 62596f3e43 CI: Reduce the ccache size for CI
We currently use 0.6GB for a clean build with sanitizers enabled. This
will allow us to have ~3 clean builds cached and save 3GB of disk space
on CI. (The effect is actually double, because Azure archives the cache
in a tar file before uploading).
2024-03-02 09:11:03 +01:00
Timothy Flynn ba67a0645e CI: Strip binaries and libraries during the installation step
This saves ~400MB of disk space.
2024-03-02 09:11:03 +01:00
Idan Horowitz 0b7e4b335a strace: Add support for pretty-printing the prctl syscall 2024-03-02 09:10:14 +01:00
Idan Horowitz 8c562a764d strace: Add support for printing the fourth syscall argument 2024-03-02 09:10:14 +01:00
Idan Horowitz beca73e0fd strace: Add support for pretty-printing the kill syscall 2024-03-02 09:10:14 +01:00
Idan Horowitz c55b4d49a3 strace: Replace incorrect syscall arg2 register
Since commit e6df1c9988 which switched us
over to using the syscall/sysret instruction the second syscall
argument changed from rcx to rdi. Update strace as well to print the
actually correct values for the second arg.
2024-03-02 09:10:14 +01:00
Idan Horowitz 209c588ed1 Kernel: Switch a couple of signal dispatch dbglns to dbgln_if
These are pretty spammy when using strace.
2024-03-02 09:10:14 +01:00
Aliaksandr Kalenik 06c176bbfb LibGfx+LibWeb: Use ref-counted object to store glyph run
...to avoid allocating a copy of glyph run for painting commands. We
can't simply save pointers to a glyph run in layout/paintable tree
because it should be safe to deallocate layout and paintable trees
after painting commands are recorded, if in the future we decide to
move command execution to a separate thread.
2024-03-02 09:09:10 +01:00
Aliaksandr Kalenik cf6999f5f3 LibWeb: Remove glyph run allocation in paint_text_fragment()
Instead of allocating a new glyph run to scale glyph positions and
fonts, a scale factor could be encoded in a paint command and applied
later during command execution.
2024-03-02 09:09:10 +01:00
Aliaksandr Kalenik aeb5a0d9e8 LibWeb: Remove glyph run allocation in RecordingPainter::draw_text_run
Instead of allocating a new glyph run solely to shift each glyph by the
painter's offset, this offset could be encoded in a paint command and
applied later during command execution.
2024-03-02 09:09:10 +01:00
Hendiadyoin1 79fd8eb28d AK/HashMap: Use structured bindings when iterating over itself 2024-03-01 14:05:53 -07:00
Hendiadyoin1 b0fc5bea91 Kernel/PCI: Prefer structured bindings when iterating over HashMaps
This makes `Access::rescan_hardware` look a bit nicer.
2024-03-01 14:05:53 -07:00
Hendiadyoin1 2537efaf64 LibGUI: Use HashMap::keys() to hand out the available sizes of icons 2024-03-01 14:05:53 -07:00
Hendiadyoin1 e1c663ba27 LibTLS: Move Strings when creating RelativeDistinguishedNames
Also cleans up the organizational_unit() helper to use `value_or({})`
instead of doing the same thing manually.
2024-03-01 14:05:53 -07:00
Hendiadyoin1 f7329f89aa LibTLS: Prefer structured bindings when iterating over HashMaps 2024-03-01 14:05:53 -07:00
Hendiadyoin1 d6c631ebe0 WindowServer: Prefer structured bindings when iterating over HashMaps 2024-03-01 14:05:53 -07:00
Hendiadyoin1 773a280bdf LibPDF: Use a struct for the subsection in parse_xref_stream 2024-03-01 14:05:53 -07:00
Hendiadyoin1 3e3b34ab8a Kernel/NVMe: Use a struct for the namespace features, instead of a Tuple 2024-03-01 14:05:53 -07:00
Hendiadyoin1 fe0fde2154 Userland+Tests: Remove unused <AK/Tuple.h> includes 2024-03-01 14:05:53 -07:00
Andreas Kling d1b5f55f91 LibWeb: Make Paintable::containing_block() return a PaintableBox*
Every single client of this function was immediately calling paintable()
on the result anyway, so there was no need to return a layout node!

This automatically leverages the cached containing block pointer we
already have in Paintable, which melts away a bunch of unnecessary
traversal in hit testing and painting. :^)
2024-03-01 17:57:10 +01:00
Nico Weber c3980eda9e LibPDF: Give Type0 CIDFontType2 a ScaledFont instead of a Font
...with the same reasoning as the previous commit.

No behavior change.
2024-03-01 17:56:59 +01:00
Nico Weber f374ad50a1 LibPDF: Give TrueTypePainter a ScaledFont instead of a Font
This will allow us to get at the font's glyphs as paths, which will
eventually enable us to implement glyph rotation. We'll have to do our
own caching then, but we can then hopefully share the caching across the
Type0 / Type1 / TrueType codepaths.

It also gives us access to a font's glyphs by glyph id, which will help
us implementing looking up glyph ids by postscript name.  (Else we'd
have to plumb through a whole Painter::draw_glyph_by_postscript_name()
API just for LibPDF.)

No behavior change.
2024-03-01 17:56:59 +01:00
Nico Weber 5dad8b693e LibPDF: Make PDFFont::replacement_for() return a ScaledFont
We only want to load non-bitmap fallback fonts as PDF fallback fonts,
so let's make the return type represent that.

No behavior change.
2024-03-01 17:56:59 +01:00
Nico Weber 7d9294b9a4 LibGfx: Add ScaledFont::scaled_with_size()
It's like ScaledFont::with_size(), except that it guarantees that the
result is non-null and ScaledFont. (Smart pointers don't allow
covariant return types, else we could just narrow down the return
type of with_size() while still overriding the base method.)

No behavior change.
2024-03-01 17:56:59 +01:00
Andreas Kling bc21ed151e LibJS/Bytecode: Handle awkward initialization case for duplicate var
`var` declarations can have duplicates, but duplicate `let` or `const`
bindings are a syntax error.

Because of this, we can sink `let` and `const` directly into the
preferred_dst if available. This is not safe for `var` since the
preferred_dst may be used in the initializer.

This patch fixes the issue by simply skipping the preferred_dst
optimization for `var` declarations.
2024-03-01 14:51:08 +01:00
Nico Weber 2bbdfe0fba LibPDF: Treat "Oblique" as italic indicator
The standard 14 fonts include e.g. "CourierBoldOblique" and
"HelveticaOblique". Let's map them to italic fonts :^)
2024-03-01 14:17:42 +01:00
Nico Weber 8e3c54f203 LibPDF: Implement ZapfDingbats clause of the adobe glphy list algorithm
Liberation Sans still doesn't have the vast majority of the
Zapf Dingbats glyphs, but now we map the Zapf Dingbats names to good
unicode values.  So we only need to use a different font and all should
work.  (And Liberation Sans has _some_ of the glyphs, like 13 of the
223.) And we now render empty squares instead of wrong glyphs for the
ones we don't have.

I haven't seen any PDFs using ZapfDingbats in the wild, but they
probably exist somewhere.
(Tests/LibPDF/standard-14-fonts.pdf is a synthetic PDF using it.)
2024-03-01 14:17:42 +01:00
Nico Weber 2eb099aabe LibPDF: Implement some of the AdobeGlyphList algorithm
Turns out there's a spec that goes with the table.

The big change here is that we can now map `uni1234` to 0x1234 and
`u123456` to 0x123456.

The parts where we split a name on `_` and map each component
and the part where we're supposed to allow multiple groups of 4
after `uni` aren't implemented yet.

The ZapfDingbats lookup is also still missing.

I haven't seen this have an effect in practice, but it's easy to
construct a PDF with a custom encoding where it would make a
difference.
2024-03-01 14:17:42 +01:00
Nico Weber f8b8d1b3be AK: Add is_ascii_uppercase_hex_digit() 2024-03-01 14:17:42 +01:00
Aliaksandr Kalenik 2764966ccc LibWeb: Reduce paintable tree traversals during hit-testing
By storing a list of positioned and floating descendants within the
stacking context tree node, we can eliminate the need for costly
paintable tree traversals during hit-testing.

This optimization results in hit-testing being 2 to 2.5 times faster
on https://ziglang.org/documentation/master/
2024-03-01 13:03:53 +01:00
Timothy Flynn 9c6c3fe0d8 Meta: Use correct helper process paths in the GN build
These changed to libexec in ea59bfaae7.
2024-02-29 22:16:39 -05:00
Timothy Flynn e1e42f5f58 Meta: Port recent changes to the GN build
f9e5b43b7a
b9dc2d7ebf
fa692ae3f6
2024-02-29 22:16:39 -05:00
Timothy Flynn 5a116a8f72 Meta: Alphabetize IDL files in the GN build 2024-02-29 22:16:39 -05:00
Luke Wilde 48e11a1f12 LibWeb: Empty CE reaction queue instead of destroying it on exception
If an exception occurs in a custom element constructor, we clear the
reaction queue by destroying it, instead of emptying the Vector.
3da6916383/Userland/Libraries/LibWeb/DOM/Element.cpp (L2033)

This causes a UAF here, as async upgrades (i.e. custom elements not
created by document.createElement) are performed in this loop:
3da6916383/Userland/Libraries/LibWeb/Bindings/MainThreadVM.cpp (L657)

Fixes crash when loading https://github.com/SerenityOS/serenity
2024-02-29 21:58:01 -05:00
Tim Ledbetter 5b4533cab8 LibWeb: Don't crash in offset_parent() if no ancestor element found
The specification says the final step of this algorithm is to return
null. Previously, the browser would crash if the content of an iframe
was appended to the document before its offsetParent property was
queried.
2024-02-29 21:54:53 -05:00
Timothy Flynn 3da6916383 CI: Remove the WPT directory after tests have completed
This directory is about 600MB. Remove it after running WPT as an attempt
to alleviate CI disk space issues.
2024-02-29 14:27:25 -05:00
Aliaksandr Kalenik 90879a07ba LibWeb: Skip page scrolling for wheel events consumed by scrollable box
Fixes the bug when we scroll both scrollable box and page.
2024-02-29 13:18:57 +01:00
Gabriel Tassinari 30d8c5f301 LibLine: Ensure suggestions are reset after ^C 2024-02-29 09:09:47 +01:00
Tim Ledbetter 3bd9566847 LibWeb: Fix typo on CSSConditionRule test 2024-02-29 09:01:04 +01:00
Timothy Flynn d878975f95 AK+LibJS: Remove OFFSET_OF and its users
With the LibJS JIT removed, let's not expose pointers to internal
members.
2024-02-29 09:00:00 +01:00
Tim Ledbetter 4646a87eba LibWeb: Make CSSConditionRule.conditionText read-only
Previously @media rule conditions could be updated by assigning to
`conditionText`. This change aligns our implementation with the CSSOM
specification, which says `CSSConditionRule.conditionText` should be
read-only.
2024-02-28 22:14:58 +01:00
implicitfield b08fd1b9ae LibWeb: Improve support for 'vertical-align: middle'
This rebaselines a few table-related layout tests since our default
stylesheet applies 'vertical-align: middle' to a few table-related
elements.
2024-02-28 16:11:05 -05:00
Nico Weber 41e0a0f0aa LibGfx/OpenType: Add named constants for header tags
...together with spec comments.

No behavior change.
2024-02-28 16:00:07 -05:00
Nico Weber 36bbf12b73 LibGfx: Add FourCC::from_u32() 2024-02-28 16:00:07 -05:00
Nico Weber 53c6dfacd7 LibGfx: IWYU for FourCC.h
Makes clangd-induced red squigglies disappear when editing this file.

No behavior change.
2024-02-28 16:00:07 -05:00
Nico Weber 86203974f5 LibGfx/OpenType: Extract read_tag() function 2024-02-28 16:00:07 -05:00