Commit graph

44686 commits

Author SHA1 Message Date
Andreas Kling
afba67f3a2 LibGfx/OpenType: Clean up "name" table reading
Use a C++ struct to read out the header, and make the rest of the code
more idiomatic.
2022-12-21 08:44:22 +01:00
Andreas Kling
5d8feab131 LibGfx/OpenType: Read "os2" table using a C++ struct 2022-12-21 08:44:22 +01:00
Andreas Kling
e6551e685d LibGfx/OpenType: Clean up "htmx" table reading
Use a C++ struct to read out the LongHorMetrics, and make the rest of
the code more idiomatic.
2022-12-21 08:44:22 +01:00
Andreas Kling
f04a878e55 LibGfx/OpenType: Read "maxp" table using a C++ struct 2022-12-21 08:44:22 +01:00
Andreas Kling
d201acf102 LibGfx/OpenType: Read "hhea" table using a C++ struct 2022-12-21 08:44:22 +01:00
Andreas Kling
61be11960b LibGfx/OpenType: Read "head" table using a C++ struct
Instead of fidgeting with offsets and manually reading out big-endian
values, we now declare the "head" table as a C++ struct and use the
BigEndian<T> template to deal with byte order.
2022-12-21 08:44:22 +01:00
Andreas Kling
23638a3b3a LibGfx/OpenType: Add spec links to classes representing OpenType tables 2022-12-21 08:44:22 +01:00
Andreas Kling
f982400063 LibGfx: Rename TTF/TrueType to OpenType
OpenType is the backwards-compatible successor to TrueType, and the
format we're actually parsing in LibGfx. So let's call it that.
2022-12-21 08:44:22 +01:00
Timothy Flynn
ed84a6f6ee LibUnicode: Use www.unicode.org domain to download emoji-test.txt
The non-www domain does not appear to be available now. We use the www
domain for UCD.zip already.

Co-authored-by: Stephan Unverwerth <s.unverwerth@serenityos.org>
2022-12-20 12:09:16 -05:00
Sam Atkins
3507679659 Lagom: Remove test apps
These are no longer useful or necessary now that a lot of different
applications run on Lagom.
2022-12-20 12:09:01 -05:00
Nico Weber
c6f81b5b83 Meta: Tweak shell_include.sh
* `chmod -x` as it's for sourcing, not for executing
* Remove run line, for the same reason
* Rename it from .shell_include.sh to shell_include.sh, since e.g.
  `rg` doesn't search in hidden files by default

No behavior change.
2022-12-20 09:23:32 -05:00
Agustin Gianni
9a2ee5a9dd AK: Add DeprecatedString::find_last(StringView)
This adds the the method DeprecatedString::find_last() as wrapper for
StringUtils::find_last for the StringView type.
2022-12-20 11:24:05 +01:00
Alexander Narsudinov
03107d4028 FileManager: Handle possible ByteBuffer allocation failure
Before this patch we created ByteBuffer with the help of the
VERIFY macro that could cause a crash of FileManager
in case of memory allocation failures.

Now we propagate the error to a caller instead of using the
`release_value_but_fixme_should_propagate_errors()` method.
2022-12-20 11:04:44 +01:00
Andrew Kaster
c0542ed40b Meta+test262-runner: Check for signature of __assert_fail in CMake
Rather than trying to assume the only two C libraries on Linux are musl
and glibc, this solution fixes musl builds by explicitly checking for
the one C library function we are overwriting.

That being said, we should find another solution to retrieving this
error information from crashing tests. Possibly just overriding the
SIGABRT handler would work. The full solution might require checking
stderr as well as stdout in the test driver though.
2022-12-20 11:04:05 +01:00
Andrew Kaster
4ed5520e3e ntpquery: Explicitly zero initialize msghdr and fill in fields
Rather than trying to use designated initializers, zero init the
msghdr variable and fill in its fields. This makes sure to zero-init any
padding bytes, and fixes a compilation error on musl-libc based systems.
2022-12-20 11:04:05 +01:00
Andrew Kaster
0d813ee519 LibThreading: Remove unused include of <sys/cdefs.h>
This file is not needed here, and causes a compile issue on musl-libc
based distributions. We should only be including this file in LibC, for
the most part anyway.
2022-12-20 11:04:05 +01:00
Andrew Kaster
61573caf53 LibELF: Include <pthread.h> to ensure PTHREAD_STACK_MAX is available
Android's bionic C library puts this definition in pthread.h rather than
limits.h
2022-12-20 11:04:05 +01:00
MacDue
a9ea0ee9af LibWeb: Fix passing size/position to paint_radial_gradient()
This was wrong twice making it right... But let's fix that.

The center was being passed as a DevicePixelPoint, but was in fact in
CSS pixels, the size was passed as a Gfx::FloatSize but was in
CSS pixels again. Then we were scaling from device pixels to CSS pixels
when painting which does not need to be done if everything is passed
which the correct scale factors already applied.
2022-12-20 11:03:18 +01:00
MacDue
6c27f2c071 LibGfx: Don't blend opaque pixels 2022-12-20 11:03:18 +01:00
MacDue
e3c64a0858 LibGfx: Remove unnecessary divides in Color::mixed_with()
This is mathematically the same thing, but the compiler can't optimize
these out without -Ofast, so let's give it a hand.
2022-12-20 11:03:18 +01:00
Karol Kosek
4784ad66b2 HackStudio: Port to Core::Stream::File :^) 2022-12-20 10:58:54 +01:00
Karol Kosek
697d6ffb1d LibDiff: Make Diff::generate_only_additions take text as StringView 2022-12-20 10:58:54 +01:00
Alexander Narsudinov
ce2ed7615a LookupServer: Propagate the errors from MulticastDNS::handle_packet()
This is a bit awkward, but I think it is better to make the caller
deal with possible errors.
2022-12-20 10:45:20 +01:00
Alexander Narsudinov
e279a1723b LookupServer: Propagate the errors from MulticastDNS::lookup()
This patch slightly change the signature of lookup() method
and propagates all the errors to the caller with help of ErrorOr.
2022-12-20 10:45:20 +01:00
Alexander Narsudinov
767529ebf5 LibCore: Make UDPServer::receive() return ErrorOr<ByteBuffer>
This is a first step towards handling OOM errors instead of just
crashing the program.

Now UDPServer's method `receive()` return memory allocation
errors explicitly with help of ErrorOr.

This removes one FIXME and make a bunch of new ones. :(
2022-12-20 10:45:20 +01:00
implicitfield
9ae9d82a03 unzip: Use StringView instead of DeprecatedString 2022-12-20 10:44:02 +01:00
implicitfield
a520894522 unzip: Verify extracted files against CRC32 checksums
This removes one TODO.
2022-12-20 10:44:02 +01:00
Jelle Raaijmakers
2da1c1c10e LibGL: Generate the API wrappers
We now generate all LibGL API wrappers from a single API method
definition list stored in `GLAPI.json`. Since a significant portion of
the OpenGL API methods are relatively consistent variants, we take
advantage of this to generate a lot of these variants at once.

The autogenerated methods check for the non-nullness of the current
`GLContext`, and only perform an action if a `GLContext` is present.
This prevents a crash in ports like GLTron, who assume you can still
call the OpenGL API without an active context.

This increases our API wrapper method count from 211 to 356.

Fixes #15814.
2022-12-20 10:42:31 +01:00
Jelle Raaijmakers
8c094699db LibGL: Implement glLightModel integer normalization
For the ambient light model, integers need to be remapped to a range of
`-1.` through `1.`. Add the `+` and `-` operators to `VectorN` to make
it a bit easier to normalize 4 values at once.
2022-12-20 10:42:31 +01:00
Jelle Raaijmakers
a074b7e871 LibGL: Support glLightModel inside lists
We now dereference the pointer given to us before adding the arguments
to an active list. This also factors out the switching logic from the
API wrappers, which helps us with a future commit where we autogenerate
all API wrapper functions.
2022-12-20 10:42:31 +01:00
Jelle Raaijmakers
403c560a7a LibGL: Correct GL_LIGHT_MODEL_LOCAL_VIEWER comparison
We were comparing the `x` parameter to `1.f` instead of `0.f`.
2022-12-20 10:42:31 +01:00
Jelle Raaijmakers
6d68f47495 LibGL: Dereference pointer in a consistent way for glMaterial* 2022-12-20 10:42:31 +01:00
Jelle Raaijmakers
7c4bbdc398 LibGL: Simplify transposing input matrices
We do not need to templatize the output type - it's always `float`.
Also, the input type can be inferred. Finally, use template
specialization instead of a conditional to deal with same type input and
output matrices.
2022-12-20 10:42:31 +01:00
Cnidarias
0ca1247a7f PixelPaint: Propagate errors when creating images or layers
This fixes a dozen release_value_but_fixme_should_propage_errors
2022-12-20 10:42:11 +01:00
Jelle Raaijmakers
25f2e4981c AK: Stop using DeprecatedString in Base64 encoding 2022-12-20 10:34:19 +01:00
Jelle Raaijmakers
99c1b634fc AK: Stop using DeprecatedString in UUID 2022-12-20 10:34:19 +01:00
EWouters
f050a426f5 Ports: Add grepcidr port 2022-12-20 10:33:00 +01:00
Baitinq
75ea339ee9 LibGUI: Fix bug in the ColorPicker's spinbox not changing colors
Before this patch, when having the initial spinbox color value
(Color::White), if you changed the color value in the vertical color
picker it didn't update the spinbox's colors.

This is fixed by manually calling update() in the color picker's
onchange() handler if the new color is equal to the previous color,
which is the case in the initial spinbox's case as it will always be
white unless it is changed (and won't be affected by the vertical
color picker).

I added a NOTE in the source to explain this "opaque" update() call :))
2022-12-20 10:30:06 +01:00
Rodrigo Tobar
89061883f2 PDFViewer: Prompt password for encrypted documents
This tackles a FIXME, but also makes sense to implement only now that
the SecurityHandler logic has been fixed. When a Document is created an
automatic attempt is made to provide the empty string as the password;
even if this attempt failed the SecurityHandler still reported it had a
user password, hence we never arrived to the VERIFY_NOT_REQUIRED line
this commit is changing.
2022-12-20 10:28:58 +01:00
Rodrigo Tobar
bb48a67f84 LibPDF: Reset encryption key on failed user password attempt
When an attempt is made to provide the user password to a
SecurityHandler a user gets back a boolean result indicating success or
failure on the attempt. However, the SecurityHandler is left in a state
where it thinks it has a user password, regardless of the outcome of the
attempt. This confuses the rest of the system, which continues as if the
provided password is correct, resulting in garbled content.

This commit fixes the situation by resetting the internal fields holding
the encryption key (which is used to determine whether a user password
has been successfully provided) in case of a failed attempt.
2022-12-20 10:28:58 +01:00
Rodrigo Tobar
dc6a11cf6b LibPDF: Treat Encyption's Length item as optional
With the StandardSecurityHandler the Length item in the Encryption
dictionary is optional, and needs to be given only if the encryption
algorithm (V) is other than 1; otherwise we can assume a length of 40
bits for the encryption key.
2022-12-20 10:28:58 +01:00
Rodrigo Tobar
b8dc05a08e PDFViewer: Fix indexing error in ErrorsView
I confused myself when implementing this, plus I tested using pages that
had errors in pages 1 and 2, so the index and the number of the page
(internally represented as 0-indexed) was always the same. When opening
files with errors on higher pages it became evident that there was an
issue with how I was reading the errors per page from the corresponding
ModelIndex object.
2022-12-20 10:28:58 +01:00
Bruno Conde
7e9019a9c3 LibGfx: Support BMP favicons with less than 32 bpp
Adapt BMPImageDecoderPlugin to support BMP images included in ICOns.
ICOImageDecoderPlugin now uses BMPImageDecoderPlugin to decode all
BMP images instead of it's own ad-hoc decoder which only supported
32 bpp BMPs.
2022-12-20 10:26:55 +01:00
thankyouverycool
91609f9327 FontEditor: Update preview window after pasting and deleting glyphs 2022-12-20 10:22:27 +01:00
thankyouverycool
96d7964913 FontEditor: Add Unicode block/glyph selection Statusbar Segment
Displays the current active Unicode block range, or, if multiple
glyphs are selected, their count. Clicking toggles the Unicode
block ListView.
2022-12-20 10:22:27 +01:00
thankyouverycool
40e94a315a LibGUI+FontEditor: Restore normalized selections on Undo/Redo
Selections are always normalized when saving undo commands.
The restore_selection() function reverses this process so
negatively sized selections (created right-to-left) continue
to resize correctly with the keyboard when restored.
2022-12-20 10:22:27 +01:00
thankyouverycool
02212f373b LibGUI: Reset GlyphMapWidget scroll value when changing active range
Fixes being teleported to the old location when scrolling on a
previously browsed range.
2022-12-20 10:22:27 +01:00
thankyouverycool
d973d43b13 LibGUI: Focus the actively resizing end of GlyphMapWidget selections 2022-12-20 10:22:27 +01:00
thankyouverycool
673afffd5a LibGUI: Only reset GlyphMapWidget selection on Escape
and when using unmodified arrows.
2022-12-20 10:22:27 +01:00
thankyouverycool
4c81fbc8c4 LibGUI: Add Page{Up,Down} support for GlyphMapWidget 2022-12-20 10:22:27 +01:00