Commit Graph

50996 Commits

Author SHA1 Message Date
stelar7
fd360ba171 LibWeb: Implement details_notification_task_steps for <details> 2023-06-03 05:56:00 +02:00
stelar7
8773122f6b LibWeb: Implement the <summary> element 2023-06-03 05:56:00 +02:00
Simon Wanner
870bcd56df LibWeb: Make disclosure marker bounds square
This makes sure we actually render an equilateral triangle
inside a square.
2023-06-03 05:54:49 +02:00
Simon Wanner
293ece2292 LibWeb: Support list-style-position
This moves the ::marker inside of <summary> actually inside. :^)
2023-06-03 05:54:49 +02:00
Simon Wanner
ee7282cbe4 LibWeb: Make pseudo-elements inspectable
This makes it possible to set a pseudo-element as the inspected node
using Document::set_inspected_node(), Document then provides
inspected_layout_node() for the painting related functions.
2023-06-03 05:54:49 +02:00
Simon Wanner
5e3e9b2f61 LibWeb: Add list-style-type: disclosure-{closed,open}
These markers are rendered as equilateral triangles pointing right and
down respectively. As we currently don't implement writing-mode the
closed marker does not respect it.
2023-06-03 05:54:49 +02:00
Tim Schumacher
ad899b179f LibLine: Ignore ENOENT errors when loading old history
A missing history file is just an empty history, so ignore that error
and replace it with an empty array.

This regressed in f93ee3142d.
2023-06-03 05:52:52 +02:00
Caoimhe
4be5000c22 SpiceAgent: Exit early if SPICE_DEVICE doesn't exist 2023-06-03 05:52:16 +02:00
Caoimhe
13506a612e SpiceAgent: Don't pledge cpath or open SPICE_DEVICE as rwc
Core::File's new `DontCreate` open mode removes the need for these
capabilities on SpiceAgent. We shouldn't have to create this file,
as if it doesn't exist, QEMU never initiated a spice connection!
2023-06-03 05:52:16 +02:00
Caoimhe
2344bb6c57 LibCore: Add File::OpenMode::DontCreate
Some applications may not want to have the ability to create a
file if it doesn't exist, but still be able to read and write
from it. The easy solution here would be just to not apply
O_CREAT when creating the flags, but to prevent breaking a ton
of applications, having a `DontCreate` mode is the best for now.
2023-06-03 05:52:16 +02:00
Lucas CHOLLET
9e6d91032e LibGfx/JPEG: Use Error to propagate errors
This patch removes a long time remnant of the pre-`AK::Error` era.
2023-06-02 20:07:27 +02:00
networkException
b5e9b9a939 Toolchain: Add qt6.qt{base,svg} to serenity.nix
This is required for building ladybird.
2023-06-02 20:05:51 +02:00
networkException
43182285fd Toolchain: Sort packages in {nativeB,b}uildInputs nix lists 2023-06-02 20:05:51 +02:00
Sam Atkins
76611790e9 LibWeb: Fix order/formatting of Properties.json 2023-06-02 20:04:23 +02:00
Sam Atkins
d3009bd568 LibWeb: Add missing value ranges to CSS properties
...except those related to `grid`, because I can't figure out how the 17
different properties interact with each other, and what values apply to
which ones. 😅

All but 1 of these are the infinite range `[-∞,∞]`. As such, specifying
that range does not change anything, but it does make it explicit that
we've looked at what the range should be, instead of just not having
added it.
2023-06-02 20:04:23 +02:00
Sam Atkins
2d7308cb88 LibWeb: Support infinite range for CSS properties
This makes `[-∞,∞]` generate valid code, instead of `return ;`
2023-06-02 20:04:23 +02:00
Andreas Kling
7115446995 LibWeb: Support font-size: calc()
Now that we have a way to resolve calc() lengths without a layout node,
we can finally support calc() values in font-size.

This wasn't possible before because font-related properties have to be
resolved eagerly in StyleComputer due to font-relative CSS length units
depending on the computed font being known.
2023-06-02 20:03:28 +02:00
Andreas Kling
df8a96ee00 LibWeb: Add a way to resolve calc() values without a layout node
Instead of a layout node, you can pass a new Length::ResolutionContext
struct which contains everything needed to resolve calc() lengths.
2023-06-02 20:03:28 +02:00
Aliaksandr Kalenik
2ade229f27 LibWeb: Fix crashing when grid track size is calc() with percentage
Use contains_percentage() that works for calc() values instead of
is_percentage().

This fixes issue when tracks with calc() that has percentages where
considered as "fixed" tracks with resolvable size which led to
incorrectly resolved infinite final track sizes.
2023-06-02 19:02:31 +02:00
Liav A
b40b1c8d93 Kernel+Userland: Ensure proper unveil permissions before using rm/rmdir
When deleting a directory, the rmdir syscall should fail if the path was
unveiled without the 'c' permission. This matches the same behavior that
OpenBSD enforces when doing this kind of operation.

When deleting a file, the unlink syscall should fail if the path was
unveiled without the 'w' permission, to ensure that userspace is aware
of the possibility of removing a file only when the path was unveiled as
writable.

When using the userdel utility, we now unveil that directory path with
the unveil 'c' permission so removal of an account home directory is
done properly.
2023-06-02 17:53:55 +02:00
Sam Atkins
1f2629f132 LibWeb: Bounds-check parsed CSS types
This reintroduces bounds-checking for the CSS `<angle>`, `<frequency>`,
`<integer>`, `<length>`, `<number>`, `<percentage>`, `<resolution>`,
and `<time>` types.

I regressed this around 6b8f484114 when
changing how we parsed StyleValues.

This is an improvement from before though, since we now allow the bounds
of a dimension type to have units.

Added a test to make sure we don't regress this again. :^)
2023-06-02 17:46:35 +02:00
Sam Atkins
51f75d7071 LibWeb: Generate bounds-checking functions for CSS basic types 2023-06-02 17:46:35 +02:00
Sam Atkins
fbfce2e73e LibWeb: Add comparison operators to CSS numeric types (except Length)
This is to make it easier to bounds-check their values during parsing.
Length is left out because many length units are relative to the
context in which they are used, and so we cannot easily compare `10px`
and `1em`, for example.
2023-06-02 17:46:35 +02:00
Andreas Kling
06617a982e LibWeb: Support flex items with calc() main size containing percentages
If a flex item's main size is a CSS calc() value that resolves to a
length and contains a percentage, we can only resolve it when we have
the corresponding reference size for the containing block.
2023-06-02 17:17:45 +02:00
Andreas Kling
d6c3cbd958 LibWeb: Make StackingContext sorting a lot faster
Stacking contexts are sorted after building a tree of them. They are
sorted by z-index first, DOM tree order second.

Sorting was previously *very* slow on pages with many stacking contexts.
That was because the sort() function used Node::is_before() in the
quick_sort comparator to see if one StackingContext was before another.
is_before() does tree traversal and can take quite a long time per call.

This patch avoids all that by letting StackingContext know its index
among all StackingContexts within the same document in tree order.
There's a noticeable snappiness increase on the CSS-FLEXBOX-1 spec page,
for instance. :^)
2023-06-02 15:00:38 +02:00
Liav A
500b7b08d6 Kernel: Move the Storage directory to be a new directory under Devices
The Storage subsystem, like the Audio and HID subsystems, exposes Unix
device files (for example, in the /dev directory). To ensure consistency
across the repository, we should make the Storage subsystem to reside in
the Kernel/Devices directory like the two other mentioned subsystems.
2023-06-02 11:04:37 +02:00
Nico Weber
f3a58f3a5a Ladybird: Simplify ImageCodecPluginLadybird a bit
No behavior change.
2023-06-02 09:57:20 +01:00
Nico Weber
c9b8af70bf WebContent: Prevent renderer crash on partially invalid image
If an image had a valid header and valid metadata, but decoding the
image frame data failed, the renderer used to crash.

The crash only happened in SerenityOS, because there
ImageCodecPluginSerenity returned nullptr bitmaps.  Instead, return
{} like ImageCodecPluginLadybird already does if there's a nullptr
frame.

Fixes #19141.

Loading #19141 in the browser satisfyingly also serves as a manual
test for the bug.  (No automated test since we don't run layout
tests within SerenityOS on the bots.)
2023-06-02 09:57:20 +01:00
Andreas Kling
5617dd1c83 LibJS: Store PrivateElement values in Handle<Value>
This fixes an issue where private element values were not always
protected from GC. I found two instances where this was happening:

- ECMAScriptFunctionObject did not mark m_private_methods
- ClassDefinitionEvaluation had two Vector<PrivateElement> that were
  opaque to the garbage collector, and so if GC occurred while
  constructing a class instance, some or all of its private elements
  could get incorrectly collected.
2023-06-02 10:33:12 +02:00
kleines Filmröllchen
0eddee44f3 Kernel: Remove unused Platform.h include in linker script
This had only been in use for architecture detection before
the removal of 32 bit x86.
2023-06-02 10:27:29 +02:00
stelar7
2ef6aa5f3d LibWeb: Parse clamp() css math function 2023-06-02 05:22:12 +02:00
stelar7
eaee0ecd88 LibWeb: Parse max() css math function 2023-06-02 05:22:12 +02:00
stelar7
6a10821bfd LibWeb: Parse min() css math function 2023-06-02 05:22:12 +02:00
stelar7
570e43a66a LibWeb: Move function parsing to separate method 2023-06-02 05:22:12 +02:00
MacDue
47fc91ed43 LibWeb: Remove per path clipping for SVGGeometryPaintable
Somewhere the path bounding box in the layout and the actual draw path
are getting slightly mismatched. This results in partly clipped bits of
SVGs. The paths are already clipped to the containing SVG, and the size
of the path in the layout is computed from the bounding box, so it is
probably safe just to remove this clipping for now.
2023-06-02 05:21:48 +02:00
FalseHonesty
de9604212f LibWeb: Avoid text-aligning content that is too long for its line box
Previously, we would always respect the `text-align` property, even if
the text being aligned was too long for its line box and would be
clipped. This led to seeing the clipped middle/end of strings when we
should instead always see the beginning of the text.
2023-06-02 05:21:22 +02:00
Ben Wiederhake
54fb9477a4 LibC+Tests: Reduce fuzz iteration in TestMemalign to speed up CI
In AArch CI, this test alone takes up 110.6 seconds. In x86_64 CI, it
takes up 68.4 seconds. There is no reason to spend this much time and
this many trials on this.

Let's reduce the number of iterations to 500. This should still surface
any misalignment with high probability, and should speed up the CI time
from minutes to seconds.
2023-06-01 20:28:41 +01:00
Ben Wiederhake
968f2b3eeb LibCrypto: Don't return reference to stack frame in PBKDF
A reference to the current stack frame becomes invalid after returning,
so returning Bytes is pointless.

I don't understand why this wasn't discovered earlier, but it caused
some CI problems for me, so I fixed it.

Don't take this as encouragement to break master! :^)
2023-06-01 21:22:14 +02:00
Ben Wiederhake
522809032a WindowServer: Don't crash when trying to set invalid effects 2023-06-01 21:17:29 +02:00
Sam Atkins
7ce4cbfe1d LibWeb: Convert NumberStyleValue from float to double
We have double precision in the parser, and currently use doubles for
most of layout, so we might as well keep that extra precision inside
NumberStyleValue too.
2023-06-01 21:04:21 +02:00
Sam Atkins
8889635ba7 LibWeb: Remove int usage of NumberStyleValues
Use IntegerStyleValue where we should; remove the ability of
NumberStyleValue to hold integers, and add integer interpolation for
animations.
2023-06-01 21:04:21 +02:00
Sam Atkins
1160d8186b LibWeb: Implement IntegerStyleValue, for holding <integer>
Having one StyleValue for `<number>` and `<integer>` is making user code
more complicated than it needs to be. We know based on the property
being parsed, whether it wants a `<number>` or an `<integer>`, so we
can use separate StyleValue types for these.
2023-06-01 21:04:21 +02:00
Sam Atkins
ad8565011c LibWeb: Rename NumericStyleValue -> NumberStyleValue
This is in preparation of splitting off a separate IntegerStyleValue.
2023-06-01 21:04:21 +02:00
Andreas Kling
1a6a4ca7d4 LibWeb: Round lengths to 3 decimals after resolving from percentage
This is a hack to emulate the behavior of other engines that use
fixed-point math. By rounding to 3 decimals, we retain a fair amount of
detail, while still allowing overshooting 100% without breaking lines.

This is both gross and slow, but it fixes real sites. Notably, the
popular Bootstrap library uses overshooting percentages in their
12-column grid system.

This hack can be removed when CSSPixels is made a fixed-point type.
2023-06-01 18:13:42 +02:00
Nico Weber
2452cf6b55 WebP/Lossy: Allow negative values from segment adjustment too
The spec doesn't talk about this happening in the text, but
`dequant_init()` in 20.4 processes segment adjustment and quantization
index adjustment in the same variable `q` before clamping.
Since we had to adjust the latter step in the previous commit, do
it for the former step too.

I haven't seen this happen in the wild yet (and now, I hopefully
never will notice it if it happens).
2023-06-01 17:36:20 +02:00
Nico Weber
661b2d394d WebP/Lossy: Clamp negative quantization indices to zero
The spec doesn't talk about this happening in the text, but
`dequant_init()` in 20.4 stores `q` in an int and clamps that
to 0 later.
2023-06-01 17:36:20 +02:00
Nico Weber
c2ec97dd79 WebP: Remove nonsensical comment
It's up to callers of the ImageDecoderPlugin to honor loop_count().
The ImageDecoderPlugin doesn't have to look at it when decoding frames.

No behavior change.
2023-06-01 16:23:46 +02:00
Nico Weber
287e2655cb WebP/Lossy: Add a missing clamp
The spec says that the AC dequantization factor for Y2 data should
be at least 8, so do that.

This only has a very small effect (only the first two AC table
entries are < 8 after multiplying with 155 / 100, so this would
have only a small effect on brightness), and this case is hit
exactly 0 times in all my test images.  But it's still good to match
the spec.
2023-06-01 16:23:46 +02:00
Nico Weber
13daa29d81 WebP/Lossy: Add const annotations to functions in Tables.h
No behavior change.
2023-06-01 16:23:46 +02:00
Nico Weber
24aa302e88 WebP/Lossy: Reduce size of MacroblockMetadata from 80 to 20 bytes
For a 1024x1024 image, saves about a quarter MB of memory use while
decoding (compared to the decompressed image data itself needing
4 MiB).  Not a huge win, but also very easy to do, so might as well.

No behavior change, no measurable performance impact.
2023-06-01 16:23:46 +02:00