Commit graph

47383 commits

Author SHA1 Message Date
Linus Groh 85414d9338 AK: Add operator""_{short_,}string to create a String from a literal
We briefly discussed this when adding the new String type but couldn't
settle on a name. However, having to use String::from_utf8() on every
literal string is a bit unwieldy, so let's have these options available!

Naming-wise '_string' is not as short as 'sv' but should be relatively
clear; it also matches '_bigint' and '_ubigint' in length.
'_short_string' may be longer than the actual string itself, but it's
still an improvement over the static function :^)

Since our C++ source files are UTF-8 encoded anyway, it should be
impossible to create a string literal with invalid UTF-8, so including
that in the name is not as important as in the function that can receive
arbitrary data.
2023-02-25 20:51:49 +01:00
kleines Filmröllchen 956450df00 Meta: Document how to manipulate CMake caches for the fuzzing build 2023-02-25 19:39:04 +01:00
kleines Filmröllchen 5ec5c68ed4 Meta: Allow disabling LibWeb fuzzers
The LibWeb fuzzer build is really slow, so for local builds it is useful
to disable it when you're not interested in running that fuzzer.

Co-authored-by: Andrew Kaster <akaster@serenityos.org>
2023-02-25 19:39:04 +01:00
Nico Weber 7c1455c357 LibGfx: Parse WebP VP8L chunk header
For now, just dbgln_if() all data. Eventually we'll want to use at
least width and height.
2023-02-25 16:02:51 +01:00
Nico Weber d5875b5962 LibGfx: Fix lossless fourcc in VP8X chunk decoder 2023-02-25 16:02:51 +01:00
Nico Weber d78c70c28c LibGfx: Add link to webp overview 2023-02-25 16:02:51 +01:00
Nico Weber 0774d2135c LibGfx: Parse some of WebP 'VP8 ' chunk
This is for lossy compression, in which case a WebP file is
a single VP8 key frame.

This only parses the 10-byte frame header, which contains image
dimensions (and some other things).

For now, just dbgln_if() all data. Eventually we'll want to use at
least width and height.
2023-02-25 16:02:51 +01:00
Nico Weber e56e7db9d4 LibGfx: Parse WebP VP8X chunk
For now, just dbgln_if() all data. Eventually we'll want to use at
least width and height.
2023-02-25 16:02:51 +01:00
Nico Weber 58a5038420 LibGfx: Add a FIXME to WebPImageDecoderPlugin::icc_data() 2023-02-25 16:02:51 +01:00
Nico Weber 65d41f8ed9 LibGfx: Add a WebPLoadingContext::error() helper
No behavior change.

(Well, technically, this now correctly sets the state to Error
if the first chunk is neither of 'VP8 ', 'VP8L', 'VP8X'. But no
*interesting* behavior change.)
2023-02-25 16:02:51 +01:00
kleines Filmröllchen 76b71fcb75 LibDSP: Get rid of DeprecatedString
This was a rather easy change, since only parameter names make use of
strings in the first place.

This also improves OOM resistance: If we can't create a parameter name,
we will just set it to the empty string.
2023-02-25 15:41:01 +01:00
Liav A 8a50c967b8 Kernel: Mark sys$prctl() as not needing the big lock
This syscall has sufficient locking and therefore it doesn't need the
big lock being taken.
2023-02-25 15:21:29 +01:00
Nico Weber 41980675f2 Lagom: Build file in lagom builds 2023-02-25 15:00:23 +01:00
Nico Weber b07e9d4c8a Lagom: Build LibELF on arm64
This seems to build fine now on Arm Macs.
2023-02-25 15:00:23 +01:00
MacDue f8bdb584f8 LibDeviceTree: Use unchecked_append() in path parsing
try_append() checks if the vector should increase capacity and if
so grows the vector. unchecked_append() verifies the vector already
has enough capacity, and will never grow the vector.
2023-02-24 23:56:37 +01:00
Linus Groh 69f0339bac Revert "LibDeviceTree: Propagate try_append() errors while parsing paths"
This reverts commit f064f5f36e.

As Andrew points out, this append is not actually fallible in practice,
since the loop is terminated once the vector size reaches its inline
capacity.

https://github.com/SerenityOS/serenity/pull/17606#discussion_r1117662246
2023-02-24 23:40:23 +01:00
Liav A b27f88f61d Kernel+Userland: Refine preventing syscall annotations of Regions option
Instead of using a special case of the annotate_mapping syscall, let's
introduce a new prctl option to disallow further annotations of Regions
as new syscall Region(s).
2023-02-24 22:26:07 +01:00
Liav A 08de5abc6d Kernel: Do 2 validations in annotate_mapping syscall outside a spinlock 2023-02-24 22:26:07 +01:00
Liav A bedd90b1f0 Kernel: Properly lock Process protected data in the prctl syscall 2023-02-24 22:26:07 +01:00
MacDue 727218ff4a LibTimeZone: Propagate try_append() errors while building timezone data 2023-02-24 22:18:25 +01:00
MacDue 01fa3bb788 LibUnicode: Propagate try_append() errors when building emoji data 2023-02-24 22:18:25 +01:00
MacDue f064f5f36e LibDeviceTree: Propagate try_append() errors while parsing paths 2023-02-24 22:18:25 +01:00
Liav A c56e1c5378 Kernel/FileSystem: Simplify the ProcFS significantly
Since the ProcFS doesn't hold many global objects within it, the need
for a fully-structured design of backing components and a registry like
with the SysFS is no longer true.

To acommodate this, let's remove all backing store and components of the
ProcFS, so now it resembles what we had in the early days of ProcFS in
the project - a mostly-static filesystem, with very small amount of
kmalloc allocations needed.
We still use the inode index mechanism to understand the role of each
inode, but this is done in a much "static"ier way than before.
2023-02-24 22:14:18 +01:00
Liav A 9216caeec2 Kernel: Fix typo proccess => process in a name of Process method 2023-02-24 22:14:18 +01:00
Liav A 12b7328c22 AK+Kernel: Add includes before removing Kernel/ProcessExposed.h
Apparently without this file, we won't be able to compile due to missing
includes to TimeManagement and KBufferBuilder.
2023-02-24 22:14:18 +01:00
Timothy Flynn 87c4080d00 Browser+LibWeb+WebContent: Store cookie expiry times in UTC
We are currently converting parsed expiry times to local time, whereas
the RFC dictates we parse them as UTC. When expiring cookies, we must
also use the current UTC time to compare against the cookies' expiry
times.
2023-02-24 15:50:42 -05:00
Timothy Flynn 1858163d3c LibIPC: Add a built-in encoder/decoder for AK::Time 2023-02-24 15:50:42 -05:00
Aliaksandr Kalenik 8eeedce805 LibWeb: Consider transform property while finding containing block 2023-02-24 20:55:40 +01:00
Aliaksandr Kalenik 6092d81e4d LibWeb: Stop overflow clip box aggregation on reached stacking context 2023-02-24 20:55:40 +01:00
Aliaksandr Kalenik 87fa1c5e66 Revert "LibWeb: Fix clip of hidden overflow..."
This reverts commit eb1ef59603.

The idea of saving clip box to apply it to handle `overflow: hidden`
turned out to break painting if box is painted before it's containing
block (it is possible if box has negative z-index).
2023-02-24 20:55:40 +01:00
Liav A 8f3c343b88 Kernel+Userland: Unify declarations for KCOV in Kernel/API/kcov.h 2023-02-24 20:35:45 +01:00
Liav A e7142c482a Kernel+Userland: Move prctl numbers header file to Kernel/API directory 2023-02-24 20:35:45 +01:00
Tim Ledbetter d62c95d779 PixelPaint: Make "Add Mask" action fallible 2023-02-24 20:33:18 +01:00
Tim Ledbetter b548a7b5ea PixelPaint: Make "Add Mask" action undoable 2023-02-24 20:33:18 +01:00
Tim Ledbetter f1a792e6c9 PixelPaint: Save layer mask when adding to the UndoStack
This makes undoing actions performed on layer masks work as
expected.

did_modify_bitmap() is now also called on redo, to ensure the layer
mask is displayed correctly.
2023-02-24 20:33:18 +01:00
Timothy Flynn 34567bc145 LibGfx: Remove single-code point Font::glyph_or_emoji_width API
All callers are now aware of multi-code point emoji (and must remain so
going forward).
2023-02-24 20:28:23 +01:00
Timothy Flynn 16ec116133 LibGUI: Make Gfx- to text-positioning handle multi-code point glyphs 2023-02-24 20:28:23 +01:00
Timothy Flynn 36a495e87e LibGfx: Use non-emoji glyph width API to compute the width of a space 2023-02-24 20:28:23 +01:00
Timothy Flynn 8d0b0fbdd3 LibWeb: Make text fragment indexing handle multi-code point glyphs 2023-02-24 20:28:23 +01:00
Timothy Flynn 3d7b13ac03 LibWeb: Make canvas text preparation handle multi-code point glyphs 2023-02-24 20:28:23 +01:00
Rodrigo Tobar cb04e4e9da LibPDF: Refactor *Font classes
The PDFFont class hierarchy was very simple (a top-level PDFFont class,
followed by all the children classes that derived directly from it).
While this design was good enough for some things, it didn't correctly
model the actual organization of font types:

 * PDF fonts are first divided between "simple" and "composite" fonts.
   The latter is the Type0 font, while the rest are all simple.
 * PDF fonts yield a glyph per "character code". Simple fonts char codes
   are always 1 byte long, while Type0 char codes are of variable size.

To this effect, this commit changes the hierarchy of Font classes,
introducing a new SimpleFont class, deriving from PDFFont, and acting as
the parent of Type1Font and TrueTypeFont, while Type0 still derives from
PDFFont directly. This distinction allows us now to:

 * Model string rendering differently from simple and composite fonts:
   PDFFont now offers a generic draw_string method that takes a whole
   string to be rendered instead of a single char code. SimpleFont
   implements this as a loop over individual bytes of the string, with
   T1 and TT implementing draw_glyph for drawing a single char code.
 * Some common fields between T1 and TT fonts now live under SimpleFont
   instead of under PDFfont, where they previously resided.
 * Some other interfaces specific to SimpleFont have been cleaned up,
   with u16/u32 not appearing on these classes (or in PDFFont) anymore.
 * Type0Font's rendering still remains unimplemented.

As part of this exercise I also took the chance to perform the following
cleanups and restructurings:

 * Refactored the creation and initialisation of fonts. They are all
   centrally created at PDFFont::create, with a virtual "initialize"
   method that allows them to initialise their inner members in the
   correct order (parent first, child later) after creation.
 * Removed duplicated code.
 * Cleaned up some public interfaces: receive const refs, removed
   unnecessary ctro/dtors, etc.
 * Slightly changed how Type1 and TrueType fonts are implemented: if
   there's an embedded font that takes priority, otherwise we always
   look for a replacement.
 * This means we don't do anything special for the standard fonts. The
   only behavior previously associated to standard fonts was choosing an
   encoding, and even that was under questioning.
2023-02-24 20:16:50 +01:00
Rodrigo Tobar e8f1a2ef02 LibPDF: Add new error construction functions
These should make it easier to create specific errors, specially when
wanting to create a formatted message.
2023-02-24 20:16:50 +01:00
Rodrigo Tobar db9fa7ff07 LibPDF: Allow show_text to return errors
Errors can (and do) occur when trying to render text, and so far we've
silently ignored them, making us think that all is well when it isn't.
Letting show_text return errors will allow us to inform the user about
these errors instead of having to hiding them.
2023-02-24 20:16:50 +01:00
Nico Weber 14c0bae704 LibGfx+Tests: Add test for webp ICC loading and fix bug
I drew the two webp files in Photoshop and saved them using the
"Save a Copy..." dialog, with ICC profile and all other boxes checked.

(I also tried saving with all the boxes unchecked, but it still wrote an
extended webp instead of a basic file.)

The lossless file exposed a bug: I didn't handle chunk padding
correctly before this patch.
2023-02-24 20:13:52 +01:00
Xexxa 7485521619 Base: Add more emoji
🧎 - U+1F9CE PERSON KNEELING
🧎‍♂️ - U+1F9CE U+200D U+2642 MAN KNEELING
🧎‍♀️ - U+1F9CE U+200D U+2640 WOMAN KNEELING
🏂 - U+1F3C2 SNOWBOARDER
🥡 - U+1F961 TAKEOUT BOX
🚇 - U+1F687 METRO
🥎 - U+1F94E SOFTBALL
2023-02-24 19:49:40 +01:00
Timothy Flynn 8be43cd3bf LibGfx: Use LibUnicode to filter code points that cannot start an emoji 2023-02-24 19:48:47 +01:00
Timothy Flynn 392c8c99aa LibGfx: Use the paths to emoji images generated alongside emoji data
Rather than formatting the paths at runtime, as vformat is quite heavy
in a profile.
2023-02-24 19:48:47 +01:00
Timothy Flynn 1484d3d9f5 LibUnicode: Add a method to check if a code point could start an emoji 2023-02-24 19:48:47 +01:00
Timothy Flynn 8c38d46c1a LibUnicode: Generate the path to emoji images alongside emoji data
This will provide for quicker emoji lookups, rather than having to
discover and allocate these paths at runtime before we find out if they
even exist.
2023-02-24 19:48:47 +01:00
Timothy Flynn 4212010ebd Base: Add a trailing newline to emoji-serenity.txt
We currently aren't parsing the last line of emoji-serenity.txt because
Core::Stream does not think the last line is readable. We should, of
course, fix Core::Stream. But keeping a trailing newline here is nice
anyways.
2023-02-24 19:48:47 +01:00