Commit graph

50967 commits

Author SHA1 Message Date
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
Jelle Raaijmakers
4df3b5e1d2 LibGfx: Do not use divisions when calculating font subpixel offsets
No functional or performance changes; they were probably already
optimized away by the compiler.
2023-06-01 15:13:57 +02:00
Jelle Raaijmakers
5bac9df865 LibGfx: Remove SSE version of Color::blend()
I could not discover proof that this is actually faster than the non-SSE
version. In addition, for these relatively simple structures, the
compiler is often sufficiently smart to generate SSE code itself.

For a synthetic font benchmark I wrote, this results in a nice 11%
decrease in runtime.
2023-06-01 15:13:47 +02:00
Andreas Kling
3f9cfa144c LibWeb: Allow infinitely long flex lines when sizing under max-content
If the flex container is being sized under a max-content main size
constraint, there is effectively infinite space available for flex
items. Thus, flex lines should be allowed to be infinitely long.

This is a little awkward, because the spec doesn't mention specifics
about how to resolve flexible lengths during intrninsic sizing.
I've marked the spec deviations with big "AD-HOC" comments.
2023-06-01 15:11:48 +02:00
stelar7
9c74f49b1d LibWeb: Implement has_transient_activation 2023-06-01 14:28:52 +02:00
stelar7
29029de839 LibWeb: Set last activation timestamp on the window 2023-06-01 14:28:52 +02:00
stelar7
266d4a3553 LibWeb: Implement step 7 of choose_a_browsing_context 2023-06-01 14:28:52 +02:00
Andreas Kling
caa491b72a LibWeb: Measure the overflow for all scroll containers
Instead of just measuring the layout viewport, we now measure overflow
in every box that is a scroll container.

This has the side effect of no longer creating paintables for layout
boxes that didn't participate in layout. (For example, empty/anonymous
boxes that were ignored by flex itemization.)

Such boxes are now marked as "(not painted)" in the layout tree dumps,
as they have no paintable to dump geometry from.
2023-06-01 13:33:35 +02:00
Andreas Kling
b7d2f6fa88 LibWeb: Clip overflow in descendant boxes for non-visible CSS overflow
We were only clipping for hidden, when we should be clipping for hidden,
clip, scroll and auto. Basically everything but visible. :^)
2023-06-01 13:33:35 +02:00
Andreas Kling
4ff52cebc4 LibWeb: Let's say that layout viewports are always scroll containers
This will allow us to have a shared code path for overflow calculation.
2023-06-01 13:33:35 +02:00
Andreas Kling
571c05bb47 LibWeb: Include scrollable overflow in paint tree dumps 2023-06-01 13:33:35 +02:00
Jelle Raaijmakers
5d0da8c096 LibGfx: Optimize Painter::blit_filtered()
For some reason, we were decoding the source color twice for every pixel
in the inner-most loop of `blit_filtered`. This makes sure we only
decode the source color once, and rearranges the code to improve
readability.

For my synthetic font rendering benchmark, this improves glyph rendering
performance by ~9%.
2023-06-01 12:23:24 +02:00
Andreas Kling
f5f4daea9a LibWebView: Unbreak content-scales-to-viewport mode for Presenter
Now that we allocate an oversized backing store during resizing of the
viewport, we need to constrain the source rect used when drawing a
scaled version of the content in the special mode used by Presenter.

Regressed with 85c542ab00.
2023-06-01 12:23:12 +02:00
Andi Gallo
62c7fcd836 LibGfx: Multiply alpha channels for vector fonts, when necessary
When the background color has an alpha < 255, we can't copy over the
pixel alpha.
2023-06-01 09:22:41 +02:00
Andreas Kling
966058d693 LibWeb: Support line-height: calc(...) values that resolve to number
This is used on GitHub and many other websites.
2023-06-01 09:20:05 +02:00
FalseHonesty
dcead6f5eb LibWeb: Add support for parsing place-content shorthand CSS property 2023-06-01 09:06:13 +02:00
Daniel Bertalan
23be1c5482 LibELF: Ignore $x/$d special symbols when symbolicating AArch64 ELF
Similarly, ignore STT_SECTION symbols, which show up as the empty
string.

This change makes AArch64 backtraces symbolicate correctly.
2023-06-01 09:04:20 +02:00
Daniel Bertalan
fb11645a9b LibC: Set up a dummy first stack frame in _start
This ensures that we stop walking the stack at `_entry` and don't
crash/panic when computing backtraces.
2023-06-01 09:04:20 +02:00
Daniel Bertalan
e77ce26ff1 run-tests: Unlink coredumps in self-test mode
This ensures that the RAM does not fill up with already processed
coredumps when many tests crash (as is the case on AArch64). We only
do this in self-test mode so as to avoid racing CrashDaemon.
2023-06-01 09:04:20 +02:00
Andreas Kling
427cf14d71 Tests/LibWeb: Import my test rebaselining script
This is not a beautiful program, but it does allow you to regenerate
the baseline expectation for a given layout or text test with a single
command. :^)
2023-06-01 08:26:33 +02:00
Andreas Kling
fde86350e3 LibWeb: Put debug spam about indefinitely sized SVGs behind a flag 2023-06-01 07:34:37 +02:00
Andreas Kling
c62c714764 LibWeb: Put debug spam about negative content sizes behind a flag
We already clamp these values to zero, so it's actually pretty harmless
when this happens. If someone wants to investigate these issues deeper
and see if they can be fixed earlier in the layout pipeline, they can
enable the spam locally.
2023-06-01 07:34:37 +02:00
Andi Gallo
827936cf7b LibWeb: Invalidate layout tree in textContent setter
The textContent setter changes the structure of the DOM, therefore the
layout tree becomes invalid.
2023-06-01 07:22:50 +02:00
Caoimhe
617edafbf2 LibGUI: Add support for jumping to a line and column in TextEditor
We had support for going to a specific line before, but now we support
jumping around using the `line:column` format :^)
2023-06-01 06:26:40 +02:00
Jelle Raaijmakers
75c8e07cc3 AK: Remove conditional noexcept from Complex
C++11 has been a requirement for some time now, no need to bother the
preprocessor with it.
2023-06-01 06:26:08 +02:00
MacDue
6685656d2d LibGfx: Fix winding order of segments on elliptical arcs
for_each_line_segment_on_elliptical_arc() flips the start/end points
for negative theta deltas. When doing this we have to make sure the
line segments emitted swap the start/end points back, so that the
(correct) winding order can be calculated from them.

This makes nonzero fills not totally broken for a lot of SVGs.
2023-06-01 06:25:00 +02:00
MacDue
48fa8f97d3 LibGfx: Implement new antialiased filled path rasterizer
This is an implementation of the scanline edge-flag algorithm for
antialiased path filling described here:
https://mlab.taik.fi/~kkallio/antialiasing/EdgeFlagAA.pdf

The initial implementation does not try to implement every possible
optimization in favour of keeping things simple. However, it does
support:

   - Both evenodd and nonzero fill rules
   - Applying paint styles/gradients
   - A range of samples per pixel (8, 16, 32)
   - Very nice antialiasing :^)

This replaces the previous path filling code, that only really applied
antialiasing in the x-axis.

There's some very nice improvements around the web with this change,
especially for small icons. Strokes are still a bit wonky, as they don't
yet use this rasterizer, but I think it should be possible to convert
them to do so.
2023-06-01 06:25:00 +02:00
MacDue
e4adaa2d20 LibGfx: Make PaintStyle::paint() a public function
It's a pain (and silly) to make this private and add every user as a
friend.
2023-06-01 06:25:00 +02:00
MacDue
81ff242e86 AK: Mark generic shorthand functions as constexpr 2023-06-01 06:25:00 +02:00
Jelle Raaijmakers
5339b54b5d LibGfx: Improve glyph rendering speed for vector fonts
The glyph bitmap is a grayscale image that is multiplied with the
requested color provided to `Gfx::Painter::draw_glyph()` to get the
final glyph bitmap that can be blitted.

Using `Gfx::Color::multiply()` is unnecessary however: by simply taking
the destination color and copying over the glyph bitmap's alpha value,
we can prevent four multiplications and divisions per pixel.

In an artifical benchmark I wrote, this improved glyph rendering
performance by ~9%.
2023-06-01 06:18:57 +02:00