Commit graph

51414 commits

Author SHA1 Message Date
Sam Atkins
9c05b83540 AK: Use consume_until in SourceGenerator
This got fixed a while ago to not consume the stop character, so we can
remove the workaround.
2023-06-17 17:48:06 +01:00
Sam Atkins
c8eafd3700 AK: Remove SourceGenerator::as_string()
Turns out nobody uses this!
2023-06-17 17:48:06 +01:00
Andreas Kling
eee4b6eca7 LibJS/Bytecode: Let var without initializer codegen to nothing
Otherwise we incorrectly overwrite the binding with `undefined` at the
point where the `var` statement is.

Fixes 9 test262 tests. :^)
2023-06-17 15:37:33 +02:00
Andreas Kling
743943a042 LibJS/Bytecode: Reorder function compilation to ensure correct hoisting
Fixes 37 test262 tests. :^)

Co-authored-by: Luke Wilde <lukew@serenityos.org>
2023-06-17 15:37:33 +02:00
Andreas Kling
9c568282dc Ladybird+LibJS: Add CLI option to run browser with LibJS bytecode VM
This required quite a bit of plumbing, but now you can run

    ladybird --use-bytecode
2023-06-17 14:16:45 +02:00
Luke Wilde
7ec7015750 LibWeb: Create an audio document for audio/ MIME types on navigation 2023-06-17 14:16:26 +02:00
stelar7
d6db924d47 LibWeb: Implement CSS rem() 2023-06-17 12:13:28 +01:00
stelar7
dc042662d1 LibWeb: Implement CSS mod() 2023-06-17 12:13:28 +01:00
stelar7
b2230c826b LibWeb: Implement CSS round() 2023-06-17 12:13:28 +01:00
djwisdom
ec0054da06 Ports: Update serenity-theming use latest commit 43c42c9 2023-06-17 06:27:56 -04:00
Luke Wilde
26f8a441f5 LibWeb: Add audio mime types to HTMLMediaElement.canPlayType
Now that we support audio, we can start correctly reporting we support
certain audio mime types!

Required by certain sites like Gartic Phone, which fails to load audio
because we didn't return a non-empty string for `audio/mpeg`:
```
"https://garticphone.com/sounds/turnundefined", Error: Load failed: 404
```

```js
(new Audio).canPlayType("audio/mpeg") && (this._extension = ".mp3"),
```
2023-06-17 06:26:56 -04:00
Andreas Kling
d89e0b36d4 LibJS/Bytecode: Support class field initializers
Fixes 513 test262 tests. :^)
2023-06-17 11:00:39 +02:00
Andreas Kling
82828ad936 LibJS/Bytecode: Extract accumulator value before incurring side effects
Many operations in JavaScript may incur side effects, including calling
arbitrary user code. Since the user code will clobber the accumulator,
we have to take care to extract anything we need from the accumulator
before doing anything that may have side effects.

Fixes 3 test262 tests. :^)
2023-06-17 11:00:39 +02:00
tgsm
c30775522e LibCompress/Gzip: Replace usage of DeprecatedString 2023-06-17 06:44:16 +02:00
Simon Wanner
7990f1b85a LibXML: Fix parser not leaving self-closing tags 2023-06-17 06:39:21 +02:00
MacDue
4f2770a745 LibWeb: Apply canvas transform while building paths
The transform can change between path building operations (and before
the path is filled or stroked). This fixes the sun ray backgroun on
the https://www.kevs3d.co.uk/dev/html5logo/ canvas demo.
2023-06-17 06:38:32 +02:00
MacDue
9e57f8d183 LibGfx: Invalidate path bounding boxes when invalidating split lines
If the lines are no longer valid then the bounding box (which is derived
from the lines) is also invalid.
2023-06-17 06:38:32 +02:00
stelar7
4436ab0cb1 LibWeb: Handle calculated vertical-align 2023-06-17 06:33:52 +02:00
kamp
c476ff10a5 LibWeb/CSS: Update Default.css from the HTML specification 2023-06-17 06:31:28 +02:00
Andreas Kling
61148bce5f LibJS/Bytecode: Use the correct this value in GetById
The fix for this was to port the "don't create unnecessary FooObject
for property access on primitives" optimization from Reference,
which also brings us the correct behavior.
2023-06-16 21:46:43 +02:00
Andreas Kling
dbfe1311ef LibJS/Bytecode: Simplify creating/leaving lexical environment
Since we no longer need to create or leave var environments directly
in bytecode, we can streamline the two instructions by making them
always operate on the lexical environment.
2023-06-16 21:46:43 +02:00
Andreas Kling
12ce0789da LibJS/Bytecode: Remove BlockBoundaryType::LeaveVariableEnvironment
We never need to manually exit a var environment from bytecode anymore.
2023-06-16 21:46:43 +02:00
Andreas Kling
ac246d764d LibJS/Bytecode: Leave BlockDeclarationInstantiation in C++
Instead of implementing this AO in bytecode, we now have an instruction
for it that simply invokes the C++ implementation.

This allows us to simplify Bytecode::Generator quite a bit by removing
all the variable scope tracking.
2023-06-16 21:46:43 +02:00
Andreas Kling
4684d3fe54 LibJS: Make BlockDeclarationInstantiation take a VM&
There's no need for this to require an AST Interpreter.
2023-06-16 21:46:43 +02:00
Timothy Flynn
9e95c9892c Ladybird+LibWeb+WebContent: Add context menu controls for muting audio 2023-06-16 19:34:42 +02:00
Timothy Flynn
b3bbdb1e2c Ladybird: Add a context menu for audio elements 2023-06-16 19:34:42 +02:00
Timothy Flynn
14ca04de25 Ladybird+LibWeb+WebContent: Generalize video context menus for all media
The data we want to send out of the WebContent process is identical for
audio and video elements. Rather than just duplicating all of this for
audio, generalize the names used for this IPC for all media elements.

This also encapsulates that data into a struct. This makes adding new
fields to be sent much easier (such as an upcoming field for muting the
element).
2023-06-16 19:34:42 +02:00
Timothy Flynn
e81abbde7b LibWeb: Explicitly set the audio element playback position after seeking
The audio element behaves a bit differently than the video element in
that the audio element drives itself on a timer (as opposed to LibVideo
notifying the video element when a frame is available). So if an audio
element is paused while seeking, we wouldn't receive an updated playback
position until the element is unpaused.

This fixes an issue where you would have to click the play button twice
to re-start an audio track after it reached the end.
2023-06-16 19:34:42 +02:00
Andreas Kling
58478d572f headless-browser: Bump test timeout from 5s to 15s
We're seeing occasional timeouts on the very first test when running
on CI. Let's try giving it more time to see if it goes away. :^)
2023-06-16 17:43:14 +02:00
Andi Gallo
52956d355c LibWeb: Make border-collapse actually inherited
Move it to the inherited section of ComputedValues.
2023-06-16 17:21:15 +02:00
stelar7
5727e276ea LibWeb: Implement CSS exp() 2023-06-16 14:58:47 +01:00
stelar7
6dde49404a LibWeb: Implement CSS log() 2023-06-16 14:58:47 +01:00
stelar7
fa37bb8b76 LibWeb: Implement CSS hypot() 2023-06-16 14:58:47 +01:00
stelar7
0d30fb5a6e LibWeb: Implement CSS sqrt() 2023-06-16 14:58:47 +01:00
stelar7
9aed8ec7f0 LibWeb: Implement CSS pow() 2023-06-16 14:58:47 +01:00
Sam Atkins
8ef25989b6 LibWeb: Parse identifiers last in parse_paint_value()
Previously, using an identifier color like `currentColor` would fail to
parse, since we look at ident tokens (and reject unrecognised ones)
before trying to parse colors.
2023-06-16 15:39:32 +02:00
Andreas Kling
a988241f3f LibWeb: Resolve % min-sizes against 0 while under min-content constraint
When resolving a percentage min-width or min-height size against a
containing block currently under a min-content constraint, we should act
as if the containing block has zero size in that axis.
2023-06-16 14:39:03 +02:00
Andreas Kling
1578121dcb Tests/LibWeb: Fix typo in test
"display: max-content" is not a thing. The test was actually not working
correctly, it just looked like it did. Now it has correct metrics for
the body element.
2023-06-16 14:39:03 +02:00
Andi Gallo
b69036970b LibWeb: Add layout support for border spacing
When border-collapse is separate, border-spacing affects layout.
Implement most of that functionality.
2023-06-16 13:57:31 +02:00
Andi Gallo
396f1a977c LibWeb: Add CSS support for border-spacing property 2023-06-16 13:57:31 +02:00
Timothy Flynn
f662a452c9 LibWeb: Draw a volume scrub bar on media elements to control volume 2023-06-16 13:50:15 +02:00
Timothy Flynn
a4cb3b5d4d LibWeb: Draw a speaker on media elements to toggle muting audio 2023-06-16 13:50:15 +02:00
Timothy Flynn
1107cb58c0 LibWeb: Compute some media timeline rects/sizes before painting anything
The idea here is to let us decide ahead of time what components to paint
depending on the size available. We currently paint each component left-
to-right, until we run out of room. This implicitly gives priority to
the left-most components.

We will soon paint volume controls on the right-side of the timeline.
Subjectively, they should have a higher priority than, say, the timeline
scrubbing bar (i.e. it's more important to be able to mute audio than to
seek). By computing these components before painting, we can more easily
allocate sections to the components in priority order, until the area
remaining has been depleted.
2023-06-16 13:50:15 +02:00
Timothy Flynn
55b61724a0 LibWeb: Handle media elements being painted before their duration is set
It can take some time to download / decode a media resource. During this
time, its duration is set to NaN. The media control box would then have
some odd rendering glitches as it tried to treat NaN as an actual time.
Once we do have a duration, we also must ensure the media control box is
updated.
2023-06-16 13:50:15 +02:00
Timothy Flynn
8cb0197eeb LibWeb: Slightly decrease the font size used for media timestamps
The default scaled font is currently quite large on Ladybird. Decrease
it a bit to make more room for other elements.
2023-06-16 13:50:15 +02:00
Timothy Flynn
54e674974e LibWeb: Use the scaled font size when computing media timestamp width
We draw the text for the timestamp using the scaled font, so we must
also compute its width using the scaled font.
2023-06-16 13:50:15 +02:00
Timothy Flynn
b9e4dc2cb7 LibWeb: Implement the HTMLMediaElement volume and muted IDL attributes 2023-06-16 13:50:15 +02:00
Timothy Flynn
d3b8d88598 LibWeb: Expose volume controls through the platform audio plugin 2023-06-16 13:50:15 +02:00
Andreas Kling
d364d99cb8 LibJS/Bytecode: Perform ToNumeric on accumulator before postfix inc/dec
This ensures we get the expected behavior of code like:

    let a = []
    let b = a++

(Where b should be 0, not [], because JavaScript.)
2023-06-16 12:56:39 +02:00
Andreas Kling
c9bd324369 LibJS/Bytecode: Set "home object" of functions within object expression
We manage this by having a stack of home objects in Generator, and then
adding an optional home object parameter to the NewFunction instruction.
2023-06-16 12:56:39 +02:00