Commit graph

49811 commits

Author SHA1 Message Date
Dan Klishch
3c900765bc AK: Move taint_for_optimizer to StdLibExtras.h
Additionally, split it into two versions (for IsIntegral<T> -- asking
to place value into register and for !IsIntegral<T> -- asking to place
value into memory with memory clobber), so that Clang is no more
completely confused about `taint_for_optimizer(AK::StringView&)`.
2023-04-30 06:05:54 +02:00
Matthew Olsson
a9d192e882 LibJS+LibWeb: Explicitly mark ignored members in visit_edges methods 2023-04-30 06:04:33 +02:00
Matthew Olsson
39d8c8d2a9 LibJS+LibWeb: Add missing visit calls in visit_edges implementations 2023-04-30 06:04:33 +02:00
Matthew Olsson
a3344cab63 LibWeb: Fix incorrect usage of JS::GCPtr 2023-04-30 06:04:33 +02:00
Matthew Olsson
48d92eecac Lagom: Enforce GC-allocated fields are visited in LibJSGCVerifier 2023-04-30 06:04:33 +02:00
Matthew Olsson
82eeee2008 LibJS+LibWeb: Normalize calls to Base::visit_edges in GC objects 2023-04-30 06:04:33 +02:00
Matthew Olsson
98ed74087f Lagom: Enforce uniform calls to Base::visit_edges in LibJSGCVerifier
This ensures that all visit_edges implementations include a call to
Base::visit_edges. In particular, this gives three nice benefits:

  - The call can't be forgotten (the main benefit, of course).
  - All of the calls look the same. In other words, always use "Base"
    instead of the actual concrete class.
  - Ensure the object has a call to JS_CELL or JS_OBJECT in the
    definition. Otherwise, Base will not be defined and the call will
    not compile.
2023-04-30 06:04:33 +02:00
Matthew Olsson
3f22919eb5 LibWeb: Add missing JS::GCPtr wrappers in HTMLLinkElement 2023-04-30 06:04:33 +02:00
Liav A
bc3eb6d65f Kernel/VirtIO: Use proper error propagation from the get_config method
This allows us to drop null-checks at call-sites, thus simplifying the
code and reducing the chance of nullptr-dereference errors.
2023-04-30 06:03:47 +02:00
Liav A
87a32ab869 Kernel/VirtIO: Improve error handling during device initialization
Rename the initialize method to initialize_virtio_resources so it's
clear what this method is intended for.

To ensure healthier device initialization, we could also return the type
of ErrorOr<void> from this method, so in all overriden instances and in
the original method code, we could leverage TRY() pattern which also
does simplify the code a bit.
2023-04-30 06:03:47 +02:00
Liav A
aa985a0570 Kernel/VirtIO: Move declarations and definitions to a separate file 2023-04-30 06:03:47 +02:00
Zaggy1024
2ec043c4db LibVideo/VP9: Make inter-prediction fast path accumulators 32-bit
Some occasional cases could cause the accumulator to overflow and have
an incorrect result. It would be nice to use a smaller accumulator, but
it seems not to be correct. :^(

We now cast to i16 to allow 128-bit vectorization to make use of one
whole register instead of having to split the loop into multiple.

This results in about a 5% reduction in performance in my testing.
2023-04-30 05:58:27 +02:00
Nico Weber
3a5d20d82b icc: Add a --measure flag that prints color difference in profile
If --measure is passed, icc prints the color pairs with the smallest
and largest perceptual difference between them.

Converting 254 * 254 * 254 * 4 = 65 Million colors from sRGB to LAB
and then computing 254 * 254 * 254 * 3 = 49 Million DeltaEs between
them takes a while. On my laptop, it takes 17s to run. So there's
a small progress display.
2023-04-30 05:57:20 +02:00
Nico Weber
8ab6e0d3a5 ICC: Mark Profile::to_pcs() and to_lab() const 2023-04-30 05:57:20 +02:00
Nico Weber
cd81b3e2fa TestICCProfile: Don't capture sRGB by value
No behavior change.
2023-04-30 05:57:20 +02:00
Nico Weber
923027b1df LibGfx: Add DeltaE() function 2023-04-30 05:57:20 +02:00
Nico Weber
adec1abf81 LibGfx: Move CIELAB to its own file 2023-04-30 05:57:20 +02:00
martinfalisse
22202715fc LibWeb: Parse grid-template property 2023-04-30 05:56:10 +02:00
martinfalisse
bebf4363db LibWeb: Change name of GridTrackSizeListStyleValue
Change the name of GridTrackSizeStyleValue to
GridTrackSizeListStyleValue which is more accurate.
2023-04-30 05:56:10 +02:00
Andreas Kling
5236819f58 LibWeb: Resolve horizontal auto margins for images with display: block 2023-04-30 05:52:19 +02:00
thankyouverycool
f7e034d4b2 LibGfx+Userland: Merge FrameShape and FrameShadow into FrameStyle
Previously, Frames could set both these properties along with a
thickness to confusing effect: Most shapes of the same shadowing only
differentiated at a thickness >= 2, and some not at all. This led
to a lot of creative but ultimately superfluous choices in the code.

Instead let's streamline our options, automate thickness, and get
the right look without so much guesswork.

Plain shadowing has been consolidated into a single Plain style,
and 0 thickness can be had by setting style to NoFrame.
2023-04-30 05:49:46 +02:00
thankyouverycool
4c9933bfb7 LibGUI: Remove Label icons and replace instances with ImageWidget
These icons are a relic of GLabel and were never implemented to
accomodate both image and text. This convenience can always be added
in the future, but no current instance assumes or needs it, so let's
replace them all with ImageWidget to show clearer intent.
2023-04-30 05:48:14 +02:00
thankyouverycool
59483b0654 LibGUI: Don't fix ImageWidget's size when disabling auto_resize() 2023-04-30 05:48:14 +02:00
thankyouverycool
b17d4a0ced LibGUI: Propagate construction errors in LinkLabel 2023-04-30 05:48:14 +02:00
thankyouverycool
91bafc2653 LibGUI+Userland: Port Labels to String 2023-04-30 05:48:14 +02:00
thankyouverycool
3d53dc8228 LibGfx: Return StringView for SystemTheme Roles
This will simplify upcoming Label porting in ThemeEditor.
2023-04-30 05:48:14 +02:00
thankyouverycool
9a03e4dd73 AK: Add count() helper to String 2023-04-30 05:48:14 +02:00
Nico Weber
f3dbfb85d9 ICC: Add Profile::to_lab()
This can be used to convert a profile-dependent color to the L*a*b*
color space.

(I'd like to use this to implement the DeltaE (CIE 2000) algorithm,
which is a metric for how similar two colors are perceived.
(And I'd like to use that to evaluate color conversion roundtrip
quality, once I've implemented full conversions.)
2023-04-30 00:46:11 +02:00
Nico Weber
5fc11a316f LibTest: Add a EXPECT_APPROXIMATE_WITH_ERROR macro with custom error 2023-04-30 00:46:11 +02:00
Andreas Kling
72195ade9d Ladybird: Let WebContent know if the current system theme is dark
This means we now actually respect @media (prefers-color-scheme: dark)
by default when in dark mode. :^)
2023-04-30 00:27:28 +02:00
Tim Ledbetter
fd9b6878f6 PixelPaint: Clip the gradient tool preview to the active layer rect
This makes it easier to see what the result will be when using two
solid colors.
2023-04-30 00:24:06 +02:00
Tim Ledbetter
55d573afa4 Chess: Don't attempt to update the board when clicking out of bounds
Previously, clicking outside the bounds of the board when the window
was resized, could cause a crash.
2023-04-29 23:28:50 +02:00
Nicolas Josef Zunker
852bf35c1e Ports: Add c-ares library
The asynchronous DNS requests library c-ares was ported to serenity
2023-04-29 08:55:16 -06:00
Nicolas Josef Zunker
3aadc09c53 LibC: Add Ipv6 address checking macros to netinet/in.h
To be able to port c-ares the IN6_IS_ADDR_V4COMPAT and
various macros of the form IN6_IS_ADDR_MC_XX_LOCAL were added
as well as the IN_CLASS{A,B} macros
2023-04-29 08:55:16 -06:00
Liav A
d430ee8bec Kernel/aarch64: Don't set multiboot_modules to an empty array on-stack
Since multiboot_modules_count is set to 0, we can safely set the
multiboot_modules pointer to 0 (null pointer), as we don't use multiboot
on aarch64 anyway.
2023-04-29 08:53:29 -06:00
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