Commit graph

47693 commits

Author SHA1 Message Date
Andreas Kling
924d23353e LibGfx/OpenType: Support one specific type of embedded color bitmaps
This patch adds support for index format 1 and image format 17.
This is enough to get Noto Color Emoji working.
2023-03-06 10:52:55 +01:00
Andreas Kling
e8cc1a4373 LibGfx: Prepare the paint code for fonts whose glyphs are color bitmaps
This patch does three things:
- Font::has_color_bitmaps() (true if CBLC and CBDT are present)
- Glyph now knows when its bitmap comes from a color bitmap font
- Painter draws color bitmap glyphs with the appropriate scaling etc
2023-03-06 10:52:55 +01:00
Andreas Kling
bca35bee6d LibGfx/OpenType: Add scaffolding for CBDT and CBLC tables 2023-03-06 10:52:55 +01:00
Andreas Kling
e6131e45e2 LibGfx/OpenType: Make "glyf" and "loca" tables optional
These tables are not guaranteed to be present in all font files.
2023-03-06 10:52:55 +01:00
MacDue
918a3082d6 LibWeb: Fix currentColor as a background-color (and maybe other places)
This moves color to be the first value resolved, this ensures that
calls to .to_color() on style values for other properties will always
be able to resolve the current color.

This change fixes the `background-color: currentColor` example in
colors.html.
2023-03-06 00:09:13 +00:00
Timothy Flynn
77fbd912b7 LibWeb+WebContent+WebDriver: Port WebDriver parameters to String
This changes the parameters parsed from a WebDriver HTTP request to
String for transferring over IPC. Conveniently, most locations these
were ultimately passed to only need a StringView.
2023-03-05 23:50:05 +00:00
Timothy Flynn
03d0be13e8 LibWeb: Allow constructing a WebDriver::Error from an OOM AK::Error
This will allow easily surrounding operations that may fail due to OOM
with TRY. Note that we now also have to define a "normal" constructor
for WebDriver::Error in order to add the AK::Error constructor.
2023-03-05 23:50:05 +00:00
Timothy Flynn
a7bb72a3d6 LibIPC: Support transferring String over IPC
Note that unlike the StringView encoder, we do not handle any "null"
state, as the new String cannot be null.
2023-03-05 23:50:05 +00:00
Sam Atkins
a1baa5cb00 CharacterMap: Make the search happen as you type 2023-03-05 23:03:32 +01:00
Sam Atkins
1f0f96e6d7 CharacterMap: Limit the number of results from the GUI character search
Past a few hundred matches, the search is no longer useful, and takes an
excessive amount of time to recalculate the column widths by measuring
thousands of pieces of text. 250 seems like a reasonable arbitrary
limit, and keeps things nice and snappy. :^)
2023-03-05 23:03:32 +01:00
Sam Atkins
bb8bd48dc0 CharacterMap: Pause updates while generating search results
Co-authored-by: Tim Flynn <trflynn89@pm.me>
2023-03-05 23:03:32 +01:00
Linus Groh
725a758c66 LibIDL: Also parse extended attributes after 'optional'
From the WebIDL grammar:
(https://webidl.spec.whatwg.org/#prod-Argument)

Argument ::
    ExtendedAttributeList ArgumentRest
ArgumentRest ::
    optional TypeWithExtendedAttributes ArgumentName Default
TypeWithExtendedAttributes ::
    ExtendedAttributeList Type

One IDL file has been updated to match the spec literally, as it can now
be parsed properly.
2023-03-05 21:59:16 +00:00
Linus Groh
cc1e8a4e9f LibWeb/HTML: Propagate errors from Window::initialize_web_interfaces() 2023-03-05 21:22:34 +00:00
Sam Atkins
8110cf9fab PartitionEditor: Migrate to Directory::for_each_entry() 2023-03-05 20:23:42 +01:00
Sam Atkins
3c25a9b5fe MouseSettings: Migrate to Directory::for_each_entry() 2023-03-05 20:23:42 +01:00
Sam Atkins
1b776bffcf KeyboardSettings: Migrate to Directory::for_each_entry() 2023-03-05 20:23:42 +01:00
Sam Atkins
8f3c77a5a3 ImageViewer: Migrate to Directory::for_each_entry() 2023-03-05 20:23:42 +01:00
Sam Atkins
c325a656ec GamesSettings: Migrate to Directory::for_each_entry() 2023-03-05 20:23:42 +01:00
Sam Atkins
442dd133bb FileManager: Migrate to Directory::for_each_entry() 2023-03-05 20:23:42 +01:00
Sam Atkins
3daaf47607 Assistant: Migrate to Directory::for_each_entry() 2023-03-05 20:23:42 +01:00
Sam Atkins
728b07fbf6 Tests: Migrate to Directory::for_each_entry() 2023-03-05 20:23:42 +01:00
Sam Atkins
23aec16e8b LibCore: Introduce a new directory iteration API
`Core::Directory::for_each_entry()` takes a callback which is passed the
DirectoryEntry and the parent Directory. It returns any error from
creating the iterator, iterating the entries, or returned from the
callback.

As a simple example, this:

```c++
Core::DirIterator piece_set_iterator { "/res/icons/chess/sets/",
        Core::DirIterator::SkipParentAndBaseDir };
while (piece_set_iterator.has_next())
    m_piece_sets.append(piece_set_iterator.next_path());
```

becomes this:

```c++
TRY(Core::Directory::for_each_entry("/res/icons/chess/sets/"sv,
        Core::DirIterator::SkipParentAndBaseDir,
        [&](auto const& entry, auto&) -> ErrorOr<IterationDecision> {
    TRY(m_piece_sets.try_append(entry.name));
    return IterationDecision::Continue;
}));
```
2023-03-05 20:23:42 +01:00
Sam Atkins
ceaed7440e LibCore: Remove unused Directory::create_iterator() method 2023-03-05 20:23:42 +01:00
Sam Atkins
a4667fdc9b LibCore: Expose Directory file descriptor 2023-03-05 20:23:42 +01:00
Sam Atkins
7864898f52 LibCore: Ensure that Directory always has a path
`Directory::path()` returning `ErrorOr` makes it awkward to use, and all
current users create a Directory with a path. If we find we need
pathless directories later, we can come up with a clever solution
then. :^)
2023-03-05 20:23:42 +01:00
Sam Atkins
774f328783 LibCore+Everywhere: Return an Error from DirIterator::error()
This also removes DirIterator::error_string(), since the same strerror()
string will be included when you print the Error itself. Except in `ls`
which is still using fprintf() for now.
2023-03-05 20:23:42 +01:00
Sam Atkins
a98ae8f357 LibCore: Expose file type from DirIterator
Our `find` utility makes use of the `dirent::d_type` field for filtering
results, which `Core::DirIterator` didn't expose. So, now it does. :^)

We now store the name and type of the entry as the "next" value instead
of just the name. The type is exposed as a `DirectoryEntry::Type`
instead of a `DT_FOO` constant, so that we're not tied to posixy
systems, and because proper enums are nice. :^)
2023-03-05 20:23:42 +01:00
Timothy Flynn
bc0bb98c01 LibGUI: Paint emoji using text in the EmojiInputDialog
This widget originally used text, but at the time we did not support
painting multi-code point emoji as text at all. So it was changed to
paint emoji with their bitmaps in commit 8190120f95.

Now that we can paint text with multi-code point emoji, revert this
widget to use text again. This has the added benefit that the dialog has
a what-you-see-is-what-you-get effect; any emoji with text presentation
in the font (e.g. U+00A9 Copyright) will be displayed as such in the
dialog, which is how the text would be painted when selected anyways.

Note that to accommodate some emoji sizes, this also had to bump the
button sizes a bit, otherwise they would be displayed with an ellipsis.
2023-03-05 20:21:57 +01:00
Timothy Flynn
054297431a LibGUI: Fix typo in the name of the EmojiCategory struct 2023-03-05 20:21:57 +01:00
Timothy Flynn
153218ed76 LibGUI: Allow overriding toolbar button tooltips
The EmojiInputDialog, for example, will want its toolbar buttons to have
a tooltip which differs from its text. If no tooltip override has been
provided, we fall back to the button text still.
2023-03-05 20:21:57 +01:00
Timothy Flynn
f8a0365002 LibUnicode: Detect ZWJ sequences when filtering by emoji presentation
This was preventing some unqualified emoji sequences from rendering
properly, such as the custom SerenityOS flag. We rendered the flag
correctly when given the fully qualified sequence:

    U+1F3F3 U+FEOF U+200D U+1F41E

But were not detecting the unqualified sequence as an emoji when also
filtering for emoji-presentation sequences:

    U+1F3F3 U+200D U+1F41E
2023-03-05 20:21:57 +01:00
Kenneth Myhra
ab6bd946d8 LibWeb: Port ProgressEvent to new String 2023-03-05 18:25:59 +00:00
Kenneth Myhra
fe6b82b01c LibWeb: Port WebGLContextEvent to new String 2023-03-05 18:25:59 +00:00
Kenneth Myhra
cec1cda8b0 LibWeb: Port SubmitEvent to new String 2023-03-05 18:25:59 +00:00
Kenneth Myhra
dd2d029952 LibWeb: Port PromiseRejectionEvent to new String 2023-03-05 18:25:59 +00:00
Kenneth Myhra
bb7ae423d5 LibWeb: Port FormDataEvent to new String 2023-03-05 18:25:59 +00:00
Kenneth Myhra
eed69e5093 LibWeb: Port MessageEvent to new String 2023-03-05 18:25:59 +00:00
Kenneth Myhra
84997ab0ee LibWeb: Port ErrorEvent to new String 2023-03-05 18:25:59 +00:00
Kenneth Myhra
e661f03ffa LibWeb: Port CloseEvent to new String 2023-03-05 18:25:59 +00:00
Kenneth Myhra
d0f904dd4c LibWeb: Port MediaQueryListEvent to new String 2023-03-05 18:25:59 +00:00
Kenneth Myhra
97947fdffa LibWeb: Port PageTransitionEvent to new String 2023-03-05 18:25:59 +00:00
Kenneth Myhra
03ceca4ca1 AK: Add FlyString::to_deprecated_fly_string()
This adds the conversion function to_deprecated_fly_string() to enable
conversion from new FlyString to DeprecatedFlyString.
2023-03-05 18:25:59 +00:00
Nico Weber
efabfd4c66 LibGfx: Fill in remaining values in built-in sRGB profile
The values aren't 100% self-consistent, but it probably doesn't make
a difference for u8 color data. Good enough for now. See all the links
on #17714 for some more background.
2023-03-05 18:21:43 +00:00
Liav A
be1d7c325a Kernel: Move process coredump metadata modification to the prctl syscall 2023-03-05 16:55:08 +01:00
Sam Atkins
822164a686 LibCMake: Add folding regions to syntax highlighter
This creates folding regions for blocks defined by the following:
- if/elseif/else/endif
- foreach/endforeach
- while/endwhile
- macro/endmacro
- function/endfunction

Since there is no guarantee that each keyword will have a matching
partner, we do our best by looking for the most recent possible start
token matching the current end token. If we find one, we link to it and
drop all the other start-tokens that happened in between. For example,
we would define a folding region for this invalid file like so:

[-] if(TRUE)
 │      while()
 └─ endif()
2023-03-05 16:54:10 +01:00
Sam Atkins
631927470a LibCMake: Treat block, endblock and return as control keywords
I missed these before because they weren't mentioned on the language
description page of the CMake manual.
2023-03-05 16:54:10 +01:00
Timothy Flynn
ca2b030336 LibUnicode: Use binary search for lookups into the generated emoji data
This sorts the array of generated emoji data by code point (first by
code point length, then by code point value). This lets us use a binary
search to find emoji data, rather than the current linear search.

In a profile of scrolling around /home/anon/Documents/emoji.txt, this
reduces the runtime of Gfx::Emoji::emoji_for_code_points from 69.03% to
28.42%. Within that, Unicode::find_emoji_for_code_points reduces from
28.42% to just 1.95%.
2023-03-05 16:44:20 +01:00
Linus Groh
2bc54ae56a LibWeb: Remove unused SourceGenerator mappings 2023-03-05 15:37:33 +00:00
Linus Groh
65b1229dae LibWeb: Don't use C++ name for error messages in generated bindings 2023-03-05 15:37:33 +00:00
Linus Groh
a430d78843 LibWeb: Use 'Base::initialize()' in generated bindings 2023-03-05 15:37:33 +00:00