Commit graph

27466 commits

Author SHA1 Message Date
Ali Mohammad Pur
913382734c AK: Allow RBTree::find_largest_not_above_iterator() to fail
Previously this function would've crashed if the key failed to match any
entry.
2021-09-13 14:38:53 +04:30
Ali Mohammad Pur
27e3589f61 AK+Kernel: Avoid unescaped control chars in append_escaped_for_json()
Otherwise it could produce invalid JSON.
2021-09-13 14:38:53 +04:30
Ali Mohammad Pur
e1e91f6c85 Kernel: Deduplicate signpost perf event strings 2021-09-13 14:38:53 +04:30
Ali Mohammad Pur
d600f0d5b3 Kernel: Specialize Traits<(Nonnull)OwnPtr<T>> for KString
To make it behave like a string, since KString is always stored as a
(Nonnull)OwnPtr in the kernel.
2021-09-13 14:38:53 +04:30
Ali Mohammad Pur
a21a3c2620 AK: Make traits for NonnullOwnPtr use ptr_hash instead of int_hash
Otherwise they'd be truncating the pointer in 64-bit builds.
2021-09-13 14:38:53 +04:30
Andreas Kling
7632cce5e5 LibWeb: Make requestAnimationFrame() work in multi-process mode
Since we don't have a direct connection to WindowServer, this is slighly
more naive implementation than what we were doing for single-process
mode.

Basically, there's a global RequestAnimationFrameDriver object that
has a 16ms single-shot timer. Whenever someone registers for a RAF
callback, we start the timer (if needed).

This is not ideal, but it's better than nothing. :^)
2021-09-13 02:03:06 +02:00
Idan Horowitz
f21041861b LibWeb: Add the URLSearchParams built-in
This is a very partial implementation, as some features (like 2 of the
possible constructor types, iteration and the getAll method) are
missing, and other's are not implemented due to the currently missing
URL built-in.
2021-09-13 01:43:10 +02:00
Idan Horowitz
de19dcf81a LibWeb: Add URL::url_decode for decoding form url encoded parameters 2021-09-13 01:43:10 +02:00
Idan Horowitz
4629f2e4ad LibWeb: Add the Web::URL namespace and move URLEncoder to it
This namespace will be used for all interfaces defined in the URL
specification, like URL and URLSearchParams.

This has the unfortunate side-effect of requiring us to use the fully
qualified AK::URL name whenever we want to refer to the AK class, so
this commit also fixes all such references.
2021-09-13 01:43:10 +02:00
Idan Horowitz
2b78e227f2 LibWeb: Add support for generating a stringifier method/attribute 2021-09-13 01:43:10 +02:00
Idan Horowitz
47e261c691 LibWeb: Escape reserved names of generated wrapper functions
This also adds 'delete' to the list of reserved cpp names.
2021-09-13 01:43:10 +02:00
Luke Wilde
e946316618 LibWeb: Implement MediaQueryList.{addListener,removeListener} 2021-09-13 01:43:03 +02:00
Linus Groh
4f362fc703 LibJS: Set OrdinaryFunctionObject's realm from the Tnterpreter
...instead of relying on the VM having a current execution context. This
was an incorrect assumption I made, and it caused onfoo attribute
handler construction in LibWeb to crash.
Just use the same mechanism as NativeFunction in the meantime.
2021-09-12 23:12:51 +01:00
Brian Gianforcaro
a46b0fc1ff LibCrypto: Fix MacOS build by replacing explicit_bzero with secure_zero 2021-09-13 00:02:42 +02:00
Brian Gianforcaro
b8cad2c9b9 LibCore: Switch to AK::secure_zero instead of platform specific APIs 2021-09-13 00:02:42 +02:00
Brian Gianforcaro
43f4292ca0 LibC: Implement explicit_bzero with AK::secure_zero 2021-09-13 00:02:42 +02:00
Brian Gianforcaro
ff1e5aa935 AK: Add secure_zero() implementation so it can be used on all platforms
Serenity has explicit_bzero() in LibC with the same implementation,
however we need to be able to use this from Lagom on all platforms
that we support building serenity on. I've implemented it in AK for
this reason.
2021-09-13 00:02:42 +02:00
Andreas Kling
f6ad7dfc0b LibWeb: Log classic script start, finish, and duration
When waiting for a page to load, it's nice to see which scripts run,
and how long they take to finish.
2021-09-12 23:39:17 +02:00
kleines Filmröllchen
3f067f8457 AudioServer: Fix deadlock when playing two audio streams
Previously, AudioServer would deadlock when trying to play another audio
stream, i.e. creating a queue. The m_pending_cond condition was used
improperly, and the condition wait now happens independently of querying
the pending queue for new clients if the mixer is running.

To make the mixer's concurrency-safety code more readable, the use of
raw POSIX mutex and condition syscalls is replaced with Threading::Mutex
and Threading::ConditionVariable.
2021-09-12 23:38:57 +02:00
kleines Filmröllchen
c7104e7512 LibThreading: Add ConditionVariable wrapper
ConditionVariable is a thin wrapper over the pthread_cond_* APIs, just
as Mutex is a wrapper over pthread_mutex.

Because ConditionVariable might want to wait on a high-level Mutex, it
needs to be friends with it.
2021-09-12 23:38:57 +02:00
kleines Filmröllchen
bd17da9f9e Audio: Add per-client volume
Note: While ClientAudioStream has had a volume property, it is only now
used in the mixer.
2021-09-12 23:38:57 +02:00
kleines Filmröllchen
5300c9e6b4 AudioServer: Rename BufferQueue to ClientAudioStream
Although the old name is more technically correct, it doesn't reflect
what the class is actually doing in the context of the audio server
logic.
2021-09-12 23:38:57 +02:00
kleines Filmröllchen
ab4a2b8b41 LibDSP+LibAudio: Use logarithmic scaling in delay effect
With logarithmic volume scaling, the delay effect can sound more
natural.
2021-09-12 23:38:57 +02:00
kleines Filmröllchen
152ec28da0 Audio: Change how volume works
Across the entire audio system, audio now works in 0-1 terms instead of
0-100 as before. Therefore, volume is now a double instead of an int.
The master volume of the AudioServer changes smoothly through a
FadingProperty, preventing clicks. Finally, volume computations are done
with logarithmic scaling, which is more natural for the human ear.

Note that this could be 4-5 different commits, but as they change each
other's code all the time, it makes no sense to split them up.
2021-09-12 23:38:57 +02:00
kleines Filmröllchen
2909c3a931 LibIPC: Add support for transferring doubles over IPC messages
I'm still wondering why nobody did this yet :^) Also changes the use of
unions for the more cleaner / less undefined AK::bit_cast.
2021-09-12 23:38:57 +02:00
Karol Kosek
6c5fb2ca63 HackStudio: Remove an old file from the vectors in 'Save as...' action
If you saved a file under a different name and then went back to
the first file, then you had the same TextDocument buffer, and therefore
the same changes to the file as in the new one.
2021-09-12 22:10:48 +02:00
Karol Kosek
d811ad921c HackStudio: Rename Project::get_file() to Project::create_file()
The function no longer looks for the already opened files, so let's
emphasize that by renaming it to `create_file`. :^)
2021-09-12 22:10:48 +02:00
Karol Kosek
4a1974b174 HackStudio: Remove storing a vector of opened files in Project class
It looks to me like this has the same purpose as m_open_files
in the HackStudioWidget, so removing it shouldn't change anything.
2021-09-12 22:10:48 +02:00
Sam Atkins
5bb6936a2a LibWeb: Tidy up CSS parser logging 2021-09-12 21:34:57 +02:00
Sam Atkins
8f6017bc4e LibWeb: Ignore CSS properties with vendor-prefixed values
For example, this CSS previously produced a lot of log spam about the
`display` properties having invalid values:
```css
.foo {
  display: -webkit-box;
  display: -moz-box;
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
}
```

Now, it just ignores them, because we don't need to know about it. :^)
2021-09-12 21:34:57 +02:00
Sam Atkins
00b84249d6 LibWeb: Rename CSS::Parser::SelectorParsingResult => ParsingResult
I'm going to use it for non-selector purposes too, so the name needed to
change.
2021-09-12 21:34:57 +02:00
Sam Atkins
6c27e2938a LibWeb: Ignore vendor-prefixed at-rules
I don't know if I have ever seen one, but they are mentioned in the
spec, so we might as well do this.
https://wiki.csswg.org/spec/vendor-prefixes#css-vendor-prefixes
2021-09-12 21:34:57 +02:00
Sam Atkins
13c67f9920 LibWeb: Ignore vendor-prefixed pseudo-element/classes in selectors
Our debug logging when we fail to parse a legitimate selector, is less
useful when it's hidden among selectors that don't parse because they
contain vendor-prefixed pseudo-elements and classes. So, now we
specifically ignore these and don't produce a log message.
2021-09-12 21:34:57 +02:00
Sam Atkins
83cd2eef8f LibWeb: Return SelectorParsingResult from all selector parsing functions
This will allow us to know why a selector failed to parse, in situations
where that matters. (Like, when a selector includes vendor prefixes...)
2021-09-12 21:34:57 +02:00
Sam Atkins
e30b702c6c LibWeb: Reduce CSS_PARSER_DEBUG spam
Having every single function emit a debug message was useful at the
time, but now makes it impossible to spot important things.
2021-09-12 21:34:57 +02:00
Sam Atkins
7817c681d0 LibWeb: Ignore CSS properties with other people's vendor prefixes
This removes some `Property '-webkit-foo' has no value.` log spam. :^)
2021-09-12 21:34:57 +02:00
Itamar
de31603028 LibGUI: Remove Indices with dangling FileSystemModel::Node on deletion
When a file deletion event happens, we now iterate over all views of the
FileSystemModel and remove any selection & cursor indices that hold
dangling references do the deleted filesystem node.

This fixes #9602.
2021-09-12 21:33:39 +02:00
Andreas Kling
a2f5589d3a LibWeb: Implement CSSStyleDeclaration.getPropertyValue(property) 2021-09-12 20:44:50 +02:00
Andreas Kling
a72fd78713 LibWeb: Log a FIXME when unimplemented computed style is requested
This will help us know which properties to compute next. :^)
2021-09-12 20:44:50 +02:00
Andreas Kling
8b27bc078c LibWeb: Add ComputedCSSSstyleDeclaration and support 2 properties :^)
getComputedStyle(element) now returns a ComputedCSSStyleDeclaration
object, which is a live view of the computed style of a given element.

This works by ComputedCSSStyleDeclaration being a wrapper around an
element pointer. When you ask it for a CSS property, it gets the latest
computed style values from the element and returns them as a
CSS::StyleProperty object.

This first cut adds support for computed 'color' and 'display'.

In case the element doesn't have a corresponding node in the layout
tree, we fall back to using specified style instead. This is achieved by
performing an on-the-fly style resolution for the individual element and
then grabbing the requested property from that resolved style.
2021-09-12 20:44:50 +02:00
Andreas Kling
caa9e1f622 Base: Add a very simple test page for getComputedStyle() 2021-09-12 20:44:50 +02:00
Andreas Kling
0bcab60463 LibWeb: Make CSSStyleDeclaration an abstract class
This patch moves the CSS property+value storage down to a new subclass
of CSSStyleDeclaration called PropertyOwningCSSStyleDeclaration.

The JavaScript wrapper for CSSStyleDeclaration now calls virtual
functions on the C++ object.

This is preparation for supporting computed style CSSStyleDeclaration
objects which won't have internal property storage, but rather an
internal element pointer. :^)
2021-09-12 20:44:50 +02:00
Brian Gianforcaro
10679b6df2 CI: Batch master builds in Azure DevOps to help with CI latency
The CI system often develops a significant backlog when we have a lot
of PRs in the queue, and folks are pushing to master directly, or
other PRs are getting merged. The individual pushes to master or PR
merges to master each end up creating a dedicated master CI build.
These builds complete for machines with the normal PR validation builds.

To aid with this, Azure DevOps has a feature where they allow the CI
builds to "batch" multiple changes together, instead of running
multiple builds for each change.

Azure DevOps defines batching as:

    When a pipeline is running, the system waits until the run is
    completed, then starts another run with all changes that have
    not yet been built.

Documentation Reference:
https://docs.microsoft.com/en-us/azure/devops/pipelines/repos/github?view=azure-devops&tabs=yaml#batching-ci-runs
2021-09-12 18:41:57 +00:00
Karol Kosek
5d567eb4ac LibGUI: Make the Open button always active in the OpenFolder mode
We can just use the current opened directory as a path in that mode. :^)
2021-09-12 20:20:18 +02:00
Karol Kosek
71185f91a8 LibGUI: Enable/Disable the Open button on text change in FilePicker
Prior this change, the button was updated on user selection change
in the file view.

This isn't quite right, as you could remove the text from the text box
or (even worse) start typing a filename there and the button state
wouldn't change.
2021-09-12 20:20:18 +02:00
Nico Weber
3c6ad4c7db Kernel: Add a class to wrap aarch64 MIDR_EL1
We'll need part_num() to determine the MMIO address base. It's
0x3F000000 on rpi3 but 0xFE000000 on rpi4.
2021-09-12 17:26:41 +00:00
Nico Weber
2dc02607ed Kernel: Put boot.S first in aarch64 Prekernel source list
The better fix is to have a linker script. We'll need this to set
the entry point to 0x80000 for bare-metal builds anyways. But I'd
like to get some UART output in qemu before I add this (otherwise
I can't check if the bare-metal version does anything), so put
in this temporary kludge for now.
2021-09-12 17:26:41 +00:00
Nico Weber
18dcd7b9c9 Kernel: Define __stack_chk_guard for aarch64 Prekernel
Needed for functions that have local variables.

In time we need to share this between aarch64 and intel, but while
we figure out what exactly the aarch64 Prekernel should do, let's
duplicate this.
2021-09-12 17:26:41 +00:00
Nico Weber
22b2ca7b8e Kernel: Build Prekernel with -fno-threadsafe-statics
Else, function-local statics create calls to
__cxa_guard_acquire / __cxa_guard_release on aarch64, which we don't
(yet?) implement. Since Prekernel is single-threaded, just sidestep
that for now.
2021-09-12 17:26:41 +00:00
Brian Gianforcaro
9a1181f748 Assistant: Use ElapsedTimer::start_new() 2021-09-12 17:24:44 +00:00