Commit Graph

39564 Commits

Author SHA1 Message Date
Tim Schumacher
28061cf94d Everywhere: Fully remove the separate LibPthread directory 2022-07-19 11:00:35 +01:00
Tim Schumacher
dac361e330 Tests: Move the LibPthread tests to the correct namespace 2022-07-19 11:00:35 +01:00
Tim Schumacher
2f3b9c49a5 LibPthread: Move the pthread and semaphore implementation to LibC
This additionally adds some compatibility code to redirect linking
attempts for LibPthread to LibC instead.
2022-07-19 11:00:35 +01:00
Tim Schumacher
e156f79f53 Everywhere: Refer to pthread.h by its non-prefixed name
This removes a bit of noise from the following patches, where we will
move the `pthread.h` header out of the `LibPthread` directory.
2022-07-19 11:00:35 +01:00
djwisdom
268c146c04 Ports: Update serenity-theming use latest commit 98ea1b3 2022-07-19 10:50:05 +01:00
Lucas CHOLLET
7a8104e79b LibGUI: Add MoveLineUpOrDownCommand
This allows lines moved by Ctrl+Shift+[Up, Down] to be registered as a
command, i.e. cancellable by Ctrl+Z.

This patch also introduces the usage of TextDocument::[take,
insert]_line. Those functions forward changes to the visual lines and
then avoid some data mismatch.

Co-authored-by: Jorropo <jorropo.pgm@gmail.com>
2022-07-19 10:49:38 +01:00
Lucas CHOLLET
cf693136e2 LibGUI: Remove wrong casts in TextDocument.cpp 2022-07-19 10:49:38 +01:00
Lucas CHOLLET
d391f1fb2a LibGUI: Add TextDocument::take_line(size_t line_index)
This method is similar in all respects to remove_line except that it
returns the removed line.
2022-07-19 10:49:38 +01:00
Lucas CHOLLET
a85223e13b LibGUI: Add a default virtual destructor to virtual classes
Affected classes are children of TextDocumentUndoCommand:
 - InsertTextCommand
 - RemoveTextCommand
 - ReplaceAllTextCommand
2022-07-19 10:49:38 +01:00
Lucas CHOLLET
cb4844bf64 LibGUI: Add VerticalDirection::operator!
This allows to invert the direction of a VerticalDirection.
2022-07-19 10:49:38 +01:00
Andrew Kaster
9c2211f246 Meta: Add Android cross-compile support to Lagom
This is a start to properly letting us cross-compile Lagom where both
the Tools and the BUILD_LAGOM=ON build are using Lagom CMakeLists.

The initial cut allows an Android build to succeed, more or less.
But there are issues with namespace clashes when using FetchContent with
this approach.
2022-07-19 10:44:02 +01:00
Andrew Kaster
d84fc60f96 LibCore: Add support for compiling for Android with API Version >= 30
Most changes are around user and group management, which are exposed in
the Android NDK differently than other Unices.

We require version 30 for memfd_create, version 28 for posix_spawn, and
so on. It's possible a shim for memfd_create could be used, but since
Google is mandating new apps use API level 30 as of Nov 2022, this seems
suitable.
2022-07-19 10:44:02 +01:00
Andrew Kaster
3b15addbc8 AK: Add support for building on Android with API version >= 30 2022-07-19 10:44:02 +01:00
DexesTTP
686c15149e headless-browser: Simplify the arguments used to select resources
We can just infer the favicon, fonts and palette from the location of
the /res folder, no need to ask each of the resources one by one.
2022-07-19 08:02:52 +01:00
DexesTTP
9e5af374d0 headless-browser: Split the setters for the screen and the viewport rect
These two represent different things, and should be handled by different
methods.
2022-07-19 08:02:52 +01:00
DexesTTP
9c431ede7a headless-browser: Use port 443 as default for HTTPS requests 2022-07-19 08:02:52 +01:00
Linus Groh
f33df0ee05 LibWeb: Split WrapperGenerator namespace check into an Array + contains
Also sort the entries alphabetically while we're here :^)
2022-07-19 00:46:04 +01:00
Linus Groh
ed49b66f25 LibWeb: Implement '5.1. Headers class' from the Fetch API :^) 2022-07-19 00:27:35 +01:00
Linus Groh
b5ab1f6b4a LibWeb: Implement HeaderList::sort_and_combine() 2022-07-19 00:27:35 +01:00
Linus Groh
bad6ad8861 LibWeb: Implement CaseInsensitiveBytesTraits::equals()
Turns out HashTable::contains() doesn't solely use hash() for equality
checks, so the lack of a proper equals() implementation broke the check
in convert_header_names_to_a_sorted_lowercase_set() and caused duplicate
entries in header_names_set.
2022-07-19 00:27:35 +01:00
Linus Groh
6b64ca4bb8 LibWeb: Prepare WrapperGenerator for Fetch bindings 2022-07-19 00:27:35 +01:00
Linus Groh
2726fc9c73 LibWeb: Move Fetch infra into the Web::Fetch::Infrastructure namespace
The Fetch spec unfortunately will cause a name clash between the Request
concept and the Request JS object - both cannot live in the Web::Fetch
namespace, and WrapperGenerator generally assumes `Web::<Name>` for
things living in the `<Name>/` subdirectory, so let's instead move infra
code into its own namespace - it already sits in a (sub-)subdirectory
anyway.
2022-07-19 00:27:35 +01:00
Timothy Flynn
4b415a23c1 LibJS: Implement Intl.NumberFormat V3's [[RoundingIncrement]] changes 2022-07-18 23:37:31 +01:00
Timothy Flynn
8ee485c350 LibJS: Implement Intl.NumberFormat V3's [[RoundingMode]] changes 2022-07-18 23:37:31 +01:00
Timothy Flynn
800a0ddc63 LibJS: Relax integer size requirements on some NumberFormat helpers
These were changed to i8 while investigating the issues fixed by commit
9e50f25. When [[RoundingIncrement]] is implemented, some of these will
be invoked with [[RoundingIncrement]]'s value, which can be up to 5000.
Change these to i32, and wrap them with AK::Checked for good measure.
Also change a couple helpers that are always comparing against zero to
not need an explicit check.
2022-07-18 23:37:31 +01:00
Timothy Flynn
cb5f7bf696 LibJS: Add missing VERIFY_NOT_REACHED in string-to-enum conversion
Noticed this while working on [[RoundingMode]].
2022-07-18 23:37:31 +01:00
Kenneth Myhra
0a511e29d1 LibWeb: Add support for Blob to XHR::send() 2022-07-18 14:57:58 +01:00
Kenneth Myhra
9b3da5a142 LibWeb: Move extract_body() towards spec compliance 2022-07-18 14:57:58 +01:00
Kenneth Myhra
bc4ccadcac LibWeb: XHR::extra_body() rewrite to use Variant::visit() 2022-07-18 14:57:58 +01:00
Kenneth Myhra
48b59aaeb1 LibWeb: Mark body argument of extract_body() as const reference 2022-07-18 14:57:58 +01:00
Kenneth Myhra
1b9f5fa28a LibWeb: Mark URLSearchParams::to_string() as const 2022-07-18 14:57:58 +01:00
Kenneth Myhra
42e76d8de9 LibWeb: Rename safely_extract_body() to extract_body()
We have not yet implemented safely_extract_body so renaming this to
extract_body() and adding a spec link.
2022-07-18 14:57:58 +01:00
MacDue
4978f388c2 Base: Add some more fun gradient demos
Adds tests for:
- Multi-stop gradient at arbitrary angles (CPU brr)
- Default/calculated color stops
- to <corner>
- Pre-multiplied alpha mixing
2022-07-18 10:10:22 +01:00
MacDue
0c521381a3 LibWeb: Replace LibGfx gradient painting with new GradientPainting 2022-07-18 10:10:22 +01:00
MacDue
469491906f LibWeb: Add GradientPainting for painting linear-gradients
This implements support for painting linear-gradients in a spec
correct way :^).

Right now it supports:

- Multi-stop gradients
- Color stop fixups
- Using pre-multiplied alpha mixing when required
- Painting gradients at arbitrary angles

It still needs to support:

- Transition hints
- Double position color stops

However what is implemented now seems to be accurate to other
browsers, and covers the most common use cases.
2022-07-18 10:10:22 +01:00
MacDue
4246d04e5a LibWeb: Calculate to <corner> angles for linear-gradients
This also renames LinearGradientStyleValue::angle() to
LinearGradientStyleValue::angle_degrees() to make the unit more
obvious.
2022-07-18 10:10:22 +01:00
Luke Wilde
9e06fe4b3f LibJS/Bytecode: Get result from accumulator in PerformEval
This is how the JS REPL retrieves the result of executing bytecode.
2022-07-18 09:00:21 +01:00
Luke Wilde
fe2efbb2fc LibJS/Bytecode: Implement initializers for array binding patterns 2022-07-18 09:00:21 +01:00
Luke Wilde
0151dc562a LibJS/Bytecode: Implement destructuring assignment 2022-07-18 09:00:21 +01:00
Luke Wilde
f99f5d740e LibJS/Bytecode: Evaluate LHS of assignment before RHS
We had the same issue with the AST interpreter, see issue #3689.
2022-07-18 09:00:21 +01:00
Luke Wilde
896c477107 LibJS/Bytecode: Don't begin breakable scope before variable scope in for
This is no longer required, since the variable scope is ended after
switching to the end block, which means that LeaveLexicalEnvironment
will always be generated instead of depending on the unwind mechanism
to handle it for us.
2022-07-18 09:00:21 +01:00
Luke Wilde
3a48c7fdaf LibJS/Bytecode: Check for lexical bindings only in current scope
BlockDeclarationInstantiation takes as input the new lexical
environment that was created and checks if there is a binding for the
current name only in this new scope.

This allows shadowing lexical variables and prevents us crashing due to
an already initialized lexical variable in this case:
```js
let x = 1;
{
    let x = 1;
}
```
2022-07-18 09:00:21 +01:00
Luke Wilde
c55a4c7f30 LibJS/Bytecode: Create global variables before setting them
This allows them to be accessed before assignment, and also prevents
throwing in strict mode as we are trying to set a non-existent
variable.
2022-07-18 09:00:21 +01:00
Luke Wilde
12e3abc9e7 LibJS/Bytecode: Make setting failures throw only in strict mode 2022-07-18 09:00:21 +01:00
Luke Wilde
8568d18d7d LibJS/Bytecode: Determine strict mode on an executable basis
An executable is generated for the top-level script and for each
function. Strict mode can only be changed with the first statement of
the top-level script and each function, which corresponds directly to
Executable.
2022-07-18 09:00:21 +01:00
Timothy Flynn
37ab7cc694 LibJS: Implement Intl.NumberFormat V3's [[TrailingZeroDisplay]] changes 2022-07-18 08:51:07 +01:00
Timothy Flynn
a712c7b5e1 LibJS: Replace comparisons of "0"_bigint with SignedBigInteger::is_zero
This just avoids creating UnsignedBigInteger's underlying vector.
2022-07-18 08:51:07 +01:00
Timothy Flynn
440d185666 LibCrypto: Expose UnsignedBigInteger's is_zero() in SignedBigInteger
Note we don't need to check the sign because negative zero became
disallowed in b0d6399f60.
2022-07-18 08:51:07 +01:00
Timothy Flynn
bb9a44cd50 LibJS: Implement Intl.NumberFormat V3's [[RoundingPriority]] changes 2022-07-18 08:51:07 +01:00
Timothy Flynn
9e50f25ac4 LibJS: Prevent i64 overflow when computing large NumberFormat exponents
The largest exponents we compute are on the order of 10^21 (governed by
the maximumSignificantDigits option, which has a max value of 21). That
is too large to fit into the i64 we were using when multiplying this
exponent by the value to be formatted.

Instead, split up the logic to multiply that value by this exponent
based on the value's underlying type:

Number: Do not cast the result of pow() to an i64, and perform the
follow-up multiplication with doubles.

BigInt: Do not use pow(). Instead, compute the exponent as a BigInt
from the start, then perform the follow-up multiplication with that
BigInt.
2022-07-18 08:51:07 +01:00