Commit graph

45719 commits

Author SHA1 Message Date
Linus Groh
966d808135 Ladybird: Replace ColorScheme enum with Web::CSS::PreferredColorScheme
This matches OutOfProcessWebView::set_preferred_color_scheme().
2023-01-12 18:27:34 +00:00
Tim Schumacher
877be0eb43 SoundPlayer: Don't silently ignore parsing failures
If we failed to decode a sample we'd presumably want to tell the user,
and we definitely don't want to just go into another round of decoding
somewhere in the middle of a broken sample.
2023-01-12 16:52:34 +01:00
Tim Schumacher
1caad457ef LibAudio: Don't assume that a non-full span means EOF
Especially if buffered streams are involved, not filling the span
completely can also mean that we just ran out of filled buffer space and
we need to refill it on the beginning of the next read call.
2023-01-12 16:52:34 +01:00
Linus Groh
0cc151bc1c Ladybird: Implement zoom :^) 2023-01-12 15:14:09 +00:00
Linus Groh
05ef6c9b64 Ladybird: Set 'device pixels per CSS pixel' to device pixel ratio :^) 2023-01-12 15:14:09 +00:00
Linus Groh
f3b6b50ee0 WebContent: Add IPC for setting 'device pixels per CSS pixel' 2023-01-12 15:14:09 +00:00
Linus Groh
075b4ca4d0 LibWeb: Rename PageHost::m_screen_display_scale to match the getter name 2023-01-12 15:14:09 +00:00
Karol Kosek
ca7648b1ae LibGUI: Port AbstractThemePreview::set_theme_from_file to Core::Stream 2023-01-12 13:56:11 +01:00
Karol Kosek
17012b266c LibGUI: Remove unused AbstractThemePreview::on_theme_load_from_file 2023-01-12 13:56:11 +01:00
Tim Ledbetter
b0fad409bf PixelPaint: Scale lasso tool preview path on zoom level change
The size of the preview shown by the lasso tool now scales with the
current zoom level.
2023-01-12 11:29:10 +01:00
MacDue
1cf45ee930 Utilities: Add ttfdisasm for disassembling OpenType instructions
This utility when given a .tff font provides options for disassembling:

 - The 'fpgm' table, this a program that's run once when the font is
   loaded. It's used to define instructions and functions used by used
   by other programs.

 - The 'prep' table, this is a general program that's run when ever
   the font size (or other properties) changes.

 - And the programs associated with any individual glyph.

The disassembly is printed in a format that matches the examples from:
https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions

I'm mainly adding this because I think it's neat to be able to look
at these things, and think it'll be helpful for debugging an
interpreter.

With this you can see that all of the LiberationSerif-XXX.tff fonts in
Serenity have these programs ready to go.
2023-01-12 11:27:57 +01:00
MacDue
768dc4cda1 LibGfx: Provide accessors to instruction data to OpenType::Font
These probably won't need to stick around forever, but will be helpful
for creating some debug utilities.
2023-01-12 11:27:57 +01:00
MacDue
4e5dc169a6 LibGfx: Parse the TTF fpgm and prep tables
These contain the font and CVT programs respectively.
2023-01-12 11:27:57 +01:00
MacDue
3b282ba8bb LibGfx: Add OpenType opcodes and helpers to parse instruction streams
This defines all the OpenType opcodes/instructions from the
specification:
https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions

Each instructions has mnemonic and a range of possible opcodes (as some
of the bits are pretty much immediate value flags).

There's a little helper Instruction struct for accessing the flags and
any associated data (in the case of PUSH instructions).

Then the InstructionStream provides a way of iterating over all the
instructions in some bytes.
2023-01-12 11:27:57 +01:00
Sam Atkins
652f87821b Userland: Replace remaining Core::Timer::construct()s with try_create() 2023-01-12 11:25:51 +01:00
Sam Atkins
e181b1cb82 Userland: Use Core::Timer::create_foo() factory functions where possible 2023-01-12 11:25:51 +01:00
Sam Atkins
6edc0cf5ab LibCore+Userland: Don't auto-start new Core::Timers
This was unintuitive, and only useful in a few cases. In the majority,
users had to immediately call `stop()`, and several who did want the
timer started would call `start()` on it immediately anyway. Case in
point: There are only two places I had to add a manual `start()`.
2023-01-12 11:25:51 +01:00
Sam Atkins
a8cf0c9371 LibCore+Userland: Make Core::Timer::create_single_shot() return ErrorOr
clang-format sure has some interesting opinions about where to put a
method call that comes after a lambda. :thonk:
2023-01-12 11:25:51 +01:00
Sam Atkins
a15d44f019 LibCore+Userland: Make Core::Timer::create_repeating() return ErrorOr
The FIXMEs must flow!
2023-01-12 11:25:51 +01:00
Timothy Flynn
1d4f287582 AK: Implement FlyString for the new String class
This implements a FlyString that will de-duplicate String instances. The
FlyString will store the raw encoded data of the String instance: If the
String is a short string, FlyString holds the String::ShortString bytes;
otherwise FlyString holds a pointer to the Detail::StringData.

FlyString itself does not know about String's storage or how to refcount
its Detail::StringData. It defers to String to implement these details.
2023-01-12 11:23:58 +01:00
Linus Groh
f49a65cb28 Ladybird: Use standard font paths in FontPluginQt
This makes vector fonts load on macOS, where /usr/share/fonts doesn't
exist and Ladybird would only load the bitmap fonts from ./res/fonts
in the SerenityOS resource root directory.
Additionally, fonts in {/usr/share/local,~/.local}/fonts are now loaded
on Linux.
2023-01-11 20:54:49 +00:00
Linus Groh
c5cadca542 LibCore: Add StandardPaths::font_directories()
This provides a list of well-known directories containing font files,
e.g. for use with Gfx::FontDatabase::load_all_fonts_from_path().
2023-01-11 20:54:49 +00:00
Karol Kosek
eed63e8174 ThemeEditor: Warn about unsaved changes on file drop 2023-01-11 20:15:47 +00:00
Karol Kosek
5157a6f6b3 ThemeEditor: Fully load files on drop events
Previously, only the preview frame was updated without changing any
values in the right panel or even a file path in the window title.
2023-01-11 20:15:47 +00:00
Karol Kosek
93a2b2a02d ThemeEditor: Take drop events from the whole window
Drops were handled only by the Preview Widget previously. It probably
made a little more sense before the program redesign, as it took most of
window the space, but now honestly this idea doesn't hold up that well.
2023-01-11 20:15:47 +00:00
Tim Ledbetter
0267d35258 LibGUI: Update the AboutDialog copyright year 2023-01-11 16:29:43 +00:00
Andreas Kling
811b8a25c2 LibWeb: Make Paintable visit its cached containing block pointer
This was *probably* already safe, but there's no harm in making sure
the cached pointer gets marked during GC.
2023-01-11 14:36:27 +01:00
Andreas Kling
6b4062ab61 LibWeb: Make a handful of paintable leaf classes final 2023-01-11 14:03:25 +01:00
Andreas Kling
f914abaf29 LibWeb: Make a handful of layout node leaf classes final 2023-01-11 14:03:18 +01:00
Andreas Kling
4d401bf796 LibWeb: Make the paint tree GC-allocated
This simplifies the ownership model between DOM/layout/paint nodes
immensely by deferring to the garbage collector for figuring out what's
live and what's not.
2023-01-11 12:55:00 +01:00
Andreas Kling
35ba13802d LibWeb: Remove unused declaration Node::removed_last_ref() 2023-01-11 12:55:00 +01:00
kleines Filmröllchen
2475f6a641 LibCore: Explain EventLoop and reorder some members in the header
This hopefully makes EventLoop easier to understand.
2023-01-11 11:49:05 +01:00
Sam Atkins
ae6a84c261 LibGUI: Lex INI files as Utf8
Iterating byte by byte meant that the column positions assigned to INI
tokens would be off if there were any multi-byte codepoints. Using a
Utf8View means these positions refer to whole codepoints instead, and
the column positions match what GUI::TextEditor expects. :^)

Fixes #12706.
2023-01-11 10:24:51 +01:00
Matthew Olsson
95df712c2e HackStudio: Hide autocomplete popup when switching tabs 2023-01-11 09:15:10 +00:00
Karol Kosek
d4367f42ba PDFViewer: Port to Core::Stream::File 2023-01-10 22:15:23 +00:00
Andreas Kling
7826cb2556 LibJS: Use a work queue instead of the C++ stack for the GC mark phase
This fixes an issue where we'd run out of C++ stack while traversing
large GC heap graphs.
2023-01-10 15:30:07 -05:00
Andreas Kling
5dcc58d54a Kernel+LibCore: Make %sid path parsing not take ages
Before this patch, Core::SessionManagement::parse_path_with_sid() would
figure out the root session ID by sifting through /sys/kernel/processes.

That file can take quite a while to generate (sometimes up to 40ms on my
machine, which is a problem on its own!) and with no caching, many of
our programs were effectively doing this multiple times on startup when
unveiling something in /tmp/session/%sid/

While we should find ways to make generating /sys/kernel/processes fast
again, this patch addresses the specific problem by introducing a new
syscall: sys$get_root_session_id(). This extracts the root session ID
by looking directly at the process table and takes <1ms instead of 40ms.

This cuts WebContent process startup time by ~100ms on my machine. :^)
2023-01-10 19:32:31 +01:00
Timothy Flynn
491edaffc7 LibWeb: Ensure legacy constructors are defined on the global object
This regressed in 6e93d89ee3.
2023-01-10 17:55:23 +00:00
Arda Cinar
4d335f3819 LibWeb: Remove all whitespace from input in decode_forgiving_base64
Instead of only stripping it from the ends, since that's actually what
the spec says.
2023-01-10 17:54:01 +00:00
Arda Cinar
283187afc5 AK+LibWeb: Move decode forgiving base64 under Web::Infra namespace
Since the forgiving base64 is part of the web infra standard
2023-01-10 17:54:01 +00:00
Arda Cinar
4ab2954210 AK: Expose Base64 tables from Base64.h
This change is necessary to move the forgiving base64 decoder to LibWeb
2023-01-10 17:54:01 +00:00
Timothy Flynn
6e93d89ee3 LibWeb: Generate exposed Window/Worker interfaces as lazy objects
We now lazily create these instances on-demand rather than all at once
when a Window/Worker object is created.
2023-01-10 16:08:14 +01:00
Timothy Flynn
3deb8e322f LibWeb: Remove Intrinsics::cached_web_prototype
It's now unused, and won't be safe to use once Web constructors and
prototypes are lazily created.
2023-01-10 16:08:14 +01:00
Timothy Flynn
c2939d58c7 LibWeb: Convert uses of cached_web_prototype to ensure_web_prototype
Once the construction of these objects is lazy, we cannot assume they
exist.
2023-01-10 16:08:14 +01:00
Timothy Flynn
af75493883 LibWeb: Move passing of Web object prototypes out of constructors 2023-01-10 16:08:14 +01:00
Timothy Flynn
834202aeb9 LibWeb: Move setting of Web object prototypes to initialize()
This needs to happen before prototype/constructor intitialization can be
made lazy. Otherwise, GC could run during the C++ constructor and try to
collect the object currently being created.
2023-01-10 16:08:14 +01:00
Timothy Flynn
7bd8fd000f LibWeb: Generate dedicated methods to create Web constructors/prototypes
Currently, for each exposed interface, we generate one massive function
to create every Web constructor and prototype. In an effort to lazily
create these instead, this first step is to extract the creation of each
of these into its own method.

First, this generates a forwarding header for all IDL types. This is to
allow callers to remain unchanged without forcing them to include the
(very heavy) generated IDL headers. This header is included by LibWeb's
forwarding header.

Next, this defines a base template method on Web::Bindings::Intrinsics
to create a prototype/constructor pair. Specializations of this template
are now generated in a new .cpp file, IntrinsicDefinitions.cpp. The base
Intrinsics class is updated to use this new method, and will continue to
cache the result.

Last, some WebAssembly classes are updated to use this new mechanism.
They were using some ad hoc cache keys that are now in line with the
generated specializations.

That one massive function is still used to invoke these specializations,
so they are not lazy as of this commit.
2023-01-10 16:08:14 +01:00
Timothy Flynn
59104262a4 LibWeb: Use correct arguments in WEB_PLATFORM_OBJECT invocations
The base class should be the second argument, and must be the immediate
base class (not the grandparent).
2023-01-10 16:08:14 +01:00
Timothy Flynn
1d7f44b629 ImageDecoder: Remove unused LibWeb forwarding header
ImageDecoder has no reason to depend on LibWeb.
2023-01-10 16:08:14 +01:00
BodilessSleeper
9a60d3509d LibJS: Update ISODaysInMonth in Calendar.cpp
This commit ticks away a box in #15525
Temporal commit: tc39/proposal-temporal@eee1e27
2023-01-10 10:22:21 +00:00