Commit Graph

47716 Commits

Author SHA1 Message Date
Andreas Kling
8a48246ed1 Everywhere: Stop using NonnullRefPtrVector
This class had slightly confusing semantics and the added weirdness
doesn't seem worth it just so we can say "." instead of "->" when
iterating over a vector of NNRPs.

This patch replaces NonnullRefPtrVector<T> with Vector<NNRP<T>>.
2023-03-06 23:46:35 +01:00
Sam Atkins
104be6c8ac less: Stop adding extra blank lines
Each time we wrapped a line, we were appending an extra blank span which
wasn't needed. This was leading to an extra blank line after every
single line.
2023-03-06 21:44:28 +01:00
timre13
eef07a411b VideoPlayer: Create submenu to set sizing mode
Also add icon to the sizing mode cycling button.
2023-03-06 20:28:22 +00:00
Matthew Olsson
b33b950e45 Lagom: Add a tool to verify correctness of the LibJS GC
This is implemented as a Clang frontend tool, and currently does two
things:
  - Ensure for all fields wrapped in {Nonnull,}GCPtr<T>, T inherits from
    JS::Cell
  - Ensure for all fields not wrapped in {Nonnull,}GCPtr, that the type
    does not inherit from JS::Cell (otherwise it should be wrapped in a
    Ptr class).

In the future, this tool could be extended further. For example, we may
consider validating all implementations of Cell::visit_impl.
2023-03-06 13:05:43 +00:00
Matthew Olsson
176beeb08e LibJS: Enforce proper const-propogation with {Nonnull,}GCPtr 2023-03-06 13:05:43 +00:00
Matthew Olsson
c0b2fa74ac LibWeb: Fix a few const-ness issues 2023-03-06 13:05:43 +00:00
Matthew Olsson
70a2ca7fc0 LibJS: Handle both const and non-const Ts in Handle<T>::create()
Again, the const-ness only really involves Heap-internal metadata, so
the callers shouldn't care about mutations here.
2023-03-06 13:05:43 +00:00
Matthew Olsson
74e93a46ea LibJS: Fix a few const-ness issues 2023-03-06 13:05:43 +00:00
Matthew Olsson
5f0ccfb499 LibJS: Accept const GCPtrs in Cell::Visitor
The const_cast in these methods should be fine since the object really
only needs to be mutable so it's Heap-internal metadata can be altered.
2023-03-06 13:05:43 +00:00
Matthew Olsson
d4b08b7196 LibJS: Use a forwarding reference in ThrowCompletion constructor
This avoids compiler complaints when trying to use const types
2023-03-06 13:05:43 +00:00
Matthew Olsson
17a528c49e LibJS: Temporarily disambiguate const-ness of GCPtr constructors
Without this change, using {Nonnull,}GCPtr<T const> would complain that
there are multiple constructors which resolve to the same type (T& and
T const&). This removes that disambiguation and allows us to slowly fix
all of the constness issues surrounding GCPtrs. This change will not be
necessary in the future as we will be able to remove all of the const
qualifiers from the Ptr classes (they'll be in the template type
instead).
2023-03-06 13:05:43 +00:00
Matthew Olsson
a9372de972 WebContent: Add missing LibGfx include 2023-03-06 13:05:43 +00:00
Matthew Olsson
6003bcfd2d Browser: Add a missing include in InspectorWidget 2023-03-06 13:05:43 +00:00
Matthew Olsson
bab883bf8e LibJS+LibWeb: Add a bunch of missing includes 2023-03-06 13:05:43 +00:00
Matthew Olsson
8dc7810976 LibGfx: Remove unnecessary AK:: prefix in VectorN.h 2023-03-06 13:05:43 +00:00
Matthew Olsson
445011d50d LibWeb: Fix include cycle between ModuleScript.h and ModuleMap.h 2023-03-06 13:05:43 +00:00
nipos
1a29ecd648 LibCore: Don't use DT_WHT in DirectoryEntry on OpenBSD 2023-03-06 12:53:01 +00:00
Ryan Liptak
bf3d9a7372 Base: Improve a few ball emojis
🎱 U+1F3B1 - Pool 8 Ball
🏀 U+1F3C0 - Basketball
🏐 U+1F3D0 - Volleyball
🥎 U+1F94E - Softball
 U+26BE - Baseball
2023-03-06 06:29:56 -05:00
Linus Groh
1a6b61b0cc LibWeb/HTML: Move WindowOrWorkerGlobalScope code into a mixin class
This will allow us to easily share the implementations of these methods
between Window and WorkerGlobalScope. The mixin class mirrors what I
already did for the Fetch API's Body mixin in 5ad62833.
2023-03-06 11:02:25 +00:00
Linus Groh
b118cc782e LibWeb/HTML: Implement WorkerGlobalScope::cross_origin_isolated() 2023-03-06 11:02:25 +00:00
Linus Groh
ed15c34387 LibWeb/HTML: Implement WorkerGlobalScope::is_secure_context() 2023-03-06 11:02:25 +00:00
Linus Groh
d1a7c39e76 LibWeb/HTML: Implement WorkerGlobalScope::origin() 2023-03-06 11:02:25 +00:00
Andreas Kling
552895da60 LibGfx: Skip old-style emoji lookup for fonts that have color bitmaps
Ultimately, we should find a way to route all emoji access through
the font code, but for now, this patch adds a special case for fonts
that are known to have embedded color bitmaps so we can test them.
2023-03-06 10:52:55 +01:00
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