Commit Graph

11470 Commits

Author SHA1 Message Date
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
networkException
2d681279d4 LibGUI: Properly handle range selections in ColumnsView
Previously we would always select the left most column when selecting a
range of rows.

This patch fixes this issue by always applying a selection to the column
in which the selection ends.
2022-07-24 13:40:31 +01:00
networkException
30d68d71b4 LibGUI: Move range selection calculations into separate function
AbstractView currently assumes a certain layout of rows and colums to
perform a range selection on.

This patch moves the implementation into a helper that can be overriden
by other views.
2022-07-24 13:40:31 +01:00
networkException
7540259b16 LibGUI: Alphabetize CMake sources 2022-07-24 13:40:31 +01:00
MacDue
e11e9d3801 LibWeb: Paint a frame around (system) <progress> elements
This makes them look a bit more like a progress bar, especially
on white backgrounds (for the default theme) where you otherwise
cannot see the unfilled part of the bar.
2022-07-24 13:31:01 +01:00
MacDue
9768cda634 LibWeb: Tidy up <progress> element default CSS
This is a very minor thing, but one being `background:` and
the other being `background-color:` bugged me (and not using
the named colors).
2022-07-24 13:31:01 +01:00
MacDue
226d3fba79 LibWeb: Use the palette "button text" on buttons in the default CSS
This fixes some legibility issues when using dark themes.
2022-07-24 13:31:01 +01:00
Liav A
977aa81310 Kernel+Userland: Add ioctl to set process ownership of DisplayConnector
Now that the infrastructure of the Graphics subsystem is quite stable,
it is time to try to fix a long-standing problem, which is the lack of
locking on display connector devices. Reading and writing from multiple
processes to a framebuffer controlled by the display connector is not a
huge problem - it could be solved with POSIX locking.

The real problem is some program that will try to do ioctl operations on
a display connector without the WindowServer being aware of that which
can lead to very bad situations, for example - assuming a framebuffer is
encoded at a known resolution and certain display timings, but another
process changed the ModeSetting of the display connector, leading to
inconsistency on the properties of the current ModeSetting.

To solve this, there's a new "master" ioctl to take "ownership" and
another one to release that ownership of a display connector device. To
ensure we will not hold a Process object forever just because it has an
ownership over a display connector, we hold it with a weak reference,
and if the process is gone, someone else can take an ownership.
2022-07-23 10:42:08 +01:00
Liav A
1968aba69b Kernel+Userland: Rename FB.h => Graphics.h
This header file represents the entire interface between the kernel and
userland, and as such, no longer should be called FB.h but something
that represents the whole graphics subsystem.
2022-07-23 10:42:08 +01:00
Liav A
b5e5b299c4 Userland: Remove stale remainders of old framebuffer devices 2022-07-23 10:42:08 +01:00
MacDue
980964d8f3 LibWeb: Add a default style for primitive progress bars
This style is the same as what is used in WebKit/Blink, it is a bit
ugly, but you're expected to override it. Adding more than a
background color here could cause some issues, as sites don't
expect to have to unset the styles.
2022-07-23 01:45:49 +02:00
MacDue
57c6792458 LibWeb: Support appearance: none for <progress> elements
This disables this system progress bar, and instead creates one
out of pseudo elements, that can be selected and styled with the
::-webkit-progress-bar/value selectors.
2022-07-23 01:45:49 +02:00
MacDue
d7d34d88e5 LibWeb: Implement appearance CSS property
This includes the "compat" values even though they are not strictly
necessary.
2022-07-23 01:45:49 +02:00
MacDue
b5febe538c LibWeb: Parse the -webkit-progress-bar/value pseudo elements
These will be needed for styling progress bars, sadly this can
only be done with these non-standard selectors. These are, hovever,
in use on real sites such as https://rpcs3.net/compatibility.
2022-07-23 01:45:49 +02:00
Timothy Flynn
ae2acc8cdf LibJS+LibUnicode: Generate a set of default DateTimeFormat patterns
This isn't called out in TR-35, but before ICU even looks at CLDR data,
it adds a hard-coded set of default patterns to each locale's calendar.
It has done this since 2006 when its DateTimeFormat feature was first
created. Several test262 tests depend on this, which under ECMA-402,
falls into "implementation defined" behavior. For compatibility, we
can do the same in LibUnicode.
2022-07-22 23:51:56 +01:00
Linus Groh
8150d71821 Everywhere: Prefix 'TYPEDEF_DISTINCT_ORDERED_ID' with 'AK_' 2022-07-22 23:09:43 +01:00
Linus Groh
5a106b6401 Everywhere: Prefix 'TYPEDEF_DISTINCT_NUMERIC_GENERAL' with 'AK_' 2022-07-22 23:09:43 +01:00
Kenneth Myhra
9a1c27a163 LibWeb: Implement BufferSource support for XHR::send() 2022-07-22 23:08:28 +01:00
Kenneth Myhra
e55bdd434a LibWeb: Add spec link for XMLHttpRequestBodyInit 2022-07-22 23:08:28 +01:00
Kenneth Myhra
5830ff5be9 LibWeb: Let XHR::extract_body() return ErrorOr
This is a minor refactor of XHR::extract_body() letting it return
ErrorOr<...> instead of just Fetch::Infrastructure::BodyWithType.

This also updates the one place extract_body() is used.
2022-07-22 23:08:28 +01:00
Kenneth Myhra
9fe12c1851 LibWeb: Let get_buffer_source_copy() return ErrorOr instead of Optional
This is a minor refactor of IDL::get_buffer_source_copy() letting it
return ErrorOr<ByteBuffer> instead of Optional<ByteBuffer>.

This also updates all places that use IDL::get_buffer_source_copy().
2022-07-22 23:08:28 +01:00
kleines Filmröllchen
4941cffdd0 Piano+LibDSP: Move Track to LibDSP
This is a tangly commit and it fixes all the bugs that a plain move
would have caused (i.e. we need to touch other logic which had wrong
assumptions).
2022-07-22 19:35:41 +01:00
kleines Filmröllchen
125122a9ab LibAudio: Prevent racy eternal deadlock of the audio enqueue thread
The audio enqueuer thread goes to sleep when there is no more audio data
present, and through normal Core::EventLoop events it can be woken up.
However, that waking up only happens when the thread is not currently
running, so that the wake-up events don't queue up and cause weirdness.
The atomic variable responsible for keeping track of whether the thread
is active can lead to a racy deadlock however, where the audio enqueuer
thread will never wake up again despite there being audio data to
enqueue. Consider this scenario:

- Main thread calls into async_enqueue. It detects that according to the
  atomic variable, the other thread is still running, skipping the event
  queue wake.
- Enqueuer thread has just finished playing the last chunk of audio and
  detects that there is no audio left. It enters the if block with the
  dbgln "Reached end of provided audio data..."
- Main thread enqueues audio, making the user sample queue non-empty.
- Enqueuer thread does not check this condition again, instead setting
  the atomic variable to indicate that it is not running. It exits into
  an event loop sleep.
- Main thread exits async_enqueue. The calling audio enqueuing system
  (see e.g. Piano, but all of them function similarly) will wait until
  the enqueuer thread has played enough samples before async_enqueue is
  called again. However, since the enqueuer thread will never play any
  audio, this condition is never fulfilled and audio playback deadlocks

This commit fixes that by allowing the event loop to not enqueue an
event that already exists, therefore overloading the audio enqueuer
event loop by at maximum one message in weird situations. We entirely
get rid of the atomic variable and the race condition is prevented.
2022-07-22 19:35:41 +01:00
kleines Filmröllchen
763cda227f LibAudio: Don't auto-start the convenience enqueuer thread
This will conflict with apps that don't use this thread and it also
creates unnecessary overhead for non-enqueuing clients like AudioApplet.
Use the new Thread is_started info to start the thread only if necessary
(on first call to async_enqueue).
2022-07-22 19:35:41 +01:00
kleines Filmröllchen
91913fba59 LibThreading: Add is_started state information to Thread
Users can now determine whether a thread has been started or not. A
started thread might also have already terminated.

Implementation note: We *could* detect this with pthread APIs maybe, but
this is much simpler.
2022-07-22 19:35:41 +01:00
Tim Schumacher
c85f307e62 LibC: Mark a bunch of functions as cancellation points 2022-07-22 10:07:15 -07:00
Tim Schumacher
899fd74f8e LibC: Implement pthread_cancel 2022-07-22 10:07:15 -07:00
Tim Schumacher
b4a926735a LibC: Implement pthread_setcancel{state,type} 2022-07-22 10:07:15 -07:00
Obinna Ikeh
9956d3d1e1 LibJS: Add tests for %TypedArray%.prototype.with 2022-07-22 17:17:15 +01:00
Obinna Ikeh
4a201e8854 LibJS: Add %TypedArray%.prototype.with 2022-07-22 17:17:15 +01:00
Luke Wilde
1e829c4ea8 LibJS: Check PlainMonthDay is in the ISO date time limits in creation
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/374305c
2022-07-22 17:10:03 +01:00
Luke Wilde
61847b3cef LibJS: Disallow negative day lengths in ZonedDateTime.protoype.round
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/6f04074
2022-07-22 17:10:03 +01:00
Timothy Flynn
b8d4f8debf LibJS: Selectively display DateTimeFormat day periods as noon 2022-07-21 20:36:03 +01:00
Timothy Flynn
32c07bc6c3 LibUnicode: Generate per-locale data for the "noon" fixed day period
Note that not all locales have this day period.
2022-07-21 20:36:03 +01:00
Timothy Flynn
0f26ab89ae LibJS+LibUnicode: Handle flexible day periods on both sides of midnight
Commit ec7d535 only partially handled the case of flexible day periods
rolling over midnight, in that it only worked for hours after midnight.
For example, the en locale defines a day period range of [21:00, 06:00).
The previous method of adding 24 hours to the given hour would change
e.g. 23:00 to 47:00, which isn't valid.
2022-07-21 20:36:03 +01:00
Samuel Bowman
2f8c20816e LibPartition: Fix end block off by one error
Previously, end block was inconsistent. GUIDPartitionTable treated
end block as an inclusive bound, while MBRPartitionTable and
EBRPartitionTable treated end block as an exclusive bound.
Now all three treat end block as an inclusive upper bound.
2022-07-21 20:13:44 +01:00
Samuel Bowman
7b8088c78d LibCore: Add File::is_{block,char}_device() helpers
The existing File::is_device() helpers don't distinguish between
block and char devices. This commit adds File::is_block_device() and
File::is_char_device() helpers which are more specific.
2022-07-21 20:13:44 +01:00
Samuel Bowman
380ce43afc LibPartition: Make GUIDPartitionTable kernel/userland agnostic 2022-07-21 20:13:44 +01:00
Samuel Bowman
11b4d51fc9 LibPartition: Make EBRPartitionTable kernel/userland agnostic 2022-07-21 20:13:44 +01:00
Samuel Bowman
7e45c3b687 LibPartition: Make MBRPartitionTable kernel/userland agnostic 2022-07-21 20:13:44 +01:00
Samuel Bowman
6a1c85aa61 LibPartition: Make PartitionTable kernel/userland agnostic
Previously, PartitionTable was constructed using a Kernel::StorageDevice
making it only usable in the kernel. This commit adds a new constructor
that takes a Core::File instead, making it usable in userland as well.

This also adds the m_block_size field which stores the block size of the
underlying device obtained by calling StorageDevice::block_size() in the
kernel or by using the STORAGE_DEVICE_GET_BLOCK_SIZE ioctl in userland.
This avoids the need for an #ifdef every time block size is needed.
2022-07-21 20:13:44 +01:00
Samuel Bowman
25de9de7dc Kernel+LibPartition: Move GUIDPartitionTable into LibPartition 2022-07-21 20:13:44 +01:00
Samuel Bowman
9053d86b82 Kernel+LibPartition: Move EBRPartitionTable into LibPartition 2022-07-21 20:13:44 +01:00
Samuel Bowman
1a6ef03e4a Kernel+LibPartition: Move MBRPartitionTable into LibPartition 2022-07-21 20:13:44 +01:00
Samuel Bowman
940dde9947 Kernel+LibPartition: Move PartitionTable into LibPartition 2022-07-21 20:13:44 +01:00
Samuel Bowman
be1c5c6b9f Kernel+LibPartition: Move DiskPartitionMetadata into LibPartition
This commit creates a new library LibPartition which will contain
partition related code sharable between Kernel and Userland and
includes DiskPartitionMetadata as the first shared class.
2022-07-21 20:13:44 +01:00
Itamar
db11cfa2c5 Utilities+LibELF: Temporary promises for dynamic linker in "pledge"
This adds a "temporary promises for the dynamic-linker" flag ('-d')
to the "pledge" utility.

Example usage:
pledge -d -p "stdio rpath" id

Without the '-d' flag, id would crash because the dynamic linker
requires 'prot_exec'.

When this flag is used and the program to be run is dynamically linked,
"pledge" adds promises that are required by the dynamic linker
to the promise set provided by the user.

The dynamic linker will later "give up" the pledge promises it no
longer requires.
2022-07-21 16:40:11 +02:00
Itamar
91a03bc6ae LibCore: Add function for searching a file in $PATH
This extracts the logic of searching for a file in $PATH from
System::exec to a separate function.
2022-07-21 16:40:11 +02:00