Commit graph

16853 commits

Author SHA1 Message Date
FrHun
bfbaad9f41 LibGUI: Grow spacers after doing layout
Before this, the spacers were handled as just another child widget, and
as such could take away space from real widgets when growing.
This also fixes the problem of effectively 0 sized spacers, that doubled
the spacing between the widgets they were placed between.
2022-06-28 17:52:42 +01:00
FrHun
aba6422e11 LibGUI: Add read-only effective size properties for debugging
These new read-only properties help with debugging layouts, by exposing
the size values that are actually used for final size determination.
2022-06-28 17:52:42 +01:00
FrHun
68ad5f3780 LibGUI: Remove temporary compatibility measures for new layout system 2022-06-28 17:52:42 +01:00
FrHun
b8aa0037a8 LibGUI: Use new layout system for BoxLayout run 2022-06-28 17:52:42 +01:00
FrHun
34c96280d7 LibGUI: Use new layout system in Splitter 2022-06-28 17:52:42 +01:00
FrHun
0d56d80514 LibGUI: Use new layout system in scrollable widgets
These changes are mainly nessecairy to remove dependence on the
temporary implicit conversions currently still in place.
2022-06-28 17:52:42 +01:00
FrHun
3451181fbf NotificationServer: Remove usages of deprecated implicit ui conversions 2022-06-28 17:52:42 +01:00
FrHun
603034759f LibGUI: Remove usages of deprecated implicit conversions 2022-06-28 17:52:42 +01:00
FrHun
8dd08d47f1 Applications: Remove usages of deprecated implicit conversions
These deprecated conversions are currently in place to make the system
compile, but they are to be removed soon. This prepares that.
2022-06-28 17:52:42 +01:00
FrHun
ec1e25929e LibGUI: Add effective and calculated sizes to Widget
Effective sizes are the ones that are actually to be used for layout.
They are just their respective propertys value, or the value returned
by the calculated_<min/preferred>_size, when the respective property
is set to shrink or fit.
The "calculated" values in turn are specific to the widget. Container
widgets for example can calculate their values depending on their
layout and child widget requirement.
Simple widgets like labels and buttons can for example calculate their
values based upon their current text.
2022-06-28 17:52:42 +01:00
FrHun
d825c8ad18 LibGUI: Change preferred_size in Layout to new layout system 2022-06-28 17:52:42 +01:00
FrHun
b2951a2116 LibGUI: Add min_size to Layout 2022-06-28 17:52:42 +01:00
FrHun
2600669b73 LibGUI: Use preferred_size to emulate old is_shrink_to_fit 2022-06-28 17:52:42 +01:00
FrHun
bd277939a1 LibGUI: Add preferred_size to Widget 2022-06-28 17:52:42 +01:00
FrHun
a4aced7f3a LibGUI: Introduce UIDimension properties 2022-06-28 17:52:42 +01:00
FrHun
b47bf2fd7c LibGUI: Use UIDimension in place of int in Widget 2022-06-28 17:52:42 +01:00
FrHun
024305e742 LibGUI: Add UIDimension and UISize types
These types are used to represent size information for layouts.
They can hold integer (int) values ≥0 or special values like shrink
and fit.
2022-06-28 17:52:42 +01:00
FrHun
e29314f837 LibGUI: Refactor BoxLayout for minor readability improvements 2022-06-28 17:52:42 +01:00
FrHun
e08508dcc1 LibGUI: Add direction totals to Margins 2022-06-28 17:52:42 +01:00
Humberto Alves
c9ed88309b Playground: Set editor->on_change before opening files
Set `editor->on_change` callback before opening files, otherwise the
compiled GML preview will only be available after some manual input in
the text editor.
2022-06-28 17:23:47 +01:00
Maciej
4fbe43f282 ln: Fix typo in arguments argument 2022-06-28 09:20:30 +01:00
Luke Wilde
50642f85ac LibWeb/WebGL: Add WebGLRenderingContextBase.canvas 2022-06-27 22:54:41 +01:00
Luke Wilde
0ec8a19a34 LibWeb/WebGL: Forward the render context ref count to HTMLCanvasElement
This allows HTMLCanvasElement and WebGL rendering contexts to share
their lifetime, as JS allows them to arbitrarily access them at any
time and WebGLRCB.canvas expects a non-null return value.
2022-06-27 22:54:41 +01:00
Luke Wilde
adf8341c4e LibWeb: Forward CRC2D's ref count to HTMLCanvasElement
This allows HTMLCanvasElement and CRC2D to share their lifetime, as JS
allows them to arbitrarily access them at any time and CRC2D.canvas
expects a non-null return value.
2022-06-27 22:54:41 +01:00
Luke Wilde
cd9864bbf1 LibHTTP+RequestServer: Recognize more HTTP methods
Previously it would default to GET for all of these and cause the
Discord API to return Method Not Allowed errors for certain endpoints.
2022-06-27 22:53:36 +01:00
Luke Wilde
1ceba560f4 LibWeb: Add CDATASection
Not used for anything currently other than exposing it on the Window
object. This allows Web Components Polyfills to patch its prototype.
2022-06-27 22:53:04 +01:00
Cyber Gsus
f97e664d8f LibJS: Check for add overflow in DataViewConstructor
Use the Checked type from AK to verify that offset + view_byte_length
is buffer_byte_length at most.
2022-06-27 20:51:00 +01:00
Humberto Alves
bbfafa19b4 LibGUI: Invert button icons only when the contrast ratio improves
Fix the algorithm that automatically inverts solid color button icons
when placed in similarly colored backgrounds. It was meant for fixing
black icons in dark themed buttons.

However, there may be situations where the resulting inverted version
is actually worse than the original. This change prevents those cases.
2022-06-27 20:22:40 +01:00
Lucas CHOLLET
0c2dc6be66 Help: Use LibWeb to open files via RequestServer 2022-06-27 20:22:15 +01:00
Lucas CHOLLET
662711fa26 Browser+LibWeb+WebContent: Allow Browser to load local files
To achieve this goal:
 - The Browser unveils "/tmp/portal/filesystemaccess"
 - Pass the page through LoadRequest => ResourceLoader
 - ResourceLoader requests a file to the FileSystemAccessServer via IPC
 - OutOfProcessWebView handles it and sends a file descriptor back to
 the Page.
2022-06-27 20:22:15 +01:00
Lucas CHOLLET
1ba9c821fb WindowServer: Make window stealing related functions synchronous
This allows us to make sure that those operations are performed
in the right order. Affected functions are:
 - add_window_stealing_for_client
 - set_window_parent_from_client
 - remove_window_stealing_for_client
 - remove_window_stealing
2022-06-27 20:22:15 +01:00
Lucas CHOLLET
deb525fd9d LibFileSystemAccessClient: Return an errno instead of a string literal
Returning an errno to ease error transmission over IPC.
2022-06-27 20:22:15 +01:00
Lucas CHOLLET
9521952f36 FileSystemAccessServer: Manage concurrent file requests
Before this patch, when you called FileSystemAccessServer::Client::try_*
twice, the second call used the same variable to store the promise. This
"race condition" is now solved using a HashMap, to store multiple
parallel requests.
2022-06-27 20:22:15 +01:00
Lucas CHOLLET
e432a284d7 LibCore: Avoid some successive allocations in Stream::read_all()
For the general case, allocations will always have the size of a block.
In case of a smaller read a block will be filled entirely before another
allocation appends.

It also adds a specialization for Stream::File::read_all() that tries to
detect the size of the file with fstat to perform a single allocation.
2022-06-27 20:22:15 +01:00
Andrew Kaster
9d70f0383f Browser: Remove GML formatting errors from BrowserSettingsWidget.gml
Regressed in commit 6571455499

This is supposed to be caught by the GML format lint in Azure, but it
looks like a :ninjamerge: occured instead :^)
2022-06-27 08:23:13 +01:00
Ali Mohammad Pur
db4a5aafc8 Spreadsheet: Display a detailed view of a cell error on hover
With this, Spreadsheet can now show an almost full stack trace for the
error (which is infintely better than just the error message).
2022-06-26 22:21:17 +01:00
Ali Mohammad Pur
64ef808aeb Spreadsheet: Allow importing sheets into an existing workbook 2022-06-26 22:21:17 +01:00
Ali Mohammad Pur
135683795b Spreadsheet: Throw if lookup value doesn't exist and no default is given
And explicitly state which value wasn't found and where in the error.
2022-06-26 22:21:17 +01:00
Ali Mohammad Pur
746b8ec8de Spreadsheet: Make it possible to refer to ranges in other sheets
Now the range A0:C4 in a sheet named "foo" can be represented as:

    R`sheet("foo"):A0:C4`

This makes it possible to do cross-sheet lookups and more.
2022-06-26 22:21:17 +01:00
Ali Mohammad Pur
0e2f4c50d3 Spreadsheet: Prevent OOB access to text editor buffer
For some reason LibGUI sends two events for each edit, and one of them
contains an OOB cursor if a character was deleted.
This works around that for now.
2022-06-26 22:21:17 +01:00
Xexxa
b691269912 Base+Browser+BrowserSettings: Add default page for new tab 2022-06-26 22:18:30 +01:00
Xexxa
6571455499 Browser+BrowserSettings: Add preference for new tab 2022-06-26 22:18:30 +01:00
Lenny Maiorani
ef46100fd3 LibGfx: Increase cache-friendliness in FastBoxBlurFilter
Change from 4 vectors of u8 to a single vector of a struct of 4
u8. Since all the accesses are on the same indicies into each vector
the cache pressure is decreased by co-locating the data.

When scrolling up and down in the `box-shadow` example page the
profile changes from about 75% of the function calls being in
`apply_single_pass()` to only about 70% on my machine.
2022-06-26 22:11:10 +01:00
MacDue
b652546a16 LibWeb: Fix parsing of background-size: contain/cover
The lack of the commit() before returning the x_value here meant,
that in parse_background_value() the token stream would be one token
behind after parsing the background-size. This led to it to returning
null, after it sees the unexpected 'second' contain / cover token.

With this change all of backgrounds.html is working again.
2022-06-26 22:04:20 +01:00
Linus Groh
93b4c3bb82 LibJS: Infer file extensions when resolving module paths
This allows `import "./foo"` to succeed, even if the file is actually
called `foo.js`. IDEs commonly exclude file extensions in auto-imports.

Closes #14364.
2022-06-26 22:03:53 +01:00
Linus Groh
2b3dd87296 LibJS: Rename filepath to filename in module related code
This is already the parameter name of Core::File::open() and
VM::get_stored_module() - both of which this is passed to - as well as
the member name of the Module class.
2022-06-26 22:03:53 +01:00
Linus Groh
893978ea89 LibJS: Replace enumeration macro in typed_array_species_create()
Use the newly added TypedArrayBase::intrinsic_constructor() instead to
get the required constructor from the global object.

Also add spec comments while we're here.
2022-06-26 21:57:39 +01:00
Linus Groh
3885fa1d10 LibJS: Store fn pointer to its intrinsic constructor on TypedArrayBase
This represents "the intrinsic object listed in column one of Table X"
in the spec.
2022-06-26 21:57:39 +01:00
Liav A
e02da2ed41 LibC: Implement the getsubopt function
This is a LibC function that POSIX defines to help userspace programs
to get suboptions. An example of a suboption is the token "pixclk" from
a Shell command running "edid-decode --gtf w=1024,h=768,pixclk=48".
The function should be run in a while loop to acquire all suboptions
until the last one.
2022-06-25 12:10:04 +01:00
Ali Mohammad Pur
d338d2b59b Shell: Ignore SIGCHLD after a few unsuccessful attempts at handling it
As noted by the comment, a stray SIGCHLD can make the shell go into an
infinite loop, pretend the signal doesn't exist after trying 10 times in
5ms.
2022-06-24 22:53:16 +01:00
Linus Groh
3beb7fc42f LibJS/Tests: Correct pluralSmallestPluralDisallowedOptions largestUnit 2022-06-24 22:12:03 +01:00
Linus Groh
ee0d5d6649 LibJS: Refactor common option reading into the GetDifferenceSettings AO
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/78abbb8
2022-06-24 22:12:03 +01:00
Linus Groh
05c5263ecc LibJS: Mark CreateTemporalDate in AddDateTime as infallible
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/cd356a6
2022-06-24 22:12:03 +01:00
Linus Groh
80663d9d3b LibJS: Mark CreateTemporalDate in ToRelativeTemporalObject as fallible
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/09e9f9c
2022-06-24 22:12:03 +01:00
Linus Groh
3679f671b9 LibJS: Mark some calls of CreateTemporalDate as infallible
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/30344e8
2022-06-24 22:12:03 +01:00
Linus Groh
26990ab41c LibJS: Mark PlainTime.prototype.round's CreateTemporalTime infallible
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/6b57938
2022-06-24 22:12:03 +01:00
Linus Groh
709e16004d LibJS: Assert RoundISODateTime is called with values within the limits
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/eaa7042
2022-06-24 22:12:03 +01:00
Linus Groh
f54ed48ef1 LibJS: Assert AddTime is called with a valid time
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/0ead23c
2022-06-24 22:12:03 +01:00
Linus Groh
416f94eb3b LibJS: Add Number conversion in PrepareTemporalFields
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/687d06c
2022-06-24 22:12:03 +01:00
Linus Groh
78bfeca643 LibJS: Add Number conversion in ZonedDateTime.prototype.getISOFields()
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/bc59d8d
2022-06-24 22:12:03 +01:00
Linus Groh
ea023ac62c LibJS: Add Number conversion in AddDu/ToOrSubtractDu/FromPlainYearMonth
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/823300c
2022-06-24 22:12:03 +01:00
Linus Groh
98dc964649 LibJS: Add conversion to mathematical number in ToTemporalTimeRecord
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/9f37d10
2022-06-24 22:12:03 +01:00
Linus Groh
7138f10c30 LibJS: Check for invalid epoch ns in DisambiguatePossibleInstants
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/c12d20d
2022-06-24 22:12:03 +01:00
Linus Groh
7b5a7e7759 LibJS: Check for invalid epoch nanoseconds in NanosecondsToDays
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/f1f016e
2022-06-24 22:12:03 +01:00
Linus Groh
ddea6d451b LibJS: Check for invalid epoch nanoseconds in InterpretISODateTimeOffset
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/cdfe4a5
2022-06-24 22:12:03 +01:00
Linus Groh
d10e0f0e3e LibJS: Check for invalid epoch nanoseconds in getPossibleInstantsFor()
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/439e6af
2022-06-24 22:12:03 +01:00
Linus Groh
61bdbe712e LibJS: Remove duplicate steps for offset-only time zones
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/7813599
2022-06-24 22:12:03 +01:00
Linus Groh
34f02bed17 LibJS: Remove check for Instant range before subtracting UTC offset
This is a normative change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/5e2fecb
2022-06-24 22:12:03 +01:00
Linus Groh
9c31fee4b5 LibJS: Remove unnecessary modulo operation in GetISOPartsFromEpoch
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/fc3f80d
2022-06-24 22:12:03 +01:00
Linus Groh
0ff6260afb LibJS: Use ToTemporalDuration in AddDu/ToOrSubtractDu/FromPlainYearMonth
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/a454134
2022-06-24 22:12:03 +01:00
Tim Schumacher
6732fec8b8 LibELF: Warn on self-dlopening libraries while initializing 2022-06-24 11:28:05 +01:00
Tim Schumacher
082a7baa3b LibELF: Check if initializers ran instead of trusting s_global_objects
The original heuristic of "a library being in `s_global_objects` means
that it was fully initialized already" doesn't hold up anymore since we
changed the loading order. This was causing us to skip parts of the
initialization of dependency libraries when running dlopen (since it was
the only user of that setting).

Instead, set a flag after we run stage 4 (which is the "run the global
initializers" stage) and check that flag when determining unfinished
dependencies. This entirely replaces the `skip_global_objects` logic.
2022-06-24 11:28:05 +01:00
kleines Filmröllchen
ef1c97e3d8 AudioServer: Reduce hardware audio buffer to 512 samples 2022-06-23 23:26:33 +01:00
kleines Filmröllchen
1c23a222b2 AudioServer: Make hardware write buffer size flexible
This removes some old cruft to refactor the hardware buffer-related
datastructures into depending on a single constant, which determines the
number of samples per hardware buffer that the audio server mixes. This
is set to 1024 as before, so there are no functional changes.
2022-06-23 23:26:33 +01:00
kleines Filmröllchen
746d3c1131 AudioServer: Explicitly cast between numeric types in the mixer 2022-06-23 23:26:33 +01:00
kleines Filmröllchen
cb8e37d436 LibAudio: Add spec comments to the FlacLoader
This way the FlacLoader can be more easily understood by someone that
doesn't already know the format inside out.
2022-06-23 23:16:34 +01:00
Andreas Kling
c03a0e7260 LibWeb: Fix unsafe capture of ref-to-local when setting up load timeout
We were capturing a reference to a stack local and then persisting the
closure, causing it to dereference a long-gone object when invoked.
2022-06-23 20:37:29 +02:00
CodeforEvolution
a02ee29af9 LibWeb/CSS: Check for NULL block statement when parsing font-face rule
This prevents font-face rules without a block statement from crashing
LibWeb during CSS parsing.

The issue was discovered by Lubrsi during CSS parser fuzzing. :)
Fixes #14141.
2022-06-23 19:14:24 +01:00
MacDue
4ffbe9284e LibGfx: Slap an -O3 optimization #pragma on FastBoxBlurFilter
This is done elsewhere in LibGfx, but adding it here is more of a
prayer for speed.
2022-06-23 19:13:24 +01:00
MacDue
30a0ed6678 LibGfx: Avoid AK::Function indirection in FastBoxBlurFilter + flatten it
This dropped a few percent when profiling Lubrsi's test.
2022-06-23 19:13:24 +01:00
MacDue
bb48a61d50 LibGfx: Flatten AntiAliasingPainter::draw_ellipse_part()
This seemed to drop the time spent here a few percent in profiling.
2022-06-23 19:13:24 +01:00
MacDue
ff1e61bd11 LibWeb: Support using a border-radius with a box-shadow
This commit adds support for using all your favorite border radii with
box-shadow, that is elliptical, circular, rounded rectangle etc. :^)

There is some work needed to make this more performant. The larger
your border radius is the larger the corner bitmap needs to be,
which means more time spent in FastBoxBlurFilter. There are probably
some tricks to bring this down.

Fixes #14325
2022-06-23 19:13:24 +01:00
MacDue
13c4c735b8 LibWeb: Add 'inside' clip mode to BorderRadiusCornerClipper
The default clip mode 'outside' clips everything outside the corner,
'inside' does the opposite :^)
2022-06-23 19:13:24 +01:00
MacDue
08baeb1e7d LibWeb: Pass border radii data to shadow painting
This is not used yet, but will be needed for painting shadows on
elements that have a border-radius.
2022-06-23 19:13:24 +01:00
Tim Schumacher
ffb95bace4 LibC: Implement wcsftime using a makeshift solution 2022-06-23 15:45:04 +01:00
Idan Horowitz
a79796ea4a LibJS: Implement stage 3 proposal FinalizationRegistry changes
Specifically the 'Symbol as WeakMap Keys Proposal'.
2022-06-23 10:57:52 +03:00
Idan Horowitz
53ed8decaf LibJS: Implement WeakRef changes from 'Symbol as WeakMap Keys Proposal' 2022-06-23 10:57:52 +03:00
Idan Horowitz
dbd0110721 LibJS: Implement WeakSet changes from 'Symbol as WeakMap Keys Proposal' 2022-06-23 10:57:52 +03:00
Idan Horowitz
a80d3fdf49 LibJS: Implement WeakMap changes from 'Symbol as WeakMap Keys Proposal' 2022-06-23 10:57:52 +03:00
Idan Horowitz
22a78e8a2c LibJS: Implement the CanBeHeldWeakly abstract operation
This AO is required for implementing the rest of the stage 3 'Symbol as
WeakMap Keys Proposal'.
2022-06-23 10:57:52 +03:00
Andreas Kling
7953bd8391 LibWeb: Implement "transferred size suggestion" for flex items 2022-06-22 18:36:17 +02:00
Ali Mohammad Pur
910a44d5f2 LibLine: Use the real shown line count around in cleanup()
Previously we would leave artifacts on screen if a change caused the
buffer to span fewer lines than the current buffer.
This commit records the shown line count and uses that instead of trying
to guess the previous line count (and failing most of the time).
2022-06-22 15:45:27 +02:00
Michał Lach
e9dae38f38 Terminal+TerminalSettings: Add caret customization 2022-06-22 12:12:00 +01:00
Michał Lach
e2b0f6795f LibVT+Kernel: Separate the caret shapes and its steadiness
Currently CursorStyle enum handles both the styles and the steadiness or
blinking of the terminal caret, which doubles the amount of its entries.
This commit changes CursorStyle to CursorShape and moves the blinking
option to a seperate boolean value.
2022-06-22 12:12:00 +01:00
Tim Schumacher
d2b87419ac LibELF: Only collect region sizes before reserving memory
This keeps us from needlessly allocating storage via `malloc` as part
of the `Vector`s that early, which we might conflict on while reserving
memory for the main executable.
2022-06-21 22:38:15 +01:00
Tim Schumacher
c0b31796a8 LibELF: Unmap the source file temporarily while reserving space
This further reduces the chance that we will conflict with data that is
already present at the target location.
2022-06-21 22:38:15 +01:00
Tim Schumacher
c1d8612eb5 LibELF: Store DynamicLoader ELF images using an OwnPtr
This is preparation work for the next commit, where we will replace the
stored ELF image mid-load.
2022-06-21 22:38:15 +01:00
Tim Schumacher
07208feae7 LibELF: Actually do the library mapping as early as possible
We previously trusted the `map` part in `map_library` too much, and
assumed that this would already lock in the binary at its final place.

However, the `map()` function of the loader was only called in
`load_main_library`, which ran only right before jumping to the
entrypoint.

Make our binary loading a bit more stable by actually mapping the binary
right after we read its information, and only do the linking right
before jumping to the entrypoint.
2022-06-21 22:38:15 +01:00
Tim Schumacher
cead476816 LibC: Make scanf read an unsigned long when using %lu 2022-06-21 22:38:15 +01:00
Tim Schumacher
a880457380 LibC: Don't change the stack canary across function boundaries 2022-06-21 22:38:15 +01:00