Commit graph

45792 commits

Author SHA1 Message Date
MacDue
969aacd627 Kernel: AK: Fix ignored .to_string() errors in IPv4Socket 2023-01-12 23:29:57 +00:00
MacDue
514224c015 AK: Fix ignored .to_string() errors in IPv6Address 2023-01-12 23:29:57 +00:00
MacDue
35e1e12360 AK: Fix ignored .to_string() errors in IPv4Address 2023-01-12 23:29:57 +00:00
Linus Groh
f183745f4e LibWebView+Ladybird: Move preferred color scheme to ViewImplementation 2023-01-12 23:39:36 +01:00
Linus Groh
5bf5697f16 LibWebView+Ladybird: Move text selection to ViewImplementation 2023-01-12 23:39:36 +01:00
Linus Groh
8c11a2c253 LibWebView+Ladybird: Move running JavaScript to ViewImplementation 2023-01-12 23:39:36 +01:00
Linus Groh
55609f744d LibWebView+Ladybird: Move debug request to ViewImplementation 2023-01-12 23:39:36 +01:00
Linus Groh
de1c0c87fe LibWebView+Ladybird: Move page loading to ViewImplementation 2023-01-12 23:39:36 +01:00
Linus Groh
2428e3e675 LibWebView+Ladybird: Move DOM inspection helpers to ViewImplementation 2023-01-12 23:39:36 +01:00
Linus Groh
f313708237 LibWebView+Ladybird: Move get source request to ViewImplementation 2023-01-12 23:39:36 +01:00
Linus Groh
5d9f4b2ffc LibWebView+Ladybird: Move zoom logic to ViewImplementation 2023-01-12 23:39:36 +01:00
Linus Groh
5411adca22 LibWebView+Ladybird: Begin de-duplicate WebView implementations
This starts moving code equally shared between the OOPWV and Ladybird
WebContentView implementations to WebView::ViewImplementation, beginning
with the client state.
2023-01-12 23:39:36 +01:00
Brandon Jordan
121181e392 Base: Add video file type icon
This adds a file type icon for video files.
2023-01-12 22:25:31 +01:00
Andreas Kling
d132ce54e1 LibWeb: Don't mark layout tree as selected when selection is zero-length 2023-01-12 20:27:16 +01:00
Andreas Kling
2eaebdea5b Ladybird: Add Ctrl+= as an alternate "zoom in" shortcut
On many keyboards, Ctrl++ is actually Ctrl+Shift+=, and Ctrl+= makes
more sense as it's symmetric with Ctrl+-.

Both Firefox and Chrome already support this alternate shortcut,
so let's be nice and support it in Ladybird as well. :^)
2023-01-12 19:05:07 +00:00
Andreas Kling
c8ea23a4fe Ladybird: Use QKeySequence::StandardKey as much as possible
Let Qt pick the most appropriate native shortcut when it knows one.
2023-01-12 19:05:07 +00:00
Andreas Kling
0e53003f72 LibWeb: Remove now-unused LayoutRange and LayoutPosition classes :^) 2023-01-12 19:55:10 +01:00
Andreas Kling
9c7e26b8d4 Ladybird: Add "Copy" and "Select All" actions to the Edit menu 2023-01-12 19:55:10 +01:00
Andreas Kling
b79bc25a1f LibWeb: Use DOM Selection instead of ad-hoc layout tree selection
Before this patch, we were expressing the current selection as a range
between two points in the layout tree. This was a made-up concept I
called LayoutRange (2x LayoutPosition) and as it turns out, we don't
actually need it!

Instead, we can just use the Selection API from the Selection API spec.
This API expresses selection in terms of the DOM, and we already had
many of the building blocks implemented.

To ensure that selections get visually updated when the underlying Range
of an active Selection is programmatically manipulated, Range now has
an "associated Selection". If a range is updated while associated with
a selection, we recompute layout tree selection states and repaint the
page to make it user-visible.
2023-01-12 19:55:10 +01:00
Andreas Kling
1c4328902d LibWeb: Implement BrowsingContext::select_all() in terms of Selection
We do what other browsers do and create a selection anchored at the
document's body element.
2023-01-12 19:55:10 +01:00
Andreas Kling
bf69f4370e LibWeb: Implement BrowsingContext::selected_text() in terms of Selection
Instead of sifting through the layout tree to extract the selected text,
look at the DOM selection instead.

Note that we can't just stringify the DOM Range, as that would include
non-visible things (like the content of <style> elements, etc.) so we
run it through an ad-hoc variant of the range stringification algorithm.
This can probably be factored better, but it's a start. :^)
2023-01-12 19:55:10 +01:00
Andreas Kling
3cabd17f9b LibWeb: Add convenient Selection::range() accessor
This is a lot smoother than calling the throwsy get_range_at() API,
especially since we know there at most 1 range in the selection.
2023-01-12 19:55:10 +01:00
Linus Groh
36866730ce Browser: Implement zoom :^)
Largely based on the Ladybird implementation in 0cc151b.
2023-01-12 18:52:32 +00:00
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