Commit graph

57292 commits

Author SHA1 Message Date
Aliaksandr Kalenik
38d62563b3 LibAccelGfx: Fix stack use after scope in GlyphAtlas::update() 2023-12-17 14:55:41 +01:00
Ali Mohammad Pur
36f0499cc8 LibLine: Use grapheme clusters for cursor management
This makes using the line editor much nicer when multi-code-point
graphemes are present in the input (e.g. flag emojis, or some cjk
glyphs), and avoids messing up the buffer when deleting text, or
cursoring around.
2023-12-16 22:11:43 +01:00
Ali Mohammad Pur
99cc0514a7 LibLine: Don't compare byte and code point counts of the input text
This commit fixes the odd state after pasting some text containing
multibyte code points.
This also increases the input buffer size, as reading 16 bytes at a time
felt slightly laggy when pasting a large number of emojis :^)
2023-12-16 22:11:43 +01:00
Andreas Kling
e28ac74e0b LibWeb: Queue a task to proceed after module map entry finishes fetching
We were doing this synchronously, which was unsafe in that caused us to
re-enter the module map entry setting code while iterating over the
map's entries.

The fix is simply to do what the spec says and queue up a task. This way
the processing gets deferred to a later time.

To avoid stepping into this problem again, I've also added a reentrancy
check in ModuleMap.

This fixes a sporadic crash in HTML::ModuleMap::add() caught by ASAN.
In particular, this was happening regularly on https://shopify.com/
2023-12-16 20:47:16 +01:00
Aliaksandr Kalenik
2753075830 LibWeb: Do not crash when svg mask calculation failed
Currently `calculate_mask()` fails to create bitmap when
`maskContentUnits="objectBoundingBox"` is present.

Fixes https://github.com/SerenityOS/serenity/issues/22316
2023-12-16 19:48:36 +01:00
Aliaksandr Kalenik
4c81414b14 LibWeb: Fix division by zero in auto-fit/fill track calculation in GFC
Fixes https://github.com/SerenityOS/serenity/issues/22319
2023-12-16 19:39:44 +01:00
Aliaksandr Kalenik
4a2a37275e LibAccelGfx: Remove ability to change target canvas in painter
It is easier to build painter assuming target canvas won't change and
we don't use this api anyway :)
2023-12-16 19:39:36 +01:00
Aliaksandr Kalenik
161082e282 LibAccelGfx+LibWeb: Explicitly pass OpenGL context to Painter
Let's not assume there is one global OpenGL context because it might
change once we will start creating >1 page inside single WebContent
process or contexts for WebGL.
2023-12-16 19:39:36 +01:00
Andreas Kling
ed1ade0534 LibJS: Don't crash in CyclicModule::evaluate() when this == m_cycle_root
The spec allows this scenario, so I don't know why we would want to
assert that it doesn't happen.

Fixes #22317

Also, -1 crash, +1 pass on test262 :^)
2023-12-16 19:39:23 +01:00
Sönke Holz
ac79ab0b45 Kernel/riscv64: Specify correct alignment for FPUState struct
The signal handling code (and possibly other code as well) expects this
struct to have an alignment of 16 bytes, as it pushes this struct on the
stack.
2023-12-16 18:21:03 +01:00
Aliaksandr Kalenik
7d757fefeb LibWeb: Remove FIXME if paintable is missing in getBoundingClientRect()
We should not print FIXME when paintable is missing (display: none)
because that means actually we can't to get a rect.
2023-12-16 16:11:15 +01:00
Aliaksandr Kalenik
8f8ec37d58 LibWeb: Add missing paintable null check in get_bounding_client_rect()
Fixes crashing on https://github.com/
2023-12-16 16:11:15 +01:00
Aliaksandr Kalenik
f361b8c000 LibWeb: Make private RecordingPainter::state()
Removes usage of `RecordingPainter::state()` and makes it private.

No behavior change intended.
2023-12-16 15:10:07 +01:00
Aliaksandr Kalenik
55c483b763 LibAccelGfx: Add missing bind_target_canvas() in Painter::clear() 2023-12-16 14:35:47 +01:00
Andreas Kling
1e90379008 LibJS: Introduce "dictionary" mode for object shapes
This is similar to "unique" shapes, which were removed in commit
3d92c26445.

The key difference is that dictionary shapes don't have a serial number,
but instead have a "cacheable" flag.

Shapes become dictionaries after 64 transitions have occurred, at which
point no further transitions occur.

As long as properties are only added to a dictionary shape, it remains
cacheable. (Since if we've cached the shape pointer in an IC somewhere,
we know the IC is still valid.)

Deleting a property from a dictionary shape causes it to become an
uncacheable dictionary.

Note that deleting a property from a non-dictionary shape still performs
a delete transition.

This fixes an issue on Discord where Object.freeze() would eventually
OOM us, since they add more than 16000 properties to a single object
before freezing it.

It also yields a 15% speedup on Octane/pdfjs.js :^)
2023-12-16 14:25:58 +01:00
Timothy Flynn
8255a1a5ee Ladybird/Qt: Enable SQLServer for cookie storage by default
It was disabled by default for issues that have since been fixed.
Primarily: 14091f32c6
2023-12-16 13:32:04 +01:00
Timothy Flynn
acf7044544 Ladybird/Qt: Use RequestServer as the networking backend by default
This will let us find and fix any RequestServer issues more easily. Qt
networking is still available via command line.
2023-12-16 13:32:04 +01:00
Idan Horowitz
662143e0a9 Kernel: Resolve deadlock in MasterPTY due to mutex in spinlock scope
MasterPTY::read called DoubleBuffer::read which takes a mutex (which
may block) while holding m_slave's spinlock. If it did block, and was
later rescheduled on a different physical CPU, we would deadlock on
re-locking m_slave inside the unblock callback. (Since our recursive
spinlock implementation is processor based and not process based)
2023-12-16 12:55:41 +01:00
Idan Horowitz
ab06a76920 Kernel: Resolve lock-inversion based deadlock in MasterPTY & BlockSet
MasterPTY's double buffer unblock callback would take m_slave's
spinlock and then call evaluate_block_conditions() which would take
BlockerSet's spinlock, while on the other hand, BlockerSet's
add_blocker would take BlockerSet's spinlock, and then call
should_add_blocker, which would call unblock_if_conditions_are_met,
which would then call should_unblock, which will finally call
MasterPTY::can_read() which will take m_slave's spinlock.
Resolve this by moving the call to evaluate_block_conditions() out of
the scope of m_slave's spinlock, as there's no need to hold the lock
while calling it anyways.
2023-12-16 12:55:41 +01:00
Aliaksandr Kalenik
4534a43aae Ladybird/Qt: Apply to_content_position after scaling event coordinates
Fixes regression introduced in b73ae80d8b
2023-12-16 12:55:29 +01:00
Nico Weber
f2f07c3a80 LibPDF: Replace if (a) VERIFY(0) with VERIFY(!a)
No behavior change.
2023-12-16 12:39:56 +01:00
Nico Weber
ee74bc2538 LibPDF: Tolerate 0-sized Subrs in PS1 font subprograms
This regressed in 2b3a41be74 in #18031.

Fixes a crash rendering page 2 and onward of
https://pyx-project.org/presentation_dantemv35_en.pdf
2023-12-16 12:39:56 +01:00
Bastiaan van der Plaat
b73ae80d8b LibWeb: Refactor WebContentServer mouse input message to DevicePixel 2023-12-16 11:08:51 +01:00
Bastiaan van der Plaat
1f171cb60b LibWeb: Add support for the meta key modifier 2023-12-15 23:19:23 +00:00
Vladimir Shakhov
e2391105a1 LibWeb: Call process_session_history_traversal_queue on history update
Spec declares that the updates to history should be synchronous on
initial page load and on history pushState/replaceState.
2023-12-15 22:11:49 +01:00
Andreas Kling
9793d69d4f LibWeb: Make HTML::Window::page() return a Page& 2023-12-15 22:04:46 +01:00
Andreas Kling
7c95ebc302 LibWeb: Make Document::page() return a Page&
Now that Document always has a Page, and always keeps it alive, we can
make this return a Page&, exposing various unnecessary null checks.
2023-12-15 22:04:46 +01:00
Andreas Kling
70193c0009 LibWeb: Let Document have a direct GCPtr to its containing Web::Page
With this change, Document now always has a Web::Page. This means we no
longer rely on the breakable link between Document and BrowsingContext
to find a relevant Web::Page.

Fixes #22290
2023-12-15 22:04:46 +01:00
stelar7
b2b5297997 LibWeb: Implement normalize_an_algorithm 2023-12-15 21:37:51 +01:00
stelar7
635ad9e9b8 LibWeb: Use AlgorithmIdentifier in SubtleCrypto IDL 2023-12-15 21:37:51 +01:00
stelar7
d94543f964 LibWeb/IDL/Codegen: Support typedef (A or B) 2023-12-15 21:37:51 +01:00
Idan Horowitz
1bea780a7f Kernel: Reject loading ELF files with no loadable segments
If there's no loadable segments then there can't be any code to execute
either. This resolves a crash these kinds of ELF files would cause from
the directly following VERIFY statement.
2023-12-15 21:36:25 +01:00
Idan Horowitz
2a6b492c7f Kernel: Copy over TLS region size and alignment when forking
Previously we would unintentionally leave them zero-initialized,
resulting in any threads created post fork (but without execve) having
invalid thread local storage pointers stored in their FS register.
2023-12-15 21:36:03 +01:00
Idan Horowitz
b35ebd31a4 Kernel: Include FS & GS in process crash register dump
This is helpful when debugging thread-local-storage related crashes.
2023-12-15 21:36:03 +01:00
Bastiaan van der Plaat
c069ab1ca0 LibWeb: Refactor int types in WebContentServer to DevicePixels 2023-12-15 17:01:16 +01:00
Andreas Kling
8730e56f62 LibWeb: Fix uninitialized value in find_a_potential_indicated_element() 2023-12-15 16:02:52 +01:00
hanaa12G
19f137c1e6 LibLine: Remove duplicate members in CompletionSuggestion
Previously, we stored two representations of the same string in
`CompletionSuggestion` object: one for the bytes and the other for the
code points corresponding to those bytes. To minimize duplication, this
patch combine both representations into a single UTF-8 string, which is
already supported by our new String class.

Following this update, we successfully reduce the size of each object
from 376 bytes to 256 bytes
2023-12-15 16:58:03 +03:30
Ali Mohammad Pur
89877b3f40 RequestServer: Avoid race condition between cached request end/start
Prior to this commit, it was possible to get a socket stuck in a state
with enqueued entries, waiting for a nonexistent request to finish.
This state could be entered by issuing a request immediately after the
completion of another one, and before deferred_invoke execution in the
event loop.

This commit closes this hole by making sure the socket is never in a
state where it can queue requests without an active job.
2023-12-15 09:00:30 +01:00
kleines Filmröllchen
47b6030347 Meta: Replace run.sh by run.py
A Python script is much easier to maintain than the organically grown
variable mess that was run.sh.

For now, the script inherits most environment variable modifiability
from the shell script, but this is not a requirement.

While porting this script, a couple of improvements have been made:
- Spaces (especially in paths) cannot break most arguments anymore.
  Exceptions are environment variables specifying multiple arguments on
  purpose, these should be replaced in the future anyways.
- Force control over virtualization is now possible with
  SERENITY_VIRTUALIZATION_SUPPORT. If set to 0, this variable was
  sometimes ignored before.
- Handling Windows native QEMU is much more robust. Multiple incorrect
  checks for WSL, but not Windows native QEMU, were used before. This
  would also allow disabling native Windows QEMU much more easily in the
  future, which is necessary for GDB.
- Various machine types had wrong or outdated arguments, such as qn.

Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
2023-12-15 00:11:50 +01:00
Torstennator
b61e4e7cd9 PixelPaint: Repaint histogram data when the widget gets resized
This patch enables the histogram to redraw itself when it gets resized
without calculating the data again through the image.
2023-12-14 09:07:20 -07:00
Torstennator
c85c61571c PixelPaint: Make use of DynamicWidgetContainer
This patch adds the new DynamicWidgetContainer for the right panel
elements. This allows the user to collapse, expand or even detach
widgets to a separate window. The collapsed or expanded state is
persisted so that they are restored after application startup.
With this change it is possible to shrink the size of widgets to a
minimum in order to give more space to other currently important
widgets.
2023-12-14 09:07:20 -07:00
Torstennator
b65e711929 LibGUI: Add DynamicWidgetContainter
Add a new widget "DynamicWidgetContainer" that is used to group it's
child widgets within an collapsable and detachable container. The
DynmnicWidgetContainer is able to persist it's view state if a config
domain has been provided. Having that set will allow the widget to
restore it's view state automatically.
2023-12-14 09:07:20 -07:00
Torstennator
38974b4128 LibCore: Allow widgets to reparent 2023-12-14 09:07:20 -07:00
Dan Klishch
8afbeb1892 JSSpecCompiler: Print stderr in test runner if compiler invocation fails 2023-12-14 09:06:05 -07:00
Dan Klishch
8126e76e59 JSSpecCompiler: Compare CFG when running regression tests 2023-12-14 09:06:05 -07:00
Dan Klishch
ce6b987330 JSSpecCompiler: Add --dump-cfg option 2023-12-14 09:06:05 -07:00
Dan Klishch
ff44aea917 JSSpecCompiler: Add control flow building pass 2023-12-14 09:06:05 -07:00
Torstennator
c74e2d04d1 PixelPaint: Fix crash on mouse moves
This pr fixes a problem where the application would crash if the mouse
was moved while the editor was still loading the image. With this
change tool related mouse move events are discarded as long as there is
no active tool.
2023-12-14 09:04:31 -07:00
Torstennator
d462d6280a PixelPaint: Fix initial tool selection
This changes how the initial tool is beeing set on application startup.
With this change the initial tool is set the same way as when the tool
is changed via the frontend. Thus it also updates the tool properties
window which wasn't done before leaving the properties empty as long
the tool was changed for the first time.
2023-12-14 09:04:31 -07:00
Sönke Holz
2b44c4c3f7 Kernel/riscv64: Make the kernel compilable using GCC
This commit adds all necessary includes, so all functions are properly
declared.
PCI.cpp is moved to PCI/Initializer.cpp, as that matches the header
path.
2023-12-14 09:02:15 -07:00