Commit graph

51398 commits

Author SHA1 Message Date
Andi Gallo
75e87c32f2 LibWeb: Fix table width algorithm when available space is a constraint
Handle available space more carefully when computing a table width, in
order to avoid creating a definite infinite width when available space
width is max-content, as it's the case in calculate_max_content_width.
The constraint is thus correctly propagated by the time we cache the
computed value, which was previously rejected by the hash function due
to being definite but infinite instead of max-content.
2023-06-12 17:51:00 +02:00
Andreas Kling
b86ca27692 headless-browser: Improve output for failing tests a bit
- Colorize the "Test failed" part when stdout is a TTY
- Add missing newlines in the output
2023-06-12 11:52:58 +02:00
Ali Mohammad Pur
1696411f66 Shell: Reset the custom Shell keybinds before calling Editor::get_line()
Fixes #19301.
2023-06-12 10:44:44 +03:30
Lucas CHOLLET
36153136c4 LibGfx/PNG: Use ByteBuffer instead of Vector<u8> 2023-06-12 06:41:16 +02:00
Lucas CHOLLET
15df0224e1 LibGfx/PNG: Remove an unused field in PNGLoadingContext 2023-06-12 06:41:16 +02:00
Lucas CHOLLET
07b6c2ebfc LibGfx/PNG: Make chunk-related functions fallible 2023-06-12 06:41:16 +02:00
Lucas CHOLLET
96a1a8512f LibGfx/PNG: Use a StringView to compare the chunk type 2023-06-12 06:41:16 +02:00
Andreas Kling
dbcf63e85e LibJS: Combine two declarative record traversals in GlobalEnvironment
In GlobalEnvironment::get_binding_value(), we can avoid an extra walk
of the declarative environment record if has_binding() returns a
cacheable environment coordinate.
2023-06-12 06:40:49 +02:00
Andreas Kling
620c495d31 LibJS: Skip lazy intrinsic allocation check for objects without them
Most JS::Objects don't have lazily-allocated intrinsic properties,
so let's avoid doing hash lookups by putting a flag on JS::Object that
tells us whether it's present in s_intrinsics.

Takes CPU time spent in those hash lookups from 1-2.5% to nothing on
various JS heavy pages.
2023-06-12 06:40:49 +02:00
Aliaksandr Kalenik
5925e6f196 LibWeb: Use static factory methods to construct GridTrack in GFC
This allows to be more explicit in layout code about whether a track is
going to be created from definition or be auto-sized or a gap.
2023-06-12 06:33:51 +02:00
Aliaksandr Kalenik
3fba0a944a LibWeb: Expand minmax in grid tracks defined by grid-auto-rows/columns
Use GridTrack::create_from_definition() that takes care of minmax().
2023-06-12 06:33:51 +02:00
Aliaksandr Kalenik
57581735b7 LibWeb: Add GridTrack::create_from_definition() in GFC
Introducing method to construct grid track from definition allows to
reduce duplication in layout code.
2023-06-12 06:33:51 +02:00
Andreas Kling
2ebb3639aa LibWeb: Remove ImageLoader and ImageResource
The old image loading mechanism is no longer used, as everything has
been moved on top of HTML::ImageRequest! :^)
2023-06-11 20:37:12 +02:00
Andreas Kling
a553fe055b LibWeb: Piggyback on HTML::ImageRequest in HTMLObjectElement
Like the piggybacking in CSS, this is also totally ad-hoc, since there's
no spec to follow.

The code here is weird and definitely sub-optimal as we do a second load
if it turns out the loaded resource is an image, but given that object
elements are rarely used nowadays, I doubt we'll even notice.

That said, we should of course improve this code as we move forward.
2023-06-11 20:37:12 +02:00
Andreas Kling
680fc3f90a LibWeb: Piggyback on HTML::ImageRequest in CSS ImageStyleValue
This is all ad-hoc since no spec currently exists for this behavior.
Basically, ImageStyleValue now uses ImageRequest for fetching and
decoding of images.

This already leads to visible improvements on many websites.
2023-06-11 20:37:12 +02:00
Andreas Kling
f70d3faa0f LibWeb: Move image fetching & decoding into ImageRequest
This forces us to diverge from the spec, but it's for a good cause:
by moving it into ImageRequest, we'll be able to reuse fetching and
decoding logic from CSS and other places.

This patch also makes ImageRequests shareable, currently keyed by
the URL (this part needs improvement!)
2023-06-11 20:37:12 +02:00
MacDue
e27081a8ca Base: Add an SVG fill-rule example page 2023-06-11 19:34:24 +02:00
MacDue
377ff0ac26 LibWeb: Implement SVG fill-rule attribute
Previously, we did an evenodd fill for everything which while for most
SVGs works, it is not correct default (it should be nonzero), and broke
some SVGs. This fixes a few of the icons on https://shopify.com/.
2023-06-11 19:34:24 +02:00
Andi Gallo
ead56e88db LibWeb: Avoid crash for unsupported length unit in SVG elements
Acid3 sets 1em as the y coordinate of one of external SVG fonts, we
don't support that yet. Ignore unsupported unit instead of crashing.
2023-06-11 19:04:30 +02:00
MacDue
30c316a2bf LibWeb+LibGfx: Allow stroking with a paint style and opacity 2023-06-11 16:15:56 +02:00
MacDue
eb4a58528e LibWeb+LibGfx: Allow filling with a paint style and opacity 2023-06-11 16:15:56 +02:00
Karol Kosek
8bd68198d6 Userland: Filter out unsupported file types in open dialogs in more apps 2023-06-11 09:40:17 +01:00
Karol Kosek
27011cf55d LibFSAC+Userland: Pass options for FSAC::open_file() using a struct
It was rather inconvenient having to specify all arguments if you wanted
to modify only the last one.
2023-06-11 09:40:17 +01:00
Andreas Kling
5c07aeb78e LibWeb: Update HTML image loading algorithm for recent spec changes
Changes: 8a2375aac2

Note that we don't support the full lazy loading machinery yet, so this
isn't actually hooked up.
2023-06-11 10:32:09 +02:00
Andreas Kling
2e9b12d327 LibWeb: Update HTML image loading algorithm with null checks from spec
The spec has been updated to fix the missing null checks we found:
8f3d1fc6d1
2023-06-11 10:32:09 +02:00
Tim Ledbetter
2b89020b6c SystemMonitor: Make byte counts in ProcessStateWidget human-readable 2023-06-11 09:26:54 +01:00
Tim Ledbetter
8d721dc0f7 Kernel+LibCore+SystemMonitor: Make thread statistics values 64-bit
Thread statistics values which count bytes are now 64-bit. This avoids
overflow when these values go above 4GiB.
2023-06-11 09:26:54 +01:00
Dominika Liberda
75307803a2 LibC: Implement stpcpy
For better code clarity, also reformatted how strcpy increments
pointers.
2023-06-11 08:47:15 +02:00
Andreas Kling
8a43f5a64a LibWeb: Forward media attribute from link element to loaded style sheet
Otherwise, we will treat the loaded style sheet as if it had media="all"
which is not always appropriate.
2023-06-11 06:05:03 +02:00
Andreas Kling
a6c6c24428 Lagom: Allow opting into linking with mold 2023-06-10 17:31:41 -07:00
Andreas Kling
79d2c9f3e8 LibWeb: Don't justify text lines that end in a forced break
These are treated the same as the last line in a block, per CSS-TEXT-3.
2023-06-10 21:46:33 +02:00
Andreas Kling
358a4fe3cb Tests/LibWeb: Update rebaseline-libweb-test for path changes 2023-06-10 21:46:33 +02:00
Andreas Kling
69c33bd4ca LibGfx/OpenType: Load x-height metrics from OS/2 table if available
Before this change we always returned the font's point size as the
x-height which was basically never correct.

We now get it from the OS/2 table (if one with version >= 2 is available
in the file). Otherwise we fall back to using the ascent of the 'x'
glyph. Most fonts appear to have a sufficiently modern OS/2 table.
2023-06-10 21:46:33 +02:00
Andi Gallo
8090adf268 LibWeb: Add partial implementation of border conflict resolution
Fix handling of border style specified per column as well.
2023-06-10 11:17:21 +02:00
Andi Gallo
6c2712764d LibWeb: Add table-column-group to layout tree dump 2023-06-10 11:17:21 +02:00
Andi Gallo
48706742d8 LibWeb: Fix remove_irrelevant_boxes
It's supposed to remove children of table-column-group which are *not*
table-column, we were doing the opposite.
2023-06-10 11:17:21 +02:00
Tim Ledbetter
23af2cfbc5 Base: Add man page for pkill 2023-06-10 07:35:52 +02:00
Tim Ledbetter
1e21e95a1b pkill: Add --ignore-case as an alias for the -i option 2023-06-10 07:35:52 +02:00
Tim Ledbetter
69b6c6f62c pkill: Add -x option to only select exact matches 2023-06-10 07:35:52 +02:00
Tim Ledbetter
a253be6abf pkill: Add -U option to filter matches by UID or login name 2023-06-10 07:35:52 +02:00
Tim Ledbetter
caa7edff92 pkill: Add -c option to print the number of matches 2023-06-10 07:35:52 +02:00
Tim Ledbetter
6753cf8b20 pkill: Print errors when killing a process to stderr 2023-06-10 07:35:52 +02:00
Lucas CHOLLET
e252b6e258 LibGfx/JPEG: Use a more aggressive inline policy
Some of these functions can be called millions of times even for images
of moderate size. Inlining these functions really helps the compiler and
gives performance improvements up to 10%.
2023-06-10 07:30:02 +02:00
Lucas CHOLLET
5a0d702f21 LibGfx/JPEG: Avoid the copy of each scan
Inside each scan, raw data is read with the following rules:
- Each `0x00` that is preceded by `0xFF` should be discarded
- If multiple `0xFF` are following, only consider one.

That, plus the fact that we don't know the size of the scan beforehand
made us put a prepared stream in a vector for an easy, later on, usage.

This patch remove this duplication by realizing these operations in a
stream-friendly way.
2023-06-10 07:30:02 +02:00
Lucas CHOLLET
9a317267de LibGfx/JPEG: Make JPEGLoadingContext::current_scan optional
This allows us to construct a context without calling `Scan`'s
constructor.
2023-06-10 07:30:02 +02:00
Lucas CHOLLET
df63e14da7 LibGfx/JPEG: Introduce JPEGStream
This class is similar to some extent to an implementation of `Stream`,
but specialized for JPEG reading.

Technically, it is composed of a `Vector` to bufferize the input and
provides a simple interface to read bytes.

This patch aims for a future better and specialized control over the
input data. The encapsulation already allows us to get rid of the last
`seek` in the decoder, thus the ability to use the decoder with a raw
`Stream`.

As it provides faster `read` routines, this patch already reduces time
spend on reading.
2023-06-10 07:30:02 +02:00
Simon Wanner
a2efecac03 LibJS: Parse slashes after reserved identifiers correctly
Previously we were unable to parse code like `yield/2` because `/2`
was parsed as a regex. At the same time `for (a in / b/)` was parsed
as a division.

This is solved by defaulting to division in the lexer, but calling
`force_slash_as_regex()` from the parser whenever an IdentifierName
is parsed as a ReservedWord.
2023-06-10 07:20:33 +02:00
Karol Kosek
b0bd1e5eb5 MailSettings: Convert MailSettingsWidget to a failable factory 2023-06-10 07:19:06 +02:00
Karol Kosek
1ad81687e7 TerminalSettings: Convert setting widgets to a failable factory 2023-06-10 07:19:06 +02:00
Karol Kosek
754a5bda7a NetworkSettings: Convert NetworkSettingsWidget to a failable factory 2023-06-10 07:19:06 +02:00