Commit Graph

30186 Commits

Author SHA1 Message Date
Andreas Kling
750f1d580a Fuzzers: Use ImageDecoderPlugin::frame() in image decoder fuzzers
Let's work towards getting rid of the first-frame-only bitmap() API.
2021-11-18 21:11:30 +01:00
Andreas Kling
578a576a98 Kernel: Make VirtualRangeAllocator setup functions propagate errors
If an internal allocation failure occurs while setting up a new VRA,
we'll now propagate the error to our caller instead of panicking.
2021-11-18 21:11:30 +01:00
Andreas Kling
0f22ba5bf2 AK: Make RedBlackTree::try_insert() return ErrorOr<void> instead of bool 2021-11-18 21:11:30 +01:00
Andreas Kling
b285323d91 Kernel: Propagate Vector append failures from Inode::apply_flock() 2021-11-18 21:11:30 +01:00
Sam Atkins
d106f20a73 LibWeb: Delete CSSLoader
All CSS loading is now done by the relevant classes:
- CSSImportRule, which loads its linked stylesheet
- HTMLStyleElement, which "loads" its contents
- HTMLLinkElement, which loads its linked stylesheet
2021-11-18 21:11:19 +01:00
Sam Atkins
60867703c0 LibWeb: Make HTMLLinkElement responsible for its own loading
This is the last use of CSSLoader, which can now be deleted.
2021-11-18 21:11:19 +01:00
Sam Atkins
6fc1810190 LibWeb: Remove for_first_not_loaded_import_rule() :^)
This was only used for making sure `@import` rules got loaded, and since
they handle that themselves now, we can get rid of all this code!
2021-11-18 21:11:19 +01:00
Sam Atkins
9d72815deb LibWeb: Remove redundant @import-handling code from CSSLoader
Now that `@import` rules load themselves, we don't want to also load
them here.
2021-11-18 21:11:19 +01:00
Sam Atkins
738e682ae0 LibWeb: Make @import rules functional again :^)
The changes in commit d462a6720a meant
that `CSSLoader::load_next_import_if_needed()` was no longer being
called, so no `@import` rules were loading.

The spec does not seem to mention when that loading should take place,
but WebKit does this at parse time, as each rule is added to the style
sheet. If it works for them, it's probably not that bad. :^)

So, that's what we now do here. The `CSSImportRule` creates a fetch
request when it is constructed, so each one is responsible for its own
contents.
2021-11-18 21:11:19 +01:00
Jelle Raaijmakers
ce6fd38e5d Ports: Remove ScummVM's SVG patch
No longer necessary now that we have a better `acosf` implementation.
2021-11-18 21:10:30 +01:00
Jelle Raaijmakers
dfbdd035da AK: Implement acos<T> correctly
This is a naive implementation based on the symmetry with `asin`.

Before, I'm not really sure what we were doing, but it was returning
wildly incorrect results.
2021-11-18 21:10:30 +01:00
Lady Gegga
9ea5a00e24 Base: Add Shavian characters to font Katica Regular 10
10450–1047F https://unicode.org/charts/PDF/U10450.pdf
2021-11-18 13:25:21 +01:00
Ali Mohammad Pur
387df06385 LibRegex: Avoid rewriting a+ as a* as part of atomic rewriting
The initial `ForkStay` is only needed if the looping block has a
following block, if there's no following block or the following block
does not attempt to match anything, we should not insert the ForkStay,
otherwise we would be rewriting `a+` as `a*` by allowing the 'end' to be
executed.
Fixes #10952.
2021-11-18 09:09:22 +01:00
faxe1008
f10036b7c5 LibConfig: Add list methods for groups and keys
Use the methods exposed by ConfigServer to list groups and keys.
2021-11-18 09:08:51 +01:00
faxe1008
116d89eec6 ConfigServer: Add methods to list groups and keys
Applications that make use of LibConfig anyway have now a way of listing
the groups and keys without resorting to using Core::ConfigFile
directly.
2021-11-18 09:08:51 +01:00
Lady Gegga
2266b4acdb Base: Add Deseret characters to font Katica Regular 10
10400-1044F https://www.unicode.org/charts/PDF/U10400.pdf
Adjust 1750
2021-11-18 09:08:18 +01:00
Linus Groh
eaa3329573 LibJS: Fix incorrect use of "modulo" in get_iso_parts_from_epoch()
This would return incorrect results for negative inputs. It still does
to some extent, remainder() in step 2 might need to be replaced with
modulo (I opened an issue in tc39/proposal-temporal about that).
2021-11-17 22:31:28 +00:00
Linus Groh
ec1e1f4f12 LibJS: Disallow Temporal.Duration input values to be non-integers
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/8c85450
2021-11-17 22:20:59 +00:00
Sam Atkins
92708746c8 LibWeb: Implement background-repeat: round :^) 2021-11-17 22:20:01 +01:00
Sam Atkins
493435c655 LibWeb: Implement background-repeat: space 2021-11-17 22:20:01 +01:00
Sam Atkins
3d1ee5b2de LibWeb: Implement background-size :^)
This is including the `cover` and `contain` modes.
2021-11-17 22:20:01 +01:00
Sam Atkins
80642b4f9d LibWeb: Implement background-position and background-origin :^) 2021-11-17 22:20:01 +01:00
Sam Atkins
16d9ae0f88 LibWeb: Stop consuming too many tokens when parsing background-position
This was causing inputs like `0% 0%` to think only one value was
provided.
2021-11-17 22:20:01 +01:00
Sam Atkins
7089681f68 LibWeb: Manually tile background images
This reimplements image tiling instead of using `Painter::blit_tiled()`,
so that we will be able to handle CSS's more complicated repetition
rules. (Like `background-repeat: space`) Otherwise this does the same as
before. :^)
2021-11-17 22:20:01 +01:00
Sam Atkins
6234e3fcb3 LibWeb: Implement background-clip :^)
We now pass in the Layout Node so that we can read the BoxModelMetrics.
Renamed a couple of variables too for clarity.
2021-11-17 22:20:01 +01:00
Sam Atkins
aa43bee0d1 LibWeb: Store all background properties in BackgroundLayerData
All of this is now passed along to `paint_background()`. :^)

(As always, "all" excludes the background-color since that's not a layer
property.)
2021-11-17 22:20:01 +01:00
Sam Atkins
3d127472ba LibWeb: Remove background_image from NodeWithStyle
We now entirely use the background-layers to check images.
2021-11-17 22:20:01 +01:00
Sam Atkins
a214036509 LibWeb: Remove background-repeat/image fields and getters
These aren't needed now that we render using background_layers instead.
The one casualty is the resolved style for background-repeat, but that
was incorrect anyway.
2021-11-17 22:20:01 +01:00
Sam Atkins
e8b7946732 LibWeb: Paint backgrounds with multiple layers :^) 2021-11-17 22:20:01 +01:00
Sam Atkins
cdeac132dc LibWeb: Store background layers in ComputedValues
Instead of storing these as individual `background-foo` properties, we
combine them together into layers, since that is how they will be
painted. It also makes it more convenient to pass them around.
2021-11-17 22:20:01 +01:00
Sam Atkins
64d805a027 LibWeb: Stop 'no-repeat' from expanding the background area
Previously, a `background-repeat` value of `no-repeat` in a direction
would cause the image to be drawn at exactly that size. This was fine if
the image was smaller than the element, but if it was larger, it would
draw outside its bounds. Now, it behaves itself. :^)
2021-11-17 22:20:01 +01:00
Sam Atkins
ecf1b7f977 LibWeb: Handle multiple backgrounds in StyleComputer
This actually involves doing *less*, because we now just pass the
StyleValueLists through instead of needing to grab their first layer's
value. :^)
2021-11-17 22:20:01 +01:00
Sam Atkins
c052457498 LibWeb: Bring BackgroundStyleValue::to_string() to spec
This now outputs valid CSS representing the background, instead of
confusing debug info.

We can't guarantee that all the longhands have the same number of
values, since while that's always the case when parsing, we also create
BackgroundStyleValues when producing the resolved style, which just
combines the longhands together.
2021-11-17 22:20:01 +01:00
Sam Atkins
72d080b4ba LibWeb: Parse multiple backgrounds :^)
Like the `background-foo` longhand properties (except
`background-color`), `background` allows multiple layers to be defined,
separated by commas. A layer does not necessarily contain something to
actually draw!

This parses as a `BackgroundStyleValue`, holding a `StyleValueList` for
each property. This is mostly to make expansion into longhands simpler -
if we had a list of `BackgroundStyleValue`s instead, one per layer, then
we would have to break it up per-property anyway when computing styles.
2021-11-17 22:20:01 +01:00
Sam Atkins
8fd4678e79 LibWeb: Parse comma-separated lists for most background properties
We now can parse lists of values for these properties:
- `background-attachment`
- `background-clip`
- `background-image`
- `background-origin`
- `background-position`
- `background-repeat`
- `background-size`

This uses two new Parser methods:
`parse_simple_comma_separated_value_list()` for the simple case when
each value is parsed from a single token; and
`parse_comma_separated_value_list()` which takes a lambda for when
parsing each value is more involved.

This also means that any unconsumed tokens at the end will make the
parsing fail as it should, where previously we just ignored them.
2021-11-17 22:20:01 +01:00
Sam Atkins
50b15bdc1d LibWeb: Prevent copying CSS TokenStream
This was leading to confusing bugs where I was accidentally passing it
by value and then wondering why tokens weren't getting consumed!
2021-11-17 22:20:01 +01:00
Sam Atkins
0da014befd LibWeb: Remove CSS Parser method overloads with no TokenStream parameter
These are just clutter. Only one was ever used, in one place, and is
easily replaced by just passing `m_token_stream` to it.
2021-11-17 22:20:01 +01:00
Sam Atkins
7936f79825 LibWeb: Remove ParsingContext parameter from private CSS Parser methods
This was only needed when they were all static.
2021-11-17 22:20:01 +01:00
Sam Atkins
e7d0544500 LibWeb: Make CSS Parser methods non-static
Past me thought making as much static as possible was a good idea, but
it just makes things more verbose, and awkward if anything isn't also
static.
2021-11-17 22:20:01 +01:00
Sam Atkins
cf89f86dbd Base: Add additional test cases to backgrounds.html
- Add background color to `background-clip` test
- Add a mixed `background-repeat: space round` test
2021-11-17 22:20:01 +01:00
Sam Atkins
05682f8c66 LibWeb: Add NodeWithStyleAndBoxModelMetrics to Forward.h 2021-11-17 22:20:01 +01:00
Andreas Kling
1f894cee59 Kernel: Automatically sync shared file mappings when unmapped
To make sure we don't lose changes, shared file mappings will now be
fully synced when they are unmapped, whether explicitly or implicitly
(by the program exiting/crashing/etc.)

This can incur a lot of work, since we don't keep track of dirty pages,
but that's something we can optimize down the road. :^)
2021-11-17 19:35:53 +01:00
Andreas Kling
af6358e1e1 Kernel: Allow mmap() with PROT_WRITE+MAP_SHARED
Now that we have a way to flush changes back to disk, let's allow this
type of mapping.
2021-11-17 19:35:13 +01:00
Andreas Kling
32aa37d5dc Kernel+LibC: Add msync() system call
This allows userspace to trigger a full (FIXME) flush of a shared file
mapping to disk. We iterate over all the mapped pages in the VMObject
and write them out to the underlying inode, one by one. This is rather
naive, and there's lots of room for improvement.

Note that shared file mappings are currently not possible since mmap()
returns ENOTSUP for PROT_WRITE+MAP_SHARED. That restriction will be
removed in a subsequent commit. :^)
2021-11-17 19:34:15 +01:00
Andreas Kling
f2d5548d7a Kernel: Add MemoryManager::copy_physical_page()
This is a handy helper that copies out the full contents of a physical
page into a caller-provided buffer. It uses quickmapping internally
(and takes the MM lock for the duration.)
2021-11-17 19:32:07 +01:00
Lady Gegga
c4a78633b0 Base: Add Buhid characters to font Katica Regular 10
1740–175F https://www.unicode.org/charts/PDF/U1740.pdf
2021-11-17 15:55:55 +01:00
davidot
22e679d844 LibJS + js: Rethrow exception on the vm after bytecode interpreter run
When the bytecode interpreter was converted to ThrowCompletionOr<Value>
it then also cleared the vm.exception() making it seem like no exception
was thrown.
Also removed the TRY_OR_DISCARD as that would skip the error handling
parts.
2021-11-17 13:12:05 +00:00
Luke Wilde
3666d2132b LibJS: Remove fallback value for get_offset_nanoseconds_for
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/664f02d

Note that the tests are not comprehensive.
2021-11-17 11:30:13 +00:00
Linus Groh
f1784c9c87 LibJS/Tests: Fix failing Array.prototype.toLocaleString() test 2021-11-17 10:00:20 +00:00
Timothy Flynn
39ab1a8999 LibJS: Implement ECMA-402 Array.prototype.toLocaleString
Turns out the only difference between our existing implementation and
the ECMA-402 implementation is we weren't passing the locales and
options list to each element.toLocaleString invocation.

This also adds spec comments to the definition.
2021-11-17 09:01:32 +00:00