Commit graph

49939 commits

Author SHA1 Message Date
Andreas Kling eff783a6d2 LibWeb: Invalidate style *and* layout when removing a DOM node
It's not enough to invalidate only layout, since changes to the DOM tree
may also cause different selectors to apply.

This brings Acid3 back to a score of 100/100. The problem was that a
:last-child selector wasn't rechecked after removing a node that was
previously the last child of its parent.

Regression from f36cbd3b65.
2023-05-06 10:27:48 +02:00
Annie Song cbdb5f926c Documentation: Correct some typos found in kernel markdown files 2023-05-06 08:01:26 +01:00
Kenneth Myhra 8eaf28b4ce LibGUI: Guard us from trying to slice an empty Arguments::strings
This fixes an issue when we sometime pass in an empty Main::Arguments to
GUI::Application::create().

Also, this mimics the behavior that Application::construct() had which
only iterated over argv when more than one argument was passed to it.
2023-05-06 08:50:12 +02:00
Andreas Kling 1b8788157c LibWeb: Fill PageHost root with document background color
This makes Acid3 have a background color again.

Regressed with f2f14ad9bd.
2023-05-06 08:43:22 +02:00
Sam Atkins f4d8a24fe4 LibWeb: Propagate errors from parse_css_value and property_initial_value 2023-05-06 08:07:28 +02:00
Sam Atkins 294f5b109f LibWeb: Propagate errors from ResolvedCSSStyleDeclaration
Though not from ResolvedCSSStyleDeclaration::property() just yet.
2023-05-06 08:07:28 +02:00
Sam Atkins ba6d37ee6f LibWeb: Propagate errors when parsing StyleValues
This necessitated returning `nullptr` instead of just `{}` in a lot of
places. Also, some temporary hackiness in `parse_css_value()`: That
returns a special `ParseError` type already, so we now have a
`FIXME_TRY()` macro which logs the error and then returns a generic
`ParseError::InternalError` value. Eventually this macro will go away,
once I figure out how to deal with this more nicely.
2023-05-06 08:07:28 +02:00
Sam Atkins d732a83de8 LibWeb: Propagate errors from absolutizing StyleValues 2023-05-06 08:07:28 +02:00
Sam Atkins d16600a48b LibWeb: Propagate errors from StyleValue construction
Turns out we create a lot of these, mostly from places that don't return
ErrorOr. The yak stack grows.
2023-05-06 08:07:28 +02:00
Liav A 36bb04d792 Kernel/Memory: Fix UNMAP_AFTER_INIT page fault handling
This was discovered by me during a work on USB keyboard patches, so it
triggered this bug.

The printing format for the VirtualAddress part is incorrect, leading to
another crash when handling page fault after accessing UNMAP_AFTER_INIT
code section.
2023-05-06 08:03:34 +02:00
MacDue c4ef1db33d LibGUI: Use linear gradient to paint opacity sliders
No need to implement gradients again :^)
2023-05-06 08:03:02 +02:00
MacDue 5f93f62f1c LibGUI: Fix ColorSlider crash when the selected hue is 360
If the ColorSlider returns a hue of 360 degrees one of the various
   `VERIFY(hsv.hue >= 0.0 && hsv.hue < 360.0);`
in Color.h will be hit.
2023-05-06 08:03:02 +02:00
MacDue bd0bf8250e PixelPaint: Use ValueSlider for radial gradient hardness
This makes this input consistent with the hardness properties of other
tools.
2023-05-06 08:03:02 +02:00
Nico Weber 5c002c13c9 LibGfx/WebP: Some steps towards supporting animated webp files
No observable behavior change, but when building with WEBP_DEBUG 1,
this now prints frame data.
2023-05-06 08:01:13 +02:00
Nico Weber 812763e5b9 LibGfx/WebP: Stop dropping ANIM chunk decoding errors
decode_webp_chunks() was already called 5 lines up, no need to do that
again.
2023-05-06 08:01:13 +02:00
Nico Weber 835d328a6c LibGfx/WebP: Check presence of ANMF chunks correctly
Previously, we looked at the wrong variable here.
2023-05-06 08:01:13 +02:00
Pankaj Raghav ac9d60bb13 Kernel: Promote the entry to the front during a cache hit
Whenever an entry is added to the cache, the last element is removed to
make space for the new entry(if the cache is full). To make this an LRU
cache, the entry needs to be moved to the front of the list when there
is a cache hit so that the least recently used entry moves to the end
to be evicted first.
2023-05-06 08:00:55 +02:00
Aliaksandr Kalenik d6ee4e7fdc LibWeb: Remove resolve_size method in GFC
Duplicate of CSS::Size::resolved().
2023-05-06 07:01:27 +02:00
Aliaksandr Kalenik 3d05ed6b53 LibWeb: Use grid_container() to access root grid box in GFC
There is grid_container() method that can be used to access root box
in GFC without passing it through methods arguments.
2023-05-06 07:01:27 +02:00
Aliaksandr Kalenik ced862e16f LibWeb: Consolidate track sizing code for rows and columns in GFC
Although the algorithm for sizing tracks (rows or columns) is defined
once for both dimensions in the specification
(https://www.w3.org/TR/css-grid-2/#algo-track-sizing), we have
implemented it twice separately for sizing rows and columns.

In addition to code duplication, another issue is that these
implementations of the same algorithm have already diverged in some
places, and this divergence is likely to become even worse as our
implementation evolves.

This change unifies code for both dimension into one method that runs
track sizing.

While this change brings a bit of collateral damange (border.html and
minmax.html got changes in layout snaphots) it ultimately brings more
benefits because now we can evolve layout for both rows and colums
without duplicating the code :)
2023-05-06 07:01:27 +02:00
Kenneth Myhra 4c17f22735 Ports: Unbreak SDL2 by using GUI::Application::create()
Commit 1a97382 introduced the fallible GUI::Application::create() and
removed GUI::Application::construct() breaking the SDL2 port, let's
update it to use the fallible version.
2023-05-06 00:08:59 +02:00
Maciej cf52542fcf LibMarkdown+LibSyntax: Add a Markdown syntax highlighter
It currently supports only headers and code blocks.
2023-05-05 17:08:40 +01:00
Maciej 416d6ab6c8 LibMarkdown: Make LineIterator::operator- take a const reference 2023-05-05 17:08:40 +01:00
Tim Ledbetter ccab25e54e LibChess+Chess: Ensure no pawns have moved when invoking 50 move rule
The 50 and 75 move rules are no longer invoked if a pawn has advanced
in the last 50 or 75 moves respectively.
2023-05-05 16:56:18 +01:00
Xuekun Li 4fb200a546 LibGUI: Fix crash on deleting word forward
<Ctrl-Del> will crash when deleting at the end of line
where the next line contains only punctuation and seperator characters,
because TextDocument::first_word_break_after will return a wrong index
of the next word break (+1 bigger than the correct index),
thus RemoveTextCommand will try to remove a out-of-bound text range
causing a crash.
2023-05-05 16:48:36 +01:00
Xuekun Li 60805546bf LibGUI: Fix stuck on deleting word backward
<Ctrl-Backspace> will stuck when deleting at the end of line
which contains only one single character. When finding the
previous word break position starting at column 0 in
TextDocument::first_word_break_before, the code enters an
infinite while loop. The early return should simply fix this.
2023-05-05 16:48:36 +01:00
Lucas CHOLLET 5c29b45d1d LibGUI: Make Clipboard::initialize propagate errors 2023-05-05 16:41:21 +01:00
Lucas CHOLLET 1a97382305 LibGUI: Make Application's construction fallible
The pattern to construct `Application` was to use the `try_create`
method from the `C_OBJECT` macro. While being safe from an OOM
perspective, this method doesn't propagate errors from the constructor.
This patch make `Application` use the `C_OBJECT_ABSTRACT` and manually
define a `create` method that can bubble up errors from the
construction stage.

This commit also removes the ability to use `argc` and `argv` to
create an `Application`, only `Main`'s `Arguments` can be used.

From a user point of view, the patch renames `try_create` => `create`,
hence the huge number of modified files.
2023-05-05 16:41:21 +01:00
Tim Ledbetter f132751fae PixelPaint: Ensure the selection is always within image bounds 2023-05-05 16:35:42 +01:00
Tim Ledbetter fc137a7827 LibGfx: Correct off by one error in Point::constrain()
Previously, the y value would be clamped to a value one less than
necessary.
2023-05-05 16:35:42 +01:00
Tim Ledbetter ea0b527675 PixelPaint: Allow lasso tool to select outside the active layer
This makes the lasso tool behavior consistent with other selection
tools.
2023-05-05 16:35:42 +01:00
Tim Ledbetter 971a5467bf PixelPaint: Use the crosshair cursor with the lasso tool
This matches the behavior of other selection tools.
2023-05-05 16:35:42 +01:00
Caoimhe 5e4d835caf FontEditor: Use LibFileSystemAccessClient 2023-05-05 16:25:55 +01:00
Caoimhe f663e2dbd1 FontEditor: Don't paint in GlyphEditorWidget if m_font is null
The font isn't set in the constructor, there may be a case where the
font hasn't loaded before the first paint event. Therefore, we should
not paint if the font is null. All other methods should be fine.
2023-05-05 16:25:55 +01:00
Caoimhe 08668e8084 LibGUI: Fix crash when not using a custom font in GlyphMapWidget
`m_original_font` is only set if `GlyphMapWidget::set_font` is called.
But, if the user of `GlyphMapWidget` decides not to set a font,
there will be no value for `m_original_font`.

This commit fixes that issue by checking if `m_original_font` is not
null before attempting to use it.
2023-05-05 16:25:55 +01:00
Caoimhe c43295b668 LibGfx: Add Core::File variant of BitmapFont::write_to_file 2023-05-05 16:25:55 +01:00
Caoimhe 0d2ca125b3 LibGfx: Add a MappedFile variant of BitmapFont::try_load_from_file
Let's make it possible to create a BitmapFont directly from a MappedFile
instead of a file path.
2023-05-05 16:25:55 +01:00
Andreas Kling 74d34134ff Documentation: Add Qt6 SVG module to Ladybird build deps on Ubuntu 2023-05-05 17:12:43 +02:00
Andreas Kling 4b5cbe7931 Ladybird: Use vector icons in the browser toolbar
We now load SVG icons (via the Qt resource system) and render them into
a QIcon (with normal and disabled variants) using system colors.
We also re-render them if the system color theme changes.

This instantly makes Ladybird look less foreign on my Linux box.

I drew the icons myself, and they could definitely be more optimized,
but this was my first time using Inkscape. :^)
2023-05-05 16:58:08 +02:00
Andreas Kling 60312f2c83 Ladybird: Remove the "home" icon from the toolbar (and the concept)
This feature isn't really that useful in practice, so let's remove it.
(Other browsers haven't had this action for years either.)
2023-05-05 16:58:08 +02:00
Tom f0f82c6391 LibGfx/PNG: Add support for animated PNG images 2023-05-05 15:20:44 +01:00
Tom e7921cfe14 LibGfx: Add first_animated_frame_index method to ImageDecoder
Some image formats such as APNG may not use the first frame for
animations.
2023-05-05 15:20:44 +01:00
Lucas CHOLLET 5a4c61838f FileSystemAccessServer: Use ECANCELED instead of -1
-1 was used when the user cancel the dialog, `ECANCELED` is a bit more
explicit about what it is.
2023-05-05 15:12:24 +01:00
0GreenClover0 8bb2663a22 LibWeb: Zero out margins if width is not 'auto' in BFC's compute_width
Reverse the condition to satisfy the spec comment. Probably a typo.
A 3 year old typo! :^)
2023-05-05 13:26:41 +02:00
Cubic Love 0d808f6dcb Base+Minesweeper: Move assets from /icons/ to /graphics/
The graphics directory is a more suitable home for game assets.
2023-05-05 11:52:33 +01:00
Cubic Love 9c8385c605 Base+FlappyBug: Move assets from /icons/ to /graphics/
The graphics directory is a more suitable home for game assets.
2023-05-05 11:52:33 +01:00
Cubic Love c6454d37c0 Base+ColorLines: Move assets from /icons/ to /graphics/
The graphics directory is a more suitable home for game assets.
2023-05-05 11:52:33 +01:00
Cubic Love 248542535d Base+LibChess: Move assets from /icons/ to /graphics/
The graphics directory is a more suitable home for game assets.
2023-05-05 11:52:33 +01:00
Cubic Love 240a56d9ce Base+CatDog: Move assets from /icons/ to /graphics/
The graphics directory is a more suitable home for demo assets.
Also, update the example presenter file which uses a CatDog sprite.
2023-05-05 11:52:33 +01:00
Cubic Love 1d6f2e5608 Base+LibCards: Move card backs from /icons/ to /graphics/
The graphics directory is a more suitable home for game assets.
Also, move card backs into their own subfolder in preparation for a
themes subfolder for card fronts.
2023-05-05 11:52:33 +01:00