Commit graph

49726 commits

Author SHA1 Message Date
Sam Atkins
28ceeec435 LibWeb: Split Length::relative_length_to_px() by type
Length units are either relative to the font, or to the viewport, but
never both. So we can save some work by not gathering font metrics for
a viewport unit, and not retrieving the viewport for a font unit.

Currently this is only helpful when the `to_px(Layout::Node)` method is
called, but since that is 208 places according to CLion, (plus 33
indirect uses via `Length::resolved()`) it still seems worthwhile. :^)
2023-04-29 16:23:50 +02:00
Sam Atkins
d6e5e61ed4 LibWeb: Add even more viewport-based Length units
`*vi` and `*vb` vary on which direction they check depending on whether
the writing mode is horizontal or vertical, so they will need some
modification once we support that.
2023-04-29 16:23:50 +02:00
Sam Atkins
091a1ff527 LibWeb: Add *lots* of viewport-based Length units
`sfoo` `lfoo` and `dfoo` are, for our purposes, identical to `foo`,
because we don't have dynamic GUI elements that cover the page content.
2023-04-29 16:23:50 +02:00
Sam Atkins
0dd585ba7b LibWeb: Add ic and ric Length units
Using the rough heuristic instead of the actual spec measurement. It's
allowed by the spec, but not ideal:

> In the cases where it is impossible or impractical to determine the
  ideographic advance measure, it must be assumed to be 1em.
2023-04-29 16:23:50 +02:00
Sam Atkins
03ed37eb14 LibWeb: Add cap and rcap Length units
As noted, the ascent of the font is not the best heuristic for this, but
it is one that's listed as OK to use by the spec:

> In the cases where it is impossible or impractical to determine the
  cap-height, the font’s ascent must be used.
2023-04-29 16:23:50 +02:00
Sam Atkins
a8e0fa403a LibWeb: Add rex and rch Length units
These are the same as `ex` and `ch`, but using the root element's
metrics. We now have this information available, so let's use it. :^)
2023-04-29 16:23:50 +02:00
Sam Atkins
3c171593f8 LibWeb: Merge StyleComputer root-element font-metric calculation methods
This saves us from doing a lot of the same work multiple times, when we
want both the root font size and its line height.
2023-04-29 16:23:50 +02:00
Sam Atkins
0679b4e0b9 LibWeb: Wrap font metrics into a struct
Rather than passing an increasingly-unwieldy number of font parameters
individually to every function that resolves lengths, let's wrap them
up.

This is frustratingly close to being `Gfx::FontPixelMetrics`, but bitmap
fonts cause issues: We choose the closest font to what the CSS
requests, but that might have a wildly different size than what the
page expects, so we have to fudge the numbers.

No behaviour changes.
2023-04-29 16:23:50 +02:00
Sam Atkins
4a191875a9 LibWeb: Categorize relative length units 2023-04-29 16:23:50 +02:00
Sam Atkins
7add4f2d2f LibWeb: Add some font-related properties to the resolved style 2023-04-29 16:23:50 +02:00
Sam Atkins
2c5f72b4f0 LibWeb: Remove outdated comment
I missed this when removing calc() from Length. Oops!
2023-04-29 16:23:50 +02:00
Sam Atkins
6ea84a7c87 LibWeb: Sort and group CSS Length units as they are in the spec
They previously weren't sorted at all. Alphabetical would be nice, but
then things like `em` and `rem` would be separated. So, let's copy the
spec's order. That way it's easier to keep track of which units we have
or haven't implemented. (Since there are so many...)
2023-04-29 16:23:50 +02:00
Aliaksandr Kalenik
e54ee7de96 LibWeb: Exclude borders from width available for table columns
Fix table box width calculation to minus horizonal borders from space
available for columns.
2023-04-29 16:08:48 +02:00
Abuneri
a04316403e Spreadsheet: Add blank sheet when import dialog is cancelled
If you launch the Spreadsheet app by clicking on a CSV
(or other supported formats) the import dialog is immediately
launched. If you cancel out of the import the application ends
up in an empty state where there are no sheets added. When you
launch the app normally it defaults to having a blank sheet, so
we should have the same behaviour in this scenario to prevent users
from having to manually add the new/blank sheet before being able to
use the app
2023-04-29 12:14:21 +01:00
huttongrabiel
8bc232e6be Spreadsheet: Enable the ability to undo/redo changes in cell color
Cells can be updated with new background/foreground colors and then this
action can be undone/redone.
2023-04-29 12:09:08 +01:00
huttongrabiel
7c204745ee Spreadsheet: Add CellUndoMetadataCommand class
Enables the ability to undo changes in metadata without undoing chages
in data. Previously there was only CellUndoData which cannot undo things
such as changes in cell background color.
2023-04-29 12:09:08 +01:00
huttongrabiel
40725c7c8c Spreadsheet: Add CellChange constructor for changes in type metadata
Allows the creation of CellChanges where the change is in the type
metadata instead of in data.
2023-04-29 12:09:08 +01:00
Torstennator
cd33f271b1 PixelPaint: Add radial gradient support
This patch adds radial gradients to the gradients tool.
2023-04-29 11:55:31 +01:00
Torstennator
abcfaca3da LibGfx: Add support to draw radial gradients with an rotation angle 2023-04-29 11:55:31 +01:00
Daniel Bertalan
81dd29f713 Kernel/aarch64: Support reading the command line via the RPi Mailbox
This reuses the existing `RPi::Mailbox` interface to read the command
line via a VideoCore-specific mailbox message. This will have to be
replaced if that interface starts being smarter, as this is needed very
early, and nothing guarantees that a smarter Mailbox interface wouldn't
need to allocate or log, which is a no-no during early boot.

As the response string can be arbitrarily long, it's the caller's job to
provide a long enough buffer for `Mailbox::query_kernel_command_line`.
This commit chose 512 bytes, as it provides a large enough headroom over
the 150-200 characters implicitly added by the VC firmware.

The portable way would be to parse the `/chosen/bootargs` property of
the device tree, but we currently lack the scaffolding for doing that.

Support for this in QEMU relies on a patch that has not yet been
accepted upstream, but is available via our `Toolchain/BuildQEMU.sh`
script. It should, however, work on bare metal.

Tested-By: Timon Kruiper <timonkruiper@gmail.com>
2023-04-29 08:24:18 +02:00
Daniel Bertalan
20fcbcb860 Toolchain: Patch QEMU to support reading kernel cmdline via RPI Mailbox
This commit backports my upstream QEMU patch to implement this
functionality, which is currently waiting for review.

It was submitted here:
https://lists.nongnu.org/archive/html/qemu-arm/2023-04/msg00549
2023-04-29 08:24:18 +02:00
Daniel Bertalan
a7f61a15af Toolchain: Fix self-built QEMU crashing on startup on macOS
If the SDL libraries are present on the system, QEMU will attempt to use
that for rendering the UI. This causes a crash when the AArch64 port
starts up with the following message:

> NSWindow drag regions should only be invalidated on the Main Thread!

Fix this by explicitly disabling SDL support.
2023-04-29 08:24:18 +02:00
Daniel Bertalan
6aa392f6e4 Kernel: Store the kernel command line in a StringView
The Raspberry Pi's mailbox interface does not guarantee that the
returned command line is null-terminated. This commit removes that
assumption from the current code, allowing the next commit to add
support for reading it on the Pi.

This also lets us eliminate a few manual `strlen()` calls :^)
2023-04-29 08:24:18 +02:00
Daniel Bertalan
c911fb0150 AK: Add Span::align_to
This method returns a sub-span whose data pointer and size is aligned to
a specified alignment.
2023-04-29 08:24:18 +02:00
Nico Weber
ab98ad4e70 ICC: Add a missing " at the end of a comment 2023-04-29 06:49:36 +02:00
Nico Weber
227072a5af ICC: Rename XYZ and XYZNumber fields to uppercase
Given that XYZ and xyz are distinct things, let's use the correct
case for these member variables.

No behavior change.
2023-04-29 06:49:36 +02:00
Nico Weber
1e5ececf75 ICC: Add comment with a link to WellKnownProfiles.cpp 2023-04-29 06:49:36 +02:00
Nico Weber
de7a413a9f ICC: Add a test for Profile::to_pcs 2023-04-29 06:49:36 +02:00
Nico Weber
af453b246a ICC: Add method to convert a color to the profile connection space
Only implemented for matrix profiles so far.

This API won't be fast enough to color manage images, but let's
get something working before getting something fast.
2023-04-29 06:49:36 +02:00
Nico Weber
e76d2238bb ICC: Make number_of_components_in_color_space() external
...and make its return type unsigned.
2023-04-29 06:49:36 +02:00
Nico Weber
037d213fdf ICC: Make struct XYZ store float instead of double
Should be good enough.
2023-04-29 06:49:36 +02:00
Tim Ledbetter
e1de31a3fe Chess: Display appropriate dialog when engine move ends the game
A dialog is now displayed when an engine move results in a checkmate
or a draw. In the case of threefold repetition or the fifty move rule,
the engine will always accept a draw. A human player is asked if they
would like to accept a draw.
2023-04-29 06:47:22 +02:00
Aliaksandr Kalenik
d9f0c2a806 LibWeb: Implement "distribute height to rows" step in TFC
This commit implements following missing steps in table layout:
- Calculate final table height
- Resolve percentage height of cells and rows using final table height
- Distribute avilable height to table rows
2023-04-29 06:46:45 +02:00
Aliaksandr Kalenik
9fd51a59ff LibWeb: Fix division by zero in table columns width distribution
If total max columns width (grid_max) is zero then available width
should be divided equally between columns. Previously there was
division by zero: `column.max_width / grid_max`.
2023-04-29 06:46:45 +02:00
MacDue
77a5f40736 Base: Fix incorrectly closed tag in welcome.html 2023-04-29 05:42:57 +02:00
Liav A
eb90d468ac SystemServer: Remove unused code for generating /dev/hwrng
This device was removed in b596af363c, so
we can't really create anything related to it, therefore this piece of
code should be removed too.
2023-04-28 23:26:31 +02:00
Tim Schumacher
9ab598af49 Revert "Kernel/x86: Bake the Prekernel and the Kernel into one image"
Some hardware/software configurations crash KVM as soon as we try to
start Serenity. The exact cause is currently unknown, so just fully
revert it for now.

This reverts commit 897c4e5145.
2023-04-28 23:24:19 +02:00
Emil Militzer
a8d08357c9 LibWeb: Compute inset for relative positioned inline-block 2023-04-28 18:12:02 +02:00
Aliaksandr Kalenik
62bc8590ad LibWeb: Implement "get all used history steps" for traversables
https://html.spec.whatwg.org/multipage/browsing-the-web.html#getting-all-used-history-steps
2023-04-28 18:11:44 +02:00
Aliaksandr Kalenik
6ec88b36b9 LibWeb: Implement "get the target history entry" for navigables 2023-04-28 18:11:44 +02:00
Aliaksandr Kalenik
d9d8896380 LibWeb: Implement "get session history entries" for navigables
https://html.spec.whatwg.org/multipage/browsing-the-web.html#getting-session-history-entries
2023-04-28 18:11:44 +02:00
Aliaksandr Kalenik
4c6564e3c1 AK: Add values() method in HashTable
Add HashTable::values() method that returns all values.
2023-04-28 18:11:44 +02:00
Aliaksandr Kalenik
c9c8f2413f LibWeb: Change Navigable::traversable_navigable() to be const 2023-04-28 18:11:44 +02:00
Aliaksandr Kalenik
6660eb3e1b LibWeb: Add non-const session_history_entries getter in traversable 2023-04-28 18:11:44 +02:00
Aliaksandr Kalenik
51d64bdaec LibWeb: Add NestedHistory in DocumentState 2023-04-28 18:11:44 +02:00
Daniel Bertalan
a0356a0302 Kernel/aarch64: Fix build after is_sharing_with_others API removal
This commit fixes the build after the removal of
`GenericInterruptHandler::is_sharing_with_others` in 8944ca830f.
2023-04-28 15:00:06 +02:00
Ali Mohammad Pur
41cf52a623 AK: Make the Optional formatter always available and tweak its format
There's no real reason to make this a debug-only formatter, on top of
that, jakt has a optional formatter that prints None/foo instead of
OptionalNone/Optional(foo), which is more concise anyway, so switch to
that.
2023-04-28 14:55:56 +02:00
MacDue
8ff6239d4f Base: Add SVG gradients test page 2023-04-28 09:42:28 +02:00
MacDue
afd355c135 LibWeb: Resolve and paint SVG gradient fills
This bit is mostly ad-hoc for now. This simply turns fill: url(#grad1)
into document().get_element_by_id('grad1') then resolves the gradient.
This seems to do the trick for most use cases, but this is not
attempting to follow the spec yet to keep things simple.
2023-04-28 09:42:28 +02:00
MacDue
aa3464466e LibWeb: Implement SVGLinearGradientElement (<linearGradient>)
This represents the SVG <linearGradient>. The actual gradient is
converted to a Gfx::PaintStyle for use in SVG fills... There is a little
guesswork in the implementation, but it seems to match Chrome/Firefox.

Note: Still not hooked up to actual painting in this commit.
2023-04-28 09:42:28 +02:00