Commit graph

45771 commits

Author SHA1 Message Date
Sam Atkins
8d3b268cca AK: Add JsonObject::get...() methods that return Optional
`get()` is intended as a replacement for `get_deprecated()` and `get_ptr
()`. The former returns the same value for "key not found" and "key
found and contains `null`" which is ambiguous. The latter returns a raw
pointer which is spooky. Returning `Optional<JsonValue const&>` covers
all the previous uses for these.

The `get_foo()` methods are helpers to make user code less verbose. Most
of the time, we only want a specific type of value: if we want a number
and get a string, we respond the same as if the value was not there at
all. These make that easier to express.

This also adjusts the `has_i32()` method and friends to examine the
value instead of just looking at the underlying type.
2023-01-17 19:52:52 -05:00
Sam Atkins
d1ad63c466 AK: Move JsonObject implementation out of line 2023-01-17 19:52:52 -05:00
Sam Atkins
1dd6b7f5b7 AK+Everywhere: Rename JsonObject::get() to ::get_deprecated()
This is a preparatory step to making `get()` return `ErrorOr`.
2023-01-17 19:52:52 -05:00
Sam Atkins
efe4329f9f AK: Add JsonValue::{is,as}_integer() methods
The existing `is_i32()` and friends only check if `i32` is their
internal type, but a value such as `0` could be literally any integer
type internally. `is_integer<T>()` instead determines whether the
contained value is an integer and can fit inside T.
2023-01-17 19:52:52 -05:00
Jelle Raaijmakers
6d93947212 LibGfx: Use ALWAYS_INLINE for inline Bitmap methods
`Bitmap::scanline_u8` started popping up in profiles. We can't be having
that of course.
2023-01-17 19:34:54 -05:00
Jelle Raaijmakers
78926c182f Presenter: Increase the minimum widget size
The previous 100x100 size was a bit too small for comfort :^)
2023-01-17 19:30:51 -05:00
Jelle Raaijmakers
677d27d36a Presenter: Restructure menu to be more consistent with other apps
Add a "Quit" action and create a separate "Help" menu.
2023-01-17 19:30:51 -05:00
Xexxa
8a3cad58e0 Base: Add more emoji
🤱 - U+1F931 BREAST-FEEDING
💃 - U+1F483 WOMAN DANCING
🚣 - U+1F6A3 PERSON ROWING BOAT
🚣‍♂️ - U+1F6A3 U+200D U+2642 MAN ROWING BOAT
🚣‍♀️ - U+1F6A3 U+200D U+2640 WOMAN ROWING BOAT
⛹️ - U+26F9 PERSON BOUNCING BALL
⛹️‍♂️ - U+26F9 U+200D U+2642 MAN BOUNCING BALL
⛹️‍♀️ - U+26F9 U+200D U+2640 WOMAN BOUNCING BALL
👨‍👦‍👦 - U+1F468 U+200D U+1F466 U+200D U+1F466
FAMILY: MAN, BOY, BOY
👩‍👦 - U+1F469 U+200D U+1F466 FAMILY: WOMAN, BOY
👩‍👦‍👦 - U+1F469 U+200D U+1F466 U+200D U+1F466
FAMILY: WOMAN, BOY, BOY
👩‍👧 - U+1F469 U+200D U+1F467 FAMILY: WOMAN, GIRL
👩‍👧‍👦 - U+1F469 U+200D U+1F467 U+200D U+1F466
FAMILY: WOMAN, GIRL, BOY
👩‍👧‍👧 - U+1F469 U+200D U+1F467 U+200D U+1F467
FAMILY: WOMAN, GIRL, GIRL
🪶 - U+1FAB6 FEATHER
💮 - U+1F4AE WHITE FLOWER
🧉 - U+1F9C9 MATE
⛴️ - U+26F4 FERRY
2023-01-17 23:45:32 +00:00
Tim Schumacher
0a563f4943 LibCore: Remove Stream::write_or_error
This was there for compatibility purposes and now it's no longer
needed.
2023-01-17 23:55:34 +01:00
Tim Schumacher
9f92e1bf11 LibProtocol: Remove Request::stream_into(OutputStream&) 2023-01-17 23:55:34 +01:00
Tim Schumacher
2313460b3e pro: Use Core::Stream for writing contents to the output
We also have to do a little dance with file descriptor numbers, since we
can't just `freopen` a `FILE` struct anymore to redirect to the correct
file.
2023-01-17 23:55:34 +01:00
Tim Schumacher
5320ed0fd6 LibProtocol: Use AllocatingMemoryStream to buffer requests 2023-01-17 23:55:34 +01:00
Arda Cinar
8f4c67672c LibGfxDemo: Draw diagonal dotted and dashed lines 2023-01-17 22:54:18 +01:00
Arda Cinar
9418586990 LibGfx: Remove an unnecessary FIXME
Clipping in diagonal line drawing has already been implemented a long
time ago.
2023-01-17 22:54:18 +01:00
Arda Cinar
c8d7bf5449 LibGfx: Implement drawing dotted/dashed diagonal Lines
The implementation simply tracks the number of pixels we have drawn so
far and draws pixels in an on-and-off pattern
2023-01-17 22:54:18 +01:00
Tim Schumacher
add2e2c076 LibCore: Do short forward seeks by discarding bytes from the buffer
This saves us an actual seek and rereading already stored buffer data in
cases where the seek is entirely covered by the currently buffered data.
This is especially important since we implement `discard` using `seek`
for seekable streams.
2023-01-17 21:56:56 +01:00
Tim Schumacher
bdf991fe76 LibCore: Calculate the correct seek offset for buffered streams 2023-01-17 21:56:56 +01:00
Tim Schumacher
caeb772894 SoundPlayer: Specify the total sample count in playback device samples
The current sample count is already reported like that, so this fixes a
mismatch between current and total. In the future, we should look into
abstracting this away properly instead of requiring the user to think of
converting it manually everywhere.
2023-01-17 21:54:23 +01:00
Tim Ledbetter
9c7f4bafdf Assistant: Debounce text input on_change event
This prevents unnecessary queries being executed when pasting text
or typing very quickly. The debounce timeout is 5ms, which is half the
rate at which the UI is updated. Therefore, there should be no
noticable impact on user experience.
2023-01-17 21:52:21 +01:00
Tim Ledbetter
d9aa7eacc6 Assistant: Cache results for each query by provider
Previously, results were cached for each query in a single list.
The majority of CPU time was spent determining which items in the
cache had been seen previously. This commit removes the need to
check previous results by holding a separate list of results for each
provider type.

This makes Assistant feel much more responsive to user input,
especially when the filesystem has a lot of files.
2023-01-17 21:52:21 +01:00
Jelle Raaijmakers
634d1e0197 LibGUI+WindowServer: Improve window resizing performance
The old `GUI::Window` resizing behavior created a new backing store for
each resize event (i.e. every visible window size). This caused a lot of
trashing and on my machine, caused up to 25% of CPU time spent in
creating new backing stores.

The new behavior is a bit more sensible:

  * If the window size is shrinking, the backing store is already large
    enough to contain the entire window - so we don't create a new one.

  * If the window size is growing, as soon as the backing store can no
    longer contain the window, it is inflated with a large margin (of an
    arbitrary chosen 64 pixels) in both directions to accommodate some
    leeway in resizing before an even larger backing store is required.

  * When the user stops resizing the window, the backing store is
    resized to the exact dimensions of the window.

For me, this brings the CPU time for creating backing stores down to 0%.
2023-01-17 18:16:02 +01:00
Aliaksandr Kalenik
45e85d20b6 LibWeb: Output display type inline-table in layout dump 2023-01-17 10:18:33 +01:00
Aliaksandr Kalenik
276a77f02d LibWeb: Support display inline-table
Add support for inline-table display type with corrresponding changes in
tree builder to generate inline anonymous wrapper around inline table
boxes.
2023-01-17 10:18:33 +01:00
Brian Gianforcaro
87b18f9304 Meta: Add dependabot configuration to update github actions 2023-01-16 20:59:23 -08:00
Jonah
569b56e2ad WebDriver: Add computedrole endpoint 2023-01-16 20:32:21 -05:00
Tim Ledbetter
3fb4d50982 PixelPaint: Preserve layer location when copying layers
Location metadata is now included when copying a layer to the
clipboard. This allows a pasted layer to be placed in the location it
was copied from.
2023-01-17 00:36:01 +01:00
Tim Ledbetter
112035d5c3 LibGUI: Allow extra metadata when copying bitmaps to the clipboard 2023-01-17 00:36:01 +01:00
Timothy Flynn
d6ddca0c0f AK+LibUnicode: Provide Unicode-aware String titlecase transformation 2023-01-16 18:33:44 -05:00
Timothy Flynn
bc51017a03 LibUnicode: Support full case folding for titlecasing a string
Unicode declares that to titlecase a string, the first cased code point
after each word boundary should be transformed to its titlecase mapping.
All other codepoints are transformed to their lowercase mapping.
2023-01-16 18:33:44 -05:00
Timothy Flynn
b562348d31 LibUnicode: Generate simple case folding mappings for titlecase
Note we already generate the special case foldings for titlecase.
2023-01-16 18:33:44 -05:00
Timothy Flynn
6d710eeb43 LibUnicode: Add an overload of word segmentation for UTF-8 strings 2023-01-16 18:33:44 -05:00
Tim Schumacher
40cb41a16c LibLine: Do a whole bunch of internal error propagation 2023-01-16 21:04:48 +00:00
Tim Schumacher
f9f1e1dd49 LibLine: Port most functions to Core::Stream 2023-01-16 21:04:48 +00:00
Lucas CHOLLET
0ab29cffd2 LibVirtGPU: Port to Core::Stream 2023-01-16 17:05:41 +00:00
Lucas CHOLLET
2e52de5744 LibCore: Add Stream::File::fd()
Unlike `leak_fd()` the stream is still owning the file descriptor after
the call.
2023-01-16 17:05:41 +00:00
Lucas CHOLLET
c6aeb9811c Spreadsheet: Port to Core::Stream
It also takes advantage of the new, `Core::Stream`-friendly, interface
in `LibFileSystemAccessClient`.
2023-01-16 17:28:32 +03:30
Lucas CHOLLET
81008062a7 Spreadsheet: Port from Result to ErrorOr 2023-01-16 17:28:32 +03:30
Lucas CHOLLET
4952cdfe2b Spreadsheet: Move to a non-owning model for Stream in Writer::XSV 2023-01-16 17:28:32 +03:30
Timothy Flynn
fc413711ee LibJS: Port trivial use cases in the Intl namespace to String 2023-01-16 10:12:37 +00:00
Timothy Flynn
edfdade9e9 LibLocale: Add a method to convert LanguageID to a String 2023-01-16 10:12:37 +00:00
Timothy Flynn
b6b5ddeb3b LibJS: Port StringIterator to String 2023-01-16 10:12:37 +00:00
Timothy Flynn
0d47c4e7a0 LibJS: Port the TrimString AO to String
This also adds spec comments to parseFloat to make it clear that we are
now deviating a bit from the spec (the TrimString invocation should be
infallible, but we want to propagate OOM errors).
2023-01-16 10:12:37 +00:00
Timothy Flynn
4235c59397 LibJS: Add a convenience StringView accessor to PrimitiveString 2023-01-16 10:12:37 +00:00
Timothy Flynn
0a1874c203 AK: Export the OptionalNone helper structure 2023-01-16 10:12:37 +00:00
Brian Gianforcaro
bffc29ae34 LibJS: Fix uninitialized member variable in DurationFormat
Reported-by: PVS Studio
2023-01-16 09:45:46 +01:00
Brian Gianforcaro
bfa890251c Kernel: Fix uninitialized member variable in FATFS Filesystem
Reported-by: PVS Studio
2023-01-16 09:45:46 +01:00
Brian Gianforcaro
19a87fce36 Meta: Disable PVS Studio v1052 static analysis rule in github actions
This rule conflicts with the projects style guide, and ends up being
just a bunch of unnecessary noise. So lets just suppress it.
2023-01-16 09:45:46 +01:00
Aliaksandr Kalenik
7dc0edcb86 LibWeb: Prevent floats from being placed higher than preceding blocks
CSS 2.2 section 9.5.1:
The outer top of a floating box may not be higher than the
outer top of any _block_ or floated box generated by an
element earlier in the source document.

Where block is `BlockContainer` in LibWeb type system.
Which means `current_boxes` need to be cleared before
leaving block container.

```html
<style>
.wrapper {
  width: 100px;
  height: 300px;
  background-color: lightgray;
}

.box {
  margin: 10px;
  width: 50px;
  height: 50px;
  float: left;
}

.a { background-color: salmon; }
.b { background-color: slateblue; }
.c { background-color: green; }
</style>
<div class="wrapper">
	<div class="box a"></div>
	<div class="box b"></div>
</div>
<div class="box c">
</div>
```
2023-01-16 09:45:16 +01:00
Brian Gianforcaro
745883e29b Meta: Add myself to CODEOWNERS 2023-01-16 08:28:38 +01:00
Lucas CHOLLET
07f0873531 Presenter: Disable "Next" and "Previous" actions when non-applicable 2023-01-16 08:28:11 +01:00