Commit graph

20641 commits

Author SHA1 Message Date
Andreas Kling
661a940ddd UserspaceEmulator: Implement MOV_seg_RM32 and MOV_seg_RM16
This allows hosted programs to write to segment registers. :^)
2022-12-07 13:18:48 +01:00
Andreas Kling
bd1f39ebaa UserspaceEmulator: Implement PUSH_{CS,DS,ES,FS,GS,SS}
You can now push the segment registers on the stack! :^)
2022-12-07 13:18:48 +01:00
Andreas Kling
b6472c250c UserspaceEmulator: Add SoftCPU getters for FS and GS 2022-12-07 13:18:48 +01:00
Andreas Kling
fba91a4307 UserspaceEmulator: Initialize the FS segment on startup
Set it to 0x23, matching the initial value in a native process.
2022-12-07 13:18:48 +01:00
Timothy Flynn
b159bdd4fd LibSQL+SQLServer+sql: Send and parse the correct number of changed rows
The sql REPL had the created/updated rows swapped by mistake. Also make
sure SQLServer fills in the correct value depending on the executed
command, and that the DELETE command indicates the rows it deleted.
2022-12-07 13:09:00 +01:00
Timothy Flynn
b9d8c25b0b LibSQL+SQLServer+SQLStudio+sql: Send result rows over IPC as SQL::Value
We've been sending the values converted to a string, but now that the
Value type is transferrable over IPC, send the values themselves. Any
client that wants the value as a string may do so easily, whereas this
will allow less trivial clients to avoid string parsing.
2022-12-07 13:09:00 +01:00
Timothy Flynn
27ce88864f SQLServer: Do not store statement execution results at the class level
If a statement is executed multiple times in quick succession, we may
overwrite the results of a previous execution. Instead of storing the
result, pass it around as it is sent to the client.
2022-12-07 13:09:00 +01:00
Timothy Flynn
f9d23e1d2f LibSQL+SQLServer+SQLStudio+sql: Propagate connection errors immediately
Currently, when clients connect to SQL server, we inform them of any
errors opening the database via an asynchronous IPC. But we already know
about these errors before returning from the connect() IPC, so this
roundabout propagation is a bit unnecessary. Now if we fail to open the
database, we will simply not send back a valid connection ID.

Disconnect has a similar story. Rather than disconnecting and invoking
an asynchronous IPC to inform the client of the disconnect, make the
disconnect() IPC synchronous (because all it does is remove the database
from the map of open databases). Further, the only user of this command
is the SQL REPL when it wants to connect to a different database, so it
makes sense to block it. This did require moving a bit of logic around
in the REPL to accommodate this change.
2022-12-07 13:09:00 +01:00
Timothy Flynn
aec75d749a LibSQL+SQLServer+SQLStudio+sql: Allocate per-statement-execution IDs
In order to execute a prepared statement multiple times, and track each
execution's results, clients will need to be provided an execution ID.
This will create a monotonically increasing ID each time a prepared
statement is executed for this purpose.
2022-12-07 13:09:00 +01:00
Timothy Flynn
e2f71d2808 LibSQL+SQLServer+SQLStudio+sql: Use proper types for SQL IPC and IDs
When storing IDs and sending values over IPC, this changes SQLServer to:

1. Stop using -1 as a nominal "bad" ID. Store the IDs as unsigned, and
   use Optional in the one place that the IPC needs to indicate an ID
   was not allocated.

2. Let LibIPC encode/decode enumerations (SQLErrorCode) on our behalf.

3. Use size_t for array sizes.
2022-12-07 13:09:00 +01:00
Timothy Flynn
8fcb8c30c6 SQLServer+SQLStudio+sql: Allow sending placeholder values to SQLServer 2022-12-07 13:09:00 +01:00
Timothy Flynn
b13527b8b2 SQLServer: Parse SQL a single time to actually "prepare" the statement
One of the benefits of prepared statements is that the SQL string is
parsed just once and re-used. This updates SQLStatement to do just that
and store the parsed result.
2022-12-07 13:09:00 +01:00
Timothy Flynn
83bb25611e LibSQL: Add an IPC encoder/decoder for SQL::Value
This will allow clients to send placeholder values for prepared
statements over IPC.
2022-12-07 13:09:00 +01:00
Timothy Flynn
b2b9ae27fd LibSQL: Parse and execute sequential placeholder values
This partially implements SQLite's bind-parameter expression to support
indicating placeholder values in a SQL statement. For example:

    INSERT INTO table VALUES (42, ?);

In the above statement, the '?' identifier is a placeholder. This will
allow clients to compile statements a single time while running those
statements any number of times with different placeholder values.

Further, this will help mitigate SQL injection attacks.
2022-12-07 13:09:00 +01:00
Timothy Flynn
53f8d62ea4 LibSQL: Partially implement the UPDATE command
This implements enough to update rows filtered by a WHERE clause.
2022-12-07 13:09:00 +01:00
MacDue
1574f2c3f6 Meta+Userland: Pass Gfx::FloatSize by value
Just two floats like Gfx::FloatPoint.
2022-12-07 11:48:27 +01:00
MacDue
27fae78335 Meta+Userland: Pass Gfx::IntSize by value
Just two ints like Gfx::IntPoint.
2022-12-07 11:48:27 +01:00
MacDue
e011eafd37 Meta+Userland: Pass Gfx::FloatPoint by value
Just a small 8-byte value like Gfx::IntPoint.
2022-12-07 11:48:27 +01:00
MacDue
7be0b27dd3 Meta+Userland: Pass Gfx::IntPoint by value
This is just two ints or 8 bytes or the size of the reference on
x86_64 or AArch64.
2022-12-07 11:48:27 +01:00
MacDue
bbc149ebb9 Meta+Userland: Pass Gfx::Color by value
Gfx::Color is always 4 bytes (it's just a wrapper over u32) it's less
work just to pass the color directly.

This also updates IPCCompiler to prevent from generating
Gfx::Color const &, which makes replacement easier.
2022-12-07 11:48:27 +01:00
Marcus Nilsson
f76c7f3788 LibGL: Generate GL_OUT_OF_MEMORY error in glBufferData when OOM 2022-12-07 11:46:37 +01:00
Linus Groh
54abfcf835 LibJS: Remove redundant AK_MAKE_NON{COPYABLE,MOVABLE} from Symbol class
These are already applied to the Cell base class.
2022-12-07 09:58:59 +00:00
Linus Groh
f490ba13ff LibJS: Move creation of global symbols into Symbol.for()
This is now according to the spec. Having a non-standard lookup API
that creates symbols on the fly doesn't seem ideal.
2022-12-07 09:58:59 +00:00
Linus Groh
b821356ba6 LibJS: Add const/non-const VM::global_symbol_registry() getters
This will allow us to replace the strange get_global_symbol() API that
creates symbols on the fly when not found.
2022-12-07 09:58:59 +00:00
Linus Groh
d5457375e6 LibJS: Store NonnullGCPtr<Symbol> values in m_global_symbol_registry 2022-12-07 09:58:59 +00:00
Linus Groh
2c579ed0df LibJS: Rename m_global_symbol_map to m_global_symbol_registry
The spec calls it "GlobalSymbolRegistry".
2022-12-07 09:58:59 +00:00
Linus Groh
112b3f7342 LibJS: Convert MarkupGenerator to the new String 2022-12-07 09:58:38 +00:00
Linus Groh
daec065fde LibJS: Move initialize_instance_elements() from VM to Object
This makes more sense as an Object method rather than living within the
VM class for no good reason. Most of the other 7.3.xx AOs already work
the same way.
Also add spec comments while we're here.
2022-12-07 00:23:51 +00:00
Linus Groh
cdeaced54e LibJS: Add spec link and comment to VM::execution_context_stack() 2022-12-07 00:14:10 +00:00
Linus Groh
91a9f41155 LibJS: Add spec link and comment to VM::running_execution_context() 2022-12-07 00:14:01 +00:00
Linus Groh
1832474a37 LibJS: Remove forgotten VM::construct() declaration
This has been a standalone AO function for a long time now.
2022-12-06 23:46:47 +00:00
Linus Groh
1f4437ff2b LibJS: Remove unused VM::join_arguments() function
The last uses of this were removed in ff5e07d.
2022-12-06 23:45:24 +00:00
Linus Groh
c756585deb LibWeb: Ignore -Wshadow in TRY_OR_RETURN_OOM() 2022-12-06 21:31:00 +00:00
Maciej
6e4f886999 3DFileViewer: Properly propagate errors from WavefrontOBJLoader
Fixes 3 FIXMEs.
2022-12-06 17:24:45 +00:00
Hendiadyoin1
fcc3348bc8 LibJS: Intercept returns through finally blocks in Bytecode
This is still not perfect, as we now actually crash in the
`try-finally-continue` tests, while we now succeed all
`try-catch-finally-*` tests.

Note that we do not yet go through the finally block when exiting the
unwind context through a break or continue.
2022-12-06 16:09:24 +03:30
Hendiadyoin1
c2108489a5 LibJS: Don't try to manage unwind contexts in the execution loop in BC
We are already doing this in a good manner via the generated code,
doing so in the execution loop as well will cause us to pop contexts
multiple times, which is not very good.
2022-12-06 16:09:24 +03:30
Hendiadyoin1
133faa0acc LibJS: Remove FinishUnwind instruction
This is essentially a LeaveUnwind+Jump, so lets just do that, that will
make it easier to optimize it, or see unwind state transitions
2022-12-06 16:09:24 +03:30
Hendiadyoin1
fc332be2e5 LibJS: Leave unwind contexts on enter of finally blocks in Bytecode
Before we were doing so while exiting the catch-block, but not when
exiting the try-block.
This now centralizes the responsibility to exit the unwind context to
the finalizer, ignoring return/break/continue.
This makes it easier to handle the return case in a future commit.
2022-12-06 16:09:24 +03:30
Linus Groh
57dc179b1f Everywhere: Rename to_{string => deprecated_string}() where applicable
This will make it easier to support both string types at the same time
while we convert code, and tracking down remaining uses.

One big exception is Value::to_string() in LibJS, where the name is
dictated by the ToString AO.
2022-12-06 08:54:33 +01:00
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
Aliaksandr Kalenik
f74251606d LibWeb: Do not try to place out-of-flow blocks in anonymous nodes
Currently placing floating blocks in anonymous nodes makes
https://stackoverflow.com/ hang so let's leave it to try
to place only absolute blocks in anonymous nodes for now.

Also it breaks flex formatting when element with floating is
flex child.
2022-12-06 08:53:10 +01:00
Tim Schumacher
312a41fddf LibAudio: Use NonnullOwnPtr to keep track of LoaderPlugin streams
This doesn't have any immediate uses, but this adapts the code a bit
more to `Core::Stream` conventions (as most functions there use
NonnullOwnPtr to handle streams) and it makes it a bit clearer that this
pointer isn't actually supposed to be null. In fact, MP3LoaderPlugin
and FlacLoaderPlugin apparently forgot to check for that completely
before starting to decode data.
2022-12-05 17:49:47 +01:00
Tim Schumacher
c57be0f474 LibAudio: Switch LoaderPlugin to a more traditional constructor pattern
This now prepares all the needed (fallible) components before actually
constructing a LoaderPlugin object, so we are no longer filling them in
at an arbitrary later point in time.
2022-12-05 17:49:47 +01:00
Tim Schumacher
3cf93d0dd2 LibAudio: Stop passing Bytes by reference
`Bytes` is very slim, so the memory and/or performance gains from
passing it by reference isn't that big, and it passing it by value is
more compatible with xvalues, which is handy for things like
`::try_create(buffer.bytes())`.
2022-12-05 17:49:47 +01:00
MacDue
385ba1280b LibWeb: Fix box-shadows where the border-radius is < the blur-radius
This fixes a rendering issue where box-shadows would not appear or
render completely broken if the blur radius was larger than the
border radius (border-radius < 2 * blur-radius to be exact).
2022-12-05 17:48:51 +01:00
Aliaksandr Kalenik
ca123350cc LibWeb: Inherit TableFormattingContext from FC instead of BFC 2022-12-05 17:47:48 +01:00
Aliaksandr Kalenik
fae0b96fe4 LibWeb: Add vertical-align support for table cells 2022-12-05 17:47:48 +01:00
Aliaksandr Kalenik
ba64d0462c LibWeb: Move box_baseline from LineBuilder.cpp to LayoutState.cpp 2022-12-05 17:47:48 +01:00
Aliaksandr Kalenik
2f38f8c84a LibWeb: Implement intrinsic width calculation for TFC 2022-12-05 17:47:48 +01:00
Aliaksandr Kalenik
dbf76e8ae1 LibWeb: Take rowspan into account while table formatting 2022-12-05 17:47:48 +01:00
Aliaksandr Kalenik
1c6783cd7e LibWeb: Start implementation of CSS Table 3 spec
Here I try to address bug where content of table overflows
it's width (hacker news is an example of such site) by
reimplementing some parts of table formatting context.

Now TFC implements first steps of:
https://www.w3.org/TR/css-tables-3/#table-layout-algorithm
but column width and row height distribution steps are
still very incomplete.
2022-12-05 17:47:48 +01:00
Cameron Youell
4e3b965d7f LibGUI: Fix a typo 2022-12-05 13:59:00 +00:00
Filiph Sandström
2e3efd34c3 MouseSettings: Add "Natural scrolling" toggle 2022-12-04 19:32:43 +00:00
Filiph Sandström
5a083c03a6 WindowServer: Add "Natural scrolling" support
Also commonly referred to as "reverse scrolling" or "inverted
scrolling".
2022-12-04 19:32:43 +00:00
Victor Song
88ecc4a1e5 WebContent+WebDriver: Implement POST /session/{id}/window endpoint 2022-12-04 09:33:55 -05:00
MacDue
b04cf15b3e WebContent: Unveil /usr/lib as readable
This is required to load libsoftgpu for the WebGL demos.
2022-12-04 14:58:22 +01:00
Osamu-kj
ac556e2623 DisplaySettings: Remove unnecessary check for an overridden theme
Issue discussed in #16290
2022-12-04 12:12:55 +00:00
Alec Murphy
8677dbfc7f Utilities: Add strings 2022-12-04 12:08:48 +00:00
Štěpán Balážik
e3112a3d2e LibGUI: Swap Next and Previous button on IncrementalSearchBanner
This order seems more natural as it is used in basically all apps on
other systems (e.g. Firefox, CLion,...).
2022-12-04 10:46:30 +01:00
Linus Groh
babfc13c84 Everywhere: Remove 'clang-format off' comments that are no longer needed
https://github.com/SerenityOS/serenity/pull/15654#issuecomment-1322554496
2022-12-03 23:52:23 +00:00
Linus Groh
d26aabff04 Everywhere: Run clang-format 2022-12-03 23:52:23 +00:00
Linus Groh
0d63b7a515 LibCodeComprehension: Add .clang-format to disable formatting for tests
Same as 42865b8975.
2022-12-03 23:52:23 +00:00
Andrew Kaster
ad9c24ffc2 LibC: Add definitions for missing ELF constants
Qt 6.4.0 relies on the definitions of ELFOSABI_GNU, ELFOSABI_AIX, and
EM_S390 existing.
2022-12-03 23:16:16 +00:00
davidot
cf0d30add6 LibJS: Add a function to ensure calls are made within the same second
Before these tests could be flaky if they happened to be called around
the edge of a second. Now we try up to 5 times to execute the tests
while staying within the same second.
2022-12-03 23:04:08 +00:00
Taj Morton
146d45a652 LibC: Return h_aliases array from gethostbyname() and gethostbyaddr()
The hostent struct's h_aliases field conventionally contains a pointer
to an array of alternate hostnames, where the final entry in this array
is a nullptr (signifying the end of the list).
At least one POSIX application (Pine email client) does not expect
`h_aliases` itself to be nullptr.
2022-12-03 22:12:13 +00:00
MacDue
6dbe7b06b3 LibWeb: Fix integer overflow in gradient painting
This would cause rendering glitches at the edges of gradients (at
certain angles).
2022-12-03 16:05:02 +00:00
MacDue
40e978df85 LibGfx: Fix some more antialiased line off-by-ones
Turns out most things expect lines to include the endpoint,
e.g. 0,0 -> 3,0 is a 4px long line. But the fill_path() implementation
seems to expect the line to be the distance between the two points
(so the above example is a 3px line instead).

This now adds an option to pick between PointToPoint line length or
Distance line length and uses the latter for fill_path().
2022-12-03 15:36:58 +00:00
MacDue
acc0fceaae LibGfx: Remove some unused AntiAliasingPainter methods 2022-12-03 15:36:58 +00:00
MacDue
b85af4e9bf LibGfx: Add some AntiAliasingPainter FIXMEs
Also fixup the style on some comments.

See #16270... Hopefully someone will land on these :^)
2022-12-03 15:36:58 +00:00
Hendiadyoin1
eb50969781 LibJS: Add an EliminateLoads pass to Bytecode
This pass tries to eliminate repeated lookups of variables by name, by
remembering where these where last loaded to.

For now the lookup cache needs to be fully cleared with each call or
property access, because we do not have a way to check if these have any
side effects on the currently visible scopes.

Note that property accesses can cause getters/setters to be called, so
these are treated as calls in all cases.
2022-12-03 15:25:05 +00:00
Hendiadyoin1
fafe498238 LibJS: Expose some internals of Instructions
These will be needed in the future to allow optimization passes to check
against these
2022-12-03 15:25:05 +00:00
Hendiadyoin1
fd6e75fd01 LibJS: Add a way to replace references to registers in Bytecode 2022-12-03 15:25:05 +00:00
Hendiadyoin1
f5e7fa4d0e LibJS: Make Register comparable 2022-12-03 15:25:05 +00:00
MacDue
28028be2fc LibWeb: Support repeating-radial-gradient()s 2022-12-03 09:06:51 -05:00
Hendiadyoin1
186237aec8 LibJS: Don't try to merge blocks not ending in Jumps 2022-12-03 17:07:30 +03:30
Hendiadyoin1
192897c269 LibJS: Remeber which instruction terminated a block 2022-12-03 17:07:30 +03:30
Hendiadyoin1
8c4717fc6e LibJS: Add a debug_position helper to the Bytecode Interpreter
This also changes argument_list_evaluation's dbgln to use it.
2022-12-03 17:07:30 +03:30
Hendiadyoin1
b86f1c2fe7 LibJS: Restore cached current_block on return in Bytecode
Otherwise debug prints will show the wrong block until we preform a jump
2022-12-03 17:07:30 +03:30
Hendiadyoin1
a00c421d61 LibJS: Handle FinishUnwind in GenerateCFG 2022-12-03 17:07:30 +03:30
Hendiadyoin1
6998b72d22 LibJS: Mark FinishUnwind as a terminator 2022-12-03 17:07:30 +03:30
Hendiadyoin1
ded7545db1 LibJS: Use a switch statement in GenerateCFG 2022-12-03 17:07:30 +03:30
Hendiadyoin1
7697e09660 LibJS: Don't mark blocks for unification multiple times
This would cause a UAF otherwise
2022-12-03 17:07:30 +03:30
Hendiadyoin1
35db0c5e18 js: Force optimizations when setting the -p flag 2022-12-03 17:07:30 +03:30
Sam Atkins
0fc673e759 LibCore: Mark connections to InspectorServer as MSG_NOSIGNAL
If InspectorServer closes for some reason at the wrong time, there is no
need for the inspected application to terminate.
2022-12-03 14:27:05 +01:00
Sam Atkins
9eb26ddd21 LibCore: Mark LocalServer client sockets as MSG_NOSIGNAL
Make LocalServer connections not terminate their process from SIGPIPE,
which fixes the issue where closing DisplaySettings with the[OK] button
would often crash WindowServer.
2022-12-03 14:27:05 +01:00
Sam Atkins
cb5f83606a LibCore: Optionally pass MSG_NOSIGNAL to socket read/writes
When creating a `Core::Stream::Socket`, you can now choose to prevent
SIGPIPE signals from firing and terminating your process. This is done
by passing MSG_NOSIGNAL to the `System::recv()` or `System::send()`
calls when you `read()` or `write()` to that Socket.
2022-12-03 14:27:05 +01:00
Liav A
0bb7c8f4c4 Kernel+SystemServer: Don't hardcode coredump directory path
Instead, allow userspace to decide on the coredump directory path. By
default, SystemServer sets it to the /tmp/coredump directory, but users
can now change this by writing a new path to the sysfs node at
/sys/kernel/variables/coredump_directory, and also to read this node to
check where coredumps are currently generated at.
2022-12-03 05:56:59 -07:00
Idan Horowitz
2e806dab07 LibJS: Implement Set.prototype.isDisjointFrom 2022-12-02 13:09:15 +01:00
Idan Horowitz
3470f33a0f LibJS: Implement Set.prototype.isSupersetOf 2022-12-02 13:09:15 +01:00
Idan Horowitz
e29be4eaa8 LibJS: Implement Set.prototype.isSubsetOf 2022-12-02 13:09:15 +01:00
Idan Horowitz
e359eeabe8 LibJS: Implement Set.prototype.symmetricDifference 2022-12-02 13:09:15 +01:00
Idan Horowitz
be8329d5f6 LibJS: Implement Set.prototype.difference 2022-12-02 13:09:15 +01:00
Idan Horowitz
9e693304ff LibJS: Implement Set.prototype.intersection 2022-12-02 13:09:15 +01:00
Idan Horowitz
fee65f6453 LibJS: Implement Set.prototype.union 2022-12-02 13:09:15 +01:00
Idan Horowitz
8e1df36588 LibJS: Implement the Set Methods proposal abstract operations 2022-12-02 13:09:15 +01:00
Marco Cutecchia
55c5c97ab5 LibWeb: Log failures to decode image resources inside ImageResource 2022-12-02 11:26:29 +01:00
Marco Cutecchia
07fb0882bf LibWeb: Add null checks before derefencing Bitmaps in ImageStyleValue 2022-12-02 11:26:29 +01:00
Linus Groh
b0e7d59b8b LibJS: Throw on conversion from TimeZone to Calendar and vice versa
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/2084e77
2022-12-02 02:04:13 +01:00
Linus Groh
ca038c1a4e LibJS: Align Temporal.{Calendar,TimeZone} id getters with toString
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/0bb391a
2022-12-02 02:04:13 +01:00
Timothy Flynn
4a30446999 LibWeb: Support displaying HTMLInputElement placeholder values
This adds support for parsing the ::placeholder pseudo-element and
injecting an anonymous layout node with that element when the input
element's data is empty.
2022-12-01 11:18:11 -05:00
Timothy Flynn
fddbc2e378 LibWeb: Ensure the number of pseudo elements stays up-to-date
The ::placeholder pseudo element was added in commit 1fbad9c, but the
total number of pseudo elements was not updated. Instead of this manual
bookkeeping, add a dummy value at the end of the enumeration for the
count.
2022-12-01 11:18:11 -05:00
Timothy Flynn
c21e9a415d LibJS: Add missing spec link on String.prototype.toWellFormed
Missed in commit 3ee5217adc.
2022-12-01 11:17:02 -05:00
Timothy Flynn
3ee5217adc LibJS: Implement String.prototype.toWellFormed 2022-12-01 17:03:55 +01:00
Timothy Flynn
0bb46235a7 LibJS: Implement String.prototype.isWellFormed 2022-12-01 17:03:55 +01:00
Linus Groh
24237ae5bf LibJS: Add FIXME to removed SplitMatch AO 2022-12-01 13:32:47 +01:00
Linus Groh
e960f9549e LibJS: Sort String.prototype methods in spec order
This is similar to these previous changes in LibJS:

- 999ad734ec
- f19c4ab693
- 5f5bcd549e
2022-12-01 13:32:47 +01:00
Timothy Flynn
69f6fbdf99 LibJS: Replace CreateDataPropertyOrThrow with Set in TypedArray toSorted
This was an errant transcription in 4dbb2c2d44.
2022-11-30 23:27:51 +01:00
Timothy Flynn
34e328e580 LibJS: Allow TypedArrays to become detached while sorting
This is a normative change in the Change Array by Copy proposal. See:
https://github.com/tc39/proposal-change-array-by-copy/commit/17d8b54
2022-11-30 23:27:51 +01:00
Mateusz Górzyński
4dfdca74e2 LibWeb: Handle <relative-size> values in the font-size CSS property 2022-11-30 19:58:17 +00:00
Mateusz Górzyński
a551e02e5e LibWeb: Handle <absolute-size> values in the font-size CSS property 2022-11-30 19:58:17 +00:00
Timothy Flynn
31d315001c LibJS: Allocate concrete TypedArrays with a preallocated base TypedArray
TypedArray constructors/prototypes are currently allocating within their
C++ constructor when trying to access the intrinsic base TypedArray. To
prevent this, construct these objects with an already-allocated base
TypedArray.
2022-11-30 13:05:57 -05:00
Timothy Flynn
c0952e3670 LibJS: Do not allocate in Set's constructor
We are currently allocating in Set's constructor to create the set's
underlying Map. This can cause GC to occur before the member is actually
initialized, thus we will crash in Set::visit_edges trying to visit a
member that does not exist.

Instead, create the Map in Set::initialize, where we can allocate. Also
change Map to be stored as a normal JS heap-allocated object, rather
than as a stack variable.
2022-11-30 13:05:57 -05:00
MacDue
65acfe6c60 LibWeb: Handle degenerate radial gradients 2022-11-30 14:24:04 +00:00
MacDue
476acae04f LibWeb: Paint radial-gradient()s
This almost looks too easy now :^), but it's just another way to sample
the gradient line.
2022-11-30 14:24:04 +00:00
MacDue
d1b06af307 LibWeb: Add missing equals() function for ConicGradientStyleValue
Also, tidy up the one for LinearGradientStyleValue.
2022-11-30 14:24:04 +00:00
MacDue
22a7611e1c LibWeb: Parse radial-gradient()s 2022-11-30 14:24:04 +00:00
MacDue
040dac558e LibWeb: Implement RadialGradientStyleValue
Adds a style value for `radial-gradient()`s and implements some helpers
for resolving their properties.
2022-11-30 14:24:04 +00:00
MacDue
f1f1977e2d LibWeb: Move color stop list parsing to standalone functions
This makes these slightly less clunky to use for other gradient types.
2022-11-30 14:24:04 +00:00
MacDue
c02163c31f LibWeb: Allow optional values to be missing when parsing <position>s 2022-11-30 14:24:04 +00:00
MacDue
b7d436fe1b LibWeb: Only floor conic-gradient() angles for hard-edge gradients
This avoids a few little jaggy edges on gradients that are meant to
have smooth transitions.
2022-11-30 14:24:04 +00:00
Rodrigo Tobar
cb3e05f476 LibPDF: Add initial implementation of XObject rendering
This implementation currently handles Form XObjects only, skipping
image XObjects. When rendering an XObject, its resources are passed to
the underlying operations so they use those instead of the Page's.
2022-11-30 14:51:14 +01:00
Rodrigo Tobar
b3007c17bd LibPDF: Allow operators to receive optional resources
Operators usually assume that the resources its operations will require
will be the Page's. This assumption breaks however when XObjects with
their own resources come into the picture (and maybe other cases too).
In that case, the XObject's resources take precedence, but they should
also contain the Page's resources. Because of this, one can safely use
the XObject resources alone when given, and default to the Page's if
not.

This commit adds all operator calls an extra argument with optional
resources, which will be fed by XObjects as necessary.
2022-11-30 14:51:14 +01:00
Rodrigo Tobar
e58165ed7a LibPDF: Render cubic bezier curves
The implementation of bezier curves already exists on Gfx, so
implementing the PDF rendering of this command is trivial.
2022-11-30 14:51:14 +01:00
Rodrigo Tobar
fe5c823989 LibPDF: Communicate resources to ColorSpace, not Page
Resources can come from other sources (e.g., XObjects), and since the
only attribute we are reading from Page are its resources it makes sense
to receive resources instead. That way we'll be able to pass down
arbitrary resources that are not necessarily declared at the page level.
2022-11-30 14:51:14 +01:00
Rodrigo Tobar
164422f8d8 LibPDF: Add further common names 2022-11-30 14:51:14 +01:00
Rodrigo Tobar
5277ad1d6d LibPDF: Implement Run Length Decoding
This is a simple decoding process that is needed by some streams.
2022-11-30 14:51:14 +01:00
Rodrigo Tobar
e776048309 LibPDF: Ignore whitespace on hex strings
The spec says that whitespaces should be ignored, but we weren't. PDFs
with whitespaces in their hex strings were thus crushing the parser.
2022-11-30 14:51:14 +01:00
Andreas Kling
9d4e0ba442 LibWeb: Fix WebIDL overload resolution with platform object arguments
We now check if an argument value is a platform object that implements
the relevant IDL interface when resolving overloads.

This makes passing a Path2D object to CanvasRenderingContext2D.fill()
actually choose the Path2D overload. :^)
2022-11-30 14:43:22 +01:00
Andreas Kling
12ddeeb9ce LibWeb: Add PlatformObject::implements_interface(String)
This can be used to ask a PlatformObject if it implements a given IDL
interface. It's implemented by a chain of virtual overrides that get
inserted for each subclass by the WEB_PLATFORM_OBJECT macro.
2022-11-30 14:43:22 +01:00
Andreas Kling
00a98c24a2 LibWeb: Update incorrect WEB_PLATFORM_OBJECT base class for two classes 2022-11-30 14:43:22 +01:00
Andreas Kling
b1f8c5879f LibIDL: Fix bug where entire EffectiveOverloadSet was erased
There was a funny bug here: by storing the "last matched item" as a
pointer, and then using Vector::remove_all_matching() to remove all
items that didn't have that exact address, we would end up removing
everything unless the last item matched was the very first item.

(This happened because every time an item was removed from the vector,
the remaining contents shift one step towards the start of the vector,
affecting item addresses.)

This patch fixes the issue by storing the last match as an index.
2022-11-30 14:43:22 +01:00
Andreas Kling
c266284559 LibWeb: Support creating Path2D objects from SVG path strings
This reuses the SVG path parsing code.
2022-11-30 14:43:22 +01:00
Andreas Kling
65d762130a LibWeb: Factor out SVG path parsing from SVGPathElement
Converting a Vector<PathInstruction> is now done by a free function so
that we can share this code with HTML::Path2D. :^)
2022-11-30 14:43:22 +01:00
Andreas Oppebøen
b716c14c32 MouseDemo: Eliminate visual artifacts when filling in the color
The drawing had several visual artifacts with the colors not perfectly
filling out their outlines. By re-using the path for both stroke and
fill, we ensure that the exact same floating point coordinates are
used. Drawing the fill first and the stroke after also helps eliminate
artifacts.
2022-11-30 12:56:29 +00:00
Andreas Oppebøen
54edd162a9 MouseDemo: Draw blue color for longer to indicate double click
When double-clicking, the button remains blue a bit longer. This
provides a convenient way to test the double click speed.

Piggybacks the timer for the scroll indicators, which is a bit weird,
but not noticeable.
2022-11-30 12:56:29 +00:00
Andreas Oppebøen
3cf81f1930 MouseDemo: Restart timer when scrolling to avoid blinking indicator
When scrolling, a timer is triggered to hide the indicator cross. When
we continuously scroll, the indicator cross would then blink once the
timer kicks in. Instead, let's cancel the current timer and schedule a
new one, making the indicator visually smooth.
2022-11-30 12:56:29 +00:00
Andreas Oppebøen
2c142e4c57 MouseDemo: Show distinct colors for primary vs secondary button
This shows mouse down of primary button in blue color,
and secondary button in light blue color.
2022-11-30 12:56:29 +00:00
Andreas Oppebøen
903bfc3d68 MouseDemo: Replace constructor with initialization at member definition
This adheres to CodingStyle.md#other-punctuation which states:
> Prefer initialization at member definition whenever possible

Since the zero-arg constructor was only initializing members, it was
simply removed.
2022-11-30 12:56:29 +00:00
Andreas Oppebøen
29de0dbea5 LibGfx: Add missing color LightBlue
Will be used in a follow-up commit as alternative to Blue
2022-11-30 12:56:29 +00:00
Filiph Sandström
4a766245fa HackStudio: Replace blank file when opening a new one
Before this we just added a new tab and left the `(Untitled)` tab in the
background. Now we instead check that it hasn't been modified and that
it's empty; if both these conditions are true we replace the blank
editor with the newly opened one.
2022-11-30 12:36:54 +00:00
Andreas Oppebøen
8cca9e94a2 PixelPaint: Record action for all select operations to allow undo
Since selections with the select tools support undo, it makes
sense for the edit operations 'select all', 'none', 'invert' and
'clear selection' to also support undo.
2022-11-30 12:18:06 +00:00
Andreas Oppebøen
427d488d7e PixelPaint: Record action when erasing a selection to allow undo 2022-11-30 12:18:06 +00:00
Tim Schumacher
d402f6cdb3 LibCore: Add support for ReadonlyBytes to MemoryStream 2022-11-30 12:09:53 +00:00
Filiph Sandström
38a882ddfa HackStudio: User-definable documentation search paths
This resolves a 3+ year old FIXME related to tooltip documentation
search paths. By default we now search man3 in addition to man2 that we
previously only searched.
2022-11-30 12:08:01 +00:00
Timothy Flynn
aba7f11a50 LibSQL: Partially implement the DELETE command
This implements enough to delete rows filtered by a WHERE clause.
2022-11-30 11:43:13 +01:00
Timothy Flynn
6d3f68cc11 LibSQL: Store a NonnullRefPtr to the table definition in SQL::Row
Also return a direct reference to the table from its getter.
2022-11-30 11:43:13 +01:00
Timothy Flynn
5336f23c7e LibSQL: Remove unused SQL::Row constructors/methods 2022-11-30 11:43:13 +01:00
Timothy Flynn
4b70908dc4 LibSQL+SQLServer: Return a NonnullRefPtr from Database::get_table
Database::get_table currently either returns a RefPtr to an existing
table, a nullptr if the table doesn't exist, or an Error if some
internal error occured. Change this to return a NonnullRefPtr to an
exisiting table, or a SQL::Result with any error, including if the
table was not found. Callers can then handle that specific error code
if they want.

Returning a NonnullRefPtr will enable some further cleanup. This had
some fallout of needing to change some other methods' return types from
AK::ErrorOr to SQL::Result so that TRY may continue to be used.
2022-11-30 11:43:13 +01:00
Timothy Flynn
56843baff9 LibSQL+SQLServer: Return a NonnullRefPtr from Database::get_schema
Database::get_schema currently either returns a RefPtr to an existing
schema, a nullptr if the schema doesn't exist, or an Error if some
internal error occured. Change this to return a NonnullRefPtr to an
exisiting schema, or a SQL::Result with any error, including if the
schema was not found. Callers can then handle that specific error code
if they want.

Returning a NonnullRefPtr will enable some further cleanup. This had
some fallout of needing to change some other methods' return types from
AK::ErrorOr to SQL::Result so that TRY may continue to be used.
2022-11-30 11:43:13 +01:00
Timothy Flynn
7464dfa974 LibSQL: Add missing definition of Value's u32 comparator
This was declared but not defined (nor was it used, but an upcoming
commit will be using it).
2022-11-30 11:43:13 +01:00
Timothy Flynn
47dd1b9f8b LibSQL: Don't copy strings when searching for a column's index
Also don't cast the return value to an int.
2022-11-30 11:43:13 +01:00
Timothy Flynn
c3a6fad080 LibSQL: Rename Row::next_pointer setter to Row::set_next_pointer 2022-11-30 11:43:13 +01:00
Timothy Flynn
0986b383cd SQLServer+SQLStudio+sql: Rename a couple of SQL IPC commands for clarity
Rename sql_statement to prepare_statement and statement_execute to
execute_statement. The former aligns more with other database libraries
(e.g. Java's JDBC prepareStatement). The latter reads less awkwardly.
2022-11-30 11:43:13 +01:00
Timothy Flynn
17988bab75 LibSQL: Immediately commit database modifications (for now)
This ensures tables survive the database connection quitting. LibSQL
does not have transactional sessions yet, and probably won't for a
while, so let's just commit each modification as it comes.
2022-11-30 11:43:13 +01:00
Timothy Flynn
8f3c22718e LibSQL: Support BOOLEAN column types in the CREATE TABLE command
The database already supports BOOLEAN, this just hooks up the executor
as well.
2022-11-30 11:43:13 +01:00
Zaggy1024
b1c7bbc4ba LibVideo/VP9: Make get_tile_offset static and remove magic numbers
This can use the new utility functions for converting units now.
2022-11-30 08:28:30 +01:00
Zaggy1024
f5ea6c89df LibVideo/VP9: Put reference frames into a struct 2022-11-30 08:28:30 +01:00
Zaggy1024
e6b696fe24 LibVideo/VP9: Remove now-unused clear_context function from Parser 2022-11-30 08:28:30 +01:00
Zaggy1024
71aac25635 LibVideo/VP9: Move partitioning contexts to TileContext
Like the non-zero tokens and segmentation IDs, these can be moved into
the tile decoding loop for above context and allocated by TileContext
for left context.
2022-11-30 08:28:30 +01:00
Zaggy1024
720fc5a853 LibVideo/VP9: Use unit conversion functions in BlockContext
This should make things in there seem a little less magical :^)
2022-11-30 08:28:30 +01:00
Zaggy1024
1fe22f2141 LibVideo/VP9: Move segmentation id prediction context to TileContext
These can also be stored in the same places as the non-zero tokens
contexts.
2022-11-30 08:28:30 +01:00
Zaggy1024
9df72080a1 LibVideo/VP9: Add FIXME about implementation of tiled decoding 2022-11-30 08:28:30 +01:00
Zaggy1024
2f043a0bd4 LibVideo/VP9: Move the above non-zero tokens context into decode_tiles
We can store this context in the stack of Parser::decode_tiles and use
spans to give access to the sections of the context for each tile and
subsequently each block.
2022-11-30 08:28:30 +01:00
Zaggy1024
4e7e9d8479 LibVideo/VP9: Move the left non-zero tokens context to TileContext
The array containing the vertical line of bools indicating whether non-
zero tokens were decoded in each sub-block is moved to TileContext, and
a span of the valid range for a block to read and write to is created
when we construct a BlockContext.
2022-11-30 08:28:30 +01:00
Zaggy1024
06082d310f LibVideo/VP9: Split/clean up the token tree-parsing context function
Since the context information for parsing residual tokens changes based
on whether we're parsing the first coefficient or subsequent ones, the
TreeParser::get_tokens_context function was split into two new ones to
allow them to read more cleanly. All variables now have meaningful
names to aid in readability as well.

The math used in the function for the first token was changed to
be more friendly to tile- or block-specific coordinates to facilitate
range-restricted Spans of the above and left context arrays.
2022-11-30 08:28:30 +01:00
Zaggy1024
3667f9bf2c LibVideo/VP9: Store m_mode_context in BlockContext
This is set by motion vector selection to later be used by inter block
info parsing.
2022-11-30 08:28:30 +01:00
Zaggy1024
b5cce5a448 LibVideo/VP9: Move the m_use_prev_frame_mvs field to FrameContext 2022-11-30 08:28:30 +01:00
Zaggy1024
6ffb0844a1 LibVideo/VP9: Remove the m_use_hp field from Parser
This one is entirely scoped to the motion vector parsing function and
its individual component read function.
2022-11-30 08:28:30 +01:00
Zaggy1024
316dad7bf7 LibVideo/VP9: Remove m_tokens and m_token_cache from Parser
Only the residual tokens array needs to be kept for the transforms to
use after all the tokens have been parsed. The token cache is able to
be kept in the stack only for the duration of the token parsing loop.
2022-11-30 08:28:30 +01:00
Zaggy1024
a4f14f220d LibVideo/VP9: Fully qualify all reference frame type enum values
Since the enum is used as an index to arrays, it unfortunately can't
be converted to an enum class, but at least we can make sure to use it
with the qualified enum name to make things a bit clearer.
2022-11-30 08:28:30 +01:00
Zaggy1024
db9f1a18f8 LibVideo/VP9: Convert TransformMode to an enum class
TXModeSelect was also renamed to plain Select, since the qualified name
will be TransformMode::Select.
2022-11-30 08:28:30 +01:00
Zaggy1024
c33d6fb028 LibVideo/VP9: Change all names containing tx_size to transform_size 2022-11-30 08:28:30 +01:00
Zaggy1024
1a2d8ac40c LibVideo/VP9: Prefix TransformSize with Transform_ instead of TX_ 2022-11-30 08:28:30 +01:00
Zaggy1024
f6e645a153 LibVideo/VP9: Rename TX(Mode|Size) to Transform(Mode|Size) 2022-11-30 08:28:30 +01:00
Zaggy1024
f898a00eb3 LibVideo/VP9: Specify more units in Parser::residual()
Previously, the variables were named similarly to the names in spec
which aren't very human-readable. This adds some utility functions for
dimensional unit conversions and names the variables in residual()
based on their units.

References to 4x4 blocks were also renamed to call them sub-blocks
instead, since unit conversion functions would not be able to begin
with "4x4_blocks".
2022-11-30 08:28:30 +01:00
Zaggy1024
f4af6714d2 LibVideo/VP9: Move persistent context storage to a different header
Moving these to another header allows Parser.h to include less context
structs/classes that were previously in Context.h.

This change will also allow consolidating some common calculations into
Context.h, since we won't be polluting the VP9 namespace as much. There
are quite a few duplicate calculations for block size, transform size,
number of horizontal and vertical sub-blocks per block, all of which
could be moved to Context.h to allow for code deduplication and more
semantic code where those calculations are needed.
2022-11-30 08:28:30 +01:00
Zaggy1024
facb779b99 LibVideo/VP9: Replace (DCT|ADST)_(DCT_ADST) with struct TransformSet
Those previous constants were only set and used to select the first and
second transforms done by the Decoder class. By turning it into a
struct, we can make the code a bit more legible while keeping those
transform modes the same size as before or smaller.
2022-11-30 08:28:30 +01:00
Zaggy1024
062da60443 LibVideo/VP9: Convert token scan order indices to u16
They are directly taken from lookup tables that only need that bit
precision, so may as well shrink them.
2022-11-30 08:28:30 +01:00
Zaggy1024
b6f41fe7d9 LibVideo/VP9: Pass the sub-block transform type around as a parameter
The sub-block transform types set and then used in a very small scope,
so now it is just stored in a variable and passed to the two functions
that need it, Parser::tokens() and Decoder::reconstruct().
2022-11-30 08:28:30 +01:00
Zaggy1024
fedbc12c4d LibVideo/VP9: Move segmentation parameters to FrameContext
Note that some of the previous segmentation feature settings must be
preserved when a frame is decoded that doesn't use segmentation.

This change also allowed a few functions in Decoder to be made static.
2022-11-30 08:28:30 +01:00
Zaggy1024
d82dc14bd9 LibVideo/VP9: Use a bitwise enum for motion vector joint selection
The motion vector joints enum is set up so that the first bit indicates
that a vector should have a non-zero value in the column, and the
second bit indicates a non-zero value for the row. Taking advantage of
this makes the code a bit more legible.
2022-11-30 08:28:30 +01:00
Zaggy1024
f4761dab09 LibVideo/VP9: Index inter-frame references with named fields or an enum
Previously, we were using size_t, often coerced from bool or u8, to
index reference pairs. Now, they must either be taken directly from
named fields or indexed using the `ReferenceIndex` enum with options
`primary` and `secondary`. With a more explicit method of indexing
these, the compiler can aid in using reference pairs correctly, and
fuzzers may be able to detect undefined behavior more easily.
2022-11-30 08:28:30 +01:00
Zaggy1024
3af4deba6d LibVideo/VP9: Move reference frame type fields to FrameContext 2022-11-30 08:28:30 +01:00
Zaggy1024
b966f9d811 LibVideo/VP9: Move the transform mode field from Parser to FrameContext 2022-11-30 08:28:30 +01:00
Zaggy1024
396972bb69 LibVideo/VP9: Retain adjacent block contexts storage between frames
Re-allocating the storage is unnecessary, since the size will rarely
change during playback.
2022-11-30 08:28:30 +01:00
Zaggy1024
ea7a6f343b LibVideo/VP9: Select and read motion vectors without fields in Parser
Candidate vector selections are only used to calculate the new vectors
for the current block, so we only need to keep those for the duration
of the inter_block_mode_info() call.

Candidate vectors are now stored in BlockMotionVectorCandidates, which
contains the fields necessary to choose the vector to use to sample
from the selected reference frame.

Most functions related to motion vectors were renamed to more verbose
but meaningful names.
2022-11-30 08:28:30 +01:00
Zaggy1024
368687a74f LibVideo/VP9: Store tile counts in FrameContext
The log2 of tile counts in the horizontal and vertical dimensions are
now stored in the FrameContext struct to be kept only as long as they
are needed.
2022-11-30 08:28:30 +01:00
Zaggy1024
6533c5f6a8 LibVideo/VP9: Move more block fields into the BlockContext struct
This includes the segment IDs, transform block sizes, prediction modes,
sub-block counts, interpolation filters and sub-block motion vectors.
2022-11-30 08:28:30 +01:00
Zaggy1024
f4e835635f LibVideo/VP9: Move quantizer indices into FrameContext
This also renames (most?) of the related quantizer functions and
variables to make more sense. I haven't determined what AC/DC stands
for here, but it may be just an arbitrary naming scheme for the first
and subsequent coefficients used to quantize the residuals for a block.
2022-11-30 08:28:30 +01:00
Zaggy1024
0df5c1f32f LibVideo/VP9: Move loop filter parameters to FrameContext 2022-11-30 08:28:30 +01:00
Zaggy1024
90f16c78fa LibVideo/VP9: Move fields set in uncompressed_header() to FrameContext 2022-11-30 08:28:30 +01:00
Zaggy1024
40bc987fe3 LibVideo/VP9: Store color config in the frame context
The color config is reused for most inter predicted frames, so we use a
struct ColorConfig to store the config from intra frames, and put it in
a field in Parser to copy from when an inter frame without color config
is encountered.
2022-11-30 08:28:30 +01:00
Zaggy1024
9f573264ea LibVideo/VP9: Add a FIXME to keep render_and_frame_size_different
The flag should be used to determine whether the pixel aspect ratio
should be updated when frame/render sizes change in the bitstream.
2022-11-30 08:28:30 +01:00
Zaggy1024
3259c99cab LibVideo/VP9: Choose whether/how to show new frames using an enum
There are three mutually exclusive frame-showing states:
- Show no new frame, only store the frame as a reference.
- Show a newly decoded frame.
- Show frame from the reference frame store.
Since they are mutually exclusive, using an enum rather than two bools
makes more sense.
2022-11-30 08:28:30 +01:00
Zaggy1024
befcd479ae LibVideo/VP9: Add Frame, Tile and Block context structs
These are used to pass context needed for decoding, with mutability
scoped only to the sections that the function receiving the contexts
needs to modify. This allows lifetimes of data to be more explicit
rather than being stored in fields, as well as preventing tile threads
from modifying outside their allowed bounds.
2022-11-30 08:28:30 +01:00
Zaggy1024
448a8b8efb LibVideo/VP9: Create Vector2DView to limit writable ranges of contexts 2022-11-30 08:28:30 +01:00
Zaggy1024
9da432f4d6 LibVideo/VP9: Remove m_eob_total field from parser
The field was only used once to track whether residual tokens were
present in the block. Parser::tokens() now returns a bool indicating
whether they were present.
2022-11-30 08:28:30 +01:00
Zaggy1024
10d207959d LibVideo/VP9: Remove m_mi_row and col fields from the parser
These are now passed as parameters to each function that uses them.
These will later be moved to a struct to further reduce the amount of
parameters that get passed around.

Above and left per-frame block contexts are now also parameters passed
to the functions that use them instead of being retrieved when needed
from a field. This will allow them to be more easily moved to a tile-
specific context later.
2022-11-30 08:28:30 +01:00
Zaggy1024
4a4aa697d9 LibVideo/VP9: Use a struct for block context to keep between frames
There are three fields that we need to store from FrameBlockContext to
keep between frames, which are used to parse for those same fields for
the next frame.
2022-11-30 08:28:30 +01:00
Zaggy1024
5275a1101e LibVideo/VP9: Remove dump_frame_info() function from Decoder
The function serves no purpose now, any debug information we want to
pull from the decoder should be instead accessed by some other yet to
be created interface.
2022-11-30 08:28:30 +01:00
Zaggy1024
0638c5d2b8 LibVideo/VP9: Use a class to store 2D context information 2022-11-30 08:28:30 +01:00
Zaggy1024
44413c31a9 LibVideo/VP9: Store data used between decode_block calls in a struct
All state that needed to persist between calls to decode_block was
previously stored in plain Vector fields. This moves them into a struct
which sets a more explicit lifetime on that data. It may be possible to
store this data on the stack of a function with the appropriate
lifetime now that it is split into its own struct.
2022-11-30 08:28:30 +01:00
Zaggy1024
9b6ab1d4e5 LibVideo/VP9: Change fields within decode_partition() to variables 2022-11-30 08:28:30 +01:00
Zaggy1024
e379223633 LibVideo/VP9: Don't store the default_intra_mode in a field
The default intra prediction mode was only used to set the sub-block
modes and the y prediction mode. Instead of storing it in a field, with
the sub modes are stored in an Array, we can just pull the last element
to set the y mode.
2022-11-30 08:28:30 +01:00
Zaggy1024
713b48cfe2 LibVideo/VP9: Remove unused parser field m_is_compound 2022-11-30 08:28:30 +01:00
Zaggy1024
eafc048101 LibVideo/VP9: Remove a FIXME that is impossible to fix
We can't memset an array with 32-bit integers to non-zero values,
silly past me :^)
2022-11-30 08:28:30 +01:00
davidot
d218a68296 LibJS: Allow CallExpressions as lhs of assignments in most cases
Although not quite like the spec says the web reality is that a lhs
target of CallExpression should not give a SyntaxError but only a
ReferenceError once executed.
2022-11-30 08:05:37 +01:00
davidot
8319d7ac06 LibJS: Fix that constant declaration in for loop was mutable in body 2022-11-30 08:05:37 +01:00
Tim Schumacher
714f0c3dce LibArchive: Implement proper support for Tar file end markers
Previously this was handled implicitly, as our implementation of Tar
would just stop processing input as soon as it found something invalid.
However, since we now error out as soon as something is found to be
wrong, we require proper handling for zero blocks, which aren't actually
fatal.
2022-11-30 08:03:31 +01:00
Tim Schumacher
cb48b9bc30 LibArchive: Pass along errors from Tar header checksum validation 2022-11-30 08:03:31 +01:00
Tim Schumacher
fd3a823a20 LibArchive: Move loading the next tar header into a helper function
This now also validates the first header that is loaded, so we can drop
the corresponding FIXME from `tar`.
2022-11-30 08:03:31 +01:00
Tim Schumacher
cbeaba0c12 LibArchive: Use Core::Stream inside TarInputStream 2022-11-30 08:03:31 +01:00
Tim Schumacher
71d1d9e2b5 LibArchive: Port TarFileStream to Core::Stream 2022-11-30 08:03:31 +01:00
Tim Schumacher
6e29619dcb LibCore: Add Stream::discard() 2022-11-30 08:03:31 +01:00
Tim Schumacher
7a065513cd LibCore: Add a basic wrapper for adapting AK::Stream to Core::Stream 2022-11-30 08:03:31 +01:00
MacDue
6daef6303a LibWeb: Use AntiAliasingPainter for canvas painting 2022-11-30 07:58:44 +01:00
MacDue
b8492006da LibGfx: Disable line intersection stroking for 1px lines
1px lines are already connected, so this just makes things look worse
and is often painting in the wrong spot anyway.
2022-11-30 07:58:44 +01:00
MacDue
8dfe43273c LibGfx: Fix off-by-one for antialiased line length
Previously the line did not include the endpoint.
2022-11-30 07:58:44 +01:00
MacDue
754b8a643d LibGfx: Remove unnecessary path members from AntiAliasingPainter
m_rotated_rectangle_path was unused and m_intersection_edge_path was
cleared/free'd each time it was used. So sticking in the class just
bloats the size.
2022-11-30 07:58:44 +01:00
lanmonster
2b7aa4a971 LibGfx+LibGUI: Use constant for line spacing instead of magic number 2022-11-30 07:57:21 +01:00
implicitfield
67de1a8148 Flood: Apply the color scheme immediately after closing settings 2022-11-30 07:56:25 +01:00
implicitfield
aa24caffc5 Flood: Store the board as a vector of integers 2022-11-30 07:56:25 +01:00
implicitfield
39caaae90a Flood: Return a Color from Board::cell
This allows us to get rid of many needless release_value() calls.
2022-11-30 07:56:25 +01:00
Zaggy1024
5f7099cff6 LibVideo/VP9: Apply higher optimization levels to Decoder and Parser
With this change, decode times on GCC as measured by TestVP9Decode are
reduced by about 15%. Not a bad improvement for a few added lines :^)
2022-11-30 07:55:29 +01:00
martinfalisse
964c18419f LibWeb: Use span value if given in the grid-*-end property
Previously were not using the span value if it was given in the
grid-column/row-end properties.
2022-11-29 19:27:31 +01:00
Timothy Flynn
99d8c115a0 LibWeb: Remove outdated FIXME regarding application cache selection
This algorithm, and window.applicationCache, was removed from the spec:
https://github.com/whatwg/html/commit/e4330d5

This also adds a spec link and comments to the affected parser method.
2022-11-29 19:04:31 +01:00
Sam Atkins
35126e81c4 profile: Pass the command to run using positional arguments
This changes this:

```sh
profile -c "python3 -m test test_dict"
```

to this:

```sh
profile -- python3 -m test test_dict
```

This should be less confusing, hopefully!
2022-11-29 18:54:27 +01:00
thankyouverycool
ed196fc265 HackStudio: Remove FindWidget
HackStudio editors now have built-in incremental search
2022-11-29 15:39:13 +00:00
thankyouverycool
a97768001b TextEditor: Change Find/Replace shortcut to Ctrl+Shift+F 2022-11-29 15:39:13 +00:00
thankyouverycool
c476ca2bd6 LibGUI: Setup IncrementalSearchBanners for TextEditors
Multi-line TextEditors now share a common search widget which can
be opened with Ctrl+F
2022-11-29 15:39:13 +00:00
thankyouverycool
8231bd9bc3 LibGUI: Add IncrementalSearchBanner
Compared to traditional modal search, incremental search begins
matching as soon as the user starts typing, highlighting results
immediately. This refactors Itamar's work for HackStudio into a
common LibGUI widget to be used in all multi-line TextEditors.
2022-11-29 15:39:13 +00:00
thankyouverycool
3c4a563415 LibGUI: Add Banner concept to AbstractScrollableWidget
Banners are abstract widgets which can house additional controls
and information on a temporary basis, popping in from the top of
their parent when needed.
2022-11-29 15:39:13 +00:00
Brendan Kelly
c2cc01c920 LibC: Treat argument "-" the same as arguments that don't start with "-"
This causes `echo -` to output "-" instead of crashing
2022-11-29 13:59:47 +00:00
Andreas Oppebøen
ad25a415ae LibWeb: Return the position at end-of-line in TextCursor hit-test
When starting to drag the cursor below the text, we would start the
selection from the closest point in the line above in the last
fragment. This is not the behavior seen in other browsers, and it
causes weird behavior when the cursor is to the left of the last
fragment, for instances when trying to select with the text
`before <span>middle</span> after`.

By starting the selection from the _end_ of the last fragment,
including the line end character, selection behavior is similar to
that of other browsers.
2022-11-29 13:52:01 +00:00
Baitinq
44ef0ac41c shuf: Support the output of a limited number of lines
This patch adds the "-n"/"--head-count" optional argument to specifiy
the maximum number of shuffled lines to output.

Idea from Andreas' FIXME roulette :^)
2022-11-29 11:44:05 +01:00
Andreas Kling
c8ff2184bd LibCore: Add Core::System::posix_fallocate() 2022-11-29 11:09:19 +01:00
Andreas Kling
361897192c LibC: Negate kernel errors before returning them in posix_fallocate()
Since posix_fallocate() doesn't set errno, it has to make sure to
manually "unwrap" any error from the kernel.
2022-11-29 11:09:19 +01:00
MacDue
f274f04e35 LibGfx: Handle alpha in color distance
This gives a slightly more reasonable result when comparing different
colors with low alpha values.

For example comparing white with alpha 100 to transparent:

	Before
		distance: 0.78
	After
		distance: 0.07

   (Where distance is between 0 and 1)

The result is unchanged for comparing colors without alpha values.
2022-11-29 11:08:50 +01:00
MacDue
613963cbce LibGfx: Don't bother painting transparent lines 2022-11-29 11:08:50 +01:00
MacDue
0e65de2e11 LibGfx: Don't write blended pixel if the alpha is zero 2022-11-29 11:08:50 +01:00
Keegan Saunders
e575339564 LibELF: Add stack guard hardening
Employ the same hardening that glibc and the Linux kernel use for
generating stack guards: zero the first byte of the guard such that
if C-style string functions read out of bounds on the stack, we do
not overwrite or potentially leak the stack guard.
2022-11-29 11:04:21 +01:00
Keegan Saunders
89b23c473a LibC: Use uintptr_t for __stack_chk_guard
We used size_t, which is a type that is guarenteed to be large
enough to hold an array index, but uintptr_t is designed to be used
to hold pointer values, which is the case of stack guards.
2022-11-29 11:04:21 +01:00
Timothy Flynn
675e5bfdce LibJS: Allow specifying only roundingIncrement in NumberFormat options
This is a normative change in the Intl.NumberFormat v3 spec. See:
https://github.com/tc39/proposal-intl-numberformat-v3/commit/a260aa3
2022-11-29 10:24:44 +01:00
Andreas Kling
e3b8a8f7c8 LibWeb: Treat unresolvable percentage width on inline-block as auto 2022-11-28 19:14:05 +01:00
Ali Mohammad Pur
c590c5c444 js: Make console.log() print to stdout again
This was broken in 84502f53b5.
2022-11-28 14:32:27 +01:00
thankyouverycool
63d0aa9d8a LibCore: Add %l conversion specification to DateTime
Replaced by the hour as a decimal 1-12 in which single digits
are preceded by a blank
2022-11-28 13:12:08 +01:00
davidot
ab19d7c99d LibJS: Enable commented out tests in Math.asin 2022-11-28 13:10:21 +01:00
davidot
bf1b2d63c6 LibJS: Add spec comments and check for edge cases in Math.tanh 2022-11-28 13:10:21 +01:00
davidot
8de8742b7c LibJS: Add spec comments and check for edge cases in Math.sinh 2022-11-28 13:10:21 +01:00
davidot
4306462a95 LibJS: Add spec comments and check for edge cases in Math.log10 2022-11-28 13:10:21 +01:00