Commit graph

43557 commits

Author SHA1 Message Date
Andreas Kling 4dd148f07c Kernel: Add File::is_regular_file()
This makes it easy and expressive to check if a File is a regular file.
2022-11-29 11:09:19 +01:00
Andreas Kling c8ff2184bd LibCore: Add Core::System::posix_fallocate() 2022-11-29 11:09:19 +01:00
Andreas Kling 9249bcb5aa Kernel: Remove unnecessary FIXME in sys$posix_fallocate()
This syscall doesn't need to do anything for ENOSPC, as that is already
handled by its callees.
2022-11-29 11:09:19 +01:00
Andreas Kling 361897192c LibC: Negate kernel errors before returning them in posix_fallocate()
Since posix_fallocate() doesn't set errno, it has to make sure to
manually "unwrap" any error from the kernel.
2022-11-29 11:09:19 +01:00
MacDue f274f04e35 LibGfx: Handle alpha in color distance
This gives a slightly more reasonable result when comparing different
colors with low alpha values.

For example comparing white with alpha 100 to transparent:

	Before
		distance: 0.78
	After
		distance: 0.07

   (Where distance is between 0 and 1)

The result is unchanged for comparing colors without alpha values.
2022-11-29 11:08:50 +01:00
MacDue 613963cbce LibGfx: Don't bother painting transparent lines 2022-11-29 11:08:50 +01:00
MacDue 0e65de2e11 LibGfx: Don't write blended pixel if the alpha is zero 2022-11-29 11:08:50 +01:00
Keegan Saunders e575339564 LibELF: Add stack guard hardening
Employ the same hardening that glibc and the Linux kernel use for
generating stack guards: zero the first byte of the guard such that
if C-style string functions read out of bounds on the stack, we do
not overwrite or potentially leak the stack guard.
2022-11-29 11:04:21 +01:00
Keegan Saunders 89b23c473a LibC: Use uintptr_t for __stack_chk_guard
We used size_t, which is a type that is guarenteed to be large
enough to hold an array index, but uintptr_t is designed to be used
to hold pointer values, which is the case of stack guards.
2022-11-29 11:04:21 +01:00
Timothy Flynn 675e5bfdce LibJS: Allow specifying only roundingIncrement in NumberFormat options
This is a normative change in the Intl.NumberFormat v3 spec. See:
https://github.com/tc39/proposal-intl-numberformat-v3/commit/a260aa3
2022-11-29 10:24:44 +01:00
Andreas Kling e3b8a8f7c8 LibWeb: Treat unresolvable percentage width on inline-block as auto 2022-11-28 19:14:05 +01:00
Ali Mohammad Pur c590c5c444 js: Make console.log() print to stdout again
This was broken in 84502f53b5.
2022-11-28 14:32:27 +01:00
thankyouverycool 63d0aa9d8a LibCore: Add %l conversion specification to DateTime
Replaced by the hour as a decimal 1-12 in which single digits
are preceded by a blank
2022-11-28 13:12:08 +01:00
cflip 5c68ca8f48 Ports/SDL2: Update window focus event listeners
Fixes an issue where ClassiCube would get stuck on the pause menu.
2022-11-28 13:11:16 +01:00
davidot ab19d7c99d LibJS: Enable commented out tests in Math.asin 2022-11-28 13:10:21 +01:00
davidot bf1b2d63c6 LibJS: Add spec comments and check for edge cases in Math.tanh 2022-11-28 13:10:21 +01:00
davidot 8de8742b7c LibJS: Add spec comments and check for edge cases in Math.sinh 2022-11-28 13:10:21 +01:00
davidot 4306462a95 LibJS: Add spec comments and check for edge cases in Math.log10 2022-11-28 13:10:21 +01:00
davidot eda90b54d4 LibJS: Add spec comments and check for edge cases in Math.log2 2022-11-28 13:10:21 +01:00
davidot 4813385c9a LibJS: Add spec comments and check for edge cases in Math.log 2022-11-28 13:10:21 +01:00
davidot d4e5644df8 LibJS: Add spec comments and check for edge cases in Math.atanh 2022-11-28 13:10:21 +01:00
davidot c565cbd30c LibJS: Add spec comments and check for edge cases in Math.atanh 2022-11-28 13:10:21 +01:00
davidot 68aeeea5d2 LibJS: Add spec comments and check for edge cases in Math.asinh 2022-11-28 13:10:21 +01:00
davidot 6bdf021b0c LibJS: Add spec comments and check for edge cases in Math.asin 2022-11-28 13:10:21 +01:00
davidot cf4daa3941 LibJS: Add spec comments and check for edge cases in Math.acosh 2022-11-28 13:10:21 +01:00
Kyle Lanmon 62a3de0c0a TextEditor: Add keyboard shortcut to (un)comment a range of lines 2022-11-27 18:28:43 -07:00
Kyle Lanmon ad250dd484 TextEditor: Add UndoCommands for commenting and uncommenting lines 2022-11-27 18:28:43 -07:00
Kyle Lanmon 9aa00a6d70 TextEditor: Add utility to keep a range of text within a line 2022-11-27 18:28:43 -07:00
Kyle Lanmon 31290c8527 LibSyntax: Teach each highlighter about it's comment syntax 2022-11-27 18:28:43 -07:00
Tim Schumacher a8c73998f1 AK: Fully qualify some usages of AK features outside of the AK namespace 2022-11-27 23:54:40 +01:00
Tim Schumacher 03fd9002da AK: Export Details and Concepts into the AK namespace
AK internals like to use concepts and details without a fully qualified
name, which usually works just fine because we make everything
AK-related available to the unqualified namespace.

However, this breaks as soon as we start not using `USING_AK_GLOBALLY`,
due to those identifiers no longer being made available. Instead, we
just export those into the `AK` namespace instead.
2022-11-27 23:54:40 +01:00
MacDue 458ca83d8c PixelPaint: Fix lasso tool preview when zoomed in
Previously only part of the preview would be visible when zoomed in,
with less visible the more you zoomed. This also now doesn't scale
the preview line thickness, similar to other image editing programs.
2022-11-27 20:35:22 +01:00
MacDue fccda26ef9 PixelPaint: Don't scale preview thickness for polygonal select tool
This is consistent with other editors and makes it a little easier
to precisely select things when zoomed in.
2022-11-27 20:35:22 +01:00
MacDue 0482190bc8 PixelPaint: Make antialiasing the default for tools
Our AA painting works with opacity and generally has a nicer look
so lets make it the default.
2022-11-27 20:35:22 +01:00
MacDue 13beed1722 LibGfx: Preseve original alpha when applying tint filter 2022-11-27 20:35:22 +01:00
MacDue db235a87bf LibGfx: Allow float thickness lines and fix fill path glitches
The main fix is stopping fill_path() scanlines being rounded to the
wrong pixel. The y-value is now floored to ensure it always snaps
in the same direction.
2022-11-27 20:34:17 +01:00
Andreas Oppebøen 93f85f1a09 Base: Set transparent rubber band for all themes
The rubber band is the rectangle indicating the selection region on the
desktop, the file manager, and other icon views. If this region is
painted opaque with alpha=ff, the rectangle obscures the icons
underneath, harming the user experience. We set it to 3c like the other
themes.
2022-11-27 11:02:04 -05:00
davidot 2c26ee89ac LibJS: Remove m_first_invalid_property_range from ObjectExpression
This was state only used by the parser to output an error with
appropriate location. This shrinks the size of ObjectExpression from
120 bytes down to just 56. This saves roughly 2.5 MiB when loading
twitter.
2022-11-27 12:31:37 +01:00
davidot 3acbd96851 LibJS: Remove is_use_strict_directive for all StringLiterals
This value was only used in the parser so no need to have this in every
string literal in the ast.
2022-11-27 12:31:37 +01:00
Zaggy1024 3c68a6684e LibVideo: Don't crash when a decoder error is encountered while seeking
When errors are encountered by PlaybackManager, it attempts to switch
states to either Stopped or Corrupted. However, that causes it to set
the last presentation media time to the current playback time while the
last presentation time is unexpectedly negative because the seek never
ended.

Ending the seek before the state changes to Stopped or Corrupted
prevents this situation from happening.
2022-11-27 10:45:52 +01:00
Aliaksandr Kalenik 1c1b750bff LibWeb: Support box-sizing in flex formatting context
Makes pass 8/10 tests in https://wpt.live/css/css-flexbox/box-sizing-001.html
2022-11-27 10:25:17 +01:00
davidot 0c4befd811 LibJS: Use the source offset to sort imports in module
Using source offsets directly means we don't have to synthesize any
SourceRanges and circumvents that SourceRange returns invalid values for
the last range of a file.
2022-11-27 00:51:36 +00:00
davidot 1dc9769f7d LibJS: No longer assume there is a cycle root when module failed before
This issue could be triggered by evaluating a module twice. If it failed
during evaluation the cycle root was never set but that status is
evaluated. This failed in step 3 of Evaluate which assumes it has a
cycle root. This is a spec issue see:
https://github.com/tc39/ecma262/issues/2823

To fix this we check if the module itself has a top level capability
first before going to the cycle root.

Co-authored-by: Jamie Mansfield <jmansfield@cadixdev.org>
2022-11-27 00:51:36 +00:00
davidot d87676de8a LibJS: Remove already resolved FIXME
We wouldn't want someone to be disappointed when trying to fix this :^).
2022-11-27 00:51:36 +00:00
Baitinq 02a2018ec4 WebDriver: Implement stub for /session/{id}/print 2022-11-27 00:37:28 +00:00
Luke Wilde a1c1ab5f8d LibJS: Switch to bytecode interpreter to run generator functions for AST
The bytecode interpreter can execute generator functions while the AST
interpreter cannot. This simply makes it create a new bytecode
interpreter when one doesn't exist when executing a generator function.
Doing so makes it automatically switch to the bytecode interpreter to
execute any future code until it exits the generator.
2022-11-26 21:04:17 +00:00
Baitinq f3763a5275 Browser: Remove previous history entry in History::replace_current()
The lack of this action caused a bug in my original patch
(https://github.com/SerenityOS/serenity/pull/16004) that appeared when
accessing a site that redirected the client and it was the first site
the client loaded.
2022-11-26 20:54:55 +01:00
Liav A 8e16588757 Utilities+Base: Add unveil utility
This utility essentially creates a filesystem sandbox for a specified
command, so it can be tested with only the unveiled paths the user
specifies beforehand.
2022-11-26 12:42:15 -07:00
Liav A 7d7127b463 LibCore: Add add_option aggregating the same option multiple times
This could be used in a scenario when it is expected that a user program
will be invoked with a specific option multiple times, for example:
"program --a-option=example --a-option=anotherexample ..."
2022-11-26 12:42:15 -07:00
Liav A 718ae68621 Kernel+LibCore+LibC: Implement support for forcing unveil on exec
To accomplish this, we add another VeilState which is called
LockedInherited. The idea is to apply exec unveil data, similar to
execpromises of the pledge syscall, on the current exec'ed program
during the execve sequence. When applying the forced unveil data, the
veil state is set to be locked but the special state of LockedInherited
ensures that if the new program tries to unveil paths, the request will
silently be ignored, so the program will continue running without
receiving an error, but is still can only use the paths that were
unveiled before the exec syscall. This in turn, allows us to use the
unveil syscall with a special utility to sandbox other userland programs
in terms of what is visible to them on the filesystem, and is usable on
both programs that use or don't use the unveil syscall in their code.
2022-11-26 12:42:15 -07:00