Commit Graph

25983 Commits

Author SHA1 Message Date
Sergey Bugaev
4c126ea908 Userland: Use fstatat() in find(1)
This speeds things up noticeably :^)

The idea here is that a directory fd is a way to hold onto
the results of path resolution that the kernel has already done
for us. This way we don't ask the kernel to resolve the same
parent directories over and over.
2021-08-18 18:13:59 +02:00
Sergey Bugaev
e526a7641f Userland: Wrap path a into struct in find(1)
Also, replace the raw string by a LexicalPath.

Both are weird changes to make on their own; but they set
the stage for what's to come next.
2021-08-18 18:13:59 +02:00
Daniel Bertalan
bd6dc5ccec Meta+LibC: Don't allow text relocations in SerenityOS libraries
The `-z,text` linker flag causes the linker to reject shared libraries
and PIE executables that have textrels. Our code mostly did not use
these except in one place in LibC, which is changed in this commit.
This makes GNU ld match LLD's behavior, which has this option enabled by
default.

TEXTRELs pose a security risk, as performing these relocations require
executable pages to be written to by the dynamic linker. This can
significantly weaken W^X hardening mitigations.

Note that after this change, TEXTRELs can still be used in ports, as the
dynamic loader code is not changed. There are also uses of it in the
kernel, removing which are outside the scope of this PR. To allow those,
`-z,notext` is added.
2021-08-18 18:01:22 +02:00
networkException
446bd1e0de README+Meta: Update the screenshot :^) 2021-08-18 14:27:37 +02:00
Andreas Kling
b36968c442 SystemMonitor: Put the "Hardware" tabs at the end of the list 2021-08-18 13:07:35 +02:00
Andreas Kling
4eb198baf3 Profiler: Limit the initial size of the timeline container
If there are a lot of process timeline tracks, we don't want to make the
window gigantic. So let's just put a limit on it.
2021-08-18 13:06:27 +02:00
Andreas Kling
16efe603cb Base: Remove System Monitor and Assistant from quick launch bar
System Monitor can already be accessed quickly by clicking one of the
resource graph applets in the task bar, so this icon was redundant.

Assistant can be opened with the Super+Space hotkey, so we don't need a
dedicated icon for it.
2021-08-18 13:03:11 +02:00
Andreas Kling
7d904eed12 FileManager: Reorder main toolbar actions a little bit
Put the "Open in terminal" action next to the other navigation actions.
And separate the "New File" and "New Directory" actions from the actions
that operate on existing items.
2021-08-18 13:00:20 +02:00
Andreas Kling
db33a36048 Base: Rename GitHub browser bookmark to "GitHub"
"SerenityOS @ GitHub" was a pointlessly long name for this.
2021-08-18 12:56:05 +02:00
Andreas Kling
fe1b490416 SystemMonitor: Rename "Graphs" tab to "Performance" 2021-08-18 12:54:59 +02:00
Andreas Kling
636a4fe36c SystemMonitor: Rename "File system" tab to "Storage" 2021-08-18 12:53:59 +02:00
Andreas Kling
f91c499a41 SystemMonitor: Consolidate hardware tabs + remove interrupts tab
Combine the "PCI devices" and "Processors" tabs into a "Hardware" tab.

And then remove the "Interrupts" tab because the number of received
IRQ's per device is not really useful information to expose in this GUI.
If the user needs this, he can check lsirq.
2021-08-18 12:50:24 +02:00
Andreas Kling
9994b81931 SystemMonitor: Remove "Devices" tab
This was crowding up the GUI without providing anything useful.
2021-08-18 12:49:30 +02:00
Andreas Kling
a401a0f8fe LibWeb: Add fast_is<Layout::InitialContainingBlockBox>
This is used by Layout::Node::containing_block() which is fairly hot.
2021-08-18 11:45:39 +02:00
Andreas Kling
1268b39ba0 LibGfx: Make FastBoxBlurFilter go faster
When entering FastBoxBlurFilter::apply_single_pass(), we VERIFY that the
bitmap format is BGRA8888.

This invariant allows us to use get_pixel<BGRA8888>() instead of the
generic get_pixel() throughout the function. This removes a lot of
branches and makes the filter significantly faster. :^)
2021-08-18 11:35:51 +02:00
Andreas Kling
2432c5264b LibGfx: Remove ancient unused NO_FPU macros 2021-08-18 11:35:51 +02:00
Martin Åberg
0ed2a03450 Meta: Assume and find GNU du
We want to use use the 'du' option '--apparent-size' which is a
GNU coreutils extension. GNU coreutils is a build dependency so
we know it is available. With this commit we first try to pick up
du as 'gdu', and if that fails, try 'du' instead.
2021-08-18 10:59:50 +02:00
Rob Ryan
dd0244a97d Browser: Add Ctrl-D keyboard shortcut for bookmarking the current page 2021-08-18 10:39:13 +02:00
Rob Ryan
34a64ed25b LibGUI+Browser: Add UrlBox class
This allows the address bar to "select all" when initially gaining focus
as Firefox and Chrome do. A future improvement on this would be for the
Widget class to mange and provide focus transition as part of the events
instead of the UrlBox class. Currently focus is updated before the event
is provided to the UrlBox class.
2021-08-18 10:39:13 +02:00
Rob Ryan
fbf824a50f LibGUI: Allow widgets to make themselves non-auto-focusable
This patchs adds a way for widgets exclude themselves from being a focus
candidate in Window::focus_a_widget_if_possible().

This is to allow the URL box to not get auto-focused when the browser
is loaded.
2021-08-18 10:39:13 +02:00
Gunnar Beutner
6f19bf8501 Kernel: Fix a crash introduced by my TCP RST fix 2021-08-18 10:38:26 +02:00
Jean-Baptiste Boric
c972afbea6 LibC: Fix sigsetjmp and siglongjmp 2021-08-18 10:33:48 +02:00
Jean-Baptiste Boric
6165811081 LibC: Expose sig_sysname array 2021-08-18 10:33:48 +02:00
Jean-Baptiste Boric
77bec6b01d LibC: Move SIG_* definitions for sigprocmask into bits/sighow.h 2021-08-18 10:33:48 +02:00
Sam Atkins
b7aba70a28 LibWeb: Fix check for too many 'normal' values in font declaration
I had the values backwards, oops!
2021-08-18 10:32:32 +02:00
Sam Atkins
b64b97ef88 LibWeb: Implement font-fallback
If the font-family property is set to a StyleValueList, we now iterate
through it, looking up each font in turn until one is found.

StyleResolver no longer needs to handle FontFamily specifically, which
is a nice bonus.

Serenity's current dependence on bitmap fonts leads to some weirdness
here - for example, the `if (!found_font)` path can trigger even if a
generic font family like "sans-serif" is used, since our default
sans-serif font might not be available in the desired size or weight.
The `monospace` variable only exists for that reason.

This is not a complete solution, by a long way! Serenity's font support
is still quite basic, so more work needs to be done there before we can
start implementing the spec's font-matching algorithm. But this is still
an improvement. :^)
2021-08-18 10:32:32 +02:00
Sam Atkins
ceece1c75e LibWeb: Handle numeric font-weights
The code was assuming the font-weight would be a Length, apparently
since NumericStyleValue didn't exist at the time. Now, it's always a
numeric value, so treat it as such.

We also replace the hardcoded numbers with references to the FontWeight
enum.

Also, it was always setting the weight to 900, so that has been fixed.
2021-08-18 10:32:32 +02:00
Sam Atkins
3c541452b7 LibWeb: Calculate font-size in NodeWidthStyle::apply_style()
Previously, this made the same "everything is px" assumption as in
`StyleProperties::load_font()`, so I've replaced it with the calculation
from there.
2021-08-18 10:32:32 +02:00
Sam Atkins
8c39fee34d LibWeb: Handle non-px font sizes
The previous code assumed all font sizes were in px, but now we perform
the conversion. There is an existing bug with em sizes returning 0,
which seems to affect other places too - see
`NodeWithStyle::apply_style()`.

This also implements 'larger', 'smaller' and calc() font-sizes.
2021-08-18 10:32:32 +02:00
Sam Atkins
c990340c5a LibGfx: Mark Typeface::get_font() const, because it is const 2021-08-18 10:32:32 +02:00
Sam Atkins
7106655c86 Base: Add more test cases to fonts.html
- More combinations of values
- Testing a font (Liberation Serif) which has multiple faces
- Add calc() tests for font-size and weight
- Check fallback when a font isn't available

While I was at it, reorganized the file so the CSS is inline - this
keeps it close to the relevant test case.
2021-08-18 10:32:32 +02:00
sin-ack
e11d177618 Userland+LibGUI: Add shorthand versions of the Margins constructor
This allows for typing [8] instead of [8, 8, 8, 8] to specify the same
margin on all edges, for example. The constructors follow CSS' style of
specifying margins. The added constructors are:

- Margins(int all): Sets the same margin on all edges.
- Margins(int vertical, int horizontal): Sets the first argument to top
  and bottom margins, and the second argument to left and right margins.
- Margins(int top, int vertical, int bottom): Sets the first argument to
  the top margin, the second argument to the left and right margins,
  and the third argument to the bottom margin.
2021-08-18 10:30:50 +02:00
sin-ack
9c9a5c55cb Userland+LibGUI: Make Margins arguments match CSS ordering
Previously the argument order for Margins was (left, top, right,
bottom). To make it more familiar and closer to how CSS does it, the
argument order is now (top, right, bottom, left).
2021-08-18 10:30:50 +02:00
Gunnar Beutner
c17f9adb12 Kernel: Don't respond to TCP RST packets
As seen with GitHub Pages and probably lots of other hosts this might
cause a loop if the peer decides to respond to our RST packet again.
2021-08-18 10:26:51 +02:00
Martin Åberg
0bf867bb9a Meta: Create memory disk before mounting it on FreeBSD
There was previously a case where the build-image-qemu.sh script
decided to mount an existing disk image, but without creating the
memory disk device and recording its /dev file name.

After this commit, We create the memory disk device just before
it is used to mount the disk image.
2021-08-18 10:25:00 +02:00
Brian Gianforcaro
e9d8f158a1 AK+Kernel: StringView hash map Traits should not set peek type to String
This typo / bug in the Traits<T> implementation for StringView caused
AK::HashMap methods to return a `String` when looking up values out of
a hash map of type HashTable<StringView,StringView>.

This change fixes the typo, and fixes the only consumer, the kernel
Commandline class.
2021-08-18 10:21:19 +02:00
Andrew Kaster
9bdb44c5d2 CI: Ensure relevant patch files are part of Toolchain cache hash
We were over-hashing for the GNU build on GitHub Actions by including
the LLVM patch as well. The GNU Toolchain doesn't care about our LLVM
patches.

For Azure, fix the inversion of the condition for which jobs check which
Build*.sh script, and add the Toolchain patch files to the cache
hash calculation.
2021-08-18 08:26:38 +02:00
Timothy Flynn
325eabc770 LibRegex: Ensure the GoBack operation decrements the code unit index
This was missed in commit 27d555bab0.
2021-08-18 09:47:09 +04:30
Timothy Flynn
c4ee576531 AK: Add Utf8View::byte_offset_of overload for code point index lookups 2021-08-18 09:47:09 +04:30
Timothy Flynn
a9716ad44e LibRegex: In non-Unicode mode, parse \u{4} as a repetition pattern 2021-08-18 09:47:09 +04:30
BuggieBot
e85c62e3a0 Base: Add a quote to the fortunes database
[skip ci]
2021-08-18 09:18:59 +04:30
Timothy Flynn
a8f9f160f9 CI: Print on-target debug logs when the tests fail 2021-08-18 08:47:23 +04:30
Andreas Kling
c70e2f2519 Kernel: Protect the Custody cache with a mutex instead of a spinlock
We don't need to access the Custody cache in IRQs or anything like that,
so it should be fine to use a regular Mutex (via ProtectedValue.)

This allows threads to block while waiting for the custody cache.
Thanks to Sergey for pointing this out. :^)
2021-08-18 00:44:35 +02:00
Jesse Buhagiar
8ad42e6771 LibGL: Implement glGetIntegerv 2021-08-18 00:35:26 +02:00
Jesse Buhagiar
0b67369830 LibGL: Implenent glGetBooleanv 2021-08-18 00:35:26 +02:00
Martin Åberg
5d146628e1 Documentation: Update FreeBSD prerequisites
FreeBSD comes with Clang as default host compiler and provides
GCC in the package system. The commit adds a few dependencies to
the pkg command line.
2021-08-18 00:35:09 +02:00
Linus Groh
90f7e01179 LibJS/Tests: Add Temporal.Calendar.from() tests for more object types 2021-08-17 23:06:05 +01:00
Linus Groh
0cdad283c0 LibJS: Reflect Record wording editorial change in the Temporal spec
See: https://github.com/tc39/proposal-temporal/commit/c8f14d0
2021-08-17 21:59:35 +01:00
Linus Groh
74ee1c9a8c LibJS: Add PlainDateTime fast path to various Calendar.prototype getters
This is a recent editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/c3880a3
2021-08-17 21:59:35 +01:00
Linus Groh
d46c531023 LibJS: Add and use newly introduced ToIntegerThrowOnInfinity Temporal AO
See: https://github.com/tc39/proposal-temporal/commit/2ed58f4
2021-08-17 21:59:35 +01:00