Commit Graph

58732 Commits

Author SHA1 Message Date
Fabian Dellwing
32b07f7057 Kernel: Make ftruncate change st_ctime as per spec
Previously we only modified `st_mtime` but the spec tells
us to do both: https://pubs.opengroup.org/onlinepubs/007908799/xsh/ftruncate.html
2024-02-12 16:27:19 +01:00
Nico Weber
751185cb76 LibPDF: Scale default glyph width by font size and x scale
This fixes rendering of commas in 0000941.pdf page 1. The commas
use the default width, and without this they show up very large,
covering the page.

Also, it's nice that the code now looks like the regular case 4 lines
further up.
2024-02-12 14:32:04 +00:00
Lucas CHOLLET
b9afac0a06 LibGfx/CCITT: Consider the UseFillBits option 2024-02-12 14:08:56 +01:00
Lucas CHOLLET
cbfea68ed8 AK: Add BigEndianInputBitStream::bits_until_next_byte_boundary() 2024-02-12 14:08:56 +01:00
Lucas CHOLLET
9ae17e3a7a LibGfx/CCITT: Align the output stream on byte-boundary after each line
This makes the CCITT decoder in line with what the TIFF decoder is
expecting.
2024-02-12 14:08:56 +01:00
Nico Weber
7ab4e53b99 LibPDF/CFF: Add code for fdselect parsing
This is one of the two top dict entries we need for CID-keyed fonts.
We don't send any CID-keyed font data into the CFF parser yet,
so no behavior change.
2024-02-12 14:05:16 +01:00
Nico Weber
6ebddab448 LibPDF/CFF: Add enum values for CID-keyed font top dict entries
No behavior change.
2024-02-12 14:05:16 +01:00
Nico Weber
6df0150671 LibPDF: Add some CIDFontType0C scaffolding
No real behavior change. We don't actually load the CFF data yet
(blocked on #23136 and some more), and we don't have drawing code
yet, and Type0Font::draw_string() doesn't do any drawing yet.

But it's a step in the right direction.
2024-02-12 13:59:00 +01:00
Aliaksandr Kalenik
95d91a37d2 LibWeb: Resolve outline CSS property before paint commands recording
Refactor to resolve paint-only properties before painting, aiming to
stop using layout nodes during recording of painting commands.

Also adds a test, as we have not had any for outlines yet.
2024-02-12 13:38:24 +01:00
MacDue
f19b17e089 LibWeb: Use paths for text in CRC2D (if possible)
This allows for:

  * Transformed text (e.g. rotated text)
  * Stroked text
  * Filling/stroking text with PaintStyles (e.g. gradients)
  * Squashed/condensed text (via maxWidth parameter)

Fixes part of #22817
2024-02-12 13:38:10 +01:00
Tim Ledbetter
774119bb57 LibWeb: Implement document.designMode
Setting this attribute to "on" makes the entire document editable.
2024-02-12 07:35:14 +01:00
Sam Atkins
c9fb3e07d2 BrickGame: Make action shortcuts work when the game is paused
We previously never called event.ignore(), so the keydown event for F2
or F11 etc would be consumed by the BrickGame widget instead of
bubbling up. Now you can start a new game, or escape fullscreen mode,
even if you've paused the game. :^)
2024-02-11 21:13:06 +00:00
Nico Weber
986872800e Tests/AK: Add a test for the array ctor deduction guide 2024-02-11 18:53:00 +01:00
Nico Weber
d84b69ace9 AK: Add to_array()
This is useful if you want an array with an explicit type but still
want its size to be inferred.
2024-02-11 18:53:00 +01:00
Nico Weber
10216e1743 AK: Remove a stray static
No behavior change.
2024-02-11 18:53:00 +01:00
Nico Weber
4409b33145 AK: Make IndexSequence use size_t
This makes it possible to use MakeIndexSequqnce in functions like:

    template<typename T, size_t N>
    constexpr auto foo(T (&a)[N])

This means AK/StdLibExtraDetails.h must now include AK/Types.h
for size_t, which means AK/Types.h can no longer include
AK/StdLibExtras.h (which arguably it shouldn't do anyways),
which requires rejiggering some things.

(IMHO Types.h shouldn't use AK::Details metaprogramming at all.
FlatPtr doesn't necessarily have to use Conditional<> and ssize_t could
maybe be in its own header or something. But since it's tangential to
this PR, going with the tried and true "lift things that cause the
cycle up to the top" approach.)
2024-02-11 18:53:00 +01:00
Tommy van der Vorst
1c7ec9c770 LibWeb: Ignore repeat(auto-fit/auto-fill, auto) as it is not allowed 2024-02-11 17:51:50 +01:00
Nico Weber
8e7cb11856 LibPDF/CFF: Add enum values for remaining PrivDictOperators
No behavior change, except that we now dbgln() if we see a
PrivDictOperator we don't know about. (I haven't seen this in
practice, but I found this useful while debugging things.)
2024-02-11 14:52:54 +01:00
ronak69
7833dc0f5a LibLine: Add internal functions to search character forwards & backwards 2024-02-11 08:50:51 +01:00
ronak69
ff33f00d16 LibVT: Ability to generate each of the 32 ASCII control characters
Before, it was only possible to generate 27 control characters (from ^A
to ^Z, and ^\) (with only one possible key combination).

Now, the remaining 5 (^@, ^[, ^], ^^, and ^_) can also be generated with
control plus key combinations. :^)

Also added are the legacy aliases supported by most terminals:

    Ctrl+{2, Space} -> ^@ (NUL)
    Ctrl+3 -> ^[ (ESC)
    Ctrl+4 -> ^\
    Ctrl+5 -> ^]
    Ctrl+6 -> ^^
    Ctrl+7 -> ^_
    Ctrl+8 -> ^? (DEL)
    Ctrl+/ -> ^_

Note that now, one extra key combination corresponding to a character
that shares the same least significant five bits with the original
character (used in caret notation) can also generate a control
character. For example, in the US English keyboard layout both Ctrl+[
and Ctrl+{ (same as Ctrl+Shift+[) will generate the Escape control
character (^[).
2024-02-11 08:50:51 +01:00
ronak69
cb02d52ac9 LibLine: Add internal function to erase consecutive spaces under cursor 2024-02-11 08:50:51 +01:00
Tim Ledbetter
7f2582fca9 LibWeb: Update the cursor position when an editable element is clicked
With this change, clicking on an editable element, such as an `input`
or `textarea` causes the cursor position to be updated to the current
mouse position.
2024-02-11 08:15:38 +01:00
Aliaksandr Kalenik
d4932196cc LibWeb: Account for all clipped border radii in containing block chain
With this change, instead of applying only the border-radius clipping
from the closest containing block with hidden overflow, we now collect
all boxes within the containing block chain and apply the clipping from
all of them.
2024-02-11 08:12:31 +01:00
Aliaksandr Kalenik
1ae416fa94 LibWeb: Add compute_combined_css_transform() for PaintableBox
This prepares for upcoming changes where the code that finds combined
CSS transform will be reused in `clear_clip_overflow_rect()`.
2024-02-11 08:12:31 +01:00
MacDue
080d9ec246 LibWeb: Invalidate layout after setting SVG transform attribute 2024-02-11 08:10:45 +01:00
MacDue
1d999fa780 LibWeb: Return milliseconds from unsafe_shared_current_time()
This was incorrectly changed to returning seconds in fc5cab5, which
meant the time passed to the callbacks of requestAnimationFrame() was
wrong.
2024-02-11 08:10:45 +01:00
MacDue
38855de829 LibWeb: Use 'now' from EventLoop for animation frame callbacks
Previously, 'now' was set to the time `requestAnimationFrame()` was
called, and the EventLoop's 'now' was ignored. This was a little odd and
meant the time was always in the past.
2024-02-11 08:10:45 +01:00
Tim Ledbetter
0577a664dd LibWeb: Use correct offset value when replacing character data
Previously, the range's end offset was being set using it's previous
value.
2024-02-10 11:18:51 +01:00
Aliaksandr Kalenik
40246adfb9 LibWeb: Add internals.wheel() to simulate mouse wheel events
This function allows us to write tests for scrolling scenarios where
the events are processed by the EventHandler.
2024-02-10 11:18:40 +01:00
Idan Horowitz
e38ccebfc8 Kernel: Stop swallowing thread unblocks while process is stopped
This easily led to kernel deadlocks if the stopped thread held an
important global mutex (like the disk cache lock) while blocking.
Resolve this by ensuring stopped threads have a chance to return to the
userland boundary before actually stopping.
2024-02-10 08:42:53 +01:00
Idan Horowitz
458e990b7b Kernel: Stop locking the scheduler spinlock before the ptrace mutex
Locking a mutex while holding a spinlock is always wrong, but in the
case of the scheduler lock, it also causes an assertion failure. (Which
would be triggered by 2 separate threads trying to ptrace at the same
time).
2024-02-10 08:42:53 +01:00
Idan Horowitz
03cb3e5370 Kernel: Move NVMeQueue's m_cq_lock to NVMePollQueue
It's only used by that subclass, so there's no reason for it to be
defined as part of the parent class.
2024-02-10 08:42:53 +01:00
Idan Horowitz
45aee20ea9 Kernel: Switch to SpinlockProtected to protect NVMeQueue's requests map
This helps ensure no one accidentally accesses m_requests without first
locking it's spinlock. In fact this change fixed such a case, since
process_cq() implicitly assumed the caller locked the lock, which was
not the case for NVMePollQueue::submit_sqe().
2024-02-10 08:42:53 +01:00
Idan Horowitz
263127f21a Kernel: Actually report nvme request status
Due to an incorrect lambda scope capture declaration, we would copy the
result status at the start of the function, before it actually got
updated with the final status. Capture it by reference instead to
ensure we report the updated result.
2024-02-10 08:42:53 +01:00
Idan Horowitz
38dad2e27f Kernel: Replace bespoke & rickety NVMeIO synchronization mechanism
Instead of assuming data races won't occur and trying to somehow verify
it with manual un-atomic tracking, we can just use a recursive spinlock
instead of a normal one, to resolve the original deadlock.
2024-02-10 08:42:53 +01:00
Idan Horowitz
a957907f4b Kernel: Merge NVME Queue complete_current_request implementations
Most of the actual logic is identical, with the only real difference
being that one wraps it with an async work item.
Merge the implementations to reduce duplications (which will also
require the fixes in the next commits to only be done once).
2024-02-10 08:42:53 +01:00
Refrag
4fbc701721 Ports: Add Sonic Robo Blast 2
This commit adds Sonic Robo Blast 2, a Sonic fangame running with SDL2
to the list of SerenityOS game ports.
The game is working fine for the most part but there's some performance
issues and the mouse never resets to the center so it gets stuck in the
window's corners. It seems like the multiplayer / networking is also
not quite working but I think that this is very cool already.
2024-02-09 23:10:18 +01:00
Tim Ledbetter
a580118e53 Kernel/HID: Set Caps Lock state before doing code point remapping
This restores Caps Lock functionality, while still ensuring that
shortcut keys are remapped correctly.
2024-02-09 12:28:08 -07:00
Sam Atkins
c6e5581682 HexEditor: Include annotation text in the "Delete annotation?" dialog
It's helpful to have some description of what you're deleting. :^)

40 characters is chosen completely arbitrarily, but seems reasonable.
2024-02-09 17:00:15 +00:00
Sam Atkins
56eb45ccbc HexEditor: Add toolbar and context menus to the Annotations panel
The Annotations panel is the most obvious place to perform actions
related to annotations, so let's make that possible. :^)

The toolbar gets open/save/save-as actions for annotations, and one for
adding an annotation. The table itself gets a context menu for editing
or deleting the selected annotation.
2024-02-09 17:00:15 +00:00
Sam Atkins
a5d11c0a26 HexEditor: Convert panels to DynamicWidgetContainer
This lets the user swap them around and pop them out as separate windows
as desired. We do lose the ability to individually resize them though,
until DynamicWidgetContainer supports that.
2024-02-09 17:00:15 +00:00
Sam Atkins
6850ef9014 HexEditor: Respond to font changes 2024-02-09 16:59:02 +00:00
Sam Atkins
3318563ad9 HexEditor: Size the offset area based on the text width
This gets rid of the last use of the offset_margin_width() magic number.

I initially tried using `character_width() * 10` and found it was not
accurate enough with between-character spacing, so instead this measures
a specific string. All offset strings should be the same width in a
fixed-width font.
2024-02-09 16:59:02 +00:00
Sam Atkins
0fdbdc5084 HexEditor: Use glyph_fixed_width() for character width 2024-02-09 16:59:02 +00:00
Sam Atkins
d3012f2df1 HexEditor: Share the code for updating the content size
And make setting the bytes_per_row a no-op if it's the same value.
2024-02-09 16:59:02 +00:00
Sam Atkins
db23d0f464 HexEditor: Save and reuse horizontal positions when painting 2024-02-09 16:59:02 +00:00
Sam Atkins
60f52aa0ef HexEditor: Save and reuse vertical positions when painting rows
Rather than repeatedly calculating the same y offset over and over,
calculate it once per row, and re-use that result.
2024-02-09 16:59:02 +00:00
Sam Atkins
4af565362c HexEditor: Remove redundant checks in offset_at()
Neither of these is possible based on the if statement above them.
2024-02-09 16:59:02 +00:00
Sam Atkins
ca3f21f273 HexEditor: Account for padding in offset_at()
Compare the x position with the start of the hex characters, which is
m_padding pixels to the right of hex_start_x. (And the same for the
text characters.) If the position is within the padding area, clamp it
so it's on the nearest character.

This was previously covered-up somewhat by using the buggy
m_address_bar_width value to calculate the start and end x positions of
these areas. Fixing that in the previous commit made this more obvious.
2024-02-09 16:59:02 +00:00
Sam Atkins
c4dc150ed7 HexEditor: Extract some content-width calculations
We repeat the same calculations a lot, and it's easy to make mistakes.

m_address_bar_width and offset_margin_width() have basically the same
purpose, but both are a little wrong. This removes the former, but
we'll get to the latter soon.
2024-02-09 16:59:02 +00:00