Commit graph

53510 commits

Author SHA1 Message Date
Cameron Youell
6e40e8316e Ladybird: Convert Browser::Settings to a singleton 2023-08-17 15:30:23 +01:00
Sam Atkins
68dae8ab46 LibWeb: Deduplicate calc-parsing code
We had `parse_calculated_value()` which parsed the contents of `calc()`,
and `parse_dynamic_value()` which parsed any math function, both of
which produce a CalculatedStyleValue, but return a plain StyleValue.
This was confusing, so let's combine them together, and return a
CalculatedStyleValue.

This also makes the other math functions work in
`StyleComputer::expand_unresolved_values()`.
2023-08-17 16:21:42 +02:00
Timothy Flynn
7bc7f376fa LibGfx: Add Point::scaled(T) and Rect::scaled(T)
Note that we already have Size::scaled(T). While subjectively providing
API symmetry, this is mostly to allow using these methods in templated
helpers without caring what the exact underlying type is.
2023-08-17 09:57:30 -04:00
Timothy Flynn
7c4b0b0389 LibGfx+Userland: Rename Size::scaled_by to Size::scaled
Ignoring Size for a second, we currently have:

    Rect::scale_by
    Rect::scaled

    Point::scale_by
    Point::scaled

In Size, before this patch, we have:

    Size::scale_by
    Size::scaled_by

This aligns Size to use the same method name as Rect and Point. While
subjectively providing API symmetry, this is mostly to allow using this
method in templated helpers without caring what the exact underlying
type is.
2023-08-17 09:57:30 -04:00
Andreas Kling
f34cc0b8e3 LibWeb: Null check fonts after parsing them in CRC2D.font assignment
Fixes an issue where setting CRC2D.font to an unparseable value would
assert due to a null dereference.
2023-08-17 10:07:38 +02:00
Andi Gallo
ef6a78518f LibWeb: Remove unused argument of InlineLevelIterator::next
Also remove unused method from LineBuilder.
2023-08-17 09:08:18 +02:00
Andreas Kling
768c35af71 LibWeb: Throw on attempt to create a Worker for now
Trying to run a worker right now just results in the WebContent process
asserting down the road, so let's throw and log a FIXME instead.
This makes it easier to see what's failing. We'll obviously remove this
once we get workers working correctly. :^)
2023-08-17 09:07:44 +02:00
EWouters
5defca01f0 Mandelbrot: Pledge unix to enable image export 2023-08-17 07:14:54 +02:00
Hendiadyoin1
30cb4cb69b LibWeb: Reject nullptr StyleValues as invalid ColorStops
This would cause a nullptr-deref during painting of invalid
linear-gradients, such as `linear-gradient(top, #f8f9fa, #ececec)`
found in googles sign-in button
2023-08-17 07:11:13 +02:00
Andi Gallo
d5f54956ba LibWeb: Use the auto table width formula if it cannot be resolved
If the width is a percentage but the parent isn't resolved yet, take the
same path as for auto width.
2023-08-17 04:13:46 +02:00
Tim Ledbetter
3a8e362ab0 Ports/citron: Use correct quote format 2023-08-16 21:40:05 +02:00
Ali Mohammad Pur
4d27257c45 LibRegex: Treat backwards jumps to IP 0 as normal backwards jumps too
This shows up in something like /\d+|x/, where the `+` ends up jumping
to the start of its own alternative.
2023-08-16 22:20:24 +03:30
Andreas Kling
045880e6c7 LibWeb: Stop whining about WOFF2 errors when trying to guess font format 2023-08-16 18:22:01 +02:00
Sam Atkins
12a2750d1e LibWeb: Support multiple values in :lang() selector
Parse them, and also don't give up completely if the first language
listed doesn't match an element.
2023-08-16 18:05:26 +02:00
Sam Atkins
39cba61c2d LibGUI: Fall back to words when double-clicking TextEditor with spans
If we double-click on a TextEditor that has spans, but the click itself
was not on a span, fall back to the without-spans behavior. Previously
the cursor would instead jump to the end of the document.
2023-08-16 16:58:49 +02:00
Sam Atkins
631a988a57 LibWeb: Allow any valid <color> in CSS gradients
We now keep the color value as a StyleValue up until we go to paint the
gradient, which makes `currentColor` work, along with any other color
values that can't be immediately converted into a `Gfx::Color` while
parsing.
2023-08-16 14:51:12 +02:00
Andreas Kling
2971ae59d8 LibGfx/WOFF2: Align all reconstructed glyf entries to 4 bytes
It wasn't enough to do it only for simple glyphs, we need to do it for
composite glyphs as well.

Fixes an issue where some glyph data was misaligned in the output and
thus ended up rendered incorrectly or not at all.
2023-08-16 14:49:59 +02:00
Tim Ledbetter
149ab91040 Ports/citron: Update formatting to be consistent with other ports 2023-08-16 15:32:42 +03:30
Tim Ledbetter
87d8a32f3d Ports/citron: Update to the latest commit 2023-08-16 15:32:42 +03:30
Andreas Kling
1c47695bae LibWeb: Invalidate layout-transformed text on DOM text node change
This fixes an issue where programmatically changing the value of an
input element wasn't reflected visually.
2023-08-16 12:16:05 +02:00
Andreas Kling
e2740bd19d LibWeb: Don't overwrite existing text content when flushing HTML parser
If we run an inline script from the HTML parser, it may append a text
node to the current insertion point.

If there was text content immediately following the script element,
we would previously overwrite the script-inserted text content, due to
an oversight in the way we select an appropriate insertion point

This patch fixes the issue by only inserting parser content into
existing text nodes if they are empty.
2023-08-16 12:16:05 +02:00
kleines Filmröllchen
c7f416682b LibAudio: Write final FLAC audio data instead of discarding it 2023-08-16 01:10:35 +02:00
kleines Filmröllchen
1a1cba1c3f LibAudio: Use channel coupling for stereo FLAC encoding
The estimation for this is fast but not very accurate, meaning we save
around 5-10% storage space. (We also don’t try other channel coupling
methods, but I am sceptical of how much benefit that actually provides.)
2023-08-16 01:10:35 +02:00
kleines Filmröllchen
3d0da734ee AK: Allow Statistics to be used with any container type
This not only facilitates using non-owning types, but also those that
cannot be default-constructed.
2023-08-16 01:10:35 +02:00
Tim Ledbetter
9aaf516bdd Base: Render checksum man page synopsis using a multi-line code block
This is consistent with other man pages and makes the synopsis render
correctly in the terminal.
2023-08-16 01:04:13 +02:00
Tim Ledbetter
b707a7f57a Ports/klong: Create /usr/local/bin if it doesn't exist 2023-08-16 00:52:18 +02:00
Tim Ledbetter
c1e94bc3c1 Ports/stb: Create /usr/local/include if it doesn't exist 2023-08-16 00:51:09 +02:00
Jelle Raaijmakers
386505d0e0 Ports: Update README.md to show the right style for depends :^) 2023-08-16 00:38:18 +02:00
Tim Ledbetter
3782903642 Ports/brogue: Update formatting to be consistent with other ports 2023-08-16 00:29:55 +02:00
Tim Ledbetter
b5f34b3cda Ports/brogue: Update to version 1.12 2023-08-16 00:29:55 +02:00
Tim Ledbetter
66d52db044 Ports/brogue: Add launcher entry 2023-08-16 00:29:55 +02:00
Nicolas Ramz
0986533c11 Meta+Tests: Add a fuzzer and a test for the ILBM decoder 2023-08-15 18:36:11 +01:00
Nicolas Ramz
fda5590313 LibGfx/ILBM: Add an IFF-ILBM decoder :)
IFF was a generic container fileformat that was popular on the Amiga
since it was the only file format supported by Deluxe Paint.

ILBM is an image format popular in the late eighties/nineties
that uses the IFF container.

This is a very first version of the decoder that only supports
(byterun) compressed files with bpp <= 8.

Only the minimal chunks are decoded: CMAP, BODY, BMHD.

I am planning to add support for the following variants:

- EHB (32 colours + lighter 32 colours)
- HAM6 / HAM8 (special mode that allowed to display the whole Amiga
4096 colours / 262 144 colours palette)
- TrueColor (24bit)

Things that could be fun to do:

- Still images could be animated using color cycle information
2023-08-15 18:36:11 +01:00
Nicolas Ramz
66d6388b8a LibGfx/WebP: Move FourCC into ImageDecoder.h
It will be shared with upcoming ILBM decoder.
2023-08-15 18:36:11 +01:00
Andreas Kling
dea91afba7 LibWeb: Make HTMLElement.offset{Left,Top} work on inline elements
Before this change, we were returning (0, 0) for inline elements, due to
a bogus paintable type check in box_type_agnostic_position().
2023-08-15 16:37:11 +02:00
Andreas Kling
79db9c27c6 LibWeb: Rename PaintableBox::effective_offset() => offset()
Since this function no longer does any computation, just "offset" seems
like a fine name.
2023-08-15 16:37:11 +02:00
Andreas Kling
25a3d0d643 LibWeb: Resolve relative offsets *once* after layout
Instead of applying relative offsets (like position:relative insets)
during painting and hit testing, we now do a pass at the end of layout
and assign the final resolved offsets to paintables.

This makes painting and hit testing easier since they don't have to
think about relative offsets, and it also fixes a bug where offsets were
not applied to text fragments inside inline-flow elements that were
themselves position:relative.
2023-08-15 16:37:11 +02:00
Andreas Kling
481fdfee68 LibWeb: Resolve CSS inset properties when entering inline-flow elements
We don't actually apply the insets anywhere yet, but at least now they
are available in the node's layout state.
2023-08-15 16:37:11 +02:00
Andreas Kling
88949b10d8 LibWeb: Make containing_block_{width,height}_for(...) take non-box nodes
There's no reason for this API to require a Layout::Box as input.
Any node that can have layout state is welcome, so this patch makes it
take NodeWithStyleAndBoxModelMetrics.
2023-08-15 16:37:11 +02:00
thankyouverycool
57f3b18109 LibGUI+Userland: Remove Toolbar::try_add_{action,separator}()
These calls largely occur during initialization before there's
unsaved state worth preserving
2023-08-15 15:56:34 +02:00
Bastiaan van der Plaat
eafdb06d87 LibWeb: Add directory entries page when visiting a local directory 2023-08-15 10:41:54 +01:00
Bastiaan van der Plaat
e4c3a52cfa LibWeb: Add resource_directory_url for internal HTML pages
The error.html page now uses the resource_directory_url this
variable contains the relative path to /Base/res/ on the host
system as a file:// url. This is needed for future pages to load
resource files like icons. For the error.html page this was not
really needed because it lies over this own URL in FrameLoader.cpp.
2023-08-15 10:41:54 +01:00
Zaggy1024
af01cf70eb Base: Fix a typo in the futex() documentation 2023-08-14 22:16:11 -04:00
MacDue
4e49aee545 Tests/LibWeb: Add opacity-stacking.html test to manifest.json
(Also explicitly set the background color)
2023-08-14 23:52:53 +02:00
MacDue
9006c7aece LibWeb: Add ref test for opacity (stacking context) paint order
Now that we can test this, let's add a test, as mentioned in:
https://github.com/SerenityOS/serenity/pull/20559#issuecomment-1677126697

(I confirmed this test failed before #20559)
2023-08-14 22:42:25 +02:00
Hendiadyoin1
394529b7d0 AK: Fix formatting of negative whole fixed point numbers
Instead of `-2` we were printing `-2.1`

Co-Authored-By: Daniel Bertalan <dani@danielbertalan.dev>
2023-08-14 14:20:45 -06:00
Hendiadyoin1
daacc5c6c2 AK: Rename AK::FixedPoint::round to rint and fix a rounding error
`rint` is a more accurate name for the roudning mode as the fixme above
stated
2023-08-14 14:20:45 -06:00
Hendiadyoin1
05c959e40b AK: Change standard casting method of FixedPoint to truncation
This matches what floats do.

Also fix typo `trunk`->`trunc`
2023-08-14 14:20:45 -06:00
Hendiadyoin1
8526791617 AK: Use wider type for FixedPoint division
This allows us to shift first and then divide, preserving more precision
2023-08-14 14:20:45 -06:00
Hendiadyoin1
e609ac74a3 AK: Fix FixedPoint multiplication rounding and overflow behaviour
We now preform the multiplication in a widened type which makes it
overflow-safe and use the correct bit for rounding direction detection.
2023-08-14 14:20:45 -06:00