Commit graph

3952 commits

Author SHA1 Message Date
Timothy Flynn
2f8eb4f068 LibJS: Implement non-ECMA-402 String.prototype.toLocale{Lower,Upper}Case
In implementations without ECMA-402, these methods are to behave like
their non-locale equivalents.
2021-07-27 22:35:24 +01:00
FrHun
7f4a32e7bf AboutDialog: Fix inconsistent margins 2021-07-27 22:17:23 +02:00
FrHun
aa3dd0721a FilePicker: Fix button margins and size 2021-07-27 22:17:23 +02:00
FrHun
749b39997b ProcessChooser: Fix button margins and size 2021-07-27 22:17:23 +02:00
Andreas Kling
d5a27d77d7 LibGfx: Hotfix a -Wmaybe-uninitialized failure on the build bots 2021-07-27 22:08:46 +02:00
sin-ack
7696e96c7f LibGfx: Make TextLayout algorithm whitespace-aware
This converts the TextLayout algorithm from handling just words to
handling blocks of strings. With this model, whitespace is preserved
and inserted as-is, rather than being eaten and then replaced with a
single space (or none, if the whitespace was at the start of the word).

Closes #9032.
2021-07-27 22:05:20 +02:00
sin-ack
4c9c85ac01 Userland: Make TextWrapping::Wrap opt-in
This was breaking many places which didn't expect text to wrap. Now,
the only place where text currently wraps is in GUI::Label.
2021-07-27 22:05:20 +02:00
Timothy Flynn
2dc9ae00af LibJS: Use special case folding for String.prototype.to{Lower,Upper}Case
Note we still have one String.prototype.toLowerCase test262 failure due
to not yet parsing WordBreakProperty.txt.
2021-07-27 21:04:36 +01:00
Timothy Flynn
39f971e42b LibUnicode: Begin implementing special Unicode case folding
This implements unconditional special case folding, and conditional
folding for non-locale cases. Worth noting that the only conditional,
non-locale special case is for converting an uppercase sigma to
lowercase.
2021-07-27 21:04:36 +01:00
Timothy Flynn
5b110034dd LibUnicode: Produce each code point's general category
This will be needed for the Unicode Standard's Default Case Algorithm.
Generate the field as an enumeration rather than a string for easier
comparison.
2021-07-27 21:04:36 +01:00
Timothy Flynn
32ea461385 LibUnicode: Download and parse the special casing UCD file
This adds a SpecialCasing structure to the generated UnicodeData.h/cpp
files. This structure contains casing rules for code points which have
non-1-to-1 upper-to-lower case code point mappings. Further, these rules
may be limited to specific locales or other context.
2021-07-27 21:04:36 +01:00
Linus Groh
af3a26f4cc LibJS: Implement Temporal.Now.plainDateTimeISO() 2021-07-27 19:51:44 +01:00
Linus Groh
0bb19fc51c LibJS: Implement Temporal.Now.plainDateTime() 2021-07-27 19:51:44 +01:00
Linus Groh
f2a2e8e13c LibJS: Implement Temporal.Now.plainDateISO() 2021-07-27 19:51:44 +01:00
Linus Groh
c303bbde54 LibJS: Implement Temporal.Now.plainDate()
...and ten required AOs we didn't have yet:

- BalanceISODate
- BalanceISODateTime
- BalanceISOYearMonth
- BalanceTime
- BuiltinTimeZoneGetPlainDateTimeFor
- GetISOPartsFromEpoch
- GetOffsetNanosecondsFor
- ParseTemporalTimeZone
- SystemDateTime
- ToTemporalTimeZone
2021-07-27 19:51:44 +01:00
Linus Groh
5512ff79f0 LibJS: Implement a bunch of time value related Date AOs
We don't have these yet as our Date implementation doesn't use the time
value algorithms and AOs from the spec, but Temporal will need these in
various contexts.
2021-07-27 19:51:44 +01:00
Linus Groh
ff307194f3 LibJS: Implement Temporal.Now[@@toStringTag] 2021-07-27 18:48:22 +01:00
Linus Groh
b3723a88a6 LibJS: Implement Temporal[@@toStringTag] 2021-07-27 18:48:22 +01:00
Gunnar Beutner
c9118b84b7 LibCoreDump: Make symbolication work when .text isn't the first segment
This can happen with binaries built with Clang or with a custom linker
script.
2021-07-27 19:14:29 +02:00
Karol Kosek
99d46caa28 LibGUI: Disable changing the view on error in the FilePicker
Prior to this change, changing the view would hide the error label
and show an empty directory.
2021-07-27 19:06:21 +02:00
Karol Kosek
80e3cf3ef7 LibGUI: Show an error message on open error in the FilePicker 2021-07-27 19:06:21 +02:00
Andreas Kling
4a8d47edf8 LibGUI: Add some "fudge factor" around IconView item rects
Previously there was a dead zone between the item icon and its text
in IconViews. This meant that you could click between the icon and
the text label and hit nothing.

This patch improves the situation by inflating both rects so that
they both overlap and become a bit easier to hit.
2021-07-27 18:27:49 +02:00
Andreas Kling
75a41da69f LibGUI: Show dotfiles with 50% opacity (in FileSystemModel views)
Use the new ModelRole::IconOpacity for this. :^)
2021-07-27 18:27:49 +02:00
Andreas Kling
8ba47facf6 LibGUI: Add ModelRole::IconOpacity and support it in all views :^)
This role allows you to specify a custom opacity for icon painting.
Note that the opacity is not in effect when the item is either
selected and/or hovered.
2021-07-27 18:27:49 +02:00
Andreas Kling
2d1eff01a2 LibGUI: Add Variant::as_float_or(fallback) 2021-07-27 18:27:49 +02:00
Andreas Kling
4486e5b26d LibGUI: Remove some unused code in GUI::TreeView 2021-07-27 18:27:49 +02:00
Gunnar Beutner
78c81854cc LibC: Don't include C++ headers in C system headers 2021-07-27 16:53:16 +02:00
Gunnar Beutner
57417a3d6e Kernel: Support loading the kernel at almost arbitrary virtual addresses
This enables further work on implementing KASLR by adding relocation
support to the pre-kernel and updating the kernel to be less dependent
on specific virtual memory layouts.
2021-07-27 13:15:16 +02:00
Gunnar Beutner
e3d2ca6bd2 LibSymbolication: Fix integer overflow when calculating region addresses 2021-07-27 13:15:16 +02:00
Gunnar Beutner
ff292fbe5a LibELF: Fix unaligned writes in the relocation code 2021-07-27 13:15:16 +02:00
Gunnar Beutner
daeb371180 DynamicLoader+LibELF: Move self-relocation code into a separate file 2021-07-27 13:15:16 +02:00
Andreas Kling
751cb094ff LibGfx: Remove Gfx::ImageDecoder::bitmap() in favor of frame(index)
To transparently support multi-frame images, all decoder plugins have
already been updated to return their only bitmap for frame(0).

This patch completes the remaining cleanup work by removing the
ImageDecoder::bitmap() API and having all clients call frame() instead.
2021-07-27 01:29:50 +02:00
Andreas Kling
d01b4327fa LibGfx: Improve ImageDecoder construction
Previously, ImageDecoder::create() would return a NonnullRefPtr and
could not "fail", although the returned decoder may be "invalid" which
you then had to check anyway.

The new interface looks like this:

    static RefPtr<Gfx::ImageDecoder> try_create(ReadonlyBytes);

This simplifies ImageDecoder since it no longer has to worry about its
validity. Client code gets slightly clearer as well.
2021-07-27 01:17:05 +02:00
Linus Groh
c6f4ecced9 LibJS: Update Temporal spec comment that's now been corrected
See: https://github.com/tc39/proposal-temporal/commit/6d2350f
2021-07-26 23:39:11 +01:00
ovf
13c7d55320 LibWeb: Fix parsing of character references in attribute values 2021-07-27 00:03:43 +02:00
Martin Blicha
0505a815f7 LibChess: Early check of legal move
One of the conditions for legal move is that the target square is not
occupied by a piece of the same color as the moving piece.

Instead of checking this for each piece separately at the end, we can
check this at the beginning and avoid more expensive checks.
2021-07-26 23:53:41 +02:00
Brian Gianforcaro
46c9b1d81c Kernel+LibC: Use argument for TIOCGPGRP ioctl value
In preparation for modifying the Kernel IOCTL API to return KResult
instead of int, we need to fix this ioctl to an argument to receive
it's return value, instead of using the actual function return value.
2021-07-27 01:23:37 +04:30
Tom
81c183e06a LibGUI: Add InputType enum to allow creating a password InputBox dialog 2021-07-26 21:55:18 +04:30
Tobias Christiansen
5745e8e18c LibWeb: Add blurring support to box-shadow
Now the box-shadow-rendering is done by using the new
Gfx::FastBoxBlurFilter. :^)
2021-07-26 17:54:19 +01:00
Tobias Christiansen
d1844e424d LibGfx: Add FastBoxBlurFilter
This patch adds a FastBoxBlurFilter to the system. It can be created by
specifying a Bitmap it will work on.
There are two uses implemented:
- apply_single_pass() applys an implementation of a linear-time
box-blur algorithm with the specified radius using a horizontal and a
vertical pass and utilizinga sliding window.
- apply_three_passes() gets a better Gaussian approximation by applying
  the filter three times. For this to work the radius of each pass is
  calculated to fit Gauss the best.
2021-07-26 17:54:19 +01:00
sin-ack
e11940fd01 Userland: Move text wrapping/elision into the new TextLayout :^)
This class now contains all the fun bits about laying out text in a
rect. It will handle line wrapping at a certain width, cutting off lines
that don't fit the given rect, and handling text elision.
Painter::draw_text now internally uses this.

Future work here would be not laying out text twice (once actually
preparing the lines to be rendered and once to get the bounding box),
and possibly adding left elision if necessary.

Additionally, this commit makes the Utf32View versions of
Painter::draw_text convert to Utf8View internally. The intention is to
completely remove those versions, but they're kept at the moment to keep
the scope of this PR small.
2021-07-26 21:14:39 +04:30
sin-ack
a5a32fbcce LibGUI: Ignore the Enter event by default
If this is not ignored by default, then one can move the mouse fast
enough to skip hovering over a parent element and hover directly over
the child, causing the parent to never receive an Enter event.
2021-07-26 21:14:39 +04:30
sin-ack
cfc9ee6f16 LibGUI: Only dispatch Leave if the now-hovered widget isn't a child
Without this change, when the mouse starts hovering over a child widget,
the parent would receive a Leave event despite the parent widget not
losing mouse hover.
2021-07-26 21:14:39 +04:30
sin-ack
444ed56521 LibGUI: Add virtual handlers for WindowEntered and WindowLeft events
These can be useful if an application wants to react to the cursor
entering the window at any point, rather than just on a widget.
2021-07-26 21:14:39 +04:30
sin-ack
6162e78c7f LibGUI: Let GUI applications create an inspectable EventLoop
GUI applications automatically have EventLoops created for them via
GUI::Application; however before this commit it was not possible to make
the application event loop inspectable. This exposes a third optional
argument to GUI::Application which allows one to make the application
event loop inspectable.
2021-07-26 21:14:39 +04:30
Timothy Flynn
2e3a5b884c LibJS: Implement Unicode aware String.prototype.to{Upper,Lower}Case 2021-07-26 17:03:55 +01:00
Timothy Flynn
98d8274040 Meta: Add LibUnicode (and its tests) to Lagom
This is primarily to allow using LibUnicode within LibJS and its REPL.

Note: this seems to be the first time that a Lagom dependency requires
generated source files. For this to work, some of Lagom's CMakeLists.txt
commands needed to be re-organized to include the CMake files that fetch
and parse UnicodeData.txt. The paths required to invoke the generator
also differ depending on what is currently building (SerenityOS vs.
Lagom as part of the Serenity build vs. a standalone Lagom build).
2021-07-26 17:03:55 +01:00
Timothy Flynn
4dda3edc9e LibUnicode: Introduce a Unicode library for interacting with UCD files
The Unicode standard publishes the Unicode Character Database (UCD) with
information about every code point, such as each code point's upper case
mapping. LibUnicode exists to download and parse UCD files at build time
and to provide accessors to that data.

As a start, LibUnicode includes upper- and lower-case code point
converters.
2021-07-26 17:03:55 +01:00
Patrick Meyer
83f88df757 Kernel: Add option to build with coverage instrumentation and KCOV
GCC and Clang allow us to inject a call to a function named
__sanitizer_cov_trace_pc on every edge. This function has to be defined
by us. By noting down the caller in that function we can trace the code
we have encountered during execution. Such information is used by
coverage guided fuzzers like AFL and LibFuzzer to determine if a new
input resulted in a new code path. This makes fuzzing much more
effective.

Additionally this adds a basic KCOV implementation. KCOV is an API that
allows user space to request the kernel to start collecting coverage
information for a given user space thread. Furthermore KCOV then exposes
the collected program counters to user space via a BlockDevice which can
be mmaped from user space.

This work is required to add effective support for fuzzing SerenityOS to
the Syzkaller syscall fuzzer. :^) :^)
2021-07-26 17:40:28 +02:00
Idan Horowitz
67b3255fe8 LibJS: Implement Temporal.PlainDate.from 2021-07-26 16:15:31 +01:00