Commit graph

20763 commits

Author SHA1 Message Date
Ali Mohammad Pur 3f350c3b65 AK: Remove [[gnu::noinline]] attribute from some variant members
These were left-overs from a debugging session :P
2021-05-22 09:34:31 +02:00
Idan Horowitz 3bc3a7a23a AK: Use calculate_base64_encoded_length in encode_base64
We were accidentally calling calculate_base64_decoded_length instead,
which resulted in extra allocations during the StringBuilder::append
calls that can be avoided.
2021-05-22 08:54:32 +04:30
Tobias Christiansen 155d876c44 LibGfx: Support alpha in rendering methods for border-radius
The methods used in displaying border-radius were ignoring alpha.
2021-05-22 00:21:02 +02:00
Mart G e16a50b586
Kernel: Remove an allocation from VFS::resolve_path_without_veil (#7287)
Use GenericLexer to replace a call to StringView::split() since that
returns its result in a heap-allocating Vector.
2021-05-22 00:12:32 +02:00
Andrew Kaster 467ceb15aa Base/CI: Create and check test-results.log file for on-target tests
Change run-tests-and-shutdown.sh to output a dead simple results file
that just records how many tests failed.

In the CI script, mount the _disk_image after running tests and verify
that the number of failed tests is 0. Otherwise, fail the build :^)

While we're here, bump the timeout for the tests up to 30 minutes, to
make sure that less powerful runners don't fail the job unecessarily.
2021-05-21 22:59:07 +01:00
Andrew Kaster b86d597938 CI: Add canonical-server/server-backports PPA to get updated QEMU
Ubuntu 20.04 only ships QEMU 4.2.1, which is quite an older release.

The BuildQemu.sh script uses version 6.0.0, while the server-backports
PPA is currently shipping 5.2.1. If it turns out the server-backports
PPA is not right, then we can switch to manually building and caching
the source build.
2021-05-21 22:59:07 +01:00
Lenny Maiorani 6ac454e70a DevTools: Remove redundant default destructor and forward declarations
Problem:
- Default destructors (and constructors) are in `.cpp` files. This
  prevents the compiler's optimizer from inlining them when it thinks
  inlining is appropriate (unless LTO is used).
- Forward declarations can prevent some optimizations, such as
  inlining of constructors and destructors.

Solution:
- Remove them or set them to `= default` and let the compiler handle
  the generation of them.
- Remove unneeded forward declarations.
2021-05-21 22:53:33 +01:00
Luke 4d34802f74 LibJS: Expose TypedArray.prototype.byteOffset 2021-05-21 22:52:35 +01:00
Luke 58afd71ad2 LibJS: Expose TypedArray.prototype.byteLength 2021-05-21 22:52:35 +01:00
Luke 8004a2dc77 LibJS: Expose TypedArray.prototype.buffer 2021-05-21 22:52:35 +01:00
Luke 6f1688279a LibJS: Expose BYTES_PER_ELEMENT on each TypedArray 2021-05-21 22:52:35 +01:00
Andreas Kling 7d12f49e74 Base: Unregister "md" extension from Browser
These are already handled by TextEditor, and I think it's a lot nicer
to open them there anyway.
2021-05-21 23:38:29 +02:00
Liav A 5e81464245 Kernel/Commandline: Allow the user to specify an embedded string
This is by default left empty, so people won't run the kernel in a mode
which they didn't want to. The embedded string will override the
supplied commandline from the bootloader, which is good for debugging
sessions.

This change seemed important for me, because I debug the kernel on bare
metal with iPXE, and every change to the commandline meant that I needed
rewrite a new iPXE USB image with a modified iPXE script.
2021-05-21 22:38:26 +01:00
Liav A b8f0a9c974 Kernel/CPU: Fix awkward printing early on boot
This usage of the word "installing" seemed for me for a long time as
a wrong thing, so let's make it better now.
2021-05-21 22:38:26 +01:00
Liav A df84fdfd2c Kernel: Print commandline after initializing it 2021-05-21 22:38:26 +01:00
Liav A e9ef3b59d8 Kernel/VirtualConsole: Fix grammar error in comment 2021-05-21 22:38:26 +01:00
Gunnar Beutner c3efae85f2 Games: Add Hearts 2021-05-21 23:38:18 +02:00
Gunnar Beutner 3e47eec862 Solitaire: Move cards functionality into LibCards 2021-05-21 23:38:18 +02:00
Max Wipfli 9440a3c280 LibWeb: Improve Unicode compatibility of HTML contenteditable
This patch updates the Page::keydown_event event handler to implement
crude Unicode support. It implements new method in EditEventHandler to
more easily handle deleting a single character after the cursor.
Furthermore, it makes use of the previously implemented methods to
increment and decrement the cursor position, which take into account
that Unicode codepoint may be multiple bytes wide.

This means it is now possible to mostly edit Unicode in editable DOM
nodes without any crashes. :^)
2021-05-21 21:57:03 +02:00
Max Wipfli 7181cb3a9c LibWeb: Frame/Position: Implement cursor increment/decrement methods
This introduces methods to increment and decrement the cursor position.
This is non-trivial as the cursor position is specified in bytes rather
than codepoints. Thus, it sometimes needs to be incremented or
decremented by more than one, depending on the codepoint to "jump over".

Because the cursor blink cycle needs to be reset after moving the
cursor, methods calling the ones in DOM::Position are implemented in
Frame. Furthermore, this allows the cursor_position() getter to stay
const. :^)

Additionally, it adds a offset_is_at_end_of_node() method which checks
if the current offset points to the end of the node.
2021-05-21 21:57:03 +02:00
Max Wipfli 08d09c4afb LibWeb: Improving cursor behavior in editable DOM nodes
This patch makes two modifications to improve the behavior of cursors in
editable DOM nodes, such as HTML tags with the contenteditable
attribute.

When the cursor blink cycle is reset in an editable DOM node, a repaint
should be initiated. For this, set_needs_display() needs to be called on
the layout node. Previously, the cursor blink cycle would not reset
properly and moving the cursor with the arrow keys did not feel
intuitive.

Furthermore, this modifies one of the conditions necessary to actually
paint the cursor, which previously prevented it from being painted when
at the end of a text node, after all the text present.
2021-05-21 21:57:03 +02:00
Max Wipfli d7df6de6a6 LibWeb: Do nothing when pressing modifier keys in HTML contenteditable
Before this patch, pressing modifier keys such as Ctrl would insert
whitespace into editable DOM nodes. This patch crudely fixes that
behavior by checking if the codepoint associated with the event is
non-zero.
2021-05-21 21:57:03 +02:00
Max Wipfli 157f72e9d7 LibWeb: Replace some TODO() calls with FIXME comments in EventHandler
This patch downgrades some TODO() calls when the cursor in an editable
DOM node should move to the previous or next node. Previously, the
process would crash, whereas now, the cursor will just stay where it
was.

This seems more sensible for now, as there is no reason to crash just
because of this.
2021-05-21 21:57:03 +02:00
Max Wipfli a72bb34970 AK: Add Utf8View::iterator_at_byte_offset method
This implements a method to get a Utf8CodepointIterator at a specified
byte offset.
2021-05-21 21:57:03 +02:00
Max Wipfli c1b452f754 AK: Add substring methods to Utf8View
This patch implements a Unicode-safe substring method, which can be used
when offset and length should be specified in actual characters instead
of bytes.

This can be used to mitigate issues where a string is split in the
middle of a UTF-8 multi-byte character, which leads to invalid UTF-8.

Furthermore, it implements to common shorthands for substring methods
which take only an offset and return the substring until the end of the
string.
2021-05-21 21:57:03 +02:00
Max Wipfli 8c19c2f296 AK: Change some argument and return types in Utf8View from int to size_t
This changes the return type of Utf8View::byte_length and the argument
types of substring_view from int to size_t.
2021-05-21 21:57:03 +02:00
Gunnar Beutner 7cd49ba2a2 Kernel: Ignore interfaces without an IP address when routing packages
Let's not route packages through interfaces which don't have an address
yet unless we're explicitly asked to (e.g. by DHCPClient).
2021-05-21 21:55:52 +02:00
Gunnar Beutner eb1cecc03d Kernel: Make sure network adapters have unique names
Previously we'd just slap 0 onto the adapter's basename. This ensures
we actually end up with unique names.
2021-05-21 21:55:52 +02:00
Andrew Kaster c6eff55439 Shell: Make sure all tests put their temp dirs in /tmp
Follow-on to #7337. Been seeing other CI test failures that point to
these temp directories, so let's just move all of them to /tmp. I'm sure
someone will write ext2fs stress tests later :^)

Example:

/usr/Tests/Shell/control-structure-as-command.sh
  Core::Socket: Failed to connect() to /tmp/portal/inspectables: ...
  + rm -rf shell-test 2>/dev/null
  + mkdir shell-test
  Error: The action has timed out.
2021-05-22 00:24:27 +04:30
Liav A 5018b3b4b7 Kernel: Fix PCI layout of i440fx QEMU machine
Some folks on discord said adding another e1000 network adapter made it
so we don't have networking on the system anymore.
To fix this, we will use other unsupported PCI device instead.
2021-05-21 21:20:10 +02:00
Andreas Kling 8f96d20b86 Tests: Remove default font tests from LibGfx/TestFontHandling
The system default font functions now rely on communication with
WindowServer and so we can't really test them here.
2021-05-21 21:02:43 +02:00
Linus Groh 3a4cbbf01c LibJS: Fix indexed access of TypedArray with byte offset
By doing the offset calculation in {get,put}_by_index() we would
delegate these operations to Object for any index >= (array length -
byte offset). By doing the offset calculation in data() instead, we can
just use the unaltered property index for indexing the returned Span.
In other words: data()[0] now returns the same value as indexing the
TypedArray at index 0 in JS.

This also fixes a bug in the js REPL which would not consider the byte
offset and subsequently access the underlying ArrayBuffer data with a
wrong index.
2021-05-21 19:29:23 +01:00
Linus Groh 9003dd907e js: Don't print newline for empty ArrayBuffer
If we don't have any bytes to print in hex representation, just return
early instead of printing a newline in preparation for the data that
won't follow. :^)
2021-05-21 19:29:23 +01:00
Andreas Kling be3f4c86de DisplaySettings: Restrict selection of fixed-width fonts
Only allow fixed-width fonts to be the system fixed-width font. :^)
2021-05-21 20:15:51 +02:00
Andreas Kling 59fd1f40ce WindowServer: Store system font queries in WindowServer.ini :^)
Changes to the system font settings are now persisted in /etc.
Note that you still need to restart the system for changes to fully
apply in all programs.
2021-05-21 20:15:51 +02:00
Andreas Kling 8ac0d4abe1 DisplaySettings: Add "Fonts" tab
This allows you to view, edit, and apply changes to the system fonts.
2021-05-21 20:15:51 +02:00
Andreas Kling c778130d63 WindowServer+LibGUI: Add an IPC API to change the current system fonts
This patch adds a set_system_fonts() IPC API that takes the two main
font queries as parameters. We'll probably expand this with additional
queries when we figure out what they should be.

Note that changing the system fonts on a live system mostly takes
effect in newly launched programs. This is because GUI::Widget will
currently cache a pointer to the Gfx::FontDatabase::default_font()
when first constructed. This is something we'll have to fix somehow.

Also note that the settings are not yet persisted.
2021-05-21 20:15:51 +02:00
Andreas Kling bb23e61fbf LibGfx+WindowServer: Have WindowServer broadcast system font settings
Instead of everybody getting their system fonts from Gfx::FontDatabase
(where it's all hardcoded), they now get it from WindowServer.

These are then plumbed into the usual Gfx::FontDatabase places so that
the old default_font() and default_fixed_width_font() APIs keep working.
2021-05-21 20:15:51 +02:00
Tobias Christiansen 66ad739934 LibWeb: Ignore vendor-specific CSS properties
If we can't parse a property we previously a log-line was generated.
However it is in our best interest to simply ignore vendor-specific
properties (e.g -moz-something or -webkit-something) since they are not
part of the spec.
The vendor-specific-ness is determined by looking whether the property
starts with '-'.
If we want to support some vendor-specific stuff, this doesn't get in
the way since this check takes place after the parser determined that
the current property is invalid.
This cuts down the log-noise of the parser.
2021-05-21 20:11:22 +02:00
Max Wipfli 229414b002 Applications: Use titlecase and distinct underlined characters in menus
This changes (context) menus across the system to conform to titlecase
capitalization and to not underline the same character twice (for
accessing actions with Alt).
2021-05-21 18:41:28 +01:00
Liav A f27e75ac0c Meta: Make i440fx QEMU machine PCI hierarchy a bit more complex
Let's help our future selves by ensuring we have proper support for
secondary PCI buses always.
2021-05-21 17:58:53 +01:00
Liav A 07474b4349 Kernel/PCI: Fix support of multiple PCI host controllers enumeration
First scan PCI bus 0. Find any device on that bus, and if it's a
PCI-to-PCI bridge, recursively scan it too.

Then try to handle Multiple PCI host bridges on slot 0, device 0.
If we happen to miss some PCI buses because they are not reachable
through recursive PCI-to-PCI bridges scanning starting from bus 0, we
might find them in this scanning.
2021-05-21 17:58:53 +01:00
Liav A c6ffee7f18 Kernel/Graphics: Indicate initialization failed if no device was found 2021-05-21 17:58:53 +01:00
Linus Groh 95a11d5737 FileManager: Change shortcut of Display Settings desktop option
'D' is already used by 'New Directory', let's use 'S'.

Fixes #7350.
2021-05-21 17:56:10 +01:00
Jagger De Leo 1d959a7b81 DisplaySettings: Allow deselection of background image
Previously, if you selected a background image you could not revert to a
solid color background.
2021-05-21 21:17:30 +04:30
Andreas Kling 6048e245ee 3DFileViewer: Make the main widget a GUI::Frame 2021-05-21 16:14:40 +02:00
Andreas Kling 8a3e622538 Browser: Stop leaking popup windows
We were leaking the "view source" and "downloading file" windows for
some reason, presumably it was necessary when these were first added.
Since they are owned by the spawning browser window, there's no need
to leak them.
2021-05-21 15:32:53 +02:00
Andreas Kling f555c2cc95 Base: Tweak syntax highlighting colors in the Default theme
The old ones were barely noticeable. Let's at least make it visible
that you have syntax highlighting enabled. :^)
2021-05-21 15:32:53 +02:00
Andreas Kling 81641ee469 LibWeb: Make tag names bold in syntax-highlighted HTML :^) 2021-05-21 15:32:53 +02:00
Idan Horowitz bcfde43849 Toolchain: Replace the -march=native flag with -mtune=native
This ensures inter-machine compatibility by not emitting any processor
specific instructions. This fixes the issue raised by the non AVX-512
supporting GitHub actions runners.
2021-05-21 15:23:07 +02:00