Commit Graph

23064 Commits

Author SHA1 Message Date
Linus Groh
c9d8aa6139 js: Handle detached ArrayBuffer in print_typed_array()
Co-authored-by: Idan Horowitz <idan.horowitz@gmail.com>
2021-07-04 22:07:36 +01:00
Linus Groh
bb1a98d809 LibJS: Add new PropertyDescriptor class and related abstract operations
This is an implementation of 'The Property Descriptor Specification
Type' and related abstract operations, namely:

- IsAccessorDescriptor
- IsDataDescriptor
- IsGenericDescriptor
- FromPropertyDescriptor
- ToPropertyDescriptor
- CompletePropertyDescriptor

It works with Optional<T> to enable omitting certain fields, which will
eventually replace the Attribute::Has{Getter,Setter,Configurable,
Enumerable,Writable} bit flags, which are awkward to work with - being
able to use an initializer list with any of the possible attributes is
much more convenient.

Parts of the current PropertyAttributes implementation as well as the
much simpler PropertyDescriptor struct in Object.h will eventually be
replaced with this and completely go away.

Property storage will still use the PropertyAttributes bit flags, this
is for the layers above.

Note that this is currently guarded behind an #if 0 as if conflicts with
the existing PropertyDescriptor struct, but it's known to compile and
work just fine - I simply want to have this in a separate commit, the
primary object rewrite commit will be large enough as is.
2021-07-04 22:07:36 +01:00
Linus Groh
a3c8ebd709 LibJS: VERIFY() that property name is valid in Value::get{,_method}() 2021-07-04 22:07:36 +01:00
Linus Groh
1ac3d253c5 LibWeb/WebAssembly+test-wasm: Use get_without_side_effects() more 2021-07-04 22:07:36 +01:00
Linus Groh
9fd9e424ff LibJS: Avoid unnecessary PropertyName creation in MarkupGenerator 2021-07-04 22:07:36 +01:00
Tobias Christiansen
f35c25a7eb Tests: Add test for String::roman_number_from() 2021-07-04 22:17:03 +02:00
Tobias Christiansen
36a420a6a6 Browser: Add Test-Page for lists
This test page showcases all our supported ol and ul list-styles.
2021-07-04 22:17:03 +02:00
Tobias Christiansen
e18e2af826 LibWeb: Add roman numerals as a list-style for ol's
This patch adds support for the identifiers upper-roman and lower-roman
of the list-style property.
2021-07-04 22:17:03 +02:00
Tobias Christiansen
87033ce7d1 AK: Add generation of roman numerals to AK::String
We now can generate roman numbers using String::roman_number_from()
similar to String::bijective_base_from().
2021-07-04 22:17:03 +02:00
Andreas Kling
24e122590c Taskbar: Simplify quick launch widget layout
Use shrink-to-fit instead of manually calculating the widget size.
2021-07-04 22:03:47 +02:00
Andreas Kling
48982a08f1 Taskbar: Give the "Show/Hide Desktop" button an icon :^) 2021-07-04 21:54:50 +02:00
Andreas Kling
49d0b9e808 LibTTF: Memory map TTF fonts instead of reading them into heap memory
All GUI applications currently load all TTF fonts on startup
(to populate the Gfx::FontDatabase. This could probably be smarter.)

Before this patch, everyone would open the files and read them into
heap-allocated storage. Now we simply mmap() them instead. :^)
2021-07-04 21:34:26 +02:00
Andreas Kling
560109bd42 LibTTF: Make TTF::Font loading API return error strings 2021-07-04 21:34:26 +02:00
Idan Horowitz
9321d9d83d AK: Explicitly require Checked types to be Integral
These were already implicitly required to be integral via the usage of
the is_within_range templated function, but making them explicit should
produce nicer error messages when building, and make the IDE highlight
the incorrect usage.
2021-07-04 20:08:28 +01:00
Idan Horowitz
301c1a3a58 Everywhere: Fix incorrect usages of AK::Checked
Specifically, explicitly specify the checked type, use the resulting
value instead of doing the same calculation twice, and break down
calculations to discrete operations to ensure no intermediary overflows
are missed.
2021-07-04 20:08:28 +01:00
Idan Horowitz
3f70efed9c LibC: Convert LengthModifier & ConversionSpecifier to enum classes
These were preventing some AK classes from using the AK Concepts header
due to the non-strictly namespaced ConversionSpecifier::Unsigned, and
are not used as their underlying value, so enum classes are more
appropriate anyways.
2021-07-04 20:08:28 +01:00
Tom
814195b060 WindowServer: Only run window animation for windows on current desktop
We should only run the minimize and launch animations for windows that
are actually rendered on the currently visible virtual desktop.
2021-07-04 20:23:56 +02:00
Tom
812ee194b7 WindowServer: Toggling desktop should only toggle current desktop
We should only show/hide the windows on the current virtual desktop.
2021-07-04 20:23:56 +02:00
zawwwu
f6cca0b8f0 Spreadsheet: Move down a cell when Return is pressed in the cell editor
If Return key is pressed when using cell value editor in a top bar,
cursor is automatically moved one line down. Fixes #8287.
2021-07-04 21:54:50 +04:30
zawwwu
cf91815654 Spreadsheet: Add function for moving cursor
This function allows to access cursor movement functionality outside of
SpreadsheetView class.
2021-07-04 21:54:50 +04:30
Andreas Kling
e8579ed24a LibThreading: Wake up the background worker thread when there's work
The worker thread used for BackgroundAction was going to sleep for
1 second at a time (when there was nothing to do.) This made using
background actions for anything interactive quite unresponsive since
you had to wait up to 1 second before it even started on your task.

We now use a simple Unix pipe to signal the worker thread that a new
work item is available.

This makes Assistant way more responsive when typing. :^)
2021-07-04 18:56:08 +02:00
Andreas Kling
d114ba4c4e LibJS: Make the with statement evaluation follow the spec even more
This was almost entirely up-to-spec already, just missing exception
checks, and we now leave the lexical environment in the modified state
if an exception occurs during statement evaluation.
2021-07-04 18:56:08 +02:00
Tom
dce18958b6 Kernel: Fix safe_memset not setting the last few bytes in some cases
Because the remainder variable will always be 0 unless a fault happened
we should not use it to decide if we have nothing left to memset when
finishing the fast path. This caused not all bytes to be zeroed
if the size was not an exact multiple of sizeof(size_t).

Fixes #8352
2021-07-04 18:54:16 +02:00
LuK1337
0486e5895d Terminal: Grey out color scheme widget when there's nothing to select
By default we only include one color scheme.
2021-07-04 17:58:33 +02:00
Itamar
2af5bb9083 CppLanguageServer: Add test for "get_parameters_hint" 2021-07-04 17:50:33 +02:00
Itamar
f26f764c7d HackStudio: Show tooltip with parameters hint when pressing Ctrl+P
When you press Ctrl+P while the cursor is inside the parameters list of
a function call site, HackStudio will request the C++ language server
to retrieve the parameters of the called function.

The result is displayed in a tooltip window, with the current argument
in bold font.
2021-07-04 17:50:33 +02:00
Itamar
32be65a8b4 CppLanguageServer: Add "get_parameters_hint" capability
Given a call site, the C++ language server can now return the declared
parameters of the called function, as well as the index of the
parameter that the cursor is currently at.
2021-07-04 17:50:33 +02:00
Itamar
232013c05b LibCpp: Add Parser::tokens_in_range(start, end)
This function returns the tokens that exist in the specified range.
2021-07-04 17:50:33 +02:00
Itamar
9a31fb6673 LibCpp: Fix positional information of Pointer types 2021-07-04 17:50:33 +02:00
Itamar
1dfdfcf820 LibCpp: Fix parsing of ellipsis
Previously the positional information for the node of an ellipsis was
incorrect.
2021-07-04 17:50:33 +02:00
timre13
55dd568583 Assistant: Show a border around the window 2021-07-04 14:48:54 +02:00
Aziz Berkay Yesilyurt
11ff3c11f4 Userland: Add pgrep 2021-07-04 14:27:47 +02:00
Gunnar Beutner
3bbe86d8ea Everywhere: Prefer using "..."sv over StringView { "..." } 2021-07-04 14:24:03 +02:00
Gunnar Beutner
ea8ff03475 LibELF: Fix loading objects with a non-zero load base
My previous patch (1f93ffcd) broke loading objects whose first PT_LOAD
entry had a non-zero vaddr.

On top of that the calculations for the relro and dynamic section were
also incorrect.
2021-07-04 14:23:52 +02:00
Idan Horowitz
2f60508ae0 LibWeb: Hook on_call_stack_emptied after m_interpreter was initialized
We must hook `on_call_stack_emptied` after the interpreter was created,
as the initialization of the WindowsObject can invoke some internal
calls, which will eventually lead to this hook being called without
`m_interpreter` being fully initialized yet.
2021-07-04 14:23:25 +02:00
ForLoveOfCats
d73f53d1de Assistant: Prevent window from being minimized 2021-07-04 13:58:56 +02:00
ForLoveOfCats
cefa2e3dd2 Taskbar: Add show desktop button to toggle showing of the desktop 2021-07-04 13:58:56 +02:00
ForLoveOfCats
271840ca22 WindowServer: Add show desktop toggle IPC call
Differentiates between normal minimization and hidden windows. A window
which is hidden is still minimized, but can be seen as another stage
of being minimized.
2021-07-04 13:58:56 +02:00
LuK1337
62d4b4abf3 LibGUI: Make tooltip height line count aware
Previously multiline was not handled properly thus in case of the
Network applet the tooltip would be drawn improperly.
2021-07-04 11:31:01 +02:00
Timothy
e42484bb65 AK+LibIPC: Make all enums codable
If an enum has a supported underlying type we can provide encoding and
decoding for the enum as well.
2021-07-04 13:48:20 +04:30
Timothy
60f84f3154 LibCore: Add method to leak fd from File
This will let other code use the fd while making sure the fd isn't
automatically closed by Core::File's destructor
2021-07-04 11:44:47 +04:30
Daniel Bertalan
2ef28602ba Tests: Add tests for Optional's conditionally trivial functions 2021-07-04 07:24:41 +04:30
Daniel Bertalan
39dd13fd17 AK: Destroy original value when assigning to Variant 2021-07-04 07:24:41 +04:30
Daniel Bertalan
515e2d9734 AK: Use conditionally trivial special member functions
This commit makes use of the conditionally trivial special member
functions introduced in C++20. Basically, `Optional` and `Variant`
inherits whether its wrapped type is trivially copy constructible,
trivially copy assignable or trivially destructible. This lets the
compiler optimize optimize a large number of their use cases.

The constraints have been applied to `Optional`'s converting
constructors too in order to make the API more explicit.

This feature is not supported by Clang yet, so we use conditional
compilation so that Lagom can be built on macOS. Once Clang has P0848R3
support, these can be removed.
2021-07-04 07:24:41 +04:30
Daniel Bertalan
6c0b9919ce FileManager: Remove explicit T to Optional<T> conversion 2021-07-04 07:24:41 +04:30
Daniel Bertalan
9323d459b4 Tests: Add test for supported operation type traits 2021-07-04 07:24:41 +04:30
Daniel Bertalan
84ddecae8a AK: Add type traits describing supported operations
This will allow us to make `Optional`, `Variant`, and possibly other
data structures conditionally trivially constructible, destructible,
copyable or movable based on their type parameters.
2021-07-04 07:24:41 +04:30
Idan Horowitz
e480d69130 LibJS: Bring ArrayCreate and ArrayConstructor closer to spec
Specifically, this now explicitly takes the length, adds missing
exceptions checks to calls with user-supplied lengths, takes and uses
the prototype argument, and fixes some spec non-conformance in
ArrayConstructor and its native functions around the use of ArrayCreate
2021-07-04 00:51:43 +01:00
Idan Horowitz
5ee1ae37b2 LibJS: Add the IteratorStep abstract iterator operation
As well as add 2 missing exception checks in the IteratorComplete and
IteratorValue abstract iterator operations.
2021-07-04 00:51:43 +01:00
Erik Biederstadt
ba4d367dea HackStudio: Remove old form editing logic
In the past Hack Studio had the ability to design GUI widgets via `.frm`
files. We now use the GML playground for this purpose, and the old code
can be removed. `.frm` files are now treated as plain text files.

This commit also fixes a crash when opening `.frm` files.
`m_form_inner_container` was never instantiated, and caused a null
pointer dereference.
2021-07-04 01:14:54 +02:00