Commit graph

47951 commits

Author SHA1 Message Date
Nico Weber 833d0d95c9 LibGfx: Remove a redundant copy of all data when writing a BMP 2023-03-12 21:32:21 +01:00
Nico Weber f1a3028ef1 LibGfx: Change BMPWriter API to be consistent with other image writers 2023-03-12 21:32:21 +01:00
Nico Weber 01387eb72b LibGfx: Change second argument of BMPWriter::dump() to Options struct
This makes it more economical to add more options here, and makes it
possible to use similar API surface for the other image writers.

(It looks like nothing currently uses this optional parameter, but
having a way to pass options to image writers seems like something
we generally want.)
2023-03-12 21:32:21 +01:00
Nico Weber 74891ab656 LibGfx: Remove unused BMPWriter::set_compression()
This has always been unused, and after #8440 BMPWriter::dump()
unconditionally writes to m_compression, meaning even if this
method was called, it would have no effect.
2023-03-12 21:32:21 +01:00
Andreas Kling 7bb7d87807 LibWeb: Resolve percentage line-height values before CSS inheritance
Percentage line-height values are relative to 1em (i.e the font-size
of the element). We have to resolve their computed values before
proceeding with inheritance.
2023-03-12 18:10:32 +01:00
Andreas Kling 7b55d79d3a LibWeb: Actually incorporate style from imported style sheets 2023-03-12 18:10:32 +01:00
Andreas Kling 1b262f8c89 Tests/LibWeb: Only care about *.html files in layout test runner 2023-03-12 18:10:32 +01:00
Andreas Kling 92eaad8f2e LibWeb: Consider entire stack of floated boxes when floating new box
If normal flow layout has caused us to progress past the current
innermost float in the block axis, we still need to consider the floats
stacked outside of it.

Fix this by always walking the currently stacked floats from innermost
to outermost when placing new floats.
2023-03-12 18:10:32 +01:00
Andreas Kling 6960a1bb45 LibWeb: Stop polluting layout tree dumps with TextNode memory addresses
I've never actually used this for anything, and it's pretty noisy.
2023-03-12 18:10:32 +01:00
Liav A 633006926f Kernel: Make the Jails' internal design a lot more sane
This is done with 2 major steps:
1. Remove JailManagement singleton and use a structure that resembles
    what we have with the Process object. This is required later for the
    second step in this commit, but on its own, is a major change that
    removes this clunky singleton that had no real usage by itself.
2. Use IntrusiveLists to keep references to Process objects in the same
    Jail so it will be much more straightforward to iterate on this kind
    of objects when needed. Previously we locked the entire Process list
    and we did a simple pointer comparison to check if the checked
    Process we iterate on is in the same Jail or not, which required
    taking multiple Spinlocks in a very clumsy and heavyweight way.
2023-03-12 10:21:59 -06:00
Nico Weber 9b297c634f LibGfx: Make QOIWriter use ErrorOr
In addition to it now handling allocation failures, the encode() API is
now consistent with PNGWriter.
2023-03-12 13:23:34 +00:00
MacDue b698d64ee9 LibGfx: Use StringView literals for CSS color list
And also remove the null terminating entry in favour of for-each loop.
2023-03-12 12:46:24 +00:00
Nico Weber b10ec6743f Userland: Add an image utility
At the moment, all it can do is read all image formats that LibGfx can
read and save to any image format that LibGfx can write (currently bmp,
png, qoi).

Currently, it drops all image metadata (including color profiles).

Over time, this could learn tricks like keeping color profiles,
converting an image to a different color profile, cropping out a part of
an image, and so on.
2023-03-12 12:17:26 +00:00
Nico Weber 3cff36b7ab Meta+CMake: Remove "image" ninja target in favor of "qemu-image"
"image" was an alias for "qemu-image".

I want to add an `image` userland utility, which clashes with that
shortname.

So remove the existing "image" target. It was just an alias for
"qemu-image".

If you use serenity.sh to build, nothing changes. This only affects you
if you run ninja manually -- you now have to say `ninja qemu-image` to
build the disk image.
2023-03-12 01:48:56 +00:00
MacDue 952222ec4d LibGfx: Fix segfault and painting off-by-one in fill_path()
Previously, this would paint scanlines one pixel too long and segfault
when painting AA scanlines that were <= 1px long.
2023-03-11 23:51:20 +01:00
MacDue a425b6f772 LibGfx: Make all fill_path() code member functions and move into .cpp
This makes all the code for fill_path() member functions of the painter,
and moves them into a new FillPathImplementation.cpp. This allows us
to avoid polluting Painter.h with implementation details, and makes
the edit, compile, retry loop much shorter.
2023-03-11 18:34:26 +00:00
MacDue b1a72d66f6 LibGfx: Speed up fill_path() with per scanline clipping & fast fills
This improves fill_path() performance by adding an API to the painter
that allows painting an entire scanline rather than just a pixel.
With this paths can be clipped a scanline at a time rather than each
pixel, removing a fair amount of checks.

Along with optimized clipping, this can now use a fast_u32_fill() to
paint all but the subpixels of a scanline if a solid color with no
alpha channel is used (which is quite common in SVGs).

This reduces scrolling around on svg.html from 21% in set_pixel() and
19% in fill_path() to just 7.8% in fill_path (with set_pixel()
eliminated). Now fill_path() is far from the slowest code when
scrolling the page.
2023-03-11 18:34:26 +00:00
Kenneth Myhra be958a14cf LibWeb: Use from_deprecated_fly_string() instead of from_utf8()
Use FlyString::from_deprecated_fly_string() in these instances instead
of FlyString::from_utf8(). As we convert to new FlyString/String we want
to be aware of these potential unnecessary allocations.
2023-03-11 18:32:33 +00:00
Kenneth Myhra e28a6d5da4 AK: Add FlyString::from_deprecated_fly_string()
Let's add FlyString::from_deprecated_fly_string() so we can use it
instead of FlyString::from_utf8(). This will make it easier to detect
potential unncessary allocations as we transfer to FlyString.
2023-03-11 18:32:33 +00:00
Linus Groh 41b8d81d49 LibWeb/HTML: Remove redundant namespace qualifiers from Window.{cpp,h} 2023-03-11 18:26:40 +00:00
Linus Groh 324dacbc5d LibWeb/HTML: Propagate OOM errors from Window::{local,session}_storage()
This requires a bit of error type conversion glue as HashMap::try_ensure
expects the callback to return ErrorOr<T> like the function itself does.
2023-03-11 18:26:40 +00:00
Linus Groh 4da68384e6 LibWeb/HTML: Make Window::m{location,navigator} lazily allocated
This now matches the other window-owned objects, which already do this:
m_crypto, m_performance, m_screen.
2023-03-11 17:53:50 +00:00
Linus Groh 22552382ff LibWeb/HTML: Use CreateMethodProperty for Window namespace properties
This makes sure the property attributes are correct (writable and
configurable), which they currently aren't for either CSS or
WebAssembly.
2023-03-11 17:32:07 +00:00
Linus Groh be0dcd465f LibJS: Fix return type of Object::create_method_property()
This doesn't return a completion in the spec as it doesn't need to
propagate any errors. It's also unused right now, which is probably why
no one noticed.
2023-03-11 17:32:07 +00:00
Linus Groh b6a69f5f03 LibWeb/HTML: Consolidate duplicate public/private sections in Window.h 2023-03-11 17:09:01 +00:00
Mathis Wiehl dd81a975d7 LibWeb: Establish a stacking context for root element
Until now we were just creating a stacking context for the tree root,
which usually is the viewport element. This lead to weird painting
behaviour when negative z-index children of the html element that
established their own stacking context were drawn below the canvas
background.

Now we establish a stacking context for both, the root element and the
viewport.
2023-03-11 16:54:58 +00:00
Sam Atkins 08c1effc04 HackStudio: Use Syntax::Language instead of our own one
The one behavior difference here is that the statusbar used to display
"Unknown" for unknown file types, and "Markdown" for md, but we now
display "Plain Text" for all file types without syntax highlighters.
2023-03-11 13:22:57 +00:00
Sam Atkins ffce6cc977 LibSyntax: Add Language-from-String/Path functions
These are taken from HackStudio, but slightly rearranged to be more
alphabetical, and returning an empty Optional instead of "Unknown".
2023-03-11 13:22:57 +00:00
Sam Atkins 82f58b8af0 AK: Forward-declare LexicalPath
And alphabetically sort the list while I'm at it.
2023-03-11 13:22:57 +00:00
Sam Atkins 8007c103dd LibSyntax: Move Language enum into its own files 2023-03-11 13:22:57 +00:00
Pankaj Raghav a1f2f08764 Meta: Use the correct boot device addressing mode for NVMe devices
Commit: 2c84466ad8 ("Kernel/Storage: Introduce new boot device
addressing modes") changed the way we pass the boot device parameter.

That commit missed updating boot parameter in the run.sh script for NVMe
boot devices.
2023-03-11 13:15:00 +00:00
Pankaj Raghav f8b67e1596 Kernel/Storage+Base: Fix boot_device_addressing document for NVMe
The LUN.target_id parameter points to a NVMe Namespace which starts from
1 and not 0. Fix the document to reflect the same while addressing a
nvme device in the boot parameters
2023-03-11 13:15:00 +00:00
Aliaksandr Kalenik 84e17fcbcc WebDriver: Fix crash in async execute script endpoint
Removal of dummy execution context in
9aca54091a caused a crash in
`execute_async_script` because of empty execution contexts stack
during `create_resolving_functions` call.
2023-03-11 13:11:51 +00:00
Fabian Dellwing 7c0b360881 Kernel: Add non standard value to sys$sysconf
Add `_SC_PHYS_PAGES` to sys$sysconf syscall. This value is needed
for a port I'm working on.
2023-03-11 13:06:36 +00:00
Julian Offenhäuser c705afa43a Kernel: Fix variable shadowing issue in PCIIDELegacyModeController
In this specific else case, primary_base_io_window would not be assigned
in the outer scope, leading to a crash immediately after.
2023-03-11 06:06:01 -07:00
Andrew Kaster b996e15d9d CI: Remove stale dependence on Toolchain.yml from nightly job
We removed this file in 0a7d0362ea but
forgot to update the nightly job.
2023-03-11 05:36:14 -07:00
Andreas Kling 47797ff52c Meta: Remove Brian's entries from CODEOWNERS
The scope of these entries is not proportional to Brian's capacity for
code review at the moment, so let's stop marking him as "code owner" on
almost every PR. :^)
2023-03-11 13:11:09 +01:00
Andreas Kling af8d5207f6 Meta: Don't check for newlines at EOF in Tests/LibWeb/Layout/ 2023-03-11 13:05:35 +01:00
Andreas Kling f3556f239e LibWeb: Don't touch flex items after they we've been frozen
When using the flex shrink factor, the flexible length resolution
algorithm was incorrectly ignoring the `frozen` flag on items and would
update the same items again, causing overconsumption of the remaining
free space on the flex line.
2023-03-11 11:52:19 +01:00
Andreas Kling 0808463a7d LibWeb: Use FlexItem::outer_hypothetical_main_size() in one more place
Better than doing the calculation manually.
2023-03-11 11:45:17 +01:00
Andreas Kling f97754942c LibWeb: Collapse margin-left with space used by left-side floats
We had an issue where boxes with margin-left were shifted right by
left-side floats twice instead of just once.
2023-03-11 10:46:26 +01:00
Andreas Kling 1cf5737e9e LibWeb: Add fast_is<T>() for various types stood out in a profile 2023-03-11 10:46:26 +01:00
Andreas Kling f6426cdcd4 LibWeb: Use static_cast in SVGGeometryBox::dom_node()
These are only ever constructed with a corresponding SVGGeometryElement,
so we know it's safe to static_cast here.
2023-03-11 10:46:26 +01:00
Mathis Wiehl ab4cf7c57d LibWeb: Don't overflow flex containers on margin auto
In case flex items had `margin: auto` on the primary flex axis, we were
still also distributing remaining space according to `justify-content`
rules. This lead to duplicated spacing in various places and overflows.

It looks like this issue was observed previously but missidentified
because there was logic to ignore margins at the start and end which
would partially paper over the root cause. However this created other
bugs (like for example not having a margin at beginning and end ;-)) and
I can find nothing in the spec or other browser behaviour that indicates
that this is something that should be done.

Now we skip justify-content space distribution alltogether if it has
already been distributed to auto margins.
2023-03-11 10:46:21 +01:00
Aliaksandr Kalenik 3716e1b8a0 Ladybird: Delete unused ConsoleClient and ConsoleGlobalObject
After the separation of LibWeb into WebContent process, ConsoleClient
and ConsoleGlobalObject are no longer used.
2023-03-11 08:09:10 +01:00
Andrew Kaster 3d33217d60 Ladybird+CI: Move layout_test.sh test runner from CI yml into CMake
We should be able to run this locally, as long as ENABLE_LAGOM_LADYBIRD
is true, or if building ladybird from the ladybird source directory.

This removes a special case from the Lagom CI yml file.
2023-03-10 23:01:55 +00:00
Lucas CHOLLET af58f012be Tests: Add a test for JPEGs with RGB components 2023-03-10 22:22:36 +01:00
Lucas CHOLLET a47d775be6 LibGfx/JPEG: Support RGB JPEGs
By default, JPEGs use YCbCr to encode colors however other encoding
exist. This patch adds the logic to determine which transformation is
needed and support for RGB encoded JPEGs :^).
2023-03-10 22:22:36 +01:00
Lucas CHOLLET c60338e187 LibGfx/JPEG: Decode the App14 segment
This half-standardized application specific segment is used for color
transform information. It means that the decoder is know informed if the
image uses YCbCr, RGB, CMYK or even YCCK.
2023-03-10 22:22:36 +01:00
Lucas CHOLLET 00808c5eba LibGfx/JPEG: Use decimal instead of hexadecimal for APP markers 2023-03-10 22:22:36 +01:00