Commit Graph

7644 Commits

Author SHA1 Message Date
kleines Filmröllchen
b48badc3b6 LibAudio: Remove frame-wise copys from FlacLoader
Previously, FlacLoader would read the data for each frame into a
separate vector, which are then combined via extend() in the end. This
incurs an avoidable copy per frame. By having the next_frame() function
write into a given Span, there's only one vector allocated per call to
get_more_samples().

This increases performance by at least 100% realtime, as measured by
abench, from about 1200%-1300% to (usually) 1400% on complex test files.
2022-01-02 22:18:37 +01:00
kleines Filmröllchen
30130904f5 LibAudio: Alow creating a Buffer from a FixedArray
A FixedArray, due to its non-allocation guarantee, is great for audio
programming, so it's natural to have it interface with Buffer.
2022-01-02 22:18:37 +01:00
Linus Groh
dc60774ac4 LibCore: Mark 'Read options' parameter [[maybe_unused]] in Account.cpp
This broke the macOS clang CI build.
2022-01-02 22:02:16 +01:00
Linus Groh
cbb7329d69 LibJS: Fix two typos in comments in AST.cpp 2022-01-02 21:44:19 +01:00
Linus Groh
7565b1fda8 LibJS: Let Completion::update_empty() take an Optional<Value>
It also needs to be able to take what the spec calls 'empty', which is
an Optional<Value> in this case (*not* an empty JS::Value). The common
use case is updating a completion with another completion, that may also
have an empty [[Value]] slot.
2022-01-02 20:48:38 +01:00
Linus Groh
13777d4886 LibJS: Move provided Optional<Value> argument in normal_completion() 2022-01-02 20:47:14 +01:00
Timothy Flynn
f16f3c4677 LibJS: Update ToRawPrecision / ToRawFixed AO spec comments
This is a normative change in the Intl spec:
https://github.com/tc39/ecma402/commit/f0f66cf

There are two main changes here:
1. Converting BigInt/Number objects to mathematical values.
2. A change in how ToRawPrecision computes its exponent and significant
   digits.

For (1), we do not yet support BigInt number formatting, thus already
have coerced Number objects to a double. When BigInt is supported, the
number passed into these methods will likely still be a Value, thus can
be coereced then.

For (2), our implementation already returns the expected edge-case
results pointed out on the spec PR.
2022-01-02 20:07:03 +01:00
Timothy Flynn
a3149c11e5 LibJS: Explicitly handle postive/negative infinity in Intl.NumberFormat
This is a normative change in the Intl spec:
https://github.com/tc39/ecma402/commit/f0f66cf

Our implementation is unaffected by this change. LibUnicode pre-computes
positive, negative, and signless format patterns, so we already format
negative infinity correctly. Also, the CLDR does not contain specific
locale-dependent strings for negative infinity anyways.
2022-01-02 20:07:03 +01:00
Andreas Kling
950784b5a6 LibGUI: Increase vertical padding on GUI::IconView item labels by 2px
Let's give the text a tiny bit of breathing room.
2022-01-02 18:08:02 +01:00
Andreas Kling
63e8cf8d59 LibCore: Enforce correct mode when creating new passwd and shadow files
- Use umask() to prevent the parent process from tampering with the mode
  bits of replacement passwd and shadow files.
- Use fchmod() to set new shadow files to mode 0600.
2022-01-02 18:08:02 +01:00
Andreas Kling
edd8f19a1b LibCore: Add Core::UmaskScope to set and unset a temporary umask 2022-01-02 18:08:02 +01:00
Andreas Kling
c6ce606e47 LibCore+id: Make more use of Core::System wrappers in Core::Account 2022-01-02 18:08:02 +01:00
Andreas Kling
431bd069f0 LibCore: Add Core::System wrappers for getspent() and getspnam() 2022-01-02 18:08:02 +01:00
Andreas Kling
7008f74214 LibCore: Add syscall wrappers for getpwuid() and getgrgid() 2022-01-02 18:08:02 +01:00
Andreas Kling
1e4117f1e1 LibCore: Add syscall wrapper for getgroups()
This wrapper does all the grunt work of figuring out how many extra GIDs
there are, and then returning them nicely wrapped in a Vector<gid_t>.
2022-01-02 18:08:02 +01:00
Andreas Kling
f95fc91e4f LibCore: Reset errno before using LibC pwd functions
We should not expect LibC functions to clear `errno` on success,
so if we want to use it for error checking after a call, we need
to clear it before the call.
2022-01-02 18:08:02 +01:00
Sam Atkins
416033a660 LibWeb: Support range syntax for media queries
This means you can now do queries like:

```css
@media (400px <= width < 800px) { }
```

Chromium and Firefox which I tested with both don't support this yet, so
that's cool. :^)
2022-01-02 15:43:51 +01:00
Sam Atkins
c3bf9e5b79 LibWeb: Rewrite media-query parsing to match spec grammar
Past me decided that the grammar was overly verbose and I could do it
better myself. Which seemed fine until the spec changed and I didn't
know how to integrate the changes. Lesson learned! :^)

Rather than have a function for every single part of the grammar, I have
written some as lambdas, and combned `<media-condition>` and
`<media-condition-without-or>` into one function. But otherwise it's
close to the spec, with comments listing the part of the grammar being
parsed, so hopefully it will be easier to make future adjustments!

This does not add any new functionality.
2022-01-02 15:43:51 +01:00
Sam Atkins
b6fe7cc324 LibWeb: Make MediaCondition a top-level type and add factory methods 2022-01-02 15:43:51 +01:00
Sam Atkins
ae4f0000c8 LibWeb: Make MediaFeature a top-level class and add factory methods
Web::CSS::MediaQuery::MediaFeature::Type was getting a bit ridiculous!
Also, this moves the detection of "min-" and "max-" media-features into
the MediaFeature itself, since this is an implementation detail, not
part of the spec.
2022-01-02 15:43:51 +01:00
Sam Atkins
d470e7e817 LibWeb: Remove media-query-related identifiers from identifiers.json
Having these in here was a hack to support the other hack of making
media-queries use StyleValues. Now they don't do that, so we can remove
these again and keep things hygienic.
2022-01-02 15:43:51 +01:00
Sam Atkins
6299d68e45 LibWeb: Introduce MediaFeatureValue type for use in media queries
Previously, we were using StyleValues for this, which was a bit of a
hack and was brittle, breaking when I modified how custom properties
were parsed. This is better and also lets us limit the kinds of value
that can be used here, to match the spec.
2022-01-02 15:43:51 +01:00
Sam Atkins
0a8e289f37 LibWeb: Update <general-enclosed> definition to match spec change
See https://github.com/w3c/csswg-drafts/pull/6799
2022-01-02 15:43:51 +01:00
sin-ack
d8ee3839e4 LibM: Count fractions when exponent < -1 with mantissa == 0
Without this change, floor(-0.125) returned 0.
This is because the number has a fraction part even if mantissa is zero
while the unbiased exponent is negative.

The names of some variables were also made clearer.

Co-Authored-By: Daniel Bertalan <dani@danielbertalan.dev>
2022-01-02 12:44:31 +03:30
Jesse Buhagiar
2de7f2021d LibC: Support X modifier for scanf
This was currently crashing Half-Life because it was a considered an
"Unknown" specifier. We can use the same case statement as the regular
hex format conversion (lower case 'x'), as the backend
to convert the number already supports upper/lower case input, hence
we get it for free :^)
2022-01-02 08:10:08 +02:00
Filiph Sandström
35dac843b4 Theming: Add alignment section
This commit removes the IsTitleCenter property and replaces it with
the TitleAlignment property that supports "Left", "Right" & "Center".
2022-01-01 22:51:53 +01:00
Filiph Sandström
c4b78bee45 LibGfx: Remove VERIFY in draw_rect_with_thickness
draw_line with thickness already supports scaling so that verify isn't
needed anymore. This fixes a scaling chrash introduced in 8a1d77f.
2022-01-01 20:30:09 +00:00
Xavier Defrang
8b95423b50 LibCore: Add FilePermissionsMask
This class parses UNIX file permissions definitions in numeric (octal)
or symbolic (ugoa+rwx) format and can apply them on a given file mode.
2022-01-01 17:33:43 +00:00
Michel Hermier
0f729cebf4 LibVideo/VP9: Do not null guard calls to free 2022-01-01 17:30:25 +00:00
Ben Wiederhake
3013e74d3a LibWeb: Avoid unnecessary copies in StyleInvalidator 2022-01-01 15:40:39 +01:00
Ben Wiederhake
0c365fdfd3 LibJS: Avoid unnecessary copies in MergeBlocks codegen pass 2022-01-01 15:40:39 +01:00
Ben Wiederhake
a1aea5b9e0 LibJS: Avoid unnecessary copies in PlaceBlocks codegen pass 2022-01-01 15:40:39 +01:00
Ben Wiederhake
182a85c895 LibSQL: Avoid unnecessary copies in Heap 2022-01-01 15:40:39 +01:00
Ben Wiederhake
5c4b2e8447 LibLine: Avoid unnecessary copies in Editor 2022-01-01 15:40:39 +01:00
Ben Wiederhake
13acf603d8 LibGUI: Avoid unnecessary copies in FileIconProvider 2022-01-01 15:40:39 +01:00
Stephan Unverwerth
b7c0c32f24 LibSoftGPU: Add option to render a debug overlay
This displays statistics regarding frame timings and number of pixels
rendered.

Timings are based on the time between draw_debug_overlay() invocations.
This measures actual number of frames presented to the user vs. wall
clock time so this also includes everything the app might do besides
rendering.

Triangles are counted after clipping. This number might actually be
higher than the number of triangles coming from LibGL.

Pixels are counted after the initial scissor and coverage test. Pixels
rejected here are not counted. Shaded pixels is the percentage of all
pixels that made it to the shading stage. Blended pixels is the
percentage of shaded pixels that were alpha blended to the color buffer.

Overdraw measures how many pixels were shaded vs. how many pixels the
render target has. e.g. a 640x480 render target has 307200 pixels. If
exactly that many pixels are shaded the overdraw number will read 0%.
614400 shaded pixels will read as an overdraw of 100%.

Sampler calls is simply the number of times sampler.sample_2d() was
called.
2022-01-01 15:09:21 +01:00
Stephan Unverwerth
fe36edf6ae LibSoftGPU: Put all constexpr config options into Config.h 2022-01-01 15:09:21 +01:00
circl
63760603f3 Kernel+LibC+LibCore: Add lchown and fchownat functions
This modifies sys$chown to allow specifying whether or not to follow
symlinks and in which directory.

This was then used to implement lchown and fchownat in LibC and LibCore.
2022-01-01 15:08:49 +01:00
Filiph Sandström
8a1d77f65c LibGfx: Add window border/title theming options
This commit adds support the following properties to theming:
Flags:
  - IsTitleCenter: true if the title should be centered.
Metrics:
  - BorderThickness: The border width.
  - BorderRadius: The border corner radius.
2022-01-01 14:54:16 +01:00
Daniel Bertalan
7fdf4004de LibCore: Fix OOB read in Stream::BufferedSeekable::read_until_any_of
If we do not decrement `m_buffered_size` whenever we read data from the
buffer, we end up saying that there are more lines available when we
reach the end of file. This bug caused callers to read garbage data.

This also fixes an incorrect condition in an if statement. The separator
candidate is searched for in `remaining_buffer`, so the separator's
length should be compared against that.
2022-01-01 14:44:02 +01:00
networkException
b46ea5158d WindowsServer+LibGUI: Avoid getting color under cursor outside screen
This patch fixes a crash in ColorPicker caused by the ColorSelectOverlay
trying to request the color for a pixel outside the screen rect.
2022-01-01 14:32:11 +01:00
Conor Byrne
8515d7d5ab LibC: Implement `flockfile and funlockfile`
To do this, we must set the type attribute when initializing a FILE to
``__PTHREAD_MUTEX_RECURSIVE``.
2022-01-01 09:50:32 +00:00
Linus Groh
d7f6635d55 LibJS: Add missing undefined fallback to IfStatement completions
Also add spec comments.
2021-12-31 15:39:25 +01:00
Conor Byrne
faad7a3ed1 LibDiff: Fix error when parsing a 'new' hunk location
If the location started at 0, and / or the length was 0, it would
originally turn out to be a location of { -1, -1 } when LibDiff was
finished parsing, which was incorrect.

To fix this, we only subtract 1 if `start` or `length` isn't 0.
2021-12-31 14:12:54 +01:00
davidot
c0a3b1467c LibJS: Fix the Now.plainDateTime in case they go over a year boundary
Since years don't have a constant amount of seconds because they can be
leap years no constant will work in all cases. We now test a timezone in
both the positive and negative direction and check that at least one
worked. Assuming years are at least 2 days long this will always pass
at least one test.
2021-12-31 12:26:26 +01:00
davidot
c296df6b58 LibJS: Convert to_reference() to ThrowCompletionOr 2021-12-31 00:03:20 +01:00
davidot
a24df37713 LibJS: Convert resolve_this_binding() to ThrowCompletionOr
Also add spec comments.
2021-12-31 00:03:20 +01:00
Emanuele Torre
dc03529ffd LibJS: Fix spec comment in Temporal::PlainDate::balance_iso_date()
This matches the text of the spec, and is more correct since the
variable is being updated, not defined it.

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

---

I also changed `test_year += 1` to `test_year++` for consistency with
step 11.c that has the same description.
2021-12-30 23:59:40 +01:00
Ali Mohammad Pur
8de8a7766d LibCore: Add Core::System::setpgid() 2021-12-31 02:19:45 +03:30
Ali Mohammad Pur
ee46cee31f LibCore: Make Core::System::pipe2() available on Lagom
Note that this drops the flags on the floor if not on linux or serenity.
2021-12-31 02:19:45 +03:30