Commit graph

33808 commits

Author SHA1 Message Date
Mahmoud Mandour
cd4dba87fa LibSQL: Avoid signed arithmetic in IntegerImpl::compare 2022-02-05 00:35:03 +01:00
Ali Mohammad Pur
a962ee020a LibJS+LibRegex: Don't repeat regex match in regexp_exec()
LibRegex already implements this loop in a more performant way, so all
LibJS has to do here is to return things in the right shape, and not
loop over the input string.
Previously this was a quadratic operation on string length, which lead
to crazy execution times on failing regexps - now it's nice and fast :^)

Note that a Regex test has to be updated to remove the stateful flag as
it repeats matching on multiple strings.
2022-02-05 00:09:32 +01:00
Ali Mohammad Pur
2b028f6faa LibRegex+LibJS: Avoid searching for more than one match in JS RegExps
All of JS's regular expression APIs only want a single match, so avoid
trying to produce more (which will be discarded anyway).
2022-02-05 00:09:32 +01:00
Tom
4c506f91fe Kernel: Disable BootFramebufferConsole when drivers create a new one
When GraphicsManagement initializes the drivers we can disable the
bootloader framebuffer console. Right now we don't yet fully destroy
the no longer needed console as it may be in use by another CPU.
2022-02-04 21:34:12 +01:00
Tom
24f2f3ba4e Kernel: Set up an initial boot framebuffer console
Instead of seeing a black screen until GraphicsManagement was fully
initialized, this allows us to see the console output much earlier.
So, if the bootloader provided us with a framebuffer, set up a console
as early as possible.
2022-02-04 21:34:12 +01:00
Tom
eb446725d5 Kernel: Separate GenericFramebufferConsole implementation
The GenericFramebufferConsoleImpl class implements the logic without
taking into account any other details such as synchronization. The
GenericFramebufferConsole class then is a simple wrapper around
GenericFramebufferConsoleImpl that takes care of synchronization.

This allows us to re-use this implementation with e.g. different
synchronization schemes.
2022-02-04 21:34:12 +01:00
Maciej
99e3e42fa5 Keymap Applet: Spawn KeyboardSettings when clicking 2022-02-04 21:30:31 +01:00
Linus Groh
e087cd574e LibJS: Rename variables to 'calendarLike' in a couple of places
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/9af2d35
2022-02-04 20:00:34 +00:00
Linus Groh
c48f695b90 LibJS: Remove '-000000' check from ParseTemporalYearMonthString
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/3be4b5d
2022-02-04 20:00:34 +00:00
Linus Groh
28ac5a1333 LibJS: Update fallibility of ParseISODateTime in spec comments
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/bc79069
2022-02-04 20:00:34 +00:00
Maciej
6df246091b LibCoredump: Add stack frame entry even if there is no object info
We know the object name and are able to include it. Function name and
source position are still unknown and will just be displayed as "??? ()"
2022-02-04 20:03:47 +01:00
Maciej
394227b2f9 LibCoredump: Fix use-after-free in Backtrace::object_info_for_region()
The first line was creating a StringView object with region name. Then,
if the path didn't start with '/', it had assigned a String made from a
temporary LexicalPath join result.

This fixes the bug that only main executable's frames were displayed.
2022-02-04 20:03:47 +01:00
Jagger De Leo
d5183cb7ac PixelPaint: Use Escape to clear rectangular selections
Now while dragging a new rectangular selection you can cancel it by
hitting Escape. Existing selections are cleared by Escape as well if the
RectangularSelectTool is active.
2022-02-04 16:11:48 +01:00
Jagger De Leo
a96b15d2bc PixelPaint: Remove conflicting action hotkey
The new CommandPalette feature conflicts with PixelPaint's Clear
Selection action keyboard shortcut (Ctrl + Shift + A).

Fixes: #12222
2022-02-04 16:11:48 +01:00
Timothy Flynn
30a143c79e LibJS: Explicitly handle invalid Date objects in UTC time setters
This is a normative change in the ECMA-262 spec:
https://github.com/tc39/ecma262/commit/ca53334

Note that this also fixes a few errors where we errantly converted the
stored time value to local time.
2022-02-04 13:47:50 +00:00
Timothy Flynn
fd7d0a31d9 LibJS: Explicitly handle invalid Date objects in local time setters
This is a normative change in the ECMA-262 spec:
https://github.com/tc39/ecma262/commit/ca53334
2022-02-04 13:47:50 +00:00
Sam Atkins
cbdbe0c5a2 LibWeb: Implement CalculatedStyleValue::to_string() 2022-02-04 13:52:02 +01:00
Sam Atkins
714832e705 LibWeb: Distinguish between Integer and Number calc() values 2022-02-04 13:52:02 +01:00
Sam Atkins
e4251f3327 LibWeb: Allow calc() in opacity
This is mostly a test to make sure that resolving calc() to a number or
percentage works correctly. I don't love how this ended up.
2022-02-04 13:52:02 +01:00
Sam Atkins
8bd1854406 LibWeb+Base: Enable calc() for font-weight property :^)
Modified the test-page because FontDatabase looks for exact font-weight
matches, so requesting weight 800 in a font that only has 700, causes
it to return the default font instead. So, we ask for 700 here.

The actual fix is to improve our font-matching but I am trying not to
get distracted today. :^)
2022-02-04 13:52:02 +01:00
Sam Atkins
2407a03fd9 LibWeb: Add resolving calc() to a number/integer/percentage
None of these require any outside metrics, which is nice! I believe the
Values-4 spec would have us simplify them down into a single value at
parse time, but that's a yak for another day.
2022-02-04 13:52:02 +01:00
Sam Atkins
e111e8e44e LibWeb: Type-check calc() in in property_accepts_value()
This means only CalculatedStyleValues that would return the desired type
will be accepted.
2022-02-04 13:52:02 +01:00
Sam Atkins
b54cd17c1e LibWeb: Allow percentage tokens again when parsing calc()
I unintentionally broke this in my LengthPercentage PR, but it was not
convenient to fix until now.
2022-02-04 13:52:02 +01:00
Sam Atkins
ce0de4b2b4 LibWeb: Allow LengthPercentage to hold a calculated value
Most of the time, we cannot resolve a `calc()` expression until we go to
use it. Since any `<length-percentage>` can legally be a `calc
()`, let's store it in `LengthPercentage` rather than make every single
user care about this distinction.
2022-02-04 13:52:02 +01:00
Sam Atkins
f0fb84dfcb LibWeb: Refactor calc() resolution logic using CalculationResult
The previous static functions are now methods of their respective
CalcFoo structs, but the logic has not changed, only that they work
with CalculationResults instead of converting everything to floats.
2022-02-04 13:52:02 +01:00
Sam Atkins
35f64af3a4 LibWeb: Implement CalculationResult type for calc() results
calc() sub-expressions can return a variety of different types, which
then can be combined using the basic arithmetic operators. This class
should make that easier to deal with, instead of having to handle all
the possible combinations at each call site. :^)

We take the Layout::Node as a pointer not a reference, since later we'll
need to call these functions when resolving to `<number>` or `<integer>`
which don't use those, and we don't want to force users to pass them in
unnecessarily.
2022-02-04 13:52:02 +01:00
Sam Atkins
b69f6097de LibWeb: Resolve type of calc() expressions at parse-time
See https://www.w3.org/TR/css-values-3/#calc-type-checking

If the sub-expressions' types are incompatible, we discard the calc() as
invalid.

Had to do some minor rearranging/renaming of the Calc structs to make
the `resolve_foo_type()` templates work too.
2022-02-04 13:52:02 +01:00
Sam Atkins
b818d952d1 LibWeb: Combine the two sets of calc() operator enums 2022-02-04 13:52:02 +01:00
Sam Atkins
ce0a516e59 LibWeb: Replace Length::set_calculated_style() with ::make_calculated()
There's no need to modify the Length's calculated-value after creating
it, so let's make it immutable. :^)
2022-02-04 13:52:02 +01:00
Sam Atkins
db04b5687d LibWeb: Move calc()-resolution code from Length to CalculatedStyleValue
The code is unchanged, just moved.
2022-02-04 13:52:02 +01:00
Brian Gianforcaro
ee61739e0a Meta: Add install-native-partition CMake target installing to a real FS
While playing around with getting serenity to run on my main desktop
machine I wanted a way of easily updating my physical serenity
partition.

To use it you just need to:
- Create and format your local partition to ext4
- Set `SERENITY_TARGET_INSTALL_PARTITION` to the partition /dev path.
- Run the `install-native-partition` build target.

Example:

    $ export SERENITY_TARGET_INSTALL_PARTITION=/dev/nvme1n1p3
    $ cd serenity/Build/x86_64
    $ ninja install-native-partition
2022-02-04 12:44:50 +01:00
Tom Martin
6ec4fd9d3c Shell: Add total time to builtin_time Timing Report 2022-02-04 15:09:22 +03:30
Lady Gegga
9d964af761 Base: Add Combining Diacritical Marks to font Csilla Regular 10
0300-036F https://www.unicode.org/charts/PDF/U0300.pdf
2022-02-04 05:26:35 +00:00
Andreas Kling
378bca8b0c LibWeb: Make debug logging of resource load errors red instead of green
Red is a bit more suspicious than green, after all. :^)
2022-02-04 00:16:25 +01:00
Andreas Kling
d7b27a9901 Meta: Add Kenneth Myhra to the contributors list :^) 2022-02-04 00:13:43 +01:00
Idan Horowitz
18b98f8c28 AK: Convert the try_make<T> factory function to use ErrorOr
This allows more ergonomic memory allocation failure related error
checking using the TRY macro.
2022-02-03 23:33:20 +01:00
Idan Horowitz
ba0a2a3e2f AK: Hide the infallible make<T> factory function from the Kernel
This function has no users, nor should it ever be used in the kernel,
as all allocation failures in the Kernel should be explicitly checked.
2022-02-03 23:33:20 +01:00
Idan Horowitz
7933a9b6c8 AK: Stop using the make<T> factory function in Trie
This function is infallible, and so we would like to exclude it from
the Kernel, which includes this header.
2022-02-03 23:33:20 +01:00
Idan Horowitz
3dc8bbbc8b Kernel: Remove the infallible make_ref_counted<T> factory function
This function had no users, nor should it ever be used, as all
allocation failures in the Kernel should be explicitly checked.
2022-02-03 23:33:20 +01:00
Idan Horowitz
a65bbbdb71 Kernel: Convert try_make_ref_counted to use ErrorOr
This allows more ergonomic memory allocation failure related error
checking using the TRY macro.
2022-02-03 23:33:20 +01:00
Idan Horowitz
8289727fac Kernel: Stop using the make<T> factory method in the Kernel
As make<T> is infallible, it really should not be used anywhere in the
Kernel. Instead replace with fallible `new (nothrow)` calls, that will
eventually be error-propagated.
2022-02-03 23:33:20 +01:00
Idan Horowitz
e5e7cb822a Kernel: Ignore allocation failures when trying to retransmit packets
We ignore allocation failures above the first 16 guaranteed socket
slots, as we will just retransmit their packets the next time around.
2022-02-03 23:33:20 +01:00
Idan Horowitz
2dc91865a4 Kernel: Stop allocating VirtIO configuration structs on the heap
These are trivially-copyable 12-byte structs, so there's no point in
allocating them on the heap.
2022-02-03 23:33:20 +01:00
Idan Horowitz
be4c144524 AK: Support formatting Vectors with any inline_capacity
The default Vector type has its inline capacity set to 0, which means
any Vector with non-zero inline capacity was unformattable.
2022-02-03 23:33:20 +01:00
Sam Atkins
6b0c4908df FileManager: Don't show command palette for the desktop 2022-02-03 23:28:56 +01:00
Sam Atkins
bf4328de52 LibGUI: Allow widgets to opt-out from showing the command palette 2022-02-03 23:28:56 +01:00
Sam Atkins
a4cb6a49ae FileManager: Disable "View as..." actions for desktop DirectoryView
This stops these actions from being activated with Ctrl+[1,2,3] or the
command palette.. Switching to table or columns view would just hide
all the icons, so let's not make those options available.
2022-02-03 23:28:56 +01:00
Andreas Kling
f92ee94fe2 LibWeb: Expose KeyboardEvent's constructor on the window object 2022-02-03 22:35:13 +01:00
Andreas Kling
926d5271b4 LibWeb: Forward CanvasRenderingContext.strokeText() to fillText()
This is a hack until we get an actual text stroking implementation.
2022-02-03 22:35:13 +01:00
Andreas Kling
dc3bf32307 LibWeb: Add barebones CanvasGradient object
Also add the CanvasRenderingContext2D APIs to go along with it.
Note that it can't be used for anything yet.
2022-02-03 22:35:13 +01:00