Commit graph

45528 commits

Author SHA1 Message Date
Børlaag
fb3e890bd9 Documentation: Update VirtualBox docs memory section 2023-01-06 11:08:58 -07:00
Børlaag
2ec4322772 Documentation: Update VMWare docs memory section 2023-01-06 11:08:58 -07:00
Linus Groh
7c2e134abd CI: Unify secrets.BUGGIEBOT and secrets.BUGGIEBOT_TOKEN
The latter is clearer, so let's use that.
2023-01-06 18:19:42 +01:00
Rodrigo Tobar
a5620fd41f LibPDF: Load destinations from Catalogue -> Names -> Dests name tree
PDF allows for named destinations to be provided as string. These can be
either found in the Dests dictionary in the document catalogue (as
already implemented), or in the Name Tree specified by the Dests key in
the Names dictionary of the document catalogue (missing).

This commit adds this missing case. Once the named destination is found
in the name tree, its value is interpreted just like in the first case,
so a new utility method encapsulates the common behavior.
2023-01-06 18:06:41 +01:00
Rodrigo Tobar
5420261347 LibPDF: Implement name tree lookups
Name Trees are hierarchical, string-keyed, sorted-by-key dictionary
structures in PDF where each node (except the root) specifies the bounds
of the values it holds, and either its kids (more nodes) or the
key/value pairs it contains.

This commit implements a series of lookup calls for finding a key in
such name trees. This implementation follows the tree as needed on each
lookup, but if that becomes inefficient in the long run we can switch to
creating a HashMap with all the contents, which as a drawback will
require more memory.
2023-01-06 18:06:41 +01:00
Rodrigo Tobar
8c79f0e0cf LibPDF: Add more utility methods to {Dict,Array}Object
Being both of them containers, these classes already offered a set of
methods to retrieve an inner element by key or index, respectively, with
different methods for the different subtypes of the PDF::Object type
returning the element cast to the correct type pointer. On top of
that, DictObject offered an additional method to obtain an element as an
Object pointer.

While these methods were useful, they have some shortcomings:

 * They always take a Document pointer to first perform an object
   resolution, in case the element is a Reference. This is not always
   necessary though, as there are values that are always meant to be
   immediate, and hence the resolution lookup adds overhead.
 * There was no easy way to get an individual Object element from an
   ArrayObject like there is in DictObject. This makes it difficult to
   obtain such values, as one first needs to call dict.get() to get a
   Value, then cast it manually to a NonnullRefPtr<Object>.

This commit fixes these two issues by:

 * Adding a new method that returns an Object for a given index.
 * Adding overloads for this new method, and all the existing methods
   described above, that do *not* take a Document, and therefore do
   *not* perform an object resolution lookup.
2023-01-06 18:06:41 +01:00
Rodrigo Tobar
0e1c858f90 LibPDF: Move casting code to its own cast_to function
This functionality was previously part of the resolve_to() Document
method, and thus only available only when resolving objects through the
Document class. There are many use cases where this casting can be used,
but no resolution is needed.

This commit moves this functionality into a new cast_to function, and
makes the resolve_to function call it internally. With this new function
in place we can now offer new versions of DictObject::get_* and
ArrayObject::get_*_at that don't perform Document resolution
unnecessarily when not required.
2023-01-06 18:06:41 +01:00
Rodrigo Tobar
f510b2b180 LibPDF: Support null destination parameters
Destination arrays contain a page number, a mode name, and parameters
specific to that mode. In many cases these parameters can be set to
"null", which our code wasn't taking into consideration.

This commit parses these parameters taking into account whether they are
null or actual numbers, and stores them as Optional<float> instead of
plain floats. The parameters are not yet used anywhere else other than
when formatting a Destination object, so the change is fairly small.
2023-01-06 18:06:41 +01:00
Rodrigo Tobar
2485c500a3 LibPDF: Fix Destination formatting
This was not correctly written, and thus printed confusing output.
2023-01-06 18:06:41 +01:00
Rodrigo Tobar
b406f1d5a4 PDFViewer: Inform users of underlying issue when loading document
While this is not super useful to end users, it's still better than the
simpler, generic "failed to load" error message.
2023-01-06 18:06:41 +01:00
Simon Danner
b10fe7c136 LibGfx: Prefer largest image with best depth for ICO display
Some favicons contain multiple icons of the same size, but with
increasing depth. Use the largest one to make things look nicer.
2023-01-06 17:31:05 +01:00
Liav A
d8ebcaede8 Kernel: Add helper function to check if a Process is in jail
Use this helper function in various places to replace the old code of
acquiring the SpinlockProtected<RefPtr<Jail>> of a Process to do that
validation.
2023-01-06 17:29:47 +01:00
Tim Ledbetter
6b3688147f PixelPaint: Fix typo in variable name 2023-01-06 15:09:56 +00:00
Tim Ledbetter
a30b956e94 PixelPaint: Allow move tool to scale in all directions
It is now possible to scale the current layer using the move tool from
all four corners of the layer boundary. Previously scaling was only
possible from the bottom right of the image.
2023-01-06 15:09:56 +00:00
Lucas CHOLLET
85bfeba8c6 AK: Support fixed point formatting to print real numbers 2023-01-06 16:05:13 +01:00
Lucas CHOLLET
25e39df7ba AK: Rename StandardFormatter::Mode::Float => FixedPoint 2023-01-06 16:05:13 +01:00
MacDue
b0ac88cf89 Meta/Lagom: Link Threads::Threads
This is required for me to be able to build both Serenity and
Ladybird from the same repo. Without this the two builds seem to
stomp on each other, then fail to link.
2023-01-06 08:04:23 -07:00
Sam Atkins
98603e2b20 Solitaire: Replace animation Card with manual painting
Repeatedly allocation a new Card object is unnecessary, and makes
propagating OOM awkward. We also don't need a full card, just which
suit/rank it is and its position. So, let's save all the extra
allocation and just paint the card bitmap directly.
2023-01-06 16:03:50 +01:00
Sam Atkins
80c7ac0d0e Spider: Highlight valid target stack when hovering over it
This is largely copied and pasted from Solitaire. Moving this into
LibCards somehow would be nice but I can't think of a nice way to do so
right now.
2023-01-06 16:03:50 +01:00
Sam Atkins
e193679352 Spider: Make Game creation fallible 2023-01-06 16:03:50 +01:00
Sam Atkins
f9f6bf3cd4 Spider: Save and load u32 config values as u32s 2023-01-06 16:03:50 +01:00
Sam Atkins
c79110d5bf Solitaire: Save and load u32 config values as u32s
This removes a bunch of awkward i32 casts. Being able to read/write enum
types directly would be even nicer, but I'm not going there right
now. :^)
2023-01-06 16:03:50 +01:00
Sam Atkins
306676792c Solitaire: Make Game creation fallible 2023-01-06 16:03:50 +01:00
Sam Atkins
6e0ad5536f AK: Export adopt_nonnull_ref_or_enomem to the global namespace 2023-01-06 16:03:50 +01:00
Sam Atkins
d7ba577c90 LibCards+Games: Make CardGame::add_stack() fallible
And while we're at it, handle the CardStack allocation (and failure
thereof) internally.
2023-01-06 16:03:50 +01:00
Timothy Flynn
08ff87b3ce Solitaire: Preview cards in a stack with the right mouse button 2023-01-06 15:55:37 +01:00
Timothy Flynn
2a1fb77faf LibCards: Support "previewing" cards that may be covered by other cards
For example, in Solitaire, the vertical normal stacks cover the suit of
all but the topmost card in the stack. To see the suit of covered cards
the user currently has to move the cards on top of them out of the way.

This adds an API for games to set a card at a location to be previewed,
which will draw that card on top of all other cards without moving it.
2023-01-06 15:55:37 +01:00
Lucas CHOLLET
c0bc3b9814 FileSystemAccessServer: Use Core::Stream
This patch also updates corresponding functions from
`LibFileSystemAccessServerClient`.

From the FileSystemAccessClient point of view, it only makes the server
take `Core::Stream::OpenMode` instead of `Core::OpenMode`. So, `enum`
conversions only happen within deprecated functions and not in the new
`Core::Stream` friendly API.

On the server side, it just removes two usages of `Core::File::open()`.
2023-01-06 14:52:29 +00:00
Lucas CHOLLET
4e164c9de7 Meta: Pass Core::Stream::OpenMode by value in the IPCCompiler 2023-01-06 14:52:29 +00:00
Lucas CHOLLET
fe2ab2bd8c LibIPC: Add File(Core::Stream::File& file, ...) 2023-01-06 14:52:29 +00:00
Lucas CHOLLET
f0d2a8dd57 LibCore: Add Stream::File::leak_fd(Badge<IPC::File>) 2023-01-06 14:52:29 +00:00
Tim Ledbetter
0cf29f6c45 PixelPaint: Draw polygonal select tool lines with two colors
This stops lines from disappearing when entering a dark area of the
image.
2023-01-06 15:41:48 +01:00
Tim Ledbetter
2f6c71c829 PixelPaint: Draw the lasso tool preview path with two colors
This stops the preview path disappearing when entering a dark area of
the image.
2023-01-06 15:41:48 +01:00
Luke Wilde
a6716e694d CI: Automatically apply pull request labels for generic PR actions
Generic PR actions include opening a PR, submit review comments, adding
new commits, etc. This prevents the reviewer and PR submitter from
having to manually bounce the labels back and forth in the general
case. The reviewer also may not have permission to set labels, meaning
the reviewer won't be able to update the labels accordingly themselves.

This does not handle more subjective labels such as pr-is-blocked and
pr-unclear. Unfortunately, there does not seem to be a GitHub Actions
trigger for when a PR has merge conflicts, so the pr-has-conflicts
label cannot be automatically applied.

Co-authored-by: kleines Filmröllchen <filmroellchen@serenityos.org>
2023-01-06 15:25:30 +01:00
Andreas Kling
3332ce01ce LibGUI: Simplify GUI::Label preferred height calculation
No need to use a TextLayout here, we can just count the number of lines
and multiply that by the font's preferred line height.

In addition to being much simpler, it also fixes a bug where labels were
got too tall if we calculated their preferred height before assigning
a final width to them.
2023-01-06 13:43:04 +01:00
Andreas Kling
ef7eb60f22 Terminal: Run clang-format on main.cpp 2023-01-06 13:04:20 +01:00
Andreas Kling
70c0c1c845 LibWeb: Use default system fonts for serif, sans-serif, etc. 2023-01-06 12:02:21 +01:00
Andreas Kling
b2d3ceaec5 LibGfx: Make text painting better at aligning vector fonts vertically
This is achieved by simplifying the logic in TextLayout. We get rid
of all the various ways that the layout bounding rect can get cropped.
Then we make sure to use the right pixel metrics.

Finally we use the font's own line gap metrics instead of hard-coding 4.

The end result is that text painted with vector fonts now gets pretty
reasonable vertical alignment in most cases.
2023-01-06 12:02:21 +01:00
Andreas Kling
f5e18dda2b LibGfx: Make BitmapFont's line gap be Gfx::Painter::LINE_SPACING
This is the closest thing we have to the OpenType line gap metrics.
Using it here will allow us to unify more of the text painting logic.
2023-01-06 12:02:21 +01:00
Andreas Kling
f9a62900b7 LibGfx: Round menu font size up when calculating menubar height 2023-01-06 12:02:21 +01:00
Andreas Kling
c8b286084b WindowServer: Round menu item font sizes up when calculating height 2023-01-06 12:02:21 +01:00
Andreas Kling
dd8d65ada0 LibGUI: Tweak GUI::Label auto-sizing logic for floating point font sizes
We have to ceil the font size or we risk being 1px too small.
2023-01-06 12:02:20 +01:00
Andreas Kling
d2195f8088 LibGfx: Use Gfx::Rect::align_within() to simplify text drawing logic
Instead of doing this manually, just use the helper we already have.
2023-01-06 12:02:20 +01:00
Andreas Kling
6b421fb521 LibGfx: Slim down Gfx::TextLayout API by removing unused accessors
Also store the Font as a const reference instead of a raw pointer,
since we don't allow a null Font here.
2023-01-06 12:02:20 +01:00
Andreas Kling
65c8cd37e3 LibGfx: Make ScaledFont::glyph_height() return the pixel height
This was returning the point height which didn't match BitmapFont and
led to bogus line heights in GUI::TextEditor.
2023-01-06 12:02:20 +01:00
Andreas Kling
cddcf531b1 LibGfx: Remove unused Font::point_size() 2023-01-06 12:02:20 +01:00
Andreas Kling
2a61d66b0a LibGfx: Make Font::preferred_line_height() more correct
Return a float, and fix a bogus calculation of ascender + descender.
2023-01-06 12:02:20 +01:00
Andreas Kling
43a10674d0 Terminal: Add zoom in/out action to increment/decrement the font size 2023-01-06 12:02:20 +01:00
Andreas Kling
8887766607 LibGfx: Remove bogus rounding in FontPixelMetrics::line_spacing() 2023-01-06 12:02:20 +01:00
Andreas Kling
bb0c5f8ab4 LibGfx/OpenType: Use typographic metrics when asked to by the OS/2 table 2023-01-06 12:02:20 +01:00