Commit graph

59026 commits

Author SHA1 Message Date
Thomas Queiroz 2de9ffa632 Kernel+Tests: Don't panic when LocalSocket is already bound 2024-02-23 09:49:23 +01:00
Hugh Davenport b365356eba Assistant: Check for access before showing file results
Fixing up from #22597.

This change checks whether a file is readable to the user before adding
files to the cache.
2024-02-23 09:48:28 +01:00
Hugh Davenport bba53441ef Assistant: Enable escalation of commands that need it
Ideal for applications such as PartitionEditor. Previously an error
about how it needs to run as root was displayed which differed from
the behaviour when clicking from the system menus.

Use the new AppFile::spawn_with_escalation to perform the escalation
2024-02-23 09:47:27 +01:00
Hugh Davenport 45c35267f6 Taskbar: Use AppFile::spawn_with_escalation 2024-02-23 09:47:27 +01:00
Hugh Davenport c4abb367a4 AppFile: Add spawn_with_escalation 2024-02-23 09:47:27 +01:00
Lucas CHOLLET 83f1775f15 LibGfx/CCITT: Reimplement PassMode in a less naive way
The old implementation of PassMode has only been tested with a single
image, and let's say that it didn't survive long in the wild. A few
cases were not considered:
 - We only supported VerticalMode right after PassMode.
 - It can happen that token need to be used but not consumed from the
 reference line.

 With that fix, we are able to decode every single PDF file from the
 1000-file zip "0000" (except 0000871.pdf, which uses byte alignment).
 This is massive progress compared to the hundred of errors that we were
 previously receiving.
2024-02-22 16:45:03 +01:00
Andreas Kling 883b2268c0 LibJS: Protect private elements from GC during class construction
Fixes an issue caught by test-js -g + UBSAN.
2024-02-22 16:44:54 +01:00
Andreas Kling 4bbb0a5c35 LibJS: Add ConservativeVector<T>
This works very similarly to MarkedVector<T>, but instead of expecting
T to be Value or a GC-allocated pointer type, T can be anything.
Every pointer-sized value in the vector's storage will be checked during
conservative root scanning.

In other words, this allows you to put something like this in a
ConservativeVector<Foo> and it will be protected from GC:

    struct Foo {
        i64 number;
        Value some_value;
        GCPtr<Object> some_object;
    };
2024-02-22 16:44:54 +01:00
Julian Offenhäuser cbecd096c2 Ports: Fix broken syntax in Milkytracker package script 2024-02-22 15:50:13 +01:00
Sönke Holz 06a32b6e16 Kernel/USB: Handle non-page aligned EHCI controller BARs correctly
BARs don't have to be page-aligned. This patch correctly calculates the
needed memory range and register base address in that region.
2024-02-22 07:36:45 +01:00
Aliaksandr Kalenik 9968c9f7a6 LibWeb: Fix hit-testing by excluding CSS transform from clip rect check
Transforms are applied to both clip rectangle and position, so we need
to remove the transform from clip rectangle before checking if position
falls within the clip rectangle.

In this change, the removal of transform is moved into
`Paintable::clip_rect()` that is shared between hit-testing and
painting.

This change fixes hit-testing in Discord's multifactor authentication
form.
2024-02-22 07:36:20 +01:00
Aliaksandr Kalenik 309259aeb6 LibWeb: Clamp scroll offset into valid range after relayout
If the layout has been recalculated and the sizes of scrollable
overflow rectangles could have changed, we need to ensure that scroll
offsets remain within the valid range.
2024-02-22 07:35:30 +01:00
Aliaksandr Kalenik 155070cfd8 LibWeb: Clamp scroll offset to valid range in set_scroll_offset()
By moving scroll offset clamp from `PaintableBox::scroll_by()` to
`PaintableBox::set_scroll_offset()`, we ensure that updates from
`Element::set_scroll_top()` and `Element::set_scroll_left()` are
constrained to a valid range.
2024-02-22 07:35:30 +01:00
Matthew Olsson ee4abacde6 LibWeb: Add AnimationEffect::target_properties() 2024-02-22 07:31:54 +01:00
Matthew Olsson 10fddb99fc LibWeb: Implement Document::remove_replaced_animations() 2024-02-22 07:31:54 +01:00
Matthew Olsson fe848487db LibWeb: Add Document::update_animations_and_send_events 2024-02-22 07:31:54 +01:00
Matthew Olsson 9bab1a95a5 LibWeb: Keep track of AnimationEffect's previous phase and iteration
This will be required for detecting transitions in StyleComputer
2024-02-22 07:31:54 +01:00
Matthew Olsson 35859c0467 LibWeb: Add helpers to convert between FillMode and Direction enums 2024-02-22 07:31:54 +01:00
Nico Weber c9234f35f1 LibPDF/CFF: Clear stack after "endchar" commands
Both type 1 and type 2 spec tell us to do this.

I haven't observed a difference from this, but I noticed it in the
spec while I was touching this code. Probably good to do what the
spec tells us to do.
2024-02-22 06:59:28 +01:00
Nico Weber 020c00ede2 LibPDF/CFF: Use offset in accented_character() data
Without this, the dieresis above an a is all the way to the left
instead of over the letter.
2024-02-22 06:59:28 +01:00
Nico Weber 12859dfde5 LibPDF/CFF: Treat endchar in type 2 as type 2 "seac" when requested
With this, a character can be defined that uses two existing glyphs.
This is useful for umlauts and the like, which then just need to
reference e.g. the glyphs named "a" and "dieresis" and provide a
translation.

Makes umlauts appear on some PDFs using CFF type2 data in Type 1
fonts.
2024-02-22 06:59:28 +01:00
Jelle Raaijmakers b2eaed43e9 Ports: Remove LibGL workarounds
Now that ports can find our OpenGL headers and shared library, remove
all configuration and patches that was previously needed to make ports
compile with LibGL.
2024-02-22 03:48:08 +01:00
Jelle Raaijmakers 857ab2e06d LibGL: Create symlinks for headers and shared library
This allows ports to access the OpenGL headers using `#include
<GL/gl.h>` and find the shared library at `/usr/lib/libGL.so` or
`/usr/lib/libGL.so.1`, removing the need for explicit include paths or
changed library names.
2024-02-22 03:48:08 +01:00
Jelle Raaijmakers 5cff59557e LibGL: Add all glPushAttrib bit flags
This is required to build the `sdl12-compat` port when it's using our
header files to compile.
2024-02-22 03:48:08 +01:00
Tim Ledbetter 3f6f3a90c1 HexEditor: Fix typo in parameter name 2024-02-21 23:32:15 +01:00
Tim Ledbetter f742334b93 HexEditor: Prefer enum class to enum for FindDialog::OptionId 2024-02-21 23:32:15 +01:00
Tim Ledbetter b330d83be4 HexEditor: Prefer ErrorOr to Result in FindDialog 2024-02-21 23:32:15 +01:00
ronak69 a42cf020ea LibTest: Return 0 if all test cases pass and 1 otherwise from TEST_MAIN
Before, TEST_MAIN used to return the return value of TestSuite::main()
function (which returns the number of test cases that did not pass, so
it can be >=256) directly.

The run-tests utility determines the success / failure of a test suite
binary by examining its (or i.e. TEST_MAIN's) exit status.

But as exit status values are supposed to be between 0 and 255, values
>=256 will get wrapped around (modulo 256), converting a return value of
256 to 0.

So, in a rare case where exactly 256 test cases are failing in your test
suite, run-tests utility will display that the test suite passed without
any failures.

Now, TEST_MAIN just returns 0 if all of the test cases pass and returns
1 otherwise.
2024-02-21 22:45:51 +01:00
Tim Ledbetter 1a223d07e1 LibGUI: Assert that most recently open file path isn't empty
Attempting to do this causes a crash. It's better to fail early in this
case, so that the cause of the failure is clear.
2024-02-21 22:37:34 +01:00
Tim Ledbetter ad62e433f0 PixelPaint: Don't crash when cancel is pressed when saving a file
Previously, we were attempting to add an empty string to the most
recently open files list when no file was saved.
2024-02-21 22:37:34 +01:00
Sönke Holz ecf41e13ad Kernel/Graphics: Probe PCI graphics adapters on all architectures 2024-02-21 22:36:00 +01:00
Jelle Raaijmakers e54e2a5a4f Ports: Patch curl CMake issue
The CMake syntax was a bit too new for our toolchain's CMake. The
following patch was backported:

  b2497a8d15

Relevant issue:

  https://github.com/curl/curl/issues/12920

As soon as the fix lands in the next curl version, we can remove this
patch again. :^)
2024-02-21 22:24:42 +01:00
Sönke Holz a203837b1f LibC: Save callee-saved floating-point registers in setjmp for riscv64 2024-02-21 21:59:01 +01:00
Julian Offenhäuser 420c54a21b Ports: Add app category hotkey for Milkytracker
Missing the & caused it to register as a different category entirely.
2024-02-21 21:53:42 +01:00
Dan Klishch 56d355a15e LibWeb: Properly round CSSPixels values in device_to_css_rect
Ceiling width or height of a chrome viewport (this function is only used
when a chrome notifies LibWeb about a new viewport size) is never
correct. If we do that, PageClient::page_did_layout will set content
size to be 1 larger than an actual physical width or height respectively
(it always ceils) and thus a spurious scrollbar will appear.

This prevents occasional scrollbar flickering in Ladybird/Qt on Wayland
with fractional scaling enabled on compositors supporting
wp-fractional-scale-v1.
2024-02-21 20:08:25 +01:00
Timothy Flynn 7bee1c9897 LibWeb: Store the input image button's selected coordinates as integers
The spec has prose which states, e.g., "The x-component must be a valid
integer".
2024-02-21 19:52:59 +01:00
Timothy Flynn 3f3db34587 LibWeb: Support setting dimensions on input image buttons
Users are allowed to specify the height and width of an image button
directly in the HTML.
2024-02-21 19:52:59 +01:00
Matthew Olsson 3ea26327c7 LibWeb: Implement Animatable::get_animations() 2024-02-21 19:52:35 +01:00
Matthew Olsson 145ae54718 LibWeb: Add a few Animation/AnimationEffect getters 2024-02-21 19:52:35 +01:00
Matthew Olsson 06a8674eec LibWeb: Simplify Animation::update_finished_state a bit
This removes the two boolean hack in favor of using the existing
mechanism to remove queued tasks. It also exposes the element
invalidation behavior for call sites that don't necessarily want to
update the finished state, but still need to invalidate the associated
target.
2024-02-21 19:52:35 +01:00
Matthew Olsson 1e37ba5515 LibWeb: Expose Animation::is_finished()
This will be required to handle forward-fill state in StyleComputer
2024-02-21 19:52:35 +01:00
Matthew Olsson 5eea53f27a LibWeb: Keep track of associated AnimationEffects in Animatable 2024-02-21 19:52:35 +01:00
Matthew Olsson 2ade834655 LibWeb: Add Animation::is_replaceable() 2024-02-21 19:52:35 +01:00
Matthew Olsson 4e6c74dcf6 LibWeb: Define the composite order between two animations 2024-02-21 19:52:35 +01:00
Matthew Olsson ceb9d0f8dc LibWeb: Record position of Animations in global animation list
"position of an Animation in the global animation list" is a fancy way
of saying "which animation object was created first"
2024-02-21 19:52:35 +01:00
Matthew Olsson c3b689488e LibWeb: Implement animation class-specific composite order
This is a part of determining the composite order of two animations
2024-02-21 19:52:35 +01:00
Nico Weber 78b3c552c2 LibGfx: Tweak semantics of some SkipTables enum values
It turns out that hmtx and OS/2 table values _are_ used when
rendering OpenType for PDFs: hmtx is used for the left-side bearing
value (which is read in `Painter::draw_glyph()`), and OS/2 is used
for the ascender, which Type0's CIDFontType2::draw_glyph()
and TrueTypeFont::draw_glyph() read.

So instead of not trying to read these tables, instead try to read
them but tolerate them failing to read and ignore them then.

Follow-up to #23276.

(I've seen weird glyph positioning from not reading the hmtx table.
I haven't seen any problems caused by not reading the OS/2 table yet,
but since the PDF code does use the ascender value, let's read that
too.)
2024-02-21 19:52:03 +01:00
Tim Ledbetter 1560bfc6c9 LibWeb: Ensure DOMRect top, bottom, left and right handle NaN correctly 2024-02-21 19:38:17 +01:00
Tim Ledbetter b03c94c26e Tests/LibWeb: Add tests for DOMRect construction 2024-02-21 19:38:17 +01:00
Tim Ledbetter fe66aeb225 LibWeb: Validate arguments when creating DOMPoint from matrix transform
Previously, it was possible to create a DOMPoint from a matrix
transform with inconsistent arguments. A TypeError is now thrown in
this case.
2024-02-21 19:38:17 +01:00