Commit graph

51169 commits

Author SHA1 Message Date
Peter Brottveit Bock 49b29332f2 AK: Migrate IPv6Address::to_deprecated_string() to ::to_string()
Change the name and return type of
`IPv6Address::to_deprecated_string()` to `IPv6Address::to_string()`
with return type `ErrorOr<String>`.

It will now propagate errors that occur when writing to the
StringBuilder.

There are two users of `to_deprecated_string()` that now use
`to_string()`:

1. `Formatted<IPv6Address>`: it now propagates errors.

2. `inet_ntop`: it now sets errno to ENOMEM and returns.
2023-06-09 19:38:14 +01:00
Peter Brottveit Bock fdfffe2d8c LibWeb: Use IPv6Address::loopback() instead of parsing "::1"
When comparing an ipv6 address against '::1', then compare against
the value object from `IPv6Address::loopback()`, instead of parsing the
string "::1" to an IPv6Address.
2023-06-09 19:38:14 +01:00
Peter Brottveit Bock 10aed80b29 AK: Define IPv6Address::loopback(), the IPv6 loopback address '::1' 2023-06-09 19:38:14 +01:00
Peter Brottveit Bock 43a8a38f57 AK: Test that IPv6Address::operator== only looks at bytes in address
This commit extends the test to ensure that different objects with
the same inet6-address are considered equal.
2023-06-09 19:38:14 +01:00
Sam Atkins 1051624084 LibWeb: Obey CSS aspect-ratio property during layout
Calculate a "preferred aspect ratio" based on the value of
`aspect-ratio` and the presence of a natural aspect ratio, and use that
in layout.

This is by no means complete or perfect, but we do now apply the given
aspect-ratio to things.

The spec is a bit vague, just saying to calculate sizes for
aspect-ratio'ed boxes the same as you would for replaced elements. My
naive solution here is to find everywhere we were checking for a
ReplacedBox, and then also accept a regular Box with a preferred aspect
ratio. This gets us pretty far. :^)

https://www.w3.org/TR/css-sizing-4/#aspect-ratio-minimum is not at all
implemented.
2023-06-09 20:37:51 +02:00
Sam Atkins 84e7216603 LibWeb: Move "natural size" concept into Layout::Box
Having this here instead of in ReplacedBox means we can access it when
figuring out what the "preferred aspect ratio" is.

There's some inconsistency between specs about what this is called, but
they're moving towards referring to this as "natural width/height/
aspect-ratio", so let's copy that terminology.
2023-06-09 20:37:51 +02:00
Sam Atkins 6fd3b39bef LibWeb: Parse aspect-ratio property
Parse it, store the result in the ComputedValues, and also expose it to
ResolvedCSSStyleDeclaration.
2023-06-09 20:37:51 +02:00
Sam Atkins 5e3da93f1a LibWeb: Add RatioStyleValue and parsing 2023-06-09 20:37:51 +02:00
Sam Atkins b9f9d87bd0 LibWeb: Allow calc() and friends inside <ratio> values
Anywhere that `<number>` appears in the grammar, `calc()` that resolves
to a number is valid, including inside the `<ratio>` grammar.
Thankfully, a calculation that produces a number cannot rely on any
context information for the calculation, so we can resolve them
straight away and just pretend they were a `<number>` the whole
time. :^)
2023-06-09 20:37:51 +02:00
Sam Atkins 57a247530c LibWeb: Introduce and use ComponentValue::is_delim() helper
`foo.is(Token::Type::Delim) && foo.token().delim() == '!'` becomes
`foo.is_delim('!')`, which is a lot less verbose. I really should have
done this ages ago.
2023-06-09 20:37:51 +02:00
Timothy Flynn bf242efd1d LibWeb: Remove outdated layout/text test scripts
These are superseded by headless-browser running these tests in a single
process, and aren't used by CI anymore. It's a bit confusing having them
still around so let's be rid of them.
2023-06-09 20:36:54 +02:00
Lucas CHOLLET aa8b8ddd57 nl: Don't output a new line on empty file 2023-06-09 17:24:59 +02:00
Lucas CHOLLET bccd12f297 nl: Use the Stream API instead of a FILE * 2023-06-09 17:24:59 +02:00
Lucas CHOLLET 14826ced68 cut: Use the Stream API instead of a FILE * 2023-06-09 17:24:59 +02:00
Lucas CHOLLET 9ab8200b89 wc: Use the Stream API instead of a FILE * 2023-06-09 17:24:59 +02:00
thankyouverycool caa8f43dbe Applications+Demos+LibGUI: Migrate to fallible WizardDialogs and Pages
And port page text to String. Also removes WizardDialog::show() helper
as all current implementations prefer to derive their own Dialog.
2023-06-09 17:21:43 +02:00
thankyouverycool 96e60c98cf FontEditor: Propagate errors in update_statusbar()
Errors are sent only to stderr as they can be spammy
2023-06-09 17:21:43 +02:00
thankyouverycool fe6b36507f FontEditor: Check complete mime type on paste_glyphs() 2023-06-09 17:21:43 +02:00
thankyouverycool 9b431bc2ab FontEditor: Don't add ineffectual glyph moves to the undo stack
And fix effectual glyph paints failing to create new undo events when
beginning at unmodifiable cells but mousing to settable ones.
2023-06-09 17:21:43 +02:00
Aliaksandr Kalenik 0d8d7ae94e LibWeb: Implement painting for svg text
The implementation of painting for SVG text follows the same pattern
as the implementation of painting for SVG geometries. However, instead
of reusing the existing PaintableWithLines to draw text, a new class
called SVGTextPaintable is introduced. because everything that is
painted inside an SVG is expected to inherit from SVGGraphicsPaintable.
Therefore reusing the text painting from regular text nodes would
require significant refactoring.
2023-06-09 17:20:34 +02:00
Jelle Raaijmakers 81a6976e90 Kernel: De-atomicize fields for promises in Process
These 4 fields were made `Atomic` in
c3f668a758, at which time these were still
accessed unserialized and TOCTOU bugs could happen. Later, in
8ed06ad814, we serialized access to these
fields in a number of helper methods, removing the need for `Atomic`.
2023-06-09 17:15:54 +02:00
Tim Ledbetter 7f855ad6b3 Kernel: Initialize ProcFS timestamps to process creation time 2023-06-09 17:15:41 +02:00
Tim Ledbetter f25530a12d Kernel: Store creation time when creating a process 2023-06-09 17:15:41 +02:00
PrestonLTaylor e2a935b1dc LibWeb: Implement the <style> SVG element
The `<style>` element is allowed to be in the SVG namespace, so we now
support this element.

It has the same behaviour as the HTML namespace `<style>` element as
described in the spec.

"The semantics and processing of a ‘style’ and its attributes must be
the same as is defined for the HTML ‘style’ element."
2023-06-09 17:14:50 +02:00
PrestonLTaylor 7f7ebc4b8b LibWeb: Extract updating a style block into StyleElementUtils 2023-06-09 17:14:50 +02:00
Sam Atkins 7a2c8d30b9 LibWeb: Allow auto as animation-duration and make that the default
This is a spec change: 2a7cc4b58f
2023-06-09 17:13:19 +02:00
Sam Atkins c4c35ce9b9 LibWeb: Alphabetize animation properties
I didn't notice this when they were added, whoops
2023-06-09 17:13:19 +02:00
Nico Weber 52d17afd7e WebP: Add test for vertical ALPH chunk filtering_method 2023-06-09 04:35:19 -07:00
Nico Weber a77b6c470a WebP: Add test image for vertical image filtering
I opened smolkling.webp in Photoshop, added a layer mask with a vertical
gradient, replaced the leftmost column with completely transparent
pixels (because the leftmost column is vertically predicted with the
horizontal filter too), and saved it as webp. That wasn't enough to
get a horizontal filter for the ALPH chunk though, so I also ran

    cwebp \
        -alpha_filter best \
        smolkling.webp \
        -o Tests/LibGfx/test-inputs/smolkling-vertical-alpha.webp

That did the trick.
2023-06-09 04:35:19 -07:00
Nico Weber b0916d2133 WebP: Add test for gradient ALPH chunk filtering_method 2023-06-09 04:35:19 -07:00
Nico Weber ec7eb78841 WebP: Add test image for gradient image filtering
I opened smolkling.webp in Photoshop, added a layer mask, and
scribbled a shape vaguely looking like the letter "C" on it.
I then saved it as a lossy webp and that was enough to end up
with filter method ¯\_(ツ)_/¯
2023-06-09 04:35:19 -07:00
Nico Weber 816674de36 WebP: Add test for horizontal ALPH chunk filtering_method 2023-06-09 04:35:19 -07:00
Nico Weber 737786f9a8 WebP: Add test image for horizontal image filtering
I opened smolkling.webp in Photoshop, added a layer mask with a
horizontal gradient, and saved it as webp. That wasn't enough to
get a horizontal filter for the ALPH chunk though, so I also ran

    cwebp \
        -alpha_filter best \
        smolkling-ps.webp \
        -o Tests/LibGfx/test-inputs/smolkling-horizontal-alpha.webp

That did the trick.

(Looks like doing the same with a vertical or diagonal gradient
_also_ produces a webp file with filtering_method 1, i.e. horizontal.)
2023-06-09 04:35:19 -07:00
Nico Weber 4e92027513 WebP: Add missing spec quotes in a comment, tweak whitespace 2023-06-09 04:35:19 -07:00
Ali Mohammad Pur 141143a1c6 LibWeb: Serialize custom properties in CSSStyleDeclaration::serialized()
Prior to this commit, PropertyOwningCSSStyleDeclaration::serialized()
did not include custom properties, which lead to an incomplete
`cssRule.cssText` result.
This commit makes that class also serialize the custom properties and
place them before the regular properties in the rule text.
2023-06-09 11:17:44 +01:00
Timothy Flynn f95ed9f373 LibWeb: Implement document.title for SVG documents 2023-06-09 01:12:48 +02:00
Timothy Flynn e2e4e6da52 LibWeb: Implement the SVG title element 2023-06-09 01:12:48 +02:00
Timothy Flynn 3a28be2a98 LibWeb: Parse SVG document types as XML documents
We began parsing SVG documents as HTML years ago in commit 05be648. This
was long before we had an XML parser, and actually violates the spec.
Since SVG documents have a MIME type of "image/svg+xml", the spec
mandates the document should be parsed as XML.

One impact here is that the SVG document is no longer "fixed" to include
<html>, <head>, and <body> tags. This will have prevented document.title
from detecting the document element is an SVG element.
2023-06-09 01:12:48 +02:00
Timothy Flynn c8d8640018 LibWeb: Detect when an XML document belongs in the SVG namespace
We currently parse all XML documents as belonging in the HTML namespace.
Switch to the SVG namespace when parsing an SVG document.
2023-06-09 01:12:48 +02:00
Timothy Flynn b6228507ac LibXML: Prevent entering the root node of an SVG document twice
Currently, if an SVG document is parsed, we enter the root <svg> element
twice - first when its node is appended, and then immediately after the
call to append its node. Prevent this by only ever entering nodes from
the appropriate location inside the call to append the node.
2023-06-09 01:12:48 +02:00
implicitfield 71b184accf Meta+Lagom: Enable CMAKE_BUILD_WITH_INSTALL_RPATH
On macOS, CMake incorrectly tries to add and/or remove rpaths from files
that it has already processed when it performs installation. Setting the
rpaths during the build process ensures that they are only set once, and
as a bonus, makes installation slightly more performant.

Fixes #10055.
2023-06-08 17:59:53 +02:00
Jelle Raaijmakers 2e3bff7ab1 Meta: Re-add boot drive to aarch64 run configuration
This broke in c2e24a2fa1 where the boot
drive was removed from `SERENITY_MACHINE`. We now add the boot drive to
the common Qemu arguments, so it gets included in the aarch64 run
configuration as well.
2023-06-08 14:43:14 +02:00
Andreas Kling 3365a1e034 LibWeb: Resolve cyclic % against 0 when available size is min-content
This fixes an issue where replaced elements with cyclic percentage width
would make an oversized min-content contribution to its container.
2023-06-08 13:54:11 +02:00
Andreas Kling a5f8f8238f LibWeb: Fix a case of incorrect flex container max-content main size
We were incorrectly returning a "specified size suggestion" for flex
items with a definite main size where that main size was also automatic.

This led to us incorrectly choosing 0 as the automatic minimum size for
that flex item, instead of its min-content size.
2023-06-08 13:54:11 +02:00
Timothy Flynn cb912f0e1a LibEDID: Ignore duplicate PNP IDs
The PNP IDs data file was recently updated with an accidental duplicate
entry (HONOR Device Co., Ltd.). Rather than breaking everyone's build,
let's just ignore duplicates.
2023-06-08 13:03:14 +02:00
Andreas Kling 102b8d717f LibWeb: Set flex-basis to 0% when omitted from flex shorthand
This doesn't match the spec, *but* matches what other engines do, and it
turns out this is required for web compat. (It fixes the menu on MDN.)
2023-06-08 10:05:56 +02:00
Andreas Kling dd2080c55f LibWeb: Stub out Element.scroll() and Element.scrollTo()
With this, we stop throwing exceptions in a way that makes MDN disappear
and it's now possible to browse MDN in Ladybird. :^)
2023-06-08 10:05:56 +02:00
Andreas Kling 7f90b0cab7 LibWeb: Don't override prototype on generated iterator prototypes
Generated iterator prototypes already have the IteratorPrototype as
their prototype, but we were incorrectly hijacking them and rerouting
to ObjectPrototype.

Regressed in cfe663435e.
2023-06-08 10:05:56 +02:00
Ben Wiederhake 3f1cc7125c CI: Don't run known-failing tests on Aarch
These might be the cause of CI failures.
2023-06-08 10:03:35 +02:00
Timothy Flynn 529546e14f Ladybird: Use the same default new tab page URL as Browser 2023-06-08 07:22:00 +02:00