Commit Graph

12453 Commits

Author SHA1 Message Date
Linus Groh
c4f0f1cc05 LibTest: Remove uses of TRY_OR_DISCARD() from JavaScriptTestRunner
In one case we can replace it with MUST() and accept the crash (we also
VERIFY() that there wasn't an exception); in the other case we don't
need to return after a throw completion.
2022-01-04 23:37:26 +00:00
Linus Groh
6c9cf4d31a LibTest: Convert JavaScriptTestRunner's get_test_results() to ErrorOr 2022-01-04 23:37:26 +00:00
Linus Groh
29e96eceeb LibJS: Convert PropertyKey::from_value() to ThrowCompletionOr
Lots of MUST() - perhaps we'll eventually come up with a better API for
the common case where it can't fail.
2022-01-04 23:37:26 +00:00
Linus Groh
62356cff40 LibJS: Convert FunctionObject::bind() to ThrowCompletionOr 2022-01-04 23:37:26 +00:00
Linus Groh
245d486ba4 LibJS: Convert PromiseResolvingElementFunction to ThrowCompletionOr 2022-01-04 23:37:26 +00:00
Linus Groh
b4208c8ea1 LibJS: Remove unused Accessor::call_{getter,setter}()
If only we had such "a way to communicate to our caller if an exception
happened" - too bad it's dead code :^)
2022-01-04 23:37:26 +00:00
Linus Groh
0e363e92ef LibJS: Remove unused IndexedProperties::take_{first,last}() 2022-01-04 23:37:26 +00:00
Timothy Flynn
1116a29c19 LibUnicode: Remove now unused Unicode symbol loader
All generated sources are now linked via weak symbols.
2022-01-04 22:49:43 +00:00
Timothy Flynn
437b9fe204 LibUnicode: Convert UnicodeData to link with weak symbols 2022-01-04 22:49:43 +00:00
Timothy Flynn
f576142fe8 LibJS+LibUnicode: Convert UnicodeLocale to link with weak symbols 2022-01-04 22:49:43 +00:00
Timothy Flynn
ba4cdf34f8 LibUnicode: Convert UnicodeDateTimeFormat to link with weak symbols 2022-01-04 22:49:43 +00:00
Timothy Flynn
98709d9be1 LibUnicode: Convert UnicodeNumberFormat to link with weak symbols
Currently, we load the generated Unicode symbols with dlopen at runtime.
This is unnecessary as of 565a880ce5.

Applications that want Unicode data now link directly against the shared
library holding that data. So the same functionality can be achieved
with weak symbols.
2022-01-04 22:49:43 +00:00
sin-ack
9121cc7cae LibWeb: Implement CanvasRenderingContext2D.measureText
This requires an implementation of the "text preparation algorithm" as
specified here:

html.spec.whatwg.org/multipage/canvas.html#text-preparation-algorithm

However, we're missing a lot of things such as the
CanvasTextDrawingStyles interface, so most of the algorithm was not
implemented. Additionally, we also are not able to use a LineBox like
the algorithm suggests, because our layouting infra is not up to the
task yet. The prepare_text function does nothing other than figuring out
the width of the given text and return glyphs with offsets at the
moment.
2022-01-04 22:41:07 +00:00
Marco Cutecchia
732e41714a ls: Fix duplicated error message when opening a directory fails 2022-01-04 22:47:57 +01:00
Marco Cutecchia
70f707d806 stat: Print an error if 'stat' fails 2022-01-04 22:47:57 +01:00
Michel Hermier
22efc34ec5 LibCrypto: Make Digests able to return bytes 2022-01-05 01:07:21 +03:30
Michel Hermier
3f0e425f1e LibCrypto: Mutualize Digests 2022-01-05 01:07:21 +03:30
Michel Hermier
4e851145ba LibCrypto: Make MultiHashDigestVariant getters const and nodiscard 2022-01-05 01:07:21 +03:30
Michel Hermier
1f4a27b80e LibCrypto: Remove spurious ; 2022-01-05 01:07:21 +03:30
Michel Hermier
25251f1b05 checksum: Use :hex-dump to format digest value 2022-01-05 01:07:21 +03:30
Michel Hermier
23fe07a148 checksum: Make name detection working even with a path 2022-01-05 01:07:21 +03:30
Andreas Kling
0c09617b48 LibGUI: Don't show "last saved" information for never-saved documents
When showing the "unsaved changes" dialog for an empty path, we should
say "last saved at ..." since that would be a lie.
2022-01-04 21:49:44 +01:00
Andreas Kling
219339d2a5 FontEditor: Use GUI::MessageBox::ask_about_unsaved_changes() 2022-01-04 21:49:44 +01:00
Andreas Kling
1a54ac262a PixelPaint: Make ImageEditor::m_undo_stack a regular value member 2022-01-04 21:49:44 +01:00
Andreas Kling
490d385d01 PixelPaint: Use GUI::MessageBox::ask_about_unsaved_changes()
To make the last-saved-at timestamp show up correctly, we also now mark
the editor's undo stack as unmodified on save.
2022-01-04 21:49:44 +01:00
Andreas Kling
82b071943d PixelPaint: Add "save" action
Let's have this as a complement to the "save as" action :^)
2022-01-04 21:49:44 +01:00
Andreas Kling
5c68e91dd7 TextEditor: Use early return style in "save" action callback 2022-01-04 21:49:44 +01:00
Andreas Kling
7178c39a78 TextEditor: Show time-since-last-save in "unsaved changes" dialogs :^) 2022-01-04 21:49:44 +01:00
Andreas Kling
e5e109a556 LibGUI: Add optional unmodified timestamp to "unsaved changes" dialogs
This allows us to show "last saved N seconds ago" when asking the user
what to do. :^)
2022-01-04 21:49:44 +01:00
Andreas Kling
c4cc796f86 LibGUI: Make GUI::UndoStack remember time it was last set to unmodified
This can be used to determine how much time has passed since a document
was saved. :^)
2022-01-04 21:49:44 +01:00
Andreas Kling
c08872f5da TextEditor: Use GUI::MessageBox::ask_about_unsaved_changes() 2022-01-04 21:49:44 +01:00
Andreas Kling
8e336d3404 LibGUI: Add GUI::MessageBox::ask_about_unsaved_changes()
This is a static helper function for asking the user what they want to
do about unsaved changes. It behaves as a standard Yes/No/Cancel box
with text and buttons tailored to the typical unsaved changes use case.
2022-01-04 21:49:44 +01:00
Tobias Christiansen
f92172c7c3 PixelPaint: Add a Bloom filter
A bloom filter creates fringes around bright areas in the image
mimicking the behavior of real-world cameras.
It gets its own category "Artistic" in the Filter Gallery since its not
one filter per se but a combination of multiple.

The filter works as follows:
- Get only the light areas (above a threshold) of the image
- Blur that image
- Compose onto the original image
2022-01-04 21:41:14 +02:00
Tobias Christiansen
e4b7d38e18 LibGfx: Add LumaFilter
This allows you to specify a luminosity range, all pixels that fall
outside this range are set to black, the others are untouched.
2022-01-04 21:41:14 +02:00
Tobias Christiansen
06ae5b3536 LibGfx: Add BitmapMixer
With this BitmapMixer one can draw one Bitmap onto another with
different modes.
For now the only supported mixing methods implemented are Add and
Lightest (which is very naive).
2022-01-04 21:41:14 +02:00
Tobias Christiansen
9d45e5ac8f PixelPaint: Add the FastBoxBlurFilter with configurable parameters :^)
The FastBoxBlurFilter has been living in LibGfx for a while and now
it's accessible in PixelPaint. The parameters for the filter are exposed
via the new Filter Gallery.
2022-01-04 21:41:14 +02:00
Tobias Christiansen
b0ab979169 LibGfx: Add BitmapFormat::BGRx8888 support to the FastBoxBlurFilter
1268b39ba introduced template specialization when reading/writing
to/from the bitmap that increased the speed of the filter.
To keep that while supporting more than one BitmapFormat, the
appropriate {get,set}_pixel<>() functions are detemined and stored in
Function<>s.
2022-01-04 21:41:14 +02:00
Rummskartoffel
902b8f1583 Calendar: Port to LibMain and TRY all the things 2022-01-04 20:46:17 +02:00
Jelle Raaijmakers
a362a95912 LibSoftGPU: Shift U/V coordinates just once in Sampler 2022-01-04 17:48:28 +00:00
Jelle Raaijmakers
bca1b9f475 LibSoftGPU: Use AK::mix instead of manual interpolation 2022-01-04 17:48:28 +00:00
Idan Horowitz
2066491f6e LibC: Use NULL instead of nullptr in serenity.h
nullptr is a c++ keyword that can not be used in LibC headers.
2022-01-04 19:08:07 +02:00
Tobias Christiansen
fd90e10600 PixelPaint: Fix crash on applying with no filter selected
The wrong conception that done() would stop the program flow right there
lead to the lambda not properly aborting when no filter was selected.

The ExecAborted would be processed and then the nullptr that was
m_selected_filter would be happily dereferenced.

This patch fixes that.
2022-01-04 18:36:27 +02:00
Tobias Christiansen
d42abb3c7b PixelPaint: Use the wrapped filters for the Filter Gallery
Now, the filters can supply the Filter Gallery with a GUI::Widget such
that the user can interact with the filter. The Filter Gallery in turn
only calls apply() on the filter once it should be run.

This decouples the PixelPaint filters a lot from the ones supported by
LibGfx and paves the way to filters with settings.

For now there still are just the plain LibGfx filters so this change
feels like introducing a lot of boilerplate, but in the future there
will be a lot more to see.
2022-01-04 14:40:00 +01:00
Tobias Christiansen
0deadcdb28 PixelPaint: Create wrappers for all supported filters 2022-01-04 14:40:00 +01:00
Tobias Christiansen
5cf0357be1 PixelPaint: Create Filter base class
All the filters will need a wrapper around them, and this is going to be
their base class
2022-01-04 14:40:00 +01:00
Tobias Christiansen
ea19f6dd4a PixelPaint: Extend Filter Gallery dialog to accommodate settings
For now, the space is empty, but it's there.
2022-01-04 14:40:00 +01:00
Timothy Flynn
534b2be16f LibJS: Implement Number.prototype.toExponential 2022-01-04 13:07:42 +00:00
Timothy Flynn
dc984c53d8 LibJS: Implement Number.prototype.toPrecision
As noted in the prototype comments, this implementation becomes less
accurate as the precision approaches the limit of 100. For example:

    (3).toPrecision(100)

Should result in "3." followed by 99 "0"s. However, due to the loss of
accuracy in the floating point computations, we currently result in
"2.9999999...".
2022-01-04 13:07:42 +00:00
mjz19910
154d33f240 unzip: Port to LibMain 2022-01-04 10:59:42 +00:00
mjz19910
7c05db19a1 zip: Port to LibMain :^) 2022-01-04 10:59:42 +00:00
mjz19910
eacbbca4c4 LibCore: Impliment ErrorOr wrapper for chdir 2022-01-04 10:59:42 +00:00
Mathieu PATUREL
571d090609 profile: Specify the /proc/profile path in the help message 2022-01-04 07:56:54 +00:00
Mathieu PATUREL
cdbcb70913 profile: Don't print anything when disabling profiling
Just like when enabling profiling. Plus it's more unixy to not print
anything on success
2022-01-04 07:56:54 +00:00
Andrew Kaster
5cbc734081 SystemMonitor: Remove unused functions and enable warning globally
These two helpers were the only unused functions clang could detect in
the entire codebase. Now that's commitment to no dead code :^)
2022-01-04 07:51:31 +00:00
Andrew Kaster
f8ea9cd64e Userland: Resolve unused-but-set-varaible warnings
These are almost always bugs, so enable globally.

Remove unused counter variables in SystemMonitor and disk_benchmark.
2022-01-04 07:51:31 +00:00
Andrew Kaster
d809637023 Userland: Resolve tautological-constant-out-of-range-compare warnings
Stop comparing platform-specific sized integer types to max() values of
other interger types. Enable the warning everywhere.
2022-01-04 07:51:31 +00:00
Andrew Kaster
a103a85ae6 Userland: Locally suppress -Wc99-designator and re-enable globally
There's only two places where we're using the C99 feature of array
designated initalizers. This feature seemingly wasn't included with
C++20 designated initalizers for classes and structs. The only two
places we were using this feature are suitably old and isolated that
it makes sense to just suppress the warning at the usage sites while
discouraging future array designated intializers in new code.
2022-01-04 07:51:31 +00:00
Andrew Kaster
c8cfd6661a Userland: Resolve -Woverloaded-virtual in LibGUI and SoundPlayer
Enable the warning project-wide. It catches when a non-virtual method
creates an overload set with a virtual method. This might cause
surprising overload resolution depending on how the method is invoked.
2022-01-04 07:51:31 +00:00
Andrew Kaster
170a7e263c Userland: Fail Core::find_executable_in_path on empty inputs
Before this patch, `which ""` or `type ""` would say that the empty
string is `/usr/local/bin/`.

Convert callers to consistently call is_empty() on the returned string
while we're at it, to support eventually removing the is_null() String
state in the future.
2022-01-04 07:38:42 +00:00
mjz19910
7f9bd34d07 wc: Port to LibMain 2022-01-04 07:33:23 +00:00
mjz19910
fc78bbe78c which: Port to LibMain 2022-01-04 07:33:23 +00:00
mjz19910
92493b210a wsctl: Port to LibMain 2022-01-04 07:33:23 +00:00
mjz19910
d4748c608c xargs: Port to LibMain 2022-01-04 07:33:23 +00:00
mjz19910
f705f57d9a yes: Port to LibMain 2022-01-04 07:33:23 +00:00
mjz19910
e9a15995fd uname: Port to LibMain 2022-01-04 07:33:23 +00:00
mjz19910
91f5fc796b LibCore: Add an ErrorOr wrapper for uname 2022-01-04 07:33:23 +00:00
mjz19910
35cd7c9a91 uniq: Port to LibMain 2022-01-04 07:33:23 +00:00
Maciej
28ea412251 PixelPaint: Make paste action create new image if no editor is opened
This matches GIMP behaviour.
2022-01-04 07:29:50 +00:00
Maciej
41d02bd5e6 PixelPaint: Add a way to quickly create an image from clipboard
Ctrl+Shift+V, like in GIMP.
2022-01-04 07:29:50 +00:00
Jesse Buhagiar
eefad5ccd7 LibC: Include strings.h in string.h
Certain C Libraries have (unfortunately) included strings.h as a
part of string.h, which violates the POSIX spec for that specific
header. Some applications rely on this being the case, so let's
include it in our string.h
2022-01-04 07:27:04 +00:00
Tom
857c8850f3 WindowServer: Fix loading MainScreen setting from configuration 2022-01-04 06:31:59 +00:00
circl
69c757e92f tar: Implement -C option
This allows specifying which directory to extract to or create
from.

I would have used the *at variants of the functions, but some
weren't implemented yet.
2022-01-04 06:22:34 +00:00
Linus Groh
143465b23a LibJS: Propagate errors from TypedArray for_each_item{,_from_last} calls
Another mistake uncovered by moving away from manual exception checks
and relying on correct completion types instead :^)
2022-01-03 22:11:35 +01:00
Linus Groh
044c70fb46 LibJS: Add a ton of spec comments to AST.cpp 2022-01-03 21:50:50 +01:00
Linus Groh
da856d7742 LibJS: Update AST to use completions :^)
This is another major milestone on our journey towards removing global
VM exception state :^)
Does pretty much exactly what it says on the tin: updating
ASTNode::execute() to return a Completion instead of a plain value. This
will *also* allow us to eventually remove the non-standard unwinding
mechanism and purely rely on the various completion types.
2022-01-03 21:50:50 +01:00
Linus Groh
95acb1ce88 LibJS: Don't assume non-empty [[Value]] in Completion TRY() helpers 2022-01-03 21:50:50 +01:00
Linus Groh
032e6a2d28 LibJS: Remove redundant abrupt completion check
A throw completion is always an abrupt completion, no need to check :^)
2022-01-03 21:50:50 +01:00
Linus Groh
85f0fc2b83 LibJS: Return Optional<T> from Completion::{value,target}(), not T
In the end this is a nicer API than having separate has_{value,target}()
and having to check those first, and then making another Optional from
the unwrapped value:

    completion.has_value() ? completion.value() : Optional<Value> {}
    //                       ^^^^^^^^^^^^^^^^^^
    //         Implicit creation of non-empty Optional<Value>

This way we need to unwrap the optional ourselves, but can easily pass
it to something else as well.

This is in anticipation of the AST using completions :^)
2022-01-03 21:50:50 +01:00
martinfalisse
b39aede8fe Spreadsheet: Background fill color after reaching vertical end
When selecting a cell in the spreadsheet that was added
automatically as per the InfinitelyScrollableTableView
implementation, the background color is now filled correctly.

Previously, when navigating horizontally in a spreadsheet, after
a certain point the cells would not have the same background fill
color as the user would have experienced in the previous column
ranges (A-Z).
2022-01-03 22:30:04 +03:30
Samuel Bowman
4711d789c9 CrashReporter: Move progressbar into main window
Previously we would create a temporary progress window to show a
progressbar while the coredump is processed. Since we're only waiting
on backtraces and CPU register states, we can move the progressbar
into the main window and show everything else immediately while the
slow parts are generated in a BackgroundAction.
2022-01-03 16:19:47 +01:00
creator1creeper1
74d1eb6502 Applets/ResourceGraph: Propagate errors in JSON decoding 2022-01-03 16:01:42 +01:00
creator1creeper1
e46f08ff33 Applets/Network: Propagate errors using custom try_create
We now move-construct the bitmaps into the NetworkWidget.
2022-01-03 16:01:42 +01:00
creator1creeper1
f125d52622 Applets/Network: Propagate errors with try_set_main_widget
Use try_set_main_widget instead of set_main_widget.
2022-01-03 16:01:42 +01:00
creator1creeper1
43ecf1d429 Applets/Audio: Propagate errors using custom try_create
We now move-construct the bitmaps into the AudioWidget.
2022-01-03 16:01:42 +01:00
creator1creeper1
a550c20c35 Applets/Audio: Propagate errors with try_set_main_widget
Use try_set_main_widget instead of set_main_widget.
2022-01-03 16:01:42 +01:00
bugreport0
99e0b69c0c WindowServer: Tighten pledged promises 2022-01-03 15:56:41 +01:00
bugreport0
764f455d21 Taskbar: Tighten pledged promises, remove incorrect comment 2022-01-03 15:56:41 +01:00
bugreport0
0d78693b6a RequestServer: Tighten pledged promises 2022-01-03 15:56:41 +01:00
bugreport0
1d6ed50dd0 ChessEngine: Remove unused 'rpath' promise 2022-01-03 15:56:41 +01:00
martinfalisse
452150c632 LibGUI: Bring entire cell into view after auto scroll into view
On account of row and column headers, when a user navigates to
a cell (for example in the spreadsheet application) that is
outside of the view, the cell is not properly aligned and so
is partially cut-off. This fix takes into account the row and
column headers when calculating the Rect to pass to the
scroll_into_view function.
2022-01-03 15:49:07 +01:00
Maciej
e824a2da90 WebServer: Make ErrorOr unwrapping more idiomatic
This still not propagates errors properly, but is at least (more)
consistent with the codebase.
2022-01-03 15:44:56 +01:00
Timothy Flynn
022b416570 LibJS: Implement the Extend TimeZoneName Option Proposal
This is a stage 4 proposal that was recently merged into the main
ECMA-402 spec. See:

https://github.com/tc39/ecma402/commit/1ba5ee7
2022-01-03 15:11:59 +01:00
Timothy Flynn
126a3fe180 LibUnicode: Add minimal support for generic & offset-based time zones
ECMA-402 now supports short-offset, long-offset, short-generic, and
long-generic time zone name formatting. For example, in the en-US locale
the America/Eastern time zone would be formatted as:

    short-offset: GMT-5
    long-offset: GMT-05:00
    short-generic: ET
    long-generic: Eastern Time

We currently only support the UTC time zone, however. Therefore, this
very minimal implementation does not consider GMT offset or generic
display names. Instead, the CLDR defines specific strings for UTC.
2022-01-03 15:11:59 +01:00
Jamie Mansfield
1d7d7d39b7 Spider: Redraw completely when drawing cards
Spider was only updating the new bounding box area after drawing cards
from the deck - leaving behind a sliver of the old deck.

This was a regression, as the game previously used the old bounding
box, introduced by GH-11153.
2022-01-02 22:26:52 +01:00
kleines Filmröllchen
c748c0726a SoundPlayer: Don't enqueue samples depending on the GUI loop
Previously, SoundPlayer would read and enqueue samples in the GUI loop
(through a Timer). Apart from general problems with doing audio on the
GUI thread, this is particularly bad as the audio would lag or drop out
when the GUI lags (e.g. window resizes and moves, changing the
visualizer). As Piano does, now SoundPlayer enqueues more audio once the
audio server signals that a buffer has finished playing. The GUI-
dependent decoding is still kept as a "backup" and to start the entire
cycle, but it's not solely depended on. A queue of buffer IDs is used to
keep track of playing buffers and how many there are. The buffer
overhead, i.e. how many buffers "too many" currently exist, is currently
set to its absolute minimum of 2.
2022-01-02 22:18:37 +01:00
kleines Filmröllchen
b48badc3b6 LibAudio: Remove frame-wise copys from FlacLoader
Previously, FlacLoader would read the data for each frame into a
separate vector, which are then combined via extend() in the end. This
incurs an avoidable copy per frame. By having the next_frame() function
write into a given Span, there's only one vector allocated per call to
get_more_samples().

This increases performance by at least 100% realtime, as measured by
abench, from about 1200%-1300% to (usually) 1400% on complex test files.
2022-01-02 22:18:37 +01:00
kleines Filmröllchen
30130904f5 LibAudio: Alow creating a Buffer from a FixedArray
A FixedArray, due to its non-allocation guarantee, is great for audio
programming, so it's natural to have it interface with Buffer.
2022-01-02 22:18:37 +01:00
kleines Filmröllchen
59601b67a0 SoundPlayer: Remove resolved FIXME
I already resolved this some time ago but apparently forgot about it :^)
2022-01-02 22:18:37 +01:00
Linus Groh
dc60774ac4 LibCore: Mark 'Read options' parameter [[maybe_unused]] in Account.cpp
This broke the macOS clang CI build.
2022-01-02 22:02:16 +01:00
Linus Groh
cbb7329d69 LibJS: Fix two typos in comments in AST.cpp 2022-01-02 21:44:19 +01:00