Commit Graph

35419 Commits

Author SHA1 Message Date
Sam Atkins
fd47460141 LibWeb: Use ValueID for media-query identifiers 2022-03-09 23:06:30 +01:00
Sam Atkins
0371d33132 LibWeb+Meta: Stop discrete media-features from parsing as ranges
Only "range" type media-features are allowed to appear in range syntax,
or have a `min-/max-` prefix.
2022-03-09 23:06:30 +01:00
Sam Atkins
a451810599 AK: Print a better error message when missing a SourceGenerator key
Previously, if you forgot to set a key on a SourceGenerator, you would
get this less-than-helpful error message:

> Generate_CSS_MediaFeatureID_cpp:
  /home/sam/serenity/Meta/Lagom/../../AK/Optional.h:174: T
  AK::Optional<T>::release_value() [with T = AK::String]: Assertion
  `m_has_value' failed.

Now, it instead looks like this:

> No key named `name:titlecase` set on SourceGenerator
  Generate_CSS_MediaFeatureID_cpp:
  /home/sam/serenity/Meta/Lagom/../../AK/SourceGenerator.h:44:
  AK::String AK::SourceGenerator::get(AK::StringView) const: Assertion
  `false' failed.
2022-03-09 23:06:30 +01:00
Sam Atkins
12561327d6 LibWeb: Use MediaFeatureIDs instead of Strings :^) 2022-03-09 23:06:30 +01:00
Sam Atkins
b7bb86462b Meta: Generate CSS::MediaFeatureID enum
This works largely the same as the PropertyID and ValueID generators,
but using LibMain, Core::Stream, and TRY().

Rather than have a MediaFeatureID::Invalid, I decided to return an
Optional. We'll see if that turns out better or not. :^)
2022-03-09 23:06:30 +01:00
Sam Atkins
e986331a4f Meta: Move title/camel_casify() functions into their own file
These were duplicated among the CSS generators.
2022-03-09 23:06:30 +01:00
Sam Atkins
f5fe75f12c LibWeb: Add MediaFeatures.json file, and associated identifiers
This data will be used to generate code for parsing media-queries. So
far, it includes all MEDIAQUERIES-4 features, and
`prefers-color-scheme` from MEDIAQUERIES-5 since we support that.
2022-03-09 23:06:30 +01:00
Stephan Unverwerth
096e44285a LibGL: Merge GLContext and SoftwareGLContext
This merges GLContext and SoftwareGLContext into a single GLContext
class. Since the hardware abstraction is handled via the GPU device
interface we do not need the virtual base of GLContext anymore. All
context handling functionality from the old GLContext has been moved
into the new version. All methods in GLContext are now non virtual and
the class is marked as final.
2022-03-09 22:51:01 +01:00
Linus Groh
2434d34644 LibJS/Tests: Add tests for '−000000' (U+2212) DateExtendedYear
I noticed we only have coverage for this with the ASCII minus sign in
our own test suite.
2022-03-09 22:08:15 +01:00
ForLoveOfCats
aabb1c85ed Base: Remove stray GML file that sneaked into Base/home/anon 2022-03-09 21:50:23 +01:00
Andreas Kling
a13079f757 LibWeb: Invalidate style after CSSStyleSheet.{insert,remove}Rule()
When rules are inserted or removed via the CSSOM API, we now invalidate
document style to ensure that any changes made are reflected.

1% progression on ACID3. :^)
2022-03-09 19:58:14 +01:00
Andreas Kling
0e758b4da8 LibWeb: Add the StyleSheet.href attribute
This is only ever null at the moment, as we only set it on <style>
elements to begin with.
2022-03-09 19:56:08 +01:00
Andreas Kling
45f717cfad LibWeb: Respect inline-axis margins between line box fragments :^)
This makes the buckets on ACID3 space out nicely.
2022-03-09 18:47:32 +01:00
davidot
bfedec6a98 LibJS: Keep PrivateEnvironment through NativeFunction calls
Previously the variable and lexical environments were already kept in a
NativeFunction call. However when we (try to) call a private method from
within an async function we go through async_block_start which sets up
a NativeFunction to call.
This is technically not exactly as the spec describes it, as that
requires you to actually "continue" the context. Since we don't have
that concept (yet) we use this as an implementation detail to access the
private environment from within a native function.

Note that this not allow general private environment access since most
things get blocked by the parser already.
2022-03-09 18:35:27 +01:00
Andreas Kling
1e53cc3f5b LibWeb: Establish parent/child relationship between BrowsingContexts
When an iframe is inserted or removed from a document, we now take it in
and out of the BrowsingContext tree.
2022-03-09 18:14:24 +01:00
Andreas Kling
6499cf4d28 LibWeb: Always relayout document on element style change
Let's get this right before trying to make it fast. This patch removes
the code that tried to do less work when an element's style changes,
and instead simply invalidates the entire document.

Note that invalidations are still coalesced, and will not be
synchronized until update_style() and/or update_layout() is used.
2022-03-09 18:14:24 +01:00
Andreas Kling
bca3c2a443 LibWeb: Always call update_style() in update_layout()
If the style is dirty, update_style() may cause layout to become dirty.
Therefore we must always update style when updating layout, to ensure
up-to-date results.
2022-03-09 18:14:24 +01:00
Andreas Kling
c988cbb8b1 LibWeb: Invalidate document style when a node is removed
This forces us to recompute style everywhere, since all kinds of
selectors may produce different results now.

In the future, we should look at narrowing down the invalidation that
occurs here, but for now let's just invalidate everything and make the
results correct before worrying about performance.
2022-03-09 18:14:24 +01:00
Andreas Kling
04311ca7f1 LibWeb: Flush pending layouts when accessing element resolved style
We were handing out stale values from window.getComputedStyle() objects
after the first layout.

Fix this by always updating layout on property access. This is not
necessary for all properties, but for now let's go with the simplest
approach to make it work correctly.
2022-03-09 18:14:24 +01:00
Andreas Kling
3259b17a6a LibWeb: Add StyleValue::equals() override for PositionStyleValue 2022-03-09 18:14:24 +01:00
Federico Guerinoni
43d5257619 LibWeb: Use reverse iterator for reverse loop into NonnullRefPtrVector 2022-03-09 17:16:28 +01:00
Federico Guerinoni
0aed2f0f86 AK: Add reverse iterator as member 2022-03-09 17:16:28 +01:00
Federico Guerinoni
f34fff852b AK: Implement wrapper for reverse range for loop
Now it is possible to use range for loop in reverse mode for a
container.
```
	for (auto item : in_reverse(vector))
```
2022-03-09 17:16:28 +01:00
Federico Guerinoni
a54e20d958 AK: Implement ReverseIterator for NonnullPtrVector 2022-03-09 17:16:28 +01:00
Federico Guerinoni
b0e74a3fd3 AK: Implement reverse iterator for Vector class 2022-03-09 17:16:28 +01:00
Federico Guerinoni
74650b4e32 AK: Add generic reverse iterator for containers 2022-03-09 17:16:28 +01:00
Tobias Christiansen
51be2283f5 PixelPaint: Support saving/loading masks to project file 2022-03-09 17:15:17 +01:00
Tobias Christiansen
0dd5f5672c PixelPaint: Rename typo'ed BMPWriter in serialize_as_json() 2022-03-09 17:15:17 +01:00
Tobias Christiansen
937785f6c1 PixelPaint: Fix saving project
Some json objects didn't get finished, so it crashed.
2022-03-09 17:15:17 +01:00
Andreas Kling
9c6999ecf2 LibWeb: Implement "NodeIterator pre-removing steps"
These steps run when a node is about to be removed from its parent,
and adjust the position of any live NodeIterators so that they don't
point at a now-removed node.

Note that while this commit implements what's in the DOM specification,
the specification doesn't fully match what other browsers do.

Spec bug: https://github.com/whatwg/dom/issues/907
2022-03-09 16:43:56 +01:00
Andreas Kling
acbdb95b0a LibWeb: Add support for DOM's TreeWalker
This patch adds TreeWalker (created via Document.createTreeWalker())
which allows you to traverse a filtered view of the DOM in all
directions.
2022-03-09 16:43:55 +01:00
Andreas Kling
fabcee016f LibWeb: Add basic support for DOM's NodeIterator and NodeFilter
This patch adds NodeIterator (created via Document.createNodeIterator())
which allows you to iterate through all the nodes in a subtree while
filtering with a provided NodeFilter callback along the way.

This first cut implements the full API, but does not yet handle nodes
being removed from the document while referenced by the iterator. That
will be done in a subsequent patch.
2022-03-09 16:43:00 +01:00
Andreas Kling
ba87f23f22 LibWeb: Allow returning JS::ThrowCompletionOr<T> from wrapped functions
In some cases, we need more nuance than what DOM::ExceptionOr<T> offers.
2022-03-09 16:43:00 +01:00
Andreas Kling
252ed8ad18 LibWeb: Fail resource loads on HTTP 4xx or 5xx error
This fixes an issue on ACID3 where failing image loads with body content
would still get displayed.
2022-03-09 16:43:00 +01:00
Andreas Kling
7b3642d08c Kernel: Mark sys$lseek() as not needing the big lock
This syscall doesn't access any data that was implicitly protected by
the big lock.
2022-03-09 16:43:00 +01:00
Andreas Kling
09e644f0ba Kernel: Mark sys$emuctl() as not needing the big lock
This syscall doesn't do anything at all, and definitely doesn't need the
big lock. :^)
2022-03-09 16:43:00 +01:00
Andreas Kling
b4fefedd1d Kernel: Mark sys$chmod() as not needing the big lock
This syscall doesn't access any data that was implicitly protected by
the big lock.
2022-03-09 16:43:00 +01:00
Andreas Kling
aa381c4a67 Kernel: Mark sys$fchmod() as not needing the big lock
This syscall doesn't access any data that was implicitly protected by
the big lock.
2022-03-09 16:43:00 +01:00
Andreas Kling
d074aae422 Kernel: Mark sys$dup2() as not needing the big lock
This syscall doesn't access any data that was implicitly protected by
the big lock.
2022-03-09 16:43:00 +01:00
Andreas Kling
8aad9e7448 Kernel: Mark sys$ftruncate() as not needing the big lock
This syscall doesn't access any data that was implicitly protected by
the big lock.
2022-03-09 16:43:00 +01:00
Andreas Kling
69a6a4d927 Kernel: Mark sys$fstatvfs() as not needing the big lock
This syscall doesn't access any data that was implicitly protected by
the big lock.
2022-03-09 16:43:00 +01:00
davidot
a61424a62b LibJS: Be more lenient when parsing milliseconds for Date
Other engines don't give NaN if there is at least one digit after the
dot for milliseconds. We were much stricter and required exactly three
digits.
But there is real world usage of different amounts of digits such as
discord having three extra trailing zeros.
2022-03-09 14:18:59 +01:00
Sahan Fernando
fd5eaf6494 Demos: Create demo for VirGL gpu device
This is a simple demo for VirGL, that does the bare minimum required to
create and render a spinning cube (with one color per face).
2022-03-09 14:58:48 +03:30
Sahan Fernando
2939f65753 SystemServer: Create device files for gpus on startup
We are adding a new class of file, a GPU device. These devices have
major number 28, and are bound to files named /dev/gpuN.
2022-03-09 14:58:48 +03:30
Sahan Fernando
a2887dc157 Kernel: Disable GPU fencing for VirtIOGPU operations
These fences should not be needed, since we force the use of
synchronous operations through synchronous_virtio_gpu_command. The use
of these fences also causes severe lag when SERENITY_GL is enabled.
2022-03-09 14:58:48 +03:30
Sahan Fernando
fd6a536c60 Kernel: Implement basic VirGL device
This commit flips VirtIOGPU back to using a Mutex for its operation
lock (instead of a spinlock). This is necessary for avoiding a few
system hangs when queuing actions on the driver from multiple
processes, which becomes much more of an issue when using VirGL from
multiple userspace process.

This does result in a few code paths where we inevitably have to grab
a mutex from inside a spinlock, the only way to fix both issues is to
move to issuing asynchronous virtio gpu commands.
2022-03-09 14:58:48 +03:30
Sahan Fernando
966989afe8 Kernel: Use AK::to_underlying instead of static_cast in VirtIOGPU 2022-03-09 14:58:48 +03:30
Sahan Fernando
0e57f80460 LibC: Add ioctls for VirGL 2022-03-09 14:58:48 +03:30
Sahan Fernando
04849c9561 Meta: Add SERENITY_GL environment variable to run.sh 2022-03-09 14:58:48 +03:30
Lady Gegga
407b67e72a Base: Add flags and RGI status to emoji.txt 2022-03-09 11:40:03 +01:00