Commit graph

21209 commits

Author SHA1 Message Date
FrHun
9d3debcbbe Magnifier: Remember grid color 2022-12-23 12:16:46 +00:00
FrHun
79f5c49afe Magnifier: Eliminate flickering when downsizing
Previously the content flickered when downsizing the window, because the
previously grabbed frame was still active, but was now too large for the
window.
This crops the source rect to a size where it now perfectly fits the
content area.
2022-12-23 12:16:46 +00:00
FrHun
6187cfec49 WindowServer: Remove overcropping for magnifier
This function is only used by the magnifier currently.
Since we now apply the scaling factor in Bitmap::cropped(), this is not
necessary anymore.
2022-12-23 12:16:46 +00:00
FrHun
4236177e4f LibGfx: Preserve scale on Bitmap crop 2022-12-23 12:16:46 +00:00
FrHun
cf47dae6a5 LibGfx: Repair SharableBitmap scaling support 2022-12-23 12:16:46 +00:00
FrHun
9e0deb76b2 Magnifier: Prevent 0 size that otherwise hangs 2022-12-23 12:16:46 +00:00
FrHun
808eafcf1e Magnifier: Add option to choose grid color 2022-12-23 12:16:46 +00:00
FrHun
2b635b5330 Magnifier: Add option to display grid over the image 2022-12-23 12:16:46 +00:00
FrHun
df30440117 LibGfx: Add NearestFractional scaling type to painter
This is useful for cases where you want to avoid scaling artifacts.
2022-12-23 12:16:46 +00:00
FrHun
837625e422 Magnifier: Allow locking location at current cursor position 2022-12-23 12:16:46 +00:00
FrHun
6d4e37138e WindowServer: Allow overriding position when getting bitmap 2022-12-23 12:16:46 +00:00
Optimoos
d856dae07c Spreadsheet: Allow Functions Help HorizontalSplitter to resize
Using set_fixed_width prevents the splitter from resizing, so it has
been changed to set_preferred_width. Added a FIXME that I'm not
familiar enough with the codebase to tackle yet.

This addresses issue #16589
2022-12-23 07:53:26 +00:00
Sam Atkins
29733e65f8 AK+Everywhere: Replace all Bitmap::must_create() uses with ::create()
Well, *someone* has to add some more FIXMEs to keep FIXME Roulette
going. :^)
2022-12-22 15:48:53 +01:00
Karol Kosek
ba60b01026 HackStudio: Fix typo in one error message
A regression from 4784ad66b2. oops.
2022-12-21 19:05:13 +00:00
Karol Kosek
917e32d31a uptime: Port to Core::Stream::File, use AK::human_readable_time() 2022-12-21 08:41:34 +00:00
Kemal Zebari
1dddefa737 Browser: Introduce action for opening bookmarks in a new window
This change introduces an action to bookmarks that allows them to be
opened in a new browser window. This is done by accessing any
bookmark's context menu and pressing "Open in New Window".
2022-12-21 08:34:08 +00:00
Andreas Kling
abad197884 LibGfx/OpenType: Read "glyf" table header using a C++ struct 2022-12-21 08:44:22 +01:00
Andreas Kling
2185a98b36 LibGfx/OpenType: Clean up "kern" table reading
- Use C++ structs for the header and subtable headers.
- Use AK::binary_search to search for kerning pairs.
2022-12-21 08:44:22 +01:00
Andreas Kling
afba67f3a2 LibGfx/OpenType: Clean up "name" table reading
Use a C++ struct to read out the header, and make the rest of the code
more idiomatic.
2022-12-21 08:44:22 +01:00
Andreas Kling
5d8feab131 LibGfx/OpenType: Read "os2" table using a C++ struct 2022-12-21 08:44:22 +01:00
Andreas Kling
e6551e685d LibGfx/OpenType: Clean up "htmx" table reading
Use a C++ struct to read out the LongHorMetrics, and make the rest of
the code more idiomatic.
2022-12-21 08:44:22 +01:00
Andreas Kling
f04a878e55 LibGfx/OpenType: Read "maxp" table using a C++ struct 2022-12-21 08:44:22 +01:00
Andreas Kling
d201acf102 LibGfx/OpenType: Read "hhea" table using a C++ struct 2022-12-21 08:44:22 +01:00
Andreas Kling
61be11960b LibGfx/OpenType: Read "head" table using a C++ struct
Instead of fidgeting with offsets and manually reading out big-endian
values, we now declare the "head" table as a C++ struct and use the
BigEndian<T> template to deal with byte order.
2022-12-21 08:44:22 +01:00
Andreas Kling
23638a3b3a LibGfx/OpenType: Add spec links to classes representing OpenType tables 2022-12-21 08:44:22 +01:00
Andreas Kling
f982400063 LibGfx: Rename TTF/TrueType to OpenType
OpenType is the backwards-compatible successor to TrueType, and the
format we're actually parsing in LibGfx. So let's call it that.
2022-12-21 08:44:22 +01:00
Alexander Narsudinov
03107d4028 FileManager: Handle possible ByteBuffer allocation failure
Before this patch we created ByteBuffer with the help of the
VERIFY macro that could cause a crash of FileManager
in case of memory allocation failures.

Now we propagate the error to a caller instead of using the
`release_value_but_fixme_should_propagate_errors()` method.
2022-12-20 11:04:44 +01:00
Andrew Kaster
4ed5520e3e ntpquery: Explicitly zero initialize msghdr and fill in fields
Rather than trying to use designated initializers, zero init the
msghdr variable and fill in its fields. This makes sure to zero-init any
padding bytes, and fixes a compilation error on musl-libc based systems.
2022-12-20 11:04:05 +01:00
Andrew Kaster
0d813ee519 LibThreading: Remove unused include of <sys/cdefs.h>
This file is not needed here, and causes a compile issue on musl-libc
based distributions. We should only be including this file in LibC, for
the most part anyway.
2022-12-20 11:04:05 +01:00
Andrew Kaster
61573caf53 LibELF: Include <pthread.h> to ensure PTHREAD_STACK_MAX is available
Android's bionic C library puts this definition in pthread.h rather than
limits.h
2022-12-20 11:04:05 +01:00
MacDue
a9ea0ee9af LibWeb: Fix passing size/position to paint_radial_gradient()
This was wrong twice making it right... But let's fix that.

The center was being passed as a DevicePixelPoint, but was in fact in
CSS pixels, the size was passed as a Gfx::FloatSize but was in
CSS pixels again. Then we were scaling from device pixels to CSS pixels
when painting which does not need to be done if everything is passed
which the correct scale factors already applied.
2022-12-20 11:03:18 +01:00
MacDue
6c27f2c071 LibGfx: Don't blend opaque pixels 2022-12-20 11:03:18 +01:00
MacDue
e3c64a0858 LibGfx: Remove unnecessary divides in Color::mixed_with()
This is mathematically the same thing, but the compiler can't optimize
these out without -Ofast, so let's give it a hand.
2022-12-20 11:03:18 +01:00
Karol Kosek
4784ad66b2 HackStudio: Port to Core::Stream::File :^) 2022-12-20 10:58:54 +01:00
Karol Kosek
697d6ffb1d LibDiff: Make Diff::generate_only_additions take text as StringView 2022-12-20 10:58:54 +01:00
Alexander Narsudinov
ce2ed7615a LookupServer: Propagate the errors from MulticastDNS::handle_packet()
This is a bit awkward, but I think it is better to make the caller
deal with possible errors.
2022-12-20 10:45:20 +01:00
Alexander Narsudinov
e279a1723b LookupServer: Propagate the errors from MulticastDNS::lookup()
This patch slightly change the signature of lookup() method
and propagates all the errors to the caller with help of ErrorOr.
2022-12-20 10:45:20 +01:00
Alexander Narsudinov
767529ebf5 LibCore: Make UDPServer::receive() return ErrorOr<ByteBuffer>
This is a first step towards handling OOM errors instead of just
crashing the program.

Now UDPServer's method `receive()` return memory allocation
errors explicitly with help of ErrorOr.

This removes one FIXME and make a bunch of new ones. :(
2022-12-20 10:45:20 +01:00
implicitfield
9ae9d82a03 unzip: Use StringView instead of DeprecatedString 2022-12-20 10:44:02 +01:00
implicitfield
a520894522 unzip: Verify extracted files against CRC32 checksums
This removes one TODO.
2022-12-20 10:44:02 +01:00
Jelle Raaijmakers
2da1c1c10e LibGL: Generate the API wrappers
We now generate all LibGL API wrappers from a single API method
definition list stored in `GLAPI.json`. Since a significant portion of
the OpenGL API methods are relatively consistent variants, we take
advantage of this to generate a lot of these variants at once.

The autogenerated methods check for the non-nullness of the current
`GLContext`, and only perform an action if a `GLContext` is present.
This prevents a crash in ports like GLTron, who assume you can still
call the OpenGL API without an active context.

This increases our API wrapper method count from 211 to 356.

Fixes #15814.
2022-12-20 10:42:31 +01:00
Jelle Raaijmakers
8c094699db LibGL: Implement glLightModel integer normalization
For the ambient light model, integers need to be remapped to a range of
`-1.` through `1.`. Add the `+` and `-` operators to `VectorN` to make
it a bit easier to normalize 4 values at once.
2022-12-20 10:42:31 +01:00
Jelle Raaijmakers
a074b7e871 LibGL: Support glLightModel inside lists
We now dereference the pointer given to us before adding the arguments
to an active list. This also factors out the switching logic from the
API wrappers, which helps us with a future commit where we autogenerate
all API wrapper functions.
2022-12-20 10:42:31 +01:00
Jelle Raaijmakers
403c560a7a LibGL: Correct GL_LIGHT_MODEL_LOCAL_VIEWER comparison
We were comparing the `x` parameter to `1.f` instead of `0.f`.
2022-12-20 10:42:31 +01:00
Jelle Raaijmakers
6d68f47495 LibGL: Dereference pointer in a consistent way for glMaterial* 2022-12-20 10:42:31 +01:00
Jelle Raaijmakers
7c4bbdc398 LibGL: Simplify transposing input matrices
We do not need to templatize the output type - it's always `float`.
Also, the input type can be inferred. Finally, use template
specialization instead of a conditional to deal with same type input and
output matrices.
2022-12-20 10:42:31 +01:00
Cnidarias
0ca1247a7f PixelPaint: Propagate errors when creating images or layers
This fixes a dozen release_value_but_fixme_should_propage_errors
2022-12-20 10:42:11 +01:00
Jelle Raaijmakers
25f2e4981c AK: Stop using DeprecatedString in Base64 encoding 2022-12-20 10:34:19 +01:00
Baitinq
75ea339ee9 LibGUI: Fix bug in the ColorPicker's spinbox not changing colors
Before this patch, when having the initial spinbox color value
(Color::White), if you changed the color value in the vertical color
picker it didn't update the spinbox's colors.

This is fixed by manually calling update() in the color picker's
onchange() handler if the new color is equal to the previous color,
which is the case in the initial spinbox's case as it will always be
white unless it is changed (and won't be affected by the vertical
color picker).

I added a NOTE in the source to explain this "opaque" update() call :))
2022-12-20 10:30:06 +01:00
Rodrigo Tobar
89061883f2 PDFViewer: Prompt password for encrypted documents
This tackles a FIXME, but also makes sense to implement only now that
the SecurityHandler logic has been fixed. When a Document is created an
automatic attempt is made to provide the empty string as the password;
even if this attempt failed the SecurityHandler still reported it had a
user password, hence we never arrived to the VERIFY_NOT_REQUIRED line
this commit is changing.
2022-12-20 10:28:58 +01:00
Rodrigo Tobar
bb48a67f84 LibPDF: Reset encryption key on failed user password attempt
When an attempt is made to provide the user password to a
SecurityHandler a user gets back a boolean result indicating success or
failure on the attempt. However, the SecurityHandler is left in a state
where it thinks it has a user password, regardless of the outcome of the
attempt. This confuses the rest of the system, which continues as if the
provided password is correct, resulting in garbled content.

This commit fixes the situation by resetting the internal fields holding
the encryption key (which is used to determine whether a user password
has been successfully provided) in case of a failed attempt.
2022-12-20 10:28:58 +01:00
Rodrigo Tobar
dc6a11cf6b LibPDF: Treat Encyption's Length item as optional
With the StandardSecurityHandler the Length item in the Encryption
dictionary is optional, and needs to be given only if the encryption
algorithm (V) is other than 1; otherwise we can assume a length of 40
bits for the encryption key.
2022-12-20 10:28:58 +01:00
Rodrigo Tobar
b8dc05a08e PDFViewer: Fix indexing error in ErrorsView
I confused myself when implementing this, plus I tested using pages that
had errors in pages 1 and 2, so the index and the number of the page
(internally represented as 0-indexed) was always the same. When opening
files with errors on higher pages it became evident that there was an
issue with how I was reading the errors per page from the corresponding
ModelIndex object.
2022-12-20 10:28:58 +01:00
Bruno Conde
7e9019a9c3 LibGfx: Support BMP favicons with less than 32 bpp
Adapt BMPImageDecoderPlugin to support BMP images included in ICOns.
ICOImageDecoderPlugin now uses BMPImageDecoderPlugin to decode all
BMP images instead of it's own ad-hoc decoder which only supported
32 bpp BMPs.
2022-12-20 10:26:55 +01:00
thankyouverycool
91609f9327 FontEditor: Update preview window after pasting and deleting glyphs 2022-12-20 10:22:27 +01:00
thankyouverycool
96d7964913 FontEditor: Add Unicode block/glyph selection Statusbar Segment
Displays the current active Unicode block range, or, if multiple
glyphs are selected, their count. Clicking toggles the Unicode
block ListView.
2022-12-20 10:22:27 +01:00
thankyouverycool
40e94a315a LibGUI+FontEditor: Restore normalized selections on Undo/Redo
Selections are always normalized when saving undo commands.
The restore_selection() function reverses this process so
negatively sized selections (created right-to-left) continue
to resize correctly with the keyboard when restored.
2022-12-20 10:22:27 +01:00
thankyouverycool
02212f373b LibGUI: Reset GlyphMapWidget scroll value when changing active range
Fixes being teleported to the old location when scrolling on a
previously browsed range.
2022-12-20 10:22:27 +01:00
thankyouverycool
d973d43b13 LibGUI: Focus the actively resizing end of GlyphMapWidget selections 2022-12-20 10:22:27 +01:00
thankyouverycool
673afffd5a LibGUI: Only reset GlyphMapWidget selection on Escape
and when using unmodified arrows.
2022-12-20 10:22:27 +01:00
thankyouverycool
4c81fbc8c4 LibGUI: Add Page{Up,Down} support for GlyphMapWidget 2022-12-20 10:22:27 +01:00
thankyouverycool
a98d5c52f8 LibGUI: Improve visible glyph estimate in GlyphMapWidget
Previously the widget used a very rough estimate for visible glyphs
based on viewport and glyph areas. Now it simply figures rows times
columns with a two row overdraw to accommodate fractional glyphs
on either end of visible content. For KaticaRegular10, this ends up
reducing unnecessary glyph iterations during painting by about 30%.
2022-12-20 10:22:27 +01:00
thankyouverycool
e34503800c LibGUI: Adjust GlyphMapWidget content sizing and glyph padding
Fixes a slightly oversized content rect and erroneous glyph outer
rect values. Increases glyph rect padding to guarantee at least 1px
between the focus rect and glyph.
2022-12-20 10:22:27 +01:00
thankyouverycool
0f5ce017c5 LibGUI: Implement calculated_min_size() for GlyphMapWidget 2022-12-20 10:22:27 +01:00
thankyouverycool
c4ac73d073 LibGUI: Check bounds when moving GlyphMapWidget selections
Fixes crashing on invalid code points when creating selections
with the keyboard and applying actions to them.

Also adds Home/End key support for selections. Ctrl+Shift+{Home,End}
now extends the selection to the beginning or end of the active range,
respectively. Shift+{Home,End} extends the selection to the start or
end of the row. Alt+{Home,End} resets the selection and moves the
active glyph to the beginning or end of the active range.
2022-12-20 10:22:27 +01:00
thankyouverycool
12cd30f1ac LibGUI: Ensure GlyphMapWidget selection resets when requested
Previously selection reset was ignored on active glyph change if the
old glyph equaled the new one. This was an intentional behavior that
allowed selections to resize by dragging the focused glyph, but has
proved more counterintuitive than useful.

Now the widget behaves like other text selection controls: selections
can be reset by clicking anywhere in them or shift can be held to
grow the selection.
2022-12-20 10:22:27 +01:00
thankyouverycool
360e58a276 LibGUI: Disallow GlyphMapWidget selection sizes equal to zero
This is a bogus size as the map must always have at least 1 glyph
selected, and it was causing occasional desync between selection
contents and the focused glyph when manipulating selections with
the keyboard.
2022-12-20 10:22:27 +01:00
thankyouverycool
8d3f60c7ef LibGUI: Forward GlyphMapWidget Key_Tab events
Allows focus to be passed using the keyboard.
2022-12-20 10:22:27 +01:00
thankyouverycool
61d214eab1 FontEditor: Set Unicode ListView's focus proxy to its search box
Provides a visual cue that arrow key input is shared between these
widgets.
2022-12-20 10:22:27 +01:00
thankyouverycool
b8969ffe97 FontEditor: Remove unused includes 2022-12-20 10:22:27 +01:00
Karol Kosek
9b3335723f TextEditor: Suggest saving new files with an extension from highlighter 2022-12-19 14:13:50 -05:00
Karol Kosek
c75bfa9cda LibSyntax: Add common_language_extension() function
The main motivation for this is to prefill an extension for user when
saving a new file.
2022-12-19 14:13:50 -05:00
Karol Kosek
fb61b3d41d LibSyntax: Remove default switch case in language_to_string()
This way we can get a compiler error about unhandled new language cases,
instead of a possible crash when running a program.

Also added a missing case to make it build now.
2022-12-19 14:13:50 -05:00
Karol Kosek
b00865bce5 LibSyntax+TextEditor: Move Highlighter::language_string() out of class 2022-12-19 14:13:50 -05:00
Baitinq
3c2227ceed Snake: Ignore default keydown events
Before this patch, all key down events except arrow keys or WASD were
not propagated, so keyboard shortcuts in the application didn't work.

This patch fixes this :))
2022-12-19 14:11:53 -05:00
Baitinq
89c6d41e9c Snake: Add snake color chooser game menu action
This patch makes use of a new "set_snake_base_color()" function to
change the snake's base color to the picked value.
2022-12-19 14:11:53 -05:00
Baitinq
56a75ec94e Snake: Don't hardcode the snake painting logic
This patch adds a m_snake_base_color variable which dictates the color
of the head of the snake and from which the rest of the snake color's
are derived from by darkening the base color.
2022-12-19 14:11:53 -05:00
Baitinq
b354e858c8 Snake: Add pause/continue game menu action
This patch adds an action in the Snake's game menu that allows for easy
pausing/unpausing of the game state.

In order to do this, the commit adds new pause()/start() functions in
the SnakeGame class ;)
2022-12-19 14:11:53 -05:00
MacDue
3de5dcf383 Browser+WebContent: Fixup some DOM inspector weirdness
This fixes a few things I noticed whilst working on the inspector
for Ladybird.

1.
The computed and resolved values were being passed swapped around
from the inspect_dom_node() IPC call. I.e. computed values were
passed as resolved values and vice versa. This was then fixed by
swapping them again in the InspectorWidget (two errors canceled out).

2.
Resolved values were called "specified values" seemingly only in the
inspect_dom_node() IPC calls. This was a little confusing so I've
renamed them to back to "resolved values" for consistency.

3.
The inspector took and stored the DOM JSON strings unnecessarily,
all the models immediately parse the JSON and don't need the strings
to hang around.
2022-12-19 11:37:56 -05:00
MacDue
e3ad5731f7 Browser: Close inspectors and JS console when tab closes
Keeping these around can lead to use-after-frees and crashes.
2022-12-19 11:37:56 -05:00
MacDue
88e50869f1 LibWeb: Fix crash when serializing nodes for DOM inspector
Noticed this trying to inspect GitHub, you'd get a segfault due to the
parent node being null here.
2022-12-19 11:37:56 -05:00
implicitfield
39fc7359d4 FileManager: Clear the selection after deleting files 2022-12-19 08:03:24 -05:00
Keir Davis
f639445456 LibWeb: Fully Implement get_an_elements_noopener
This removes two fix me in HTMLHyperlinkElementUtils
2022-12-19 07:57:44 -05:00
Jelle Raaijmakers
9feac465dc LibCore: Convert explicit timezone to local in DateTime::parse
When we encounter an explicit timezone, we shift the time to UTC.
Because we rely on `mktime`, we need to shift it to the local time
before proceeding. If no explicit timezone is provided, local timezone
is assumed.

This fixes the "timezone-offset extension" LibJS test running on
machines with a non-UTC timezone offset.

Co-authored-by: Timothy Flynn <trflynn89@pm.me>
2022-12-19 07:07:49 -05:00
Liav A
1ea10bcb73 LibGfx: Split VERIFY statements in various Bitmap class methods
This could aid debugging in many cases, and it doesn't break any
functionality, so let's ensure it's easier to understand in which way a
provided value is out of range.
2022-12-19 11:05:44 +00:00
Matt Purnell
0bda06c9c5 LibWeb: Don't const_cast layout_box() when calling const functions
layout_box() already has a non-const overload, so we don't need to
const_cast them anymore. This gets rid of 2 FIXMEs. :^)
2022-12-18 12:56:33 +01:00
Stephan Unverwerth
28ad49bcbd LibGL: Pass generated GPU IR to GPU side compiler when linking program 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
c25359df47 LibSoftGPU: Delegate shader creation to new class ShaderCompiler 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
5bab17596d LibGLSL: Fill LinkedShaders with dummy IR code 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
c88bc74afd LibGPU: Add inputs and outputs to GPU shader IR 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
b18bf702ea LibSoftGPU: Implement shader processor for SoftGPU ISA
This adds a shader processor that executes our ISA when a fragment
shader is currently bound to the device.
2022-12-17 22:39:09 -07:00
Stephan Unverwerth
1e548a84d6 LibSoftGPU: Define a simple shader instruction set
This adds a simple instruction set with basic operations and adds an
instruction list to the shader class.
2022-12-17 22:39:09 -07:00
Stephan Unverwerth
bb28492af0 LibSoftGPU: Make output in PixelQuad generic
Same as with inputs, we define outputs as a generic array of floats.
This can later be expanded to accomodate multiple render targets or
vertex attributes in the case of a vertex shader.
2022-12-17 22:39:09 -07:00
Stephan Unverwerth
c008b6ce18 LibSoftGPU: Make input in PixelQuad generic
Previously we would store vertex color and texture coordinates in
separate fields in PixelQuad. To make them accessible from shaders we
need to store them as a completely generic array of floats.
2022-12-17 22:39:09 -07:00
Stephan Unverwerth
49139d5f4e LibSoftGPU: Allow binding a fragment shader 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
93ab2db80f LibGL+LibSoftGPU: Add GPU side shader infrastructure
This adds a shader class to LibSoftGPU and makes use of it when linking
GLSL program in LibGL. Also adds actual rendering code to the shader
tests.
2022-12-17 22:39:09 -07:00
Stephan Unverwerth
4ad41e6680 LibGL: Use LibGLSL to compile shaders 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
67b2f8d68d LibGLSL: Add LibGLSL
This adds a new library, LibGLSL for parsing and compiling GLSL programs
to LibGPU IR. Currently the compiler consists only of stubs.
2022-12-17 22:39:09 -07:00
Stephan Unverwerth
5f0eb812ac LibGPU: Add basic shader IR
This adds a header to LibGPU with a basic IR for vertex and fragment
shaders.
2022-12-17 22:39:09 -07:00
Stephan Unverwerth
1b7b6e6c91 LibGL: Implement glGetProgramiv 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
424e0a2792 LibGL: Implement glGetShaderiv 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
69171e7a05 LibGL: Implement glUseProgram 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
848f1d2689 LibGL: Make shader compilation and program linking always succeed
This will help with testing until the actual compilation infrastructure
is in place.
2022-12-17 22:39:09 -07:00
Stephan Unverwerth
fdd76639d8 LibGL: Implement glLinkProgram 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
7f062e35a4 LibGL: Implement glAttachShader 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
42ef5c9e12 LibGL: Implement glCompileShader 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
d5277ecdfe LibGL: Implement glShaderSource 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
962d088e4e LibGL: Implement glCreateProgram and glDeleteProgram 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
a0adbfbf81 LibGL: Implement glCreateShader and glDeleteShader 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
b975569a40 LibGL: Add Shader and Program class stubs 2022-12-17 22:39:09 -07:00
Stephan Unverwerth
cd7d2c3446 LibGL: Remove Texture note leftovers from the NameAllocator class
The NameAllocator class is not only about Textures, so let's change a
comment being related to it.
2022-12-17 22:39:09 -07:00
Stephan Unverwerth
4568dcbb55 LibGL: Add stubs for shader and program related functions 2022-12-17 22:39:09 -07:00
Lenny Maiorani
f2336d0144 AK+Everywhere: Move custom deleter capability to OwnPtr
`OwnPtrWithCustomDeleter` was a decorator which provided the ability
to add a custom deleter to `OwnPtr` by wrapping and taking the deleter
as a run-time argument to the constructor. This solution means that no
additional space is needed for the `OwnPtr` because it doesn't need to
store a pointer to the deleter, but comes at the cost of having an
extra type that stores a pointer for every instance.

This logic is moved directly into `OwnPtr` by adding a template
argument that is defaulted to the default deleter for the type. This
means that the type itself stores the pointer to the deleter instead
of every instance and adds some type safety by encoding the deleter in
the type itself instead of taking a run-time argument.
2022-12-17 16:00:08 -05:00
Tim Ledbetter
53133b4359 PixelPaint: Debounce ImageEditor on_modified_change event
This limits the frequency of updates performed by the histogram and
vectorscope widgets.
2022-12-17 19:52:11 +00:00
Tim Ledbetter
7e020154a5 PixelPaint: Improve guide tool performance for large images
This commit ensures that the vectorscope and histogram widgets are not
updated while moving a guide with the guide tool. This significantly
improves performance for large images.
2022-12-17 19:52:11 +00:00
Keir Davis
4a0af3dc77 SystemMonitor: Propagate errors when trying to load an icon 2022-12-17 19:20:21 +00:00
Rodrigo Tobar
d116b9a8c6 PDFViewer: Move to page when outline item is selected 2022-12-17 19:40:52 +01:00
Rodrigo Tobar
d739877807 PDFViewer: Inform about selections on Outline view
Selecting an Outline Item from the Outline view informs via callback the
corresponding Destination that has been selected. This will be used to
move the application to the corresponding page/section/etc.
2022-12-17 19:40:52 +01:00
Rodrigo Tobar
aaa210e6db PDFViewer: Show page numbers in Outline TreeView
This is a nice addition to the outline view, which previously simply
displayed the titles of each section. Pages are shown in the first
column, but the tree is expanded via the second column, where the title
is.
2022-12-17 19:40:52 +01:00
Rodrigo Tobar
c76564b533 PDFViewer: Fix parent_index() implementation in OutlineModel
The previous implementation had some repeated code, and wasn't really
working (because the OutlineItem.parent member was never populated). In
fact, when navigating with the up/down arrows in the associted TreeView
one could experience some funky behavior.

Now that we store OutlineItem's parents, we are fixing the
implementation for parent_index(), which was comparing the parent
siblings against the item's outline item instead of to its parent.
2022-12-17 19:40:52 +01:00
Rodrigo Tobar
6df9aa8f2c LibPDF: Store page number, not Value, in OutlineItem
The Value previously stored corresponded to a Reference to a Page object
in the PDF document. This isn't useful information, since what we want
to display at the end of the day is the page an outline item refers to.

This commit changes the page member on OutlineItem to be a Optional<u32>
(some destinations don't necessarily refer to a Page), which we resolve
while building OutlineItems.
2022-12-17 19:40:52 +01:00
Rodrigo Tobar
3db6af6360 LibPDF: Keep track of OutlineItem parents
While OutlineItem had a parent field, it was never populated nor used.
This commit populates it when possible (no parent means the OutlineItem
is a top-level item).
2022-12-17 19:40:52 +01:00
Rodrigo Tobar
2ea8d2547e PDFViewer: Propagate errors from OutlineModel construction
This follows the same idea that Andreas was doing in this latest videos,
where construction-time TRY()s were not present but should have been.
Like Andreas did, moving the initialisation of such fields to the
factory function, which then returns ErrorOr solves the issue.
2022-12-17 19:40:52 +01:00
Rodrigo Tobar
cb2cf6de99 PDFViewer: Perform standard error handling when opening files
The previous implementation of open_file had a lambda that was used to
inspect the call of ErrorOr-returning calls. This was a non-standard way
of doing this though, as the more usual and clearer way is to have an
inner function that returns ErrorOr, then handle any incoming errors on
the top level function.

This commit adds a try_open_file function, where all the logic occurs,
and all the failure-producing steps are simplied TRY'ed. The top level
open_file function takes that result and does what the lambda previously
did: showing a message box with the actual error.
2022-12-17 19:40:52 +01:00
Karol Kosek
5049b103c0 PixelPaint: Encode layers in PixelPaint project files as PNG
Previously layers weren't compressed at all and the file size could go
up really fast in a project with multiple layers.  By switching to PNG,
the situation is slightly better now.

Interestingly enough, this change won't break compatibility with old
files, as PixelPaint loads layers using ImageDecoder which will try
every codec possible. :^)
2022-12-17 18:37:04 +01:00
Karol Kosek
11377bf0f8 PixelPaint: Propagate more errors when saving a project file 2022-12-17 18:37:04 +01:00
Quentin Ligier
588994bb00 LibWeb: Improve variable name in HTMLTableElement
The variables 'child_to_append_after' are used to specify the child
before which new elements will be inserted, its name is misleading.
These variables are always passed as 'child' to pre_insert.
2022-12-17 18:35:32 +01:00
Alexander Narsudinov
45525d4f85 LibWeb: Add NamedNodeMap::setNamedItemNS() method
This patch adds implementation of the missing `setNamedItemNS()` method.
2022-12-17 18:27:57 +01:00
Alexander Narsudinov
530d5adc62 LibWeb: Add NamedNodeMap::removeNamedItemNS() method
This patch adds implementation of the missing `removeNamedItemNS()`
method.
2022-12-17 18:27:57 +01:00
Alexander Narsudinov
7679d38c5f LibWeb: Fix incorrect behaviour in NamedNodeMap::removeNamedItem()
According to the spec we should return removed attribute, but the old
implementation returned nullptr instead.

Now we return the element's removed attribute.
2022-12-17 18:27:57 +01:00
Alexander Narsudinov
f2d7690702 LibWeb: Add NamedNodeMap::getNamedItemNS()
This patch allows us to use method getNamedItemNS() of NamedNodeMap API.
2022-12-17 18:27:57 +01:00
Alexander Narsudinov
ce6cf5bab8 LibWeb: Make method NamedNodeMap::set_attribute() closer to the spec
This patch eliminates 1 FIXME that I've got during fixme roulette! :^)
2022-12-17 18:27:57 +01:00
Alexander Narsudinov
1a0fbe1e85 LibWeb: Add internal get_attribute_ns() methods of NamedNodeMap
This patch adds methods for querying element by namespace and
local name.

These methods are defined by the spec for internal
usage, but weren't implemented in LibWeb yet.
2022-12-17 18:27:57 +01:00
Eli Youngs
0dd8066a79 tsort: Suppress warnings with -q 2022-12-16 10:41:56 -07:00
Eli Youngs
9caa3d2b55 Userland: Add a tsort utility 2022-12-16 10:41:56 -07:00
Andre Eisenbach
e80f0b23e3 CatDog: Simplify animation frame logic and fix minor bugs
Moved all images into a Vector instead of storing every animation frame
in its own member variable. This greatly simplifies the bitmap selection
logic and removes redundant if() checks.

Also fixes minor state bugs. For example, CatDog woudld go to sleep
immediately after actively moving for > 5 seconds. Also fixes arbitrary
hardcoded values for mouse offset movement tresholds as well as
inconsistent movement increments. This allows clicking anywhere on the
CatDog window without moving CatDog.

In addition to removing many member variables, the API interface is
also cleaned up a bit to expose less CatDog internals. Nobody likes
exposed CatDog internals ;).

Variables and function are also renamed where necessary to (hopefully)
improve readability.
2022-12-16 08:50:35 -07:00
Tim Ledbetter
213d82f39b PixelPaint: Fix move tool scaling function when zoomed
The move tool enters scaling mode when the user mouses within 10
pixels either side of the the bottom right of the active layer
boundary.

Previously, the bounding box used to determine whether the mouse was
at the bottom right of the layer used coordinates that were scaled to
the size of the image. This made the size of the area
you need to enter proportional the current zoom level.

This commit fixes the issue by using non-scaled coordinates to
calculate the bounding box, meaning its size is unaffected by the
current zoom level.
2022-12-16 10:24:34 +00:00
Tim Ledbetter
5ba0b551f4 PixelPaint: Display a preview image when scaling with the move tool
A preview of the scaled image and an outline of the updated layer
boundary are now shown when scaling with the move tool.
2022-12-16 10:24:34 +00:00
Timothy Slater
7b4e5d6ac0 PixelPaint: Add Text Tool 2022-12-16 10:14:20 +00:00
Timothy Slater
7b62e02bc3 LibGUI: Prevent key_down event from bubbling for Key_Up and Key_Down
This just corrects an oversight in EditingEngine where we do not
properly signal "we handled this event" for Key_Up and Key_Down like we
do for the other keys
2022-12-16 10:14:20 +00:00
Timothy Slater
296b76095f PixelPaint: Change tool keydown handle to non-const
This was changed to const in PR #15788 but presents problems for tools
that may need to forward this event to non-const event handlers.
2022-12-16 10:14:20 +00:00
Timothy Slater
159f6cf0ac PixelPaint: Account for rulers on Tool second paint events
This change makes ImageEditor provide an altered PaintEvent to the
active tool when rulers are visible. This PaintEvent has a rect that has
been adjust to account for the thickness of the rulers. Tools use this
rect for Painter clipping and this prevents a Tool's on_second_paint
from drawing over top of the rulers
2022-12-16 10:14:20 +00:00
Timothy Slater
a321df12e1 PixelPaint: Allow tools to know when the user has left them 2022-12-16 10:14:20 +00:00
Timothy Flynn
a67ad665b1 LibLine: Convert strings to time_t using signed conversion methods
The time_t type itself is signed, and the result of this conversion is
always stored as time_t, so let's not use to_uint<>.
2022-12-16 10:06:26 +01:00
Rodrigo Tobar
d4ecdf3ced PDFViewer: Avoid errors due to copying of ErrorOr
The handle_error took PDFErrorOr<T> objects by value, meaning that their
inner values (the error or value stored in the underlying Variant) were
somehow copied over. In the first instance where this lambda is called
with T = NonnullRefPtr, resulting in funky behavior (invalid
NonnullRefPtr state with a VALIDATE fail): if there is no error then the
PDFErrorOr<T> copy is destroyed, which might be causing the underlying
NonnullRefPtr to be destroyed, but somehow the original in the caller
context gets affected and fails verification.

The solution seems simple anyway: just pass the value by reference
(lvalue or rvalue) so the original object can be used directly, avoiding
destruction.
2022-12-16 10:04:23 +01:00
Rodrigo Tobar
124ab5bec6 PDFViewer: Remove unnecessary ternary operation 2022-12-16 10:04:23 +01:00
Rodrigo Tobar
6d0869c14a PDFViewer: Add TreeView to communicate rendering errors
Now that the rendering process communicates all errors upstream, and
PDFViewer has a way to tap into those errors as they occur, we can
visualise them more neatly.

This commit adds a TreeView that we populate with the errors stemming
from the rendering process. The TreeView has two levels: at the top sit
pages where errors can be found, and under each page we can see the
errors that have been found on that page. The TreeView sits below the
main PDF rendering.
2022-12-16 10:04:23 +01:00
Rodrigo Tobar
c4bc27f274 LibPDF: Don't abort on unsupported drawing operations
Instead of calling TODO(), which will abort the program, we now return
an Error specifying that we haven't implemented the drawing operation
yet. This will now nicely trickle up all the way through to the
PDFViewer, which will then notify its clients about the problem.
2022-12-16 10:04:23 +01:00
Rodrigo Tobar
e87fecf710 LibPDF: Switch to best-effort PDF rendering
The current rendering routine aborts as soon as an error is found during
rendering, which potentially severely limits the contents we show on
screen. Moreover, whenever an error happens the PDFViewer widget shows
an error dialog, and doesn't display the bitmap that has been painted so
far.

This commit improves the situation in both fronts, implementing
rendering now with a best-effort approach. Firstly, execution of
operations isn't halted after an operand results in an error, but
instead execution of all operations is always attempted, and all
collected errors are returned in bulk. Secondly, PDFViewer now always
displays the resulting bitmap, regardless of error being produced or
not. To communicate errors, an on_render_errors callback has been added
so clients can subscribe to these events and handle them as appropriate.
2022-12-16 10:04:23 +01:00
Rodrigo Tobar
96fb4b20f1 LibPDF: Add Errors class that accumulate multiple errors
This will be used to perform a best-effort rendering, where an error in
rendering won't abort the whole rendering operation, but instead will be
stored for later reference while rendering continues.
2022-12-16 10:04:23 +01:00
Rodrigo Tobar
d9718064d1 LibPDF: Add support for multi-line comments
The code parsing comments parsed only a single line of comments, but
callers assumed they parsed all comments that appeared contiguously in a
block. The latter is an easier to understand API, so this commit changes
the parse_comment function to parse entire blocks of comments instead of
single lines.
2022-12-16 10:04:23 +01:00
Linus Groh
e785c66f91 LibJS: Convert get_this_environment() to NonnullGCPtr 2022-12-16 09:59:56 +01:00
Linus Groh
c132064ee9 LibJS: Convert new_private_environment() to NonnullGCPtr 2022-12-16 09:59:56 +01:00
Linus Groh
208be8b86d LibJS: Convert new_function_environment() to NonnullGCPtr 2022-12-16 09:59:56 +01:00
Linus Groh
111a38c464 LibJS: Convert new_object_environment() to NonnullGCPtr 2022-12-16 09:59:56 +01:00
Linus Groh
107e06a396 LibJS: Convert new_declarative_environment() to NonnullGCPtr 2022-12-16 09:59:56 +01:00
Baitinq
4c732abed5 HackStudio: Add a factory function for DebugInfoWidget
Thanks to this patch we now do error propagation in the DebugInfoWidget
creation and as a result we get rid of 4 FIXMEs :)
2022-12-16 09:58:51 +01:00
Baitinq
55a903911b HackStudio: Add a factory function for HackStudioWidget
This will allow us to handle errors while creating the HackStudioWidget.

(tip: check next commit :^)
2022-12-16 09:58:51 +01:00
Baitinq
61789de11d LibGUI: Add GUI::TabWidget::add_tab() that takes a constructed tab
This patch adds a new add_tab() function in GUI::TabWidget that takes
an already created NonnullRefPtr<Widget> object. This allows us to
handle errors while creating the Tab object and then pass it to this
function to actually add the object to the TabWidget.
2022-12-16 09:58:51 +01:00
Andreas Kling
c355e9692d LibWeb: Add spec links to IDL APIs in HTMLTableElement 2022-12-16 09:58:03 +01:00
Andreas Kling
2ded895107 LibWeb: Allow setting HTMLTableElement.tFoot to null value
This annihilates 2 FIXMEs :^)
2022-12-16 09:58:03 +01:00
Andreas Kling
346737701d LibWeb: Allow setting HTMLTableElement.tHead to null value
This deals with 2 FIXMEs :^)
2022-12-16 09:58:03 +01:00
Andreas Kling
2d791cf90f LibWeb: Allow setting HTMLTableElement.caption to null value
This takes care of 2 FIXMEs :^)
2022-12-16 09:58:03 +01:00
Andreas Kling
6e127f62d7 LibWeb: Add spec link and comment to HTMLTableElement::caption() 2022-12-16 09:58:03 +01:00
Aliaksandr Kalenik
992b4489ad LibWeb: Fix bug in BFC that independent FC assigned to wrong variable
Bug was introduced in 210bf8adf0c431be05659140fd6de3a2cc5b7d99
It makes new variable for independent_formatting_context instead
of using earlier declared one which means that
parent_context_did_dimension_child_root_box will never be called.
2022-12-16 09:57:37 +01:00
Cody Hein
8d6283c229 PixelPaint: Replace vectorscope boxes with colored corner brackets
This completes a FIXME which requested us to replace the rects/boxes
with just corner brackets. I also added some color to the brackets
matching the colors they represent. The text remains white :)
2022-12-16 01:25:50 -07:00
Rodrigo Tobar
a1af79dca6 LibPDF: Follow a FontFile's Length values
These can be references (at least from what I've found in some
documents), so we want to resolve them before using them.
2022-12-16 01:24:43 -07:00
Rodrigo Tobar
cb1a7cc721 LibPDF: Simplify outline construction
While the Outline Items making up the document's Outline have all sorts
of cross-references (parent, first/last chlid, next/previous sibling,
etc), not all documents out there have fully-consistent references. Our
implementation already discarded some of that information too (e.g.,
/Parent and /Prev were never read), and trusted that /First and /Next
were good enough to traverse the whole hierarchy.

Where the current implementation failed was in assuming that /Last was
also a good source of information. There are documents out there were
/Last also points to dead ends, and were therefore causing a crash when
we verified that the last child found on a chain was the /Last child
declared by the parent. To fix this I'm simply removing the check, and
simplifying the function call to remove any references to /Last. This
way we affirm our commitment to /First and /Next as the main sources of
information.
2022-12-16 01:24:43 -07:00
Rodrigo Tobar
41bd304a7f LibPDF: Ignore seac PS1 commands for now
This command is meant to print an Standard Encoding Accented Character.
It's not critical to implement it yet, but if we want to render more
documents we need to handle the instruction, even if simply ignore it.
2022-12-16 01:24:43 -07:00
Tim Ledbetter
8353df03a8 PixelPaint: Disable bucket tool outside of the current selection
Previously, if the user clicked outside of the current selection with
the bucket tool, the selection would be filled.
2022-12-16 08:10:33 +00:00
Liav A
d97aa9cf8c DynamicLoader: Annotate all loaded library ranges as immutable
To further protect all virtual memory regions of the loaded libraries,
don't allow to mutate these regions both in changing their annotations
nor the protection bits.
2022-12-16 01:02:00 -07:00
Liav A
6c0486277e Kernel: Reintroduce the msyscall syscall as the annotate_mapping syscall
This syscall will be used later on to ensure we can declare virtual
memory mappings as immutable (which means that the underlying Region is
basically immutable for both future annotations or changing the
protection bits of it).
2022-12-16 01:02:00 -07:00
Baitinq
626142c312 ClockSettings: Add a factory function for TimeZoneSettingsWidget
This removes an unbelievable 4 FIXMEs :))
2022-12-15 21:00:24 +00:00
Baitinq
27a1798dd9 LibGUI: Add GUI::SettingsWindow::add_tab() that takes a constructed tab
This patch adds a new add_tab() function in GUI::SettingsWindow that
takes an already created NonnullRefPtr<Tab> object. This allows us to
handle errors while creating the Tab object and then pass it to this
function to actually add the object to the SettingsWindow.
2022-12-15 21:00:24 +00:00
Lucas CHOLLET
2693745336 LibThreading+Everywhere: Support returning error from BackgroundAction
This patch allows returning an `Error` from the `on_complete` callback
in `BackgroundAction`.

It also adds a custom callback to manage errors returned during its
execution.
2022-12-15 17:36:57 +00:00
Lucas CHOLLET
664117564a LibGUI: Actually try something in TabWidget::try_add_widget(Widget&)
This function, while returning an `ErrorOr<void>`, didn't call failable
API.
2022-12-15 17:36:57 +00:00
Federico Guerinoni
43ff500a80 LibCore: Use ';' to split socket path in SOCKET_TAKEOVER
This allow to use socket path with spaces inside.

Closes #16436.
2022-12-15 12:33:36 -05:00
Timothy Flynn
944e17ce9e WebContent: Disallow creating WebDriverConnections with existing sockets
This reverts commit d2b2d3ad80.

This is no longer needed once Ladybird will uses local socket files.
2022-12-15 17:29:19 +00:00
Timothy Flynn
cc62d33a07 headless-browser: Remove option to specify a WebDriver FD-passing socket 2022-12-15 17:29:19 +00:00
Timothy Flynn
cbbaf8ea2c WebDriver: Remove the WebContent socket file when closing the session
Otherwise it is left on disk forever.
2022-12-15 17:29:19 +00:00
Timothy Flynn
956fa84f12 WebDriver: Specify callbacks for clients to launch browser windows
This moves the actual launching of browser windows to the WebDriver main
file. This will allow Ladybird to specify its own callback and re-use
Serenity's Session class.
2022-12-15 17:29:19 +00:00
Timothy Flynn
366f24a73b WebContent+WebDriver: Move WebDriver socket to the standard runtime path
This will allow Ladybird to use local socket files rather than passing
around a bunch of socket FDs.
2022-12-15 17:29:19 +00:00
Timothy Flynn
701e77019c LibCore: Use the user's root session ID for standard runtime path
This ensures processes created by the user use the same runtime path.
2022-12-15 17:29:19 +00:00
Arda Cinar
e2566d5126 LibMarkdown: Prevent a crash when rendering code blocks to console
When parsing a code block not in a section (in a file without a
heading), the parser would initialize the code block with an
uninitialized (invalid) value for current_section. Accessing this value
would later cause a segmentation fault in render_to_terminal.
2022-12-15 16:30:21 +00:00
Arda Cinar
80563120e2 LibMarkdown: Handle error while rendering JS to HTML
The library logs the error and falls back to not colorizing the js code
inside the block instead.
2022-12-15 16:30:21 +00:00
Timothy Flynn
2dfa87814e LibJS: Update spec comments for replacing digits in Intl.NumberFormat
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/06d95ed

Note the new spec steps basically match our implementation in LibLocale.
2022-12-15 16:24:29 +00:00
Timothy Flynn
01fc025e9d LibJS: Fix a typo in an Intl.DateTimeFormat spec comment
This is an editorial change in the ECMA-402 spec. See:
https://github.com/tc39/ecma402/commit/078bea0
2022-12-15 16:24:29 +00:00
Lucas CHOLLET
048d0a9870 LibCore: Use System::getaddrinfo() in Socket::resolve_host 2022-12-15 13:38:13 +00:00
Lucas CHOLLET
687ef7740a LibCore: Add a wrapper for getaddrinfo() 2022-12-15 13:38:13 +00:00
Tim Schumacher
6640cb57b3 LibCore: Use AllocatingMemoryStream for SOCKSProxyClient 2022-12-15 13:28:29 +00:00
Tim Schumacher
f205f62a44 LibCore: Add an automatically allocating MemoryStream
Similar to AK::DuplexStream, this writes to the end and reads from the
beginning of a dynamically allocated buffer.
2022-12-15 13:28:29 +00:00
Tim Schumacher
8dbc7aa63f LibCore: Move the MemoryStream implementation into a separate file 2022-12-15 13:28:29 +00:00
Tim Schumacher
c6d71ca727 LibCore: Rename MemoryStream to FixedMemoryStream
This is to differentiate between the upcoming `AllocatingMemoryStream`,
which automatically allocates memory as needed instead of operating on a
static memory area.
2022-12-15 13:28:29 +00:00
Baitinq
c4f68bde57 VirGLDemo: Make a factory function for Demo and propagate errors
This removes a measly 1 FIXME :))
2022-12-15 12:35:19 +00:00
Sam Atkins
d4f74d6c48 gron: Add options for enabling/disabling colored output
These match the options in the original gron:
https://github.com/tomnomnom/gron
2022-12-15 12:20:37 +00:00
Linus Groh
bd40464195 LibJS: Convert standalone construct() to NonnullGCPtr 2022-12-15 06:56:37 -05:00
Linus Groh
6ae79a84df LibJS: Convert Object::construct() to NonnullGCPtr 2022-12-15 06:56:37 -05:00
Linus Groh
03acbf0beb LibJS: Convert FunctionObject::internal_construct() to NonnullGCPtr 2022-12-15 06:56:37 -05:00
Linus Groh
1c24b82dd7 LibJS: Convert ordinary_create_from_constructor() to NonnullGCPtr 2022-12-15 06:56:37 -05:00
Linus Groh
22089436ed LibJS: Convert Heap::allocate{,_without_realm}() to NonnullGCPtr 2022-12-15 06:56:37 -05:00
Linus Groh
2a66fc6cae LibJS: Add make_handle({Nonnull,}GCPtr<T>) overloads 2022-12-15 06:56:37 -05:00
Linus Groh
029db614e3 LibJS: Ensure Optional<Completion>'s defaults to empty completion
Default-constructing the m_value Completion made it have an undefined
JS value when not overridden in a constructor, such as the conditional
initialization in Optional(Optional<JS::Completion> const&).

See investigation by Tim here:
https://github.com/SerenityOS/serenity/pull/16498#discussion_r1049090456

Co-authored-by: Timothy Flynn <trflynn89@pm.me>
2022-12-15 06:56:37 -05:00
Kyle Lanmon
0991464de6 LibWeb: Implement input range type sanitation algorithm 2022-12-15 09:43:41 +00:00
Kyle Lanmon
c5b953e51b LibWeb: Implement input local date and time type sanitation algorithm 2022-12-15 09:43:41 +00:00
Kyle Lanmon
a3c4af7a19 LibWeb: Implement input time type sanitation algorithm 2022-12-15 09:43:41 +00:00
Kyle Lanmon
d249a69150 LibWeb: Implement input week type sanitation algorithm 2022-12-15 09:43:41 +00:00
Kyle Lanmon
8197b7a063 LibWeb: Implement input month type sanitation algorithm 2022-12-15 09:43:41 +00:00
Kyle Lanmon
edb3a0aa0a LibWeb: Implement input date type sanitation algorithm 2022-12-15 09:43:41 +00:00
Kyle Lanmon
dfbc5553f2 LibWeb: Implement input email type sanitation algorithm 2022-12-15 09:43:41 +00:00
Kyle Lanmon
6fa34a4ee3 LibWeb: Implement input color type sanitation algorithm 2022-12-15 09:43:41 +00:00
Timothy Flynn
a2cf026b30 LibJS: Throw a RangeError when when formatting strings in DurationFormat
This is a normative change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/2546080
2022-12-15 09:40:09 +00:00
Timothy Flynn
010888acec LibJS: Access DurationRecord properties in alphabetical order
This is a normative change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/42e99b8
2022-12-15 09:40:09 +00:00
Timothy Flynn
85f079dc6b LibJS: Move IsValidDurationRecord check to ToDurationRecord
This is an editorial change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/fb21723
2022-12-15 09:40:09 +00:00
Timothy Flynn
0086a3acdb LibJS: Remove infallibility markers from some Intl.DurationFormat AOs
This is an editorial change in the Intl.DurationFormat proposal. See:
https://github.com/tc39/proposal-intl-duration-format/commit/fa2b3d0
2022-12-15 09:40:09 +00:00
Max Stevens
3aeb7a41c0 LibWeb: Implement more values of flexbox align-content
Implement the values 'space-between' and 'space-around'
of the 'align-content' flexbox property.

The following WPT tests now pass:
- http://wpt.live/css/css-flexbox/align-content-004.htm
- http://wpt.live/css/css-flexbox/align-content-005.htm
2022-12-15 09:27:32 +01:00
kleines Filmröllchen
b7eea03103 Piano: Overhaul AudioPlayerLoop and throw out event loops
The audio player loop uses custom IPC plumbing to safely bypass any
event loop shenanigans. There is still work to be done, but this already
improves the realtime capabilities of Piano.
2022-12-15 00:21:00 -07:00
kleines Filmröllchen
f1d486bcde Piano: Make AudioPlayerLoop::is_playing const 2022-12-15 00:21:00 -07:00
kleines Filmröllchen
0beca84624 LibIPC: Only run responsiveness timer when there is an event loop
This disables responsiveness detection when an event loop is absent.
There are no users which both need this feature but don't have an event
loop.
2022-12-15 00:21:00 -07:00
kleines Filmröllchen
7669441282 LibIPC: Add deferred invoker getter 2022-12-15 00:21:00 -07:00
kleines Filmröllchen
727fb305a8 LibAudio: Allow resampling into existing buffer
This alleviates some copying
and we can implement existing APIs in terms of this.
2022-12-15 00:21:00 -07:00
kleines Filmröllchen
cc9192a1e7 LibAudio: Expose blocking realtime enqueue to audio clients
This is just a delegate of the same function found in the shared queue
itself.
2022-12-15 00:21:00 -07:00
kleines Filmröllchen
836f28392d LibAudio: Make resampling fallible 2022-12-15 00:21:00 -07:00
meiskam
1943aef2cb PixelPaint: Make sure modified state is updated when undo_stack changes 2022-12-15 00:14:35 -07:00
meiskam
b33aa1bc9b PixelPaint: Update window modified to look at all tabs
This causes the corner X to correctly have dots when any of the open
tabs have unsaved changes. Event calls and undo stack modifications
have been collected to one spot.
2022-12-15 00:14:35 -07:00
meiskam
fb4315d121 LibGUI: Add dots below TabWidget close button when modified 2022-12-15 00:14:35 -07:00
meiskam
b79be56bed LibGUI: Add modified bool to TabWidget
This will allow application with multiple tabs to track modifications
per-tab, not just if the entire window has been modified
2022-12-15 00:14:35 -07:00
Arda Cinar
2dd7fa2d44 HexEditor: Handle some errors inside the editor
Specifically, the ones HexEditor::did_complete_action possibly raised in
case creating an undo stack entry or pushing it onto the undo stack
fails. In this case, an error popup is displayed and the modifications
are undone.

This removes 2 FIXMEs inside the code :^)
2022-12-14 23:43:20 -07:00
Lucas CHOLLET
d3ce9cf8f6 CrashReporter: Use the Core::Stream friendly API, save_file() 2022-12-14 18:26:25 +00:00
Lucas CHOLLET
6dd716adf2 LibFileSystemAccessClient: Add save_file()
This method replaces `try_save_file_deprecated()`, as it has the same
behavior but returns a `Core::Stream::File` instead.
2022-12-14 18:26:25 +00:00
Lucas CHOLLET
cfb0e1bdb2 LibCore: Add fd overload of File::is_directory and File::is_device 2022-12-14 18:26:25 +00:00
Lucas CHOLLET
9ae97c8cb1 LibFileSystemAccessClient: Rename try_save_file =>
`try_save_file_deprecated`

This precedes the addition of a new api using `Core::Stream`
2022-12-14 18:26:25 +00:00
Lucas CHOLLET
c71fc0683f LibFileSystemAccessClient: Rename Result => DeprecatedResult
This precedes the addition of a new `Result`, using `Core::Stream::File`
instead `Core::File`.
2022-12-14 18:26:25 +00:00
Cygnix Proto
806a55eda1 LibGfx+Userland: Make Gfx::SystemTheme propagate errors
This patch introduces error propagation to Gfx::SystemTheme to remove
instances of release_value_but_fixme_should_propagate_errors().

Userland applications that have been affected by this change have been
updated to utilise this propagation and as a result 4 such instances of
the aforementioned method have been removed.
2022-12-14 18:25:28 +00:00
Sam Atkins
bdd9bc16de Piano: Only treat unmodified key presses as playing notes
This makes Action shortcuts work again. :^)

`note_key_action()` and `special_key_action()` now return whether they
consumed the event. We don't even call them if any modifier keys were
held down, so things like `Ctrl+T` no longer play notes.
2022-12-14 18:25:02 +00:00
Sam Atkins
7c17e73c7f SpaceAnalyzer: Ignore unhandled keydown events
This makes Action shortcuts work again. :^)
2022-12-14 18:25:02 +00:00
Sam Atkins
97e157708f Presenter: Ignore unhandled keydown events
This makes Action shortcuts work again. :^)
2022-12-14 18:25:02 +00:00
Sam Atkins
4752d8fd08 MasterWord: Ignore unhandled keydown events
This makes Action shortcuts work again. :^)
2022-12-14 18:25:02 +00:00
Sam Atkins
10c4c552e7 Hearts: Ignore unhandled keydown events
This makes Action shortcuts work again. :^)
2022-12-14 18:25:02 +00:00
Sam Atkins
faf30ed9ef Chess: Ignore unhandled keydown events
This makes Action shortcuts work again. :^)
2022-12-14 18:25:02 +00:00
Sam Atkins
30833b0ba8 BrickGame: Ignore unhandled keydown events
This makes Action shortcuts work again. :^)
2022-12-14 18:25:02 +00:00
Sam Atkins
0bf37b8763 Solitaire: Ignore unhandled keydown events
This makes Action shortcuts work again. :^)
2022-12-14 18:25:02 +00:00
Andrew Kaster
733a318709 Meta+CMake: Extract Wasm spec tests into the binary directory
Clean up the Wasm spec tests CMake rules to extract and compile the wat
files into wasm files in the LibWasm binary directory instead of its
source directory. Also make the rules more robust to missing host tools,
and use more CMake install rules for the test files rather than relying
on build-root-filesystem.sh. Add some FIXMEs for later, we really
shouldn't be doing installation of test files into /home/anon at the
build-root-filesystem stage in $CURRENT_YEAR. Tests go in /usr/Tests
2022-12-14 20:29:43 +03:30
Sam Atkins
ab49dbf137 LibWeb: Convert Paintable coordinates to new pixel units
This fixes a few sizing issues too. The page size is now correct in most
cases! \o/

We get to remove some of the `to_type<>()` shenanigans, though it
reappears in some other places.
2022-12-14 16:47:57 +00:00
Sam Atkins
57a69f15ff LibWeb: Remove declarations for LineBoxFragment methods that don't exist 2022-12-14 16:47:57 +00:00
Sam Atkins
1a68a4292d LibWeb: Convert text and text-decoration painting to new pixel units
This does not touch the actual font selection, so the text itself is
still small for now.
2022-12-14 16:47:57 +00:00
Sam Atkins
a72302342a LibWeb: Convert marker painting to new pixel units 2022-12-14 16:47:57 +00:00
Sam Atkins
fb43a71981 LibWeb: Convert shadow painting to new pixel units 2022-12-14 16:47:57 +00:00
Sam Atkins
9d1f30b533 LibWeb: Convert gradient painting to new pixel units
Co-authored-by: MacDue <macdue@dueutil.tech>
2022-12-14 16:47:57 +00:00
Sam Atkins
7c8eecbaa5 LibWeb: Convert backdrop-filter painting to new pixel units 2022-12-14 16:47:57 +00:00
Sam Atkins
0bf4089af9 LibWeb: Convert border painting to new pixel units 2022-12-14 16:47:57 +00:00