Commit Graph

14610 Commits

Author SHA1 Message Date
Linus Groh
7f5b4842f2 LibJS: Replace dead code in ParseTimeZoneOffsetString with an assertion
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/a29c40b
2022-03-10 23:20:39 +01:00
Linus Groh
55f9733316 LibJS: Add missing check in ParseTemporalInstant
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/baead4d
2022-03-10 23:20:39 +01:00
Linus Groh
f75052ff7c LibJS: Assert CreateTemporalDuration does not throw given correct input
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/881dd22
2022-03-10 23:20:39 +01:00
Linus Groh
d2c2a9bcbf LibJS: Assert CreateTemporalDuration does not throw in Record cases
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/43e954c
2022-03-10 23:20:39 +01:00
Linus Groh
4553512321 LibJS: Assert CreateTemporalDuration does not throw in trivial cases
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/685e20e
2022-03-10 23:20:39 +01:00
Linus Groh
54af3a5396 LibJS: Adjust grammar for DateExtendedYear to exclude -000000
This is an editorial change in the Temporal spec.

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

We lose the custom error message, but it's not the end of the world.
2022-03-10 23:20:39 +01:00
Linus Groh
68af8649fb LibJS: Follow rules for consuming completion records
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/1c19b96
2022-03-10 23:20:39 +01:00
Linus Groh
2bae040bc9 LibJS: Remove Sign abstract operation
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/bbc1ebc
2022-03-10 23:20:39 +01:00
Linus Groh
0d06f3655f LibJS: Move string-parsing code into ToTemporalDurationRecord
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/a68b97b
2022-03-10 23:20:39 +01:00
Linus Groh
87fb005a8d LibJS: Move IsValidDuration check into ToTemporalDurationRecord
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/00958d0
2022-03-10 23:20:39 +01:00
Linus Groh
34371b9b61 LibJS: Fix numeric type confusion in ToTemporalRoundingIncrement
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/6e59366
2022-03-10 23:20:39 +01:00
Linus Groh
4ceff91893 LibJS: Use different variable name in DifferenceISODateTime
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/c32cc4d
2022-03-10 23:20:39 +01:00
Linus Groh
a009e834dc LibJS: Add clarifying assertion to BalanceDurationRelative
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/9a3477a
2022-03-10 23:20:39 +01:00
Linus Groh
17da627b4c LibJS: Fix "set it to" language to be more explicit
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/de58241
2022-03-10 23:20:39 +01:00
Linus Groh
4722045e28 LibJS: Do not expose mathematical values to script in Duration methods
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/26a4c4f

No behavioral change as we already did this correctly, but I changed
some implicit JS::Value creations to explicit ones.
2022-03-10 23:20:39 +01:00
Linus Groh
a496868ee5 LibJS: Create Duration Records with their own abstract operations
This is an editorial change in the Temporal spec.

See:
- https://github.com/tc39/proposal-temporal/commit/387c405
- https://github.com/tc39/proposal-temporal/commit/b203e26
- https://github.com/tc39/proposal-temporal/commit/387c405
2022-03-10 23:20:39 +01:00
Linus Groh
64e43c89bc LibJS: Remove assertions that are now part of structured headers
This is an editorial change in the Temporal spec.

See:
- https://github.com/tc39/proposal-temporal/commit/7fbdd28
- https://github.com/tc39/proposal-temporal/commit/f666243
- https://github.com/tc39/proposal-temporal/commit/8c7d066
- https://github.com/tc39/proposal-temporal/commit/307d108
- https://github.com/tc39/proposal-temporal/commit/d9ca402

In practical terms this means we can now get rid of a couple of awkward
assertion steps that were no-ops anyway, since the types are enforced
by the compiler.
2022-03-10 23:20:39 +01:00
Linus Groh
97bd4cebab LibJS: Refactor return value of RoundDuration
This is an editorial change in the Temporal spec.

See:
- https://github.com/tc39/proposal-temporal/commit/3641adf
- https://github.com/tc39/proposal-temporal/commit/8ea590c
2022-03-10 23:20:39 +01:00
Linus Groh
bdb13a74b0 LibJS: Describe various kinds of "Duration Records"
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/983902e

We already had these defined as structs, but now they're properly
defined in the spec (opposed to the previous anonymous records), and we
don't have to make up our own names anymore :^)

Note that while we're usually not including 'record' in the name, in
this case the 'Duration Record' has a name clash with the Duration
object. Additionally, later editorial changes introduce CreateFooRecord
AOs, so let's just go with FooRecord structs here.
2022-03-10 23:20:39 +01:00
Jelle Raaijmakers
2ac415f728 LibGL: Keep track of active matrix and stack
This simplifies a lot of code in `GLContext` and prevents potential
errors when testing against the current matrix mode.
2022-03-10 20:20:05 +01:00
Jelle Raaijmakers
5d0a64bfde LibGL: Only normalize in glRotate* if possible
Vectors of length 0 cannot be normalized, so prevent dividing by zero
in the `glRotate*` API. This fixes the skybox rendering of Quake2.
2022-03-10 20:20:05 +01:00
Sam Atkins
cc874f2b82 LibTest: Port JavaScriptTestRunner to Core::Stream 2022-03-10 12:04:22 -05:00
Sam Atkins
10429e1043 WebContent: Return empty JSON object if element has no box model
The blank string "" does not parse as JSON, and so the InspectorWidget
would fail to update the box-model information when inspecting elements
with no box, (for example, `<head>`) showing stale values instead. Now,
they show all 0s.

You could argue that InspectorWidget should be more resilient when given
invalid JSON strings, but making sure we only pass valid ones works
too.
2022-03-10 17:30:09 +01:00
Sam Atkins
b5ea14b884 WebContent: Show box-model metrics for (some) pseudo-elements
This only applies to pseudo-elements which have a Layout::Box, so this
excludes any that are InlineNodes.
2022-03-10 17:30:09 +01:00
Sam Atkins
0326ad34df Browser+LibWeb+WebContent: Show style for pseudo-elements :^)
This expands the InspectorWidget::Selection to include an optional
PseudoElement, which is then passed over IPC to request style
information for it.

As noted, this has some pretty big limitations because pseudo-elements
don't have DOM nodes:
- Declared style has to be recalculated when it's requested.
- We don't display the computed style.
- We don't display custom properties.
2022-03-10 17:30:09 +01:00
Sam Atkins
2c970b9516 Browser: Replace inspector's dom_node_id with a Selection struct 2022-03-10 17:30:09 +01:00
Sam Atkins
6de2b62906 LibWeb: Display pseudo-elements in the DOM inspector
This patch only makes them appear in the tree - they are not yet
inspectable themselves.
2022-03-10 17:30:09 +01:00
Sam Atkins
1c18bb13a2 LibWeb: Move pseudo-element-from-string code into Selector 2022-03-10 17:30:09 +01:00
Sam Atkins
adc08d0646 LibWeb: Move pseudo-class/element names into the header
These are constexpr, meaning that while the implementations were in the
cpp file, nobody outside that file could actually call them.
2022-03-10 17:30:09 +01:00
Paul Wratt
83eb5ac8fd LibWeb: Add window.sessionStorage 2022-03-10 10:02:51 +01:00
Luke Wilde
1535fe0324 LibWebSocket: Add to the total read in bytes instead of subtracting
read_length in WebSocket::read_frame is used to track how many bytes we
have read in from the network. However, we was subtracting the number
of read in bytes instead of adding, underflowing it to about the 64-bit
unsigned integer limit.

This effectively limited us to only doing one read from the network.
This was only an issue if the server stalled when sending data,
which is especially common for large payloads. This would also cause us
to go out of sync. This meant when a new frame came in, we would read
the payload data of the previous frame as if it was the frame header
and payload of the next frame.

This allows us to read in the initial payload from Discord Gateway
that describes to the client the servers we are in, the emotes the
server has, the channels it has, etc. For an account that's only in
the Serenity Discord, this was about 20 KB (compressed!)
2022-03-10 01:15:00 +01:00
Ben Abraham
7594350376 Browser: Show currently loading host and remaining resource count 2022-03-10 00:51:05 +01:00
Linus Groh
fb6c8781a2 LibJS: Update RoundDuration after DRY refactor in spec
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/4ef2748

Apparently I missed this in December! :^)
2022-03-10 00:42:49 +01:00
Sam Atkins
56a36da44e LibWeb: Only try parsing valid types of media-feature values
This resolves the ambiguity between whether a single number is a number
or a ratio. :^)

Also removed the "no more tokens" checks from
deea129b8c - that logic was completely
wrong, since there are always tokens after a value in the `(123 < foo <
456)` syntax.
2022-03-09 23:06:30 +01:00
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
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
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
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