Commit graph

50694 commits

Author SHA1 Message Date
Andreas Kling
82ddc813d5 LibWeb: Stop aggressively quantizing font-weight values
Before this change, we were quantizing to either 400, 700 or 900.
This caused us to treat 100/200/300 weighted fonts as if they were
interchangeable.
2023-05-24 20:58:46 +02:00
Andreas Kling
4fc5e06837 LibWeb: Include weight and slope in CSSFontFaceRule debug dumps 2023-05-24 20:58:46 +02:00
Andreas Kling
a28275657b LibWeb: Include weight and style in CSSFontFaceRule serialization 2023-05-24 20:58:46 +02:00
Jelle Raaijmakers
76a0e601e5 Meta: Only run devcontainer build for the main repository
Let's not run this job on everyone's fork.
2023-05-24 20:19:40 +02:00
Jelle Raaijmakers
971d3eef4a Meta: Hardcode lowercase repository name for devcontainer
This should unbreak CI.
2023-05-24 20:07:34 +02:00
Josh Spicer
7026174458 Meta: Prebuild repo dev container
This commit adds a GitHub Workflow to prebuild the dev container file
present at .devcontainer/devcontainer.json. This prebuilt image is
pushed to GitHub Container Registry (ghcr).

An additional devcontainer.json is added consuming that image.
This dev container can be selected in editors that process dev
containers (ie GitHub Codespaces), to speed up time to editor.
2023-05-24 19:27:59 +02:00
Aliaksandr Kalenik
202b24584f LibWeb: Sum horizontal margins to calculate space used by floats
This fixes the issue where max margin is used to find offset of
floating box although horizonal margins do not collapse so they need
to be summed instead.
2023-05-24 18:58:42 +02:00
Jelle Raaijmakers
90d8844c77 LibWeb: Remove Gfx::Rect<float> workarounds from BFC
No longer is the last horizontal line of pixels ignored during layout.
This used to be a bug in `Gfx::Rect<float>` that was fixed in
f391ccfe53.
2023-05-24 18:19:45 +02:00
Andreas Kling
38b2cba6a2 LibWeb: Honor font-weight and font-style when using downloaded fonts
Instead of keying downloaded @font-face fonts on just the family name,
we now key them on a tuple of the family name, weight and slope.
2023-05-24 17:19:18 +02:00
Andreas Kling
74bdbdf43f LibWeb: Parse font-weight and font-style inside @font-face rules 2023-05-24 17:19:18 +02:00
Andreas Kling
be10360350 LibWeb: Move resolution of font weights and slopes to StyleValue
This isn't exactly ideal factoring (though I'm not sure what is) but
this will make it possible to reuse this code in the parser.
2023-05-24 17:19:18 +02:00
stelar7
17d6ab2416 LibWeb: Implement scroll_{width, height} 2023-05-24 17:18:30 +02:00
Timothy Flynn
5ad24156ce LibThreading: Do not crash when detaching from an already-exited thread
Contrary to the log message that was shown, it is not decidedly a logic
error to detach a thread that has exited. Even in the simple unit tests
we have, it's possibly for the thread to run and exit in between the
time it takes for our call to Thread::start() to complete and
Thread::detach() to run. This is often seen on CI.
2023-05-24 16:45:25 +02:00
implicitfield
b6af5eaa72 Fuzzers: Unbreak FuzzHttpRequest
Previously, the exit condition was inverted, causing the fuzzer to
try to read the value of an error.
2023-05-24 16:25:13 +02:00
Nico Weber
703bd4c8a3 WebP/Lossy: Validate show_frame and version when reading header 2023-05-24 16:09:40 +02:00
Nico Weber
5934c4ebfb image: Add --no-output flag to omit output writing
This is useful for timing just decoder performance.

(It'd be nice to add a `-t` flag that prints timings for all
the different phases, but for now just disabling writing is
sufficient for me.)
2023-05-24 16:01:09 +02:00
Nico Weber
32ad77b8c7 image: Remove no-longer-needed comment
The future is now, and Bitmap::load_from_file() can't do the things that
`image` now does.
2023-05-24 16:01:09 +02:00
Nico Weber
6f2e62ba2a Utilities: Use elapsed_milliseconds() instead of elapsed()
No behavior change.
2023-05-24 15:50:43 +02:00
Nico Weber
197c5729d1 LibCore: Add ElapsedTimer::elapsed_milliseconds()
It does the same thing as elapsed(), but has a clearer name.
The hope is we'll move everything to the new name over time
and then remove the old name.
2023-05-24 15:50:43 +02:00
Andreas Kling
655d9d1462 LibWeb: Make CSSPixels and Length use 64-bit (double) floating point
This fixes a plethora of rounding problems on many websites.
In the future, we may want to replace this with fixed-point arithmetic
(bug #18566) for performance (and consistency with other engines),
but in the meantime this makes the web look a bit better. :^)

There's a lot more things that could be converted to doubles, which
would reduce the amount of casting necessary in this patch.
We can do that incrementally, however.
2023-05-24 14:40:35 +02:00
Andreas Kling
30262d7023 LibWeb: Rebaseline a layout test after 10ceacf5fb 2023-05-24 13:25:05 +02:00
Nico Weber
da00dadfe7 LibVideo: Rename local variable from "max_bits" to "bits_left"
That's how the member variable it gets copied into is called.

No behavior change.
2023-05-24 04:11:05 -07:00
Nico Weber
e43c21f4d7 LibVideo: Rename BooleanDecoder::initialize param
...from "bytes" to "size_in_bytes".

I thought at first that `bytes` meant the variable contained
bytes that the decoder would read from.

Also, this variable is called `sz` (for `size`) in the spec.

No behavior change.
2023-05-24 04:11:05 -07:00
Nico Weber
35883c337f LibVideo: Remove unused BooleanDecoder::bits_remaining() 2023-05-24 04:11:05 -07:00
Jelle Raaijmakers
a0a860fa07 Documentation: Configure cache dir in CMake settings for CLion
Without this, CMake would err out on a missing `/CLDR/version.txt`.
2023-05-24 12:57:01 +02:00
Andreas Kling
10ceacf5fb LibWeb: Honor the font-size even if the font-family is not found 2023-05-24 12:11:04 +02:00
Daniel Bertalan
81b6723b29 Meta: Add GCC 13 and Clang 16 to compiler autodetection 2023-05-24 01:20:02 -06:00
Daniel Bertalan
4202bb597b Meta+Documentation: Require Xcode 14.3 or Clang 14 for the host compiler
There have been multiple reports of Xcode 14.0 (based on upstream LLVM
14) segfaulting when compiling `LibCore/Process.cpp`. Let's require
Xcode 14.3, which is a known good version based on LLVM 15.

Note that Xcode 14.3 requires macOS Ventura, so users of Monterey or
older are expected to get Homebrew Clang instead.

Homebrew Clang 13 also suffers from the same crash. Although I have not
tested on Linux, the backtrace points to the middle-end, so x86_64 is
also likely to be affected. LLVM 14 was released 14 months ago, so it's
not an unreasonable requirement.
2023-05-24 01:20:02 -06:00
Aliaksandr Kalenik
e5618b17c4 LibWeb: Avoid full tree traversal in Node::compare_document_position()
Introduce optimization that determines if one node is preceding,
following, ancestor or descdendant of another node by comparing
ancestors chains of both nodes which is much cheaper than using
Node::is_before() that can walk whole subtree in the worst case.
2023-05-24 08:20:45 +02:00
Darius Arnold
884d8b14ac LibGfx: Prevent out of bounds access when scaling small Bitmaps
Since the color interpolation requires two pixels in the horizontal and
vertical direction to work, 1 pixel wide or high bitmaps would cause a
crash when scaling. Fix this by clamping the index into the valid range.

Fixes #16047.
2023-05-24 08:12:14 +02:00
Andreas Kling
71d5dc510e LibWeb: Resolve CSS variables if present in SVG presentation attributes
SVG presentation attributes are parsed as CSS values, so we also need to
handle CSS variable expansion when handling them.

This (roughly) matches the behavior of other engines. It's also used on
the web, for example on https://stripe.com/ :^)
2023-05-24 06:43:21 +02:00
Andreas Kling
dd19f61538 LibWeb: Add fast way to check if a DOM node is an SVG element 2023-05-24 06:43:21 +02:00
Karthik Karanth
8177ecb17f Ladybird: Use cursor position for context menu 2023-05-24 06:01:47 +02:00
Tim Ledbetter
245699f303 Base: Add man page for w 2023-05-24 05:55:44 +02:00
Tim Ledbetter
72e1e38fb8 Utilities/w: Add -h option to optionally hide the header 2023-05-24 05:55:44 +02:00
Tim Ledbetter
9596346528 Utilities/w: Add the ability to filter by username 2023-05-24 05:55:44 +02:00
Tim Ledbetter
d2ec82d4f9 Utilities/w: Display the TTY pseudo name in the "TTY" column
This matches the format used by `ps`.

If we cannot determine the TTY
pseudo name we fall back to the full device name, as shown previously.
2023-05-24 05:55:44 +02:00
Tim Ledbetter
2dbc7e4fff Utilities/w: Convert TTY string from /var/run/utmp to TTY pseudo name
Previously, we were comparing the "tty" value from
`/sys/kernel/processes` to the TTY value from
`/var/run/utmp` directly.  This caused the "WHAT" column to always show
"N/A", because the former is the TTY pseudo name, while the latter is
the full device name.
2023-05-24 05:55:44 +02:00
Tim Ledbetter
826894a89c Utilities/w: Port to String 2023-05-24 05:55:44 +02:00
Tim Ledbetter
72c5c3ac77 Utilities/w: Replace LibC function calls with modern equivalents 2023-05-24 05:55:44 +02:00
Timothy Flynn
086316057b LibThreading: Improve resiliancy of timed threading tests
The threading tests currently wait for a very small amount of time for
the expected test condition to be reached, e.g. 20ms. This changes the
tests to *check* the condition every 20ms, but allow the test to run for
up to 2s until the condition is reached. This should hopefully resolve
the failures seen on CI.

This also renames one of the tests to match what it actually does. The
test itself was changed in commit 5b335e7, but the name was not updated
to reflect that change.
2023-05-24 00:25:35 +02:00
Daniel Bertalan
fd316945f5 AK: Define NAKED more resiliently for AArch64
This attribute is used for functions in the kernel that are entirely
written in assembly, yet defined in C++ source files.

Without `__attribute__((naked))`, Clang might decide to inline these
functions, making any `ret` instructions within them actually exit the
caller, or discard argument values as they appear "dead". This issue
caused a kernel panic when using the `execve` syscall in AArch64
SerenityOS built by Clang.

While the empty definition so far appears to work fine with GCC, simpler
test cases do similarly suffer from unintended inlining, so define
`NAKED` as a synonym of `NEVER_INLINE` to avert future issues.

Perhaps we should move users of `NAKED` to plain assembly files?

This makes aarch64Clang builds boot :^)
2023-05-23 23:45:01 +02:00
Caoimhe
bafc1193ee SpiceAgent: Don't send ClipboardGrab if the shared clipboard is disabled
The spice server will ignore any clipboard-related messages if we don't
have the appropriate capabilities, but I think it's better for us to
do less CPU churning whenever the user copies something to their
clipboard.

It also stops the spice server from warning in the console
about a clipboard grab message being recieved when the capability was
never announced.
2023-05-23 22:56:36 +02:00
Sam Atkins
4e47e6a3d6 LibWeb: Reject invalid tokens in calc() expressions
If we finish parsing a calculation tree and it still contains
UnparsedCalculationNodes, then it's not valid, and we shouldn't create
a StyleValue from it.
2023-05-23 15:43:23 +02:00
Andreas Kling
fa25f70086 LibWeb: Make LiveNodeList faster when it only cares about children
Same optimization as HTMLCollection, ported to LiveNodeList.
2023-05-23 14:38:45 +02:00
Andreas Kling
fe92b54137 LibWeb: Don't draw text fragments that would be clipped by the painter
This avoids a ton of work when painting large documents. Even though it
would eventually get clipped by the painter anyway, by bailing out
earlier, we avoid a lot more work (UTF-8 iteration, OpenType lookups,
etc).

It would be even nicer if we could skip entire line boxes, but we don't
have a fast way to get the bounding rect of a line box at the moment.
2023-05-23 14:38:45 +02:00
Andreas Kling
df1bb0ff49 LibWeb: Make HTMLCollection faster when it only cares about children
Some of the live HTMLCollection only ever contain children of their root
node. When we know that's the case, we can avoid doing a full subtree
traversal of all descendants and only visit children.

This cuts the ECMA262 spec loading time by over 10 seconds. :^)
2023-05-23 14:38:45 +02:00
Zaggy1024
e31f696ee6 LibVideo/PlaybackManager: Use a function to start the internal timer
In addition, this renames the internal timer to better suit its new
purpose since the playback state handlers were added. Not only is it
used to time frame presentations, but also to poll the queue when
seeking or buffering.
2023-05-23 05:17:48 -06:00
Zaggy1024
71d70df34f LibVideo/PlaybackManager: Decode frames off the main thread
Running decoding on the main thread can cause frames to be delayed due
to the presentation timer waiting for a decode to finish. If a frame
takes too long to decode, this delay can be quite visible. Therefore,
decoding has been moved to a separate thread, with frames sent to the
main thread through a thread-safe queue.

This results in frame times going from being late by up to 16ms to a
very consistent ~1-2ms.
2023-05-23 05:17:48 -06:00
Zaggy1024
eae7422ebc LibVideo: Fallibly construct playback manager fields 2023-05-23 05:17:48 -06:00