Commit graph

39990 commits

Author SHA1 Message Date
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
Tim Schumacher
a031b7a174 chmod: Implement the --recursive flag 2022-07-25 15:32:46 +02:00
Tim Schumacher
0329a644f8 chmod: Port to ArgsParser 2022-07-25 15:32:46 +02:00
kleines Filmröllchen
29e2b1c386 Piano: Replace knob instantiations with ProcessorParameterWidgets
The only remaining "manual" knob instatiation is the octave, which will
be moved into an entirely different UI in the future.
2022-07-25 15:25:13 +02:00
kleines Filmröllchen
b29d27c948 LibDSP: Add a fixed mastering processor to Track
This processor will not appear in the normal processor chain later on,
but is used for final mixing of the track.
2022-07-25 15:25:13 +02:00
kleines Filmröllchen
ab2d8edcbb LibDSP: Remove Track volume getters and setters 2022-07-25 15:25:13 +02:00
kleines Filmröllchen
a0b2e8608b Piano: Remove waveform cycling with C
This is not the most useful keyboard binding anyways, plus it will be
extremely hacky to implement it with the generic processor parameter
widgets. Therefore, we'll get rid of it and add back a more generic
keyboard binding system later.
2022-07-25 15:25:13 +02:00
kleines Filmröllchen
196841fd3a Piano: Add a generic processor parameter widget
This automatically creates the correct collection of name label, value
label and "editor" (knob, checkbox, dropdown) depending on the processor
type and layouts them vertically.
2022-07-25 15:25:13 +02:00
kleines Filmröllchen
6389384882 Piano: Add Toggle parameter widget
This is for enum widgets; though positioning is not correct as
checkboxes need more options for text-less layout.
2022-07-25 15:25:13 +02:00
kleines Filmröllchen
d5166ddbcf LibDSP: Actually implement the Mastering processor
This can now handle mute, volume control and panning.
2022-07-25 15:25:13 +02:00
kleines Filmröllchen
281b319588 LibGUI: Make Checkbox constructor protected 2022-07-25 15:25:13 +02:00
Andreas Kling
fac4529082 LibWeb: Honor flex container sizing constraints in available space 2022-07-25 15:03:18 +02:00
Andreas Kling
050e70cc7e LibWeb: Position abspos children of flex container after parent layout
If we wait until after the parent context has laid out the flex
container, abspos children are able to use the final results of the
parent sizing the flex container.

This makes `height:auto` work on abspos children of a flex container.
2022-07-25 15:03:18 +02:00
Andreas Kling
7aa9e03e85 LibWeb: Simplify some code with CSS::LengthPercentage::is_auto() 2022-07-25 15:03:18 +02:00
Andreas Kling
3145f92bc0 LibWeb: Count flex item's *outer* size towards container intrinsic size
This isn't in the spec, but it's visually obvious that we need to count
item margin boxes towards the main intrinsic size of the flex container.
2022-07-25 15:03:18 +02:00
Andreas Kling
b71f747453 LibWeb: Add helpers for adding margin box to flex item's content size 2022-07-25 15:03:18 +02:00
David Smith
c2a1817c70 Profiler: Fix use after free in FlameGraphView
Layout cleared the list of bars in the flame graph, but didn't clear the
reference m_hovered_bar. This could cause a crash in mousedown_event()
when clicking twice: the first click caused layout, the second used
the old reference.
2022-07-24 23:19:09 +01:00
Linus Groh
f52e468cd6 Kernel: Fix L1/L2/L3 cache conditionals in ProcFSCPUInformation 2022-07-24 23:01:59 +01:00