Commit graph

50777 commits

Author SHA1 Message Date
Sam Atkins
abdd4a8733 LibWeb: Add helper for creating resolved values for sided shorthands
...and use it for `margin` and `padding`.

So now, if all four margins are 12px, we output "12px" instead of "12px
12px 12px 12px". This matches the spec's requirement to use the smallest
non-ambiguous representation.
2023-05-27 20:55:00 +02:00
Sam Atkins
e8dc8f697b LibWeb: Alphabetize style_value_for_property() property list 2023-05-27 20:55:00 +02:00
Sam Atkins
ee1fc56f02 LibWeb: Resolve background-size property 2023-05-27 20:55:00 +02:00
Sam Atkins
d5fbec8a49 LibWeb: Resolve background-position[-x,-y] properties 2023-05-27 20:55:00 +02:00
Sam Atkins
3ed2c6da72 LibWeb: Resolve appearance property 2023-05-27 20:55:00 +02:00
Sam Atkins
db09f0e0c1 LibWeb: Resolve align-{content,items,self} properties 2023-05-27 20:55:00 +02:00
Sam Atkins
6a51ef9c9b LibWeb: Resolve accent-color property 2023-05-27 20:55:00 +02:00
Sam Atkins
0374b42f20 LibWeb: Remove CSS:: prefix from ResolvedCSSStyleDeclaration.cpp code
These prefixes weren't adding anything except some visual clutter, in
code that already has A::Lot::Of::This.
2023-05-27 20:55:00 +02:00
Andrew Kaster
5fd2fc70e5 LibWebView: Don't re-create WebContent proceses when repeatedly crashing
Serenity handles this in the SystemServer already, but the simplest
place to put this logic is the ViewImplementation base class.

This is trivial to see when running Ladybird without SERENTIY_SOURCE_DIR
set, or set improperly.
2023-05-27 20:09:50 +02:00
Ben Wiederhake
bdeccf8844 Chess+ChessEngine: Fix stockfish by setting correct blocking flag
Stockfish apparently cannot handle non-blocking I/O, and it does not
make sense to assume that all chess engines can do so.

Fixes #18946.
2023-05-27 18:44:21 +02:00
Ben Wiederhake
62ebb78433 AK: Enable Core::File to switch blocking-mode during use
This closely mirrors Socket::set_blocking. Note that it does not make
sense to make this a virtual method on a base class, since
SeekableStream and FixedMemoryStream cannot possible be anything except
than blocking.
2023-05-27 18:44:21 +02:00
MacDue
6f8c2dc322 LibWeb: Make SVG transform parser less crashy
Previously, this would blindly use parse_number() without checking if
there was a number to parse. This meant we would crash on transforms
like:
	rotate(BAD 32 0)

Now the attribute just gracefully fails to parse.
2023-05-27 18:40:41 +02:00
Andreas Kling
33500bb6db LibWeb: Protect against null deref during Web::Page initialization
BrowsingContext::set_active_document() may end up asking for the Page's
top level browsing context before Page has one. Do a workaround for now
where we have an API to ask if it's initialized.

Long-term we should find a cleaner solution.
2023-05-27 18:38:40 +02:00
Ben Wiederhake
f07ac8f20a HackStudio: Prefer FileSystem over DeprecatedFile
This also straightens out the logic to determine the project_path.
Instead of calling realpath on potentially-null strings and sometimes
not even reading the result, we now only make these calls when required,
and properly handle any error.
2023-05-27 17:30:55 +02:00
Ben Wiederhake
0fab68ee16 LibCoredump: Avoid unnecessary conversion to DeprecatedString 2023-05-27 17:30:55 +02:00
Andreas Kling
fdbdc4d5ff LibWeb: Only forward scroll requests for the top-level browsing context
We don't want to scroll the whole web view just because some iframe is
asking to be scrolled.
2023-05-27 17:26:29 +02:00
Andreas Kling
58d3322b0e LibWeb: Don't tell UI process about subframe title changes
This fixes an issue where loading an iframe would cause the current
browser tab title to get overwritten with an empty string.

The problem is that nested browsing contexts can be considered "top
level" during their initialization, but only one browsing context is
ever the Page::top_level_browsing_context(), so that's what we check.
2023-05-27 17:26:29 +02:00
Andreas Kling
7603f8dcae Ladybird: Use the DALL-E ladybird globe as the application icon
This looks a lot more "at home" than usual pixel art logo on
non-SerenityOS systems. :^)

Also, stop using site favicons as the app icon as that made it
annoyingly hard to find Ladybird in task switchers sometimes.
2023-05-27 17:26:29 +02:00
Andreas Kling
a98f5c7251 LibWeb: Make resolved serialization of CSS display prefer short form
Although we translate e.g `block` to `block flow` for internal use in
the engine, CSS-DISPLAY-3 tells us to use the short form in
serializations for compatibility reasons.

This adds 9 points to our score on https://html5test.com/ :^)
2023-05-27 16:43:35 +02:00
Nico Weber
8defd55349 WebP/Lossy: Add code to read the frame header in the first partition 2023-05-27 08:31:03 -06:00
Nico Weber
24a3687986 WebP/Lossy: Add WebPLoaderLossyTables.h
This will contain several of the fixed data tables from the VP8 spec.
For starters, it contains the tables needed to read the frame header
in the first partition. These tables are needed to read the
probabilities of the metablock predicition modes, which in turn will
be needed to read the metablock predicition modes themselves.
2023-05-27 08:31:03 -06:00
Nico Weber
bbc1f57d1e WebP/Lossy: Add a comment with a summary of the file format 2023-05-27 08:31:03 -06:00
Sam Atkins
e8a946c674 LibWeb: Remove StyleValue::has/to_length()
Specifically, stop letting NumericStyleValues holding `0` from
pretending to hold a Length. The parser is now smart enough that we
don't have to do this. :^)
2023-05-27 16:12:25 +02:00
Sam Atkins
6bbf163499 LibWeb: Create a LengthStyleValue for flex-basis of 0
We're about to stop letting 0 NumericStyleValues pretend to be Lengths,
so this will break. As noted, the flex-basis property accepts
`<length>` not `<number>` so this is actually correct.
2023-05-27 16:12:25 +02:00
Sam Atkins
5cbf6eb930 LibWeb: Remove StyleValue::has/to_integer()
Only NumericStyleValue holds integers.

I'm not sure our current distinction between NumericStyleValue holding
an integer or non-integer is useful given it always returns a float.
:thonk:
2023-05-27 16:12:25 +02:00
Sam Atkins
4ecf0b7768 LibWeb: Remove StyleValue::has/to_number()
Only NumericStyleValue holds numbers.

Renamed `to_number()` to `number()` because it's just a getter now.
2023-05-27 16:12:25 +02:00
Sam Atkins
5f755d721e LibWeb: Remove StyleValue::has_rect()
This behaves identically to `is_rect()`
2023-05-27 16:12:25 +02:00
Karthik Karanth
f60446bbfe LibWeb: Unit tests for min/max-inline-size 2023-05-27 16:02:33 +02:00
Karthik Karanth
733b74af7c LibWeb: Support min-inline-size & max-inline-size
Currently this assumes that writing-mode is horizontal, and therefore
only affects the min-width/max-width
2023-05-27 16:02:33 +02:00
Karthik Karanth
72507c318a LibWeb: Add logical-alias-for in Properties.json
This allows for succint definitions of logical properties, by allowing
them to inherit initial values, valid identifiers, etc from another
property
2023-05-27 16:02:33 +02:00
Lucas CHOLLET
e78d1ec03a LibJS/Runtime: Use Core::File in VM::resolve_imported_module 2023-05-27 06:48:25 -06:00
Andreas Kling
edbc732785 Ladybird+Tests/LibWeb: Add very basic text-only test harness
This allows us to create "text tests" in addition to "layout tests".
Text tests work the same as layout tests, but dump the document content
as text and exit upon receiving the window "load" event.
2023-05-27 14:03:49 +02:00
Andreas Kling
3389eed59c headless-browser: Add a --dump-text mode for simplified run & dump tests
This dumps the text content of the page (via a cheesy "select all" +
"get selected text" maneuver) :^)
2023-05-27 14:03:49 +02:00
Matthew Olsson
22e97332fc LibWeb: Throw the correct object when enqueuing to a readable stream 2023-05-27 13:55:14 +02:00
Matthew Olsson
4c8015c1f6 LibWeb: Do not clear stream algorithms (and add corresponding FIXMEs) 2023-05-27 13:55:14 +02:00
Matthew Olsson
dd65d60069 LibWeb: Use doubles for Stream's high_water_mark and queue_total_size
This matches the IDL types
2023-05-27 13:55:14 +02:00
Matthew Olsson
f63d027b0b Meta: Fix unresolvable reference to WebIDL::OperationReturnsPromise 2023-05-27 13:55:14 +02:00
Matthew Olsson
bdfc14f24d LibWeb: Accept explicit "type: undefined" in UnderlyingSource 2023-05-27 13:55:14 +02:00
Matthew Olsson
5d48ade508 LibWeb: Use TRY() to convert invoke_callback result to an ExceptionOr
Otherwise, the JS::Completion is always interpretted as an error by
ExceptionOr.
2023-05-27 13:55:14 +02:00
Matthew Olsson
e5ff777b48 LibWeb: Capture stack values by copy in async lambdas in Stream AOs 2023-05-27 13:55:14 +02:00
Matthew Olsson
42fb847cc8 LibWeb: Use u64 for ReadableByteStream offsets instead of u32
These are specified in the IDL as "unsigned long long", which translates
to u64.
2023-05-27 13:55:14 +02:00
Ben Wiederhake
5fafd82927 AK+Everywhere: Don't crash on invalid months
Sadly, we don't have proper error propagation here. However, crashing
the Kernel just because a CDROM contains an invalid month seems like a
bad idea.
2023-05-27 12:17:50 +02:00
Ben Wiederhake
9d40ecacb5 AK: Fix signed overflow in unix time parts parsing 2023-05-27 12:17:50 +02:00
Ben Wiederhake
815ea06d2c AK: Test from_unix_time_parts intensively 2023-05-27 12:17:50 +02:00
Andreas Kling
e30709fca9 LibWeb: Don't throw away the layout tree on viewport resize
We'll throw it out automatically if some media query changes changes its
evaluation state in response to the resize, and that should be enough.
2023-05-27 11:43:56 +02:00
Andreas Kling
78d6e2db8c LibWeb: Don't invalidate style when attribute set to identical value
This was a fairly common source of unnecessary style invalidations.
2023-05-27 11:43:56 +02:00
Liav A
8142f7b196 Kernel: Mark sys$get_dir_entries as not needing the big lock
After examination of all overriden Inode::traverse_as_directory methods
it seems like proper locking is already existing everywhere, so there's
no need to take the big process lock anymore, as there's no access to
shared process structures anyway.
2023-05-27 10:58:58 +02:00
Liav A
2ab657d3b5 Kernel: Make Ext2FSInode::traverse_as_directory to take m_inode_lock
The contents of the directory inode could change if we are not taking so
we must take the m_inode_lock to prevent corruption when reading the
directory contents.
2023-05-27 10:58:58 +02:00
Liav A
46ef2f8e20 Kernel: Mark sys$fork as not needing the big lock
All shared structures are already protected by "atomic" spinlocks for
those structures, so there's no need to take the big process lock.
2023-05-27 10:58:58 +02:00
Liav A
0be79f9bc2 Kernel: Mark sys$umount as not needing the big lock
All accesses to the mount table are already serialized by the actual
spinlock of that table.
2023-05-27 10:58:58 +02:00