Commit graph

39807 commits

Author SHA1 Message Date
b14ckcat
4b1537387f Kernel: Fix USB hotplug crash
Currently the SysFS node for USB devices is only initialized for USB
hubs, which means it will cause a kernel crash upon being dereferenced
in a non-hub device. This fixes the problem by making initialization
happen for all USB devices.
2022-07-27 05:52:35 +00:00
Sam Atkins
11cb7c7b28 WindowServer: Ensure windows are wide enough to show title buttons :^)
Previously, windows without a defined minimum size (or one produced from
the minimum sizes of their contents) would be shrunk down to 0 x 0,
which makes the title buttons stick out the side and become impossible
to interact with.

This patch uses the theme metrics to calculate a minimum size that is as
small as possible while still keeping the title buttons and app icon
usable. This is combined with the minimum size requested by the app
itself.

Switching themes automatically updates the calculated minimum sizes for
all existing windows. As noted, if the new theme has narrower title
buttons then the old minimum is kept, but this shouldn't be noticeable
unless you're looking for it.
2022-07-27 00:01:42 +01:00
Sam Atkins
0fcb6920e3 Browser: Give BookmarksBarWidget a minimum size
Without this, it gets a minimum size that's very large and stops you
from resizing the Browser window narrower than 609px.
2022-07-27 00:01:42 +01:00
Karol Kosek
fe60459353 LibAudio: Seek to the first frame on reset in FLAC
The files weren't starting exactly from the beginning before.
This happened because the parameter now takes the sample index, instead
of a seekpoint.
2022-07-26 23:59:06 +01:00
Karol Kosek
2878ad681e LibAudio: Read FLAC Metadata blocks larger than the buffer size
Out of 40/63 failed tests, this change reduces the number down to four.
:^)

See: #14683
2022-07-26 23:59:06 +01:00
MacDue
43ebe5ca75 Base: Add some more border-radius test cases
* A border-radius + a border on a <img> tag
   - The border-radius on the <img> should shrink to line up with
     the border.
* A border-radius + a border on a div with overflow: hidden
   - The clipping border-radius should shrink (same as the image).
2022-07-26 23:56:29 +01:00
MacDue
b68f48eb71 LibWeb: Shrink the inner border radii to accommodate the border widths
This fixes the shape of the subreddit logo on new reddit.
2022-07-26 23:56:29 +01:00
Kenneth Myhra
890514a057 LibWeb: Introduce the File interface from the FileAPI spec 2022-07-26 20:54:30 +01:00
Kenneth Myhra
df91dbfbb6 LibWeb: Add missing spec links to the Blob interface 2022-07-26 20:54:30 +01:00
Kenneth Myhra
6305ef197f LibWeb: Fix const issue on type() accessor for the Blob interface 2022-07-26 20:54:30 +01:00
Kenneth Myhra
c038a8c9c9 LibWeb: Make process_blob_parts() publicly accessible
This pulls process_blob_parts() out of the Blob class and makes it
publicly accessible.
2022-07-26 20:54:30 +01:00
Kenneth Myhra
622a4f29a7 LibWeb: Add public get accessor function for Blob's internal ByteBuffer
Blob::bytes() returns the ReadonlyBytes representation of our internal
ByteBuffer.

This change requires us to ByteBuffer::copy() Blob's ReadonlyBytes to a
ByteBuffer in XHR::send() and corresponding error handling of the copy
operation.

This removes the need for Blob to declare XMLHttpRequest as a friend
class.
2022-07-26 20:54:30 +01:00
Timothy Flynn
417a385db1 LibJS: Allow out-of-order plural ranges to be formatted
This is a normative change to the Intl NumberFormat V3 spec:
https://github.com/tc39/proposal-intl-numberformat-v3/commit/0c3d849
2022-07-26 10:46:08 -07:00
Timothy Flynn
fd7d97fba5 LibJS: Allow out-of-order number ranges to be formatted
This is a normative change to the Intl NumberFormat V3 spec:
https://github.com/tc39/proposal-intl-numberformat-v3/commit/0c3d849
2022-07-26 10:46:08 -07:00
Timothy Flynn
415742ab98 LibJS: Allow out-of-order date ranges to be formatted
This is a normative change to the Intl spec:
https://github.com/tc39/ecma402/commit/769df4b
2022-07-26 10:46:08 -07:00
gbowser3@gmail.com
16d189e96b LibGUI: Move tooltip position up 4 pixels to prevent cursor pop-under 2022-07-26 12:42:18 +02:00
MacDue
13406b83b1 AK: VERIFY() the index is in bounds in StringView::operator[]
That this did not already happen took me by surprise, as for
most other similar containers/types in AK (e.g. Span) the index
will be checked. This check not happening could easily let
off-by-one indexing errors slip through the cracks.
2022-07-26 12:41:46 +02:00
Andreas Kling
5f34c8ab03 LibWeb: Make automatic heights for abspos non-replaced behave better
Previously we were checking if values were "auto" after resolving the
"auto"-ness out of them, which didn't work. There's still a bunch of
work to do on this algorithm, but now we can at least resolve some basic
automatic height scenarios.
2022-07-26 01:53:41 +02:00
Andreas Kling
0258fd8043 LibWeb: Remove FFC helpers is_{main,cross}_axis_margin_first_auto()
We already cache these values with each flex item, so let's just use
those instead.
2022-07-26 01:53:41 +02:00
Andreas Kling
71ec46b8cc LibWeb: Don't treat calc() in used flex basis as definite for now
We'll eventually need some way to determine if a calc() value results
in a definite size.
2022-07-26 01:53:41 +02:00
Andreas Kling
7200b3a16c LibWeb: Make two passes in FFC where to support percentage min/max sizes
Percentage sizes of flex items are relative to the flex container, but
even when the flex container is automatically sized, we still have to
support them.

To make this work, we first do a pass where percentage sizes are ignored
(treated as "auto", basically) in order to get a "reference" value.

Then we do a second pass where percentages can be resolved against this
reference value.
2022-07-26 01:53:41 +02:00
Andreas Kling
3def9e47f6 LibWeb: Improve min/max content contribution calculations for flex items
Follow the spec more closely.
2022-07-26 01:53:41 +02:00
Andreas Kling
4c89252f6a LibWeb: Clamp flex items to min/max main size during intrinsic sizing
We were neglecting to clamp flex items when calculating the intrinsic
main size of the flex container. This was covered by a FIXME, which we
can now remove. :^)
2022-07-26 01:53:41 +02:00
Andreas Kling
dc66a3cad9 LibWeb: Simplify flex container main size determination
We had an older incomplete implementation of flex container max-content
sizing that we used for unconstrained main size determination.

This patch replaces the old implementation with a call to the new
max-content sizing code.

Note that this isn't a complete implementation of flex container sizing
still, but at least we've deduplicated some code.
2022-07-26 01:53:41 +02:00
Andreas Kling
18b1854aea LibWeb: Add FFC helpers for getting the computed main/cross size of box 2022-07-26 01:53:41 +02:00
Andreas Kling
a4d7dc40bf LibWeb: Move get_pixel_{width,height} helpers into FFC class 2022-07-26 01:53:41 +02:00
Andreas Kling
60ac258a48 LibWeb: Mark flex item cross sizes as definite when spec asks us to
The CSS-FLEXBOX-1 spec gives us two situations in which flex item cross
sizes should be considered definite. Both of them happen *during* flex
layout, which is super finicky but it is what it is.
2022-07-26 01:53:41 +02:00
Andreas Kling
83bb16ede3 LibWeb: Avoid some unnecessary inside layouts during intrinsic sizing
When calculating intrinsic sizes, we don't need to recurse into *every*
box and layout its insides. IIUC, we can skip any unconstrained box with
definite sizes in both axes. So this patch does exactly that.
2022-07-26 01:53:41 +02:00
Andreas Kling
3ede8dbffb LibWeb: Rename IntrinsicSizeDetermination to IntrinsicSizing
This matches the exact terminology used in CSS-SIZING-3:
https://drafts.csswg.org/css-sizing-3/#intrinsic-sizing
2022-07-26 01:53:41 +02:00
Andreas Kling
97f53de8a2 LibWeb: Take size constraints into account in fit-content calculations
Also avoid calculating both min-content and max-content sizes when only
one of them is needed.
2022-07-26 01:53:41 +02:00
Andreas Kling
8f35c9a037 LibWeb: Resolve flexbox percent heights against containing block height
Percentage values for `min-height` and `max-height` should be resolved
against the containing block height, not its width.
2022-07-26 01:53:41 +02:00
Andreas Kling
7cc6d1da2d LibWeb: Resolve definite sizes when instantiating UsedValues
When we decide that a box has definite width or height based on its
containing block's corresponding size, we'll want to resolve the
current box's size as well. Otherwise anyone querying the size on
this box will get the bogus message of "yes, this definite, and its
value is zero."
2022-07-26 01:53:41 +02:00
Andreas Kling
4cbec00c44 LibWeb: Actually check if percentage used flex basis is definite
Previously, we considered all LengthPercentage values for used flex
basis to be definite. This is not accurate, as percentages should only
be considered definite if the reference value they resolve against is
a definite size.

Fix this by checking the flex container's main definite size flag.
2022-07-26 01:53:41 +02:00
Andreas Kling
8bdc6f5390 LibWeb: Don't override main size during flex item cross sizing
There's no need to override the sizes before calculating the cross size.

Besides, by the time we're calculating the hypothetical cross size of
flex items, we may already have established a definite main size anyway,
so overriding it would be wrong.
2022-07-26 01:53:41 +02:00
Andreas Kling
69243947d5 LibWeb: Some flex items have definite size after flexing
This patch implements two of the special "definite size" rules from
the CSS-FLEXBOX-1 spec.

https://drafts.csswg.org/css-flexbox-1/#definite-sizes
2022-07-26 01:53:41 +02:00
Andreas Kling
02c59fe8c9 LibWeb: Containing block always has definite width during abspos layout
From CSS-SIZING-3:

"...the size of the containing block of an absolutely positioned element
is always definite with respect to that element."
2022-07-26 01:53:41 +02:00
Andreas Kling
71a707480c LibWeb: Move "has-definite-width/height" flags to UsedValues
This state is less static than we originally assumed, and there are
special formatting context-specific rules that say certain sizes are
definite in special circumstances.

To be able to support this, we move the has-definite-size flags from
the layout node to the UsedValues struct instead.
2022-07-26 01:53:41 +02:00
Tim Schumacher
25e6ad8d3e chown: Implement recursion 2022-07-25 23:52:46 +01:00
Tim Schumacher
7b7c9a2194 chown: Add support for multiple file paths 2022-07-25 23:52:46 +01:00
Andreas Kling
bd48d9521a LibWeb: Simplify more code with CSS::LengthPercentage::is_auto() 2022-07-26 00:04:21 +02:00
Andreas Kling
16c173de43 LibWeb: Destroy ICB formatting context before committing used values
Absolutely positioned boxes are handled by the BFC destructor, so we
need to make sure the ICB BFC is destroyed if we want these boxes
to get laid out.
2022-07-26 00:04:21 +02:00
Timothy Flynn
689cbdf6b6 LibJS: Use SortIndexedProperties AO in TypedArray.prototype.sort
Note that we cannot use CompareTypedArrayElements until the change-
array-by-copy proposal picks up the change to no longer throw with
detached array buffers.
2022-07-25 22:40:52 +01:00
Timothy Flynn
b779a3628d LibJS: Use SortIndexedProperties AO in Array.prototype.sort
By aligning Array.prototype.sort with the spec, this removes the direct
invocation of CompareArrayElements from array_merge_sort. This opens the
door for TypedArray to use SortIndexedProperties as well because now
array_merge_sort does not assume what kind of array it is invoked with.
Further, this addresses a FIXME to avoid an extra JS heap allocation.
2022-07-25 22:40:52 +01:00
Timothy Flynn
56db4235df LibJS: Add missing spec step to CompareTypedArrayElements
This isn't actually much of an issue because if the LHS side value is -0
and the RHS value is +0, errantly returning 0 in the comparison function
here has the same effect as correctly returning -1. In both cases, the
-0 is left on the LHS.
2022-07-25 22:40:52 +01:00
Tim Schumacher
864221cb02 ln: Implement correct handling of directories as link targets 2022-07-25 22:21:01 +01:00
Tim Schumacher
26d4a44a0f ln: Rework to use LibCore syscall wrappers 2022-07-25 22:21:01 +01:00
Tim Schumacher
c44b9acac3 LibCore: Add System::link() 2022-07-25 22:21:01 +01:00
Filiph Sandström
bac4bdc5d2 Kernel: Fix incorrect return type on aarch64
InterruptController's model incorrectly returned a char[] instead
of a StringView.
2022-07-25 16:01:46 +01:00
Andreas Kling
44cdca04d3 LibGfx+Base: Draw radio buttons programmatically
Remove the static PNG bitmaps we've been using for GUI radio buttons
and replace them with on-the-fly pixel painting.

This fixes a long-standing issue where radio buttons always looked the
same, regardless of system theme settings. :^)
2022-07-25 16:32:52 +02:00
zzLinus
ca74443012 Kernel/LibC: Implement posix syscall clock_getres() 2022-07-25 15:33:50 +02:00