Commit graph

27369 commits

Author SHA1 Message Date
Aliaksandr Kalenik 5f364e9bc1 LibWeb: Rename is_scrollable() to is_user_scrollable()
is_user_scrollable() is more appropriate name since this function
returns true only for boxes scrollable by user interaction.
2023-08-08 16:55:14 +02:00
Aliaksandr Kalenik 491da2a810 LibWeb: Use is_scroll_container instead of is_scrollable in JS APIs
is_scroll_container() returns true for "overflow: hidden" which allows
programmable scrolling while is_scrollable() returns true only for
"overflow: scroll" and "overflow: auto" which allow scrolling only by
user interactions.
2023-08-08 16:55:14 +02:00
Aliaksandr Kalenik 869bef523e LibWeb: Return true for "overflow: auto" from Box::is_scrollable()
is_scrollable() is currently used to determine if box support scroll
user interaction so it should return true for "auto" overflow.
2023-08-08 16:55:14 +02:00
Aliaksandr Kalenik 1b63095271 LibWeb: Compensate scroll offset translation before clip rect is applied
Position where box clip rect is applied should not be affected by
current scroll offset.
2023-08-08 16:55:14 +02:00
Aliaksandr Kalenik cdf8b9e943 LibWeb/Painting: Translate by scroll offset before painting descendants
Fixes painting of nested nodes in scrollable containers by moving
painter's scroll offset translation from paint_node() to
before_children_paint() and after_children_paint().
2023-08-08 16:55:14 +02:00
Tim Ledbetter b073d1dd8c usermod: Make error message less verbose 2023-08-08 15:15:43 +02:00
Tim Ledbetter 0875446b38 usermod: Remove premature root user check
This allows the use of `--help`, for example.
2023-08-08 15:15:43 +02:00
Tim Ledbetter 827e23940a usermod: Don't set the EGID to 0
This is unnecessary, as usermod isn't a SUID binary.
2023-08-08 15:15:43 +02:00
Karol Kosek 55b6e07a0f Userland: Open files for save in write-only mode
WavWriter and the shot utility open files with this mode and never
truncate the files, which might leave some contents of a previous file
during overwriting.
2023-08-08 15:13:43 +02:00
Daniel Bertalan fb305b66c2 LibJS: Enable await test that used to crash in AST mode
Now that the AST interpreter has been removed, this can be a simple
XFAIL.
2023-08-08 15:09:53 +02:00
Daniel Bertalan 7ac6af1998 LibJS: Uncomment passing tests 2023-08-08 15:09:53 +02:00
MacDue 5f0d3c083f LibWeb: Allow (explicitly) converting CSSPixels to float and int
...and remove some unnecessary cast chains.
2023-08-08 14:58:26 +02:00
Sam Kravitz c97eec030c LibJS: Test function toBeCloseTo takes an optional precision argument
Modeled after the equivalent Jest function.
https://jestjs.io/docs/expect#tobeclosetonumber-numdigits
2023-08-08 13:29:56 +02:00
Sam Kravitz 73c8650ea0 LibJS: Expect this.target to have typeof number in toBeCloseTo
The previous expectation of typeof value was inconsistent with the
expect message.
2023-08-08 13:29:56 +02:00
Andreas Kling 2eaa528a0e LibJS: Rip out the AST interpreter :^)
This has been superseded by the bytecode VM, which is both faster
and more capable.
2023-08-08 13:07:13 +02:00
Andreas Kling fcc72a787b Spreadsheet: Use the LibJS bytecode VM 2023-08-08 13:07:13 +02:00
Andreas Kling acd366eddd Assistant: Use the LibJS bytecode VM 2023-08-08 13:07:13 +02:00
Andreas Kling e2c8d5859e LibJS: Remove ability to disable bytecode VM 2023-08-08 13:07:13 +02:00
Andreas Kling 99ac34eeae Ladybird+LibWebView+Browser: Remove ability to run with AST interpreter 2023-08-08 13:07:13 +02:00
Andreas Kling 4eb43cc107 Browser: Remove ability to run with AST interpreter 2023-08-08 13:07:13 +02:00
Andreas Kling e7e52f95ec headless-browser: Remove ability to run with AST interpreter 2023-08-08 13:07:13 +02:00
Andreas Kling efe3eb8f4c test-js: Remove ability to run with AST interpreter 2023-08-08 13:07:13 +02:00
Andreas Kling a75b51de10 js: Remove ability to run with AST interpreter 2023-08-08 13:07:13 +02:00
Andreas Kling 9df7bf79cc LibJS: Add create_simple_execution_context<GlobalObjectType>() helper
This makes it easy to set up a realm, global object and root execution
context with a single call to LibJS. It will be useful to basically
everyone except LibWeb.
2023-08-08 13:07:13 +02:00
Andreas Kling d1d24569f8 LibJS/Bytecode: Remove unused AST interpreter hacks from bytecode VM 2023-08-08 13:07:13 +02:00
Andi Gallo 7bd00d6a42 LibWeb: Snap table grid to device pixels in separate borders mode
Build a grid snapped to device pixels and use it to construct the
rectangles for the cell edges, same as for collapsed borders. This is
especially important when border-spacing is set to 0 since it avoids
gaps between adjacent cells which have borders set.
2023-08-08 12:26:11 +02:00
Jelle Raaijmakers 14091f32c6 Browser: Synchronize database statements used for cookies
Since SQLServer is inherently asynchronous, database statements can run
in parallel. Our `CookieJar` did not require synchronous actions on the
database for its cookies, resulting in cookies not being set
immediately. This resulted in a bug that could be exposed by setting
`document.cookie` and immediately querying its value, revealing that the
cookie was not yet persisted.

Solve this by requiring all database statements to be executed
synchronously. Ideally SQLServer has a mechanism to determine interquery
dependencies and blocks until dependent queries are fully executed, but
until we have that, this works around that limitation.
2023-08-08 06:25:11 -04:00
Aliaksandr Kalenik 568c486610 LibWeb: Support positioning of abspos boxes inside grid container
- Out-of-flow items should not affect grid layout
- "The static position of an absolutely-positioned child of a grid
  container is determined as if it were the sole grid item in a grid
  area whose edges coincide with the content edges of the grid
  container."
2023-08-08 11:31:35 +02:00
Sam Kravitz 073eb46824 LibJS: Apply the correct precedence for unary + and - operators
When determining the precedence of the + and - operators, the parser
always returned the precedence using these operators in a binary
expression (lower than division!). The context of whether the operator
is used in a unary or binary expression must be taken into account.
2023-08-08 07:41:07 +02:00
Andreas Kling 18c54d8d40 LibJS: Make Cell::initialize() return void
Stop worrying about tiny OOMs.

Work towards #20405
2023-08-08 07:39:11 +02:00
Lucas CHOLLET 3f35ffb648 Userland: Prefer _string over _short_string
As `_string` can't fail anymore (since 3434412), there are no real
benefits to use the short variant in most cases.
2023-08-08 07:37:21 +02:00
Lucas CHOLLET a5edc9cdfc Userland: Prefer _short_string over String::from_utf8_short_string
This user-defined literal is a strictly equivalent but shorter alias to
`String::from_utf8_short_string`.
2023-08-08 07:37:21 +02:00
Daniel Bertalan 66645cdc94 LibJS+LibWeb: Mark NonnullGCPtr::ptr() as returns_nonnull
This invariant is enforced by the fact that `NonnullGCPtr` can only be
constructed from references.

This commit fixes an instance where we compared a pointer to null after
we have already dereferenced it.
2023-08-07 22:20:03 -04:00
Daniel Bertalan 9feb1ce39f LibJS+LibWeb: Apply the Rule of Zero to {Nonnull,}GCPtr<T>
The compiler-generated copy constructor and copy assignment operator
already do the right thing (which is to simply copy the underlying
pointer).

The [Itanium C++ ABI][1] treats any class with non-trivial copy/move
constructors and destructors as non-trivial for the purposes of calls --
even if they are functionally identical to the compiler-generated ones.
If a class is non-trivial, it cannot be passed or returned in registers,
only via an invisible reference, which is worse for codegen. This commit
makes `{Nonnull,}GCPtr` trivial.

As the compiler can be sure that capturing a `GCPtr` by value has no
side effects, a few `-Wunused-lambda-capture` warnings had to be
addressed in LibWeb.

GCC seems to have a bug that prevents `ExceptionOr<Variant<GCPtr<T>>>`
from being implicitly constructed from `GCPtr<T>` after this change. A
non-invasive workaround is to explicitly construct the inner Variant
type.

[1]: https://itanium-cxx-abi.github.io/cxx-abi/abi.html#non-trivial
2023-08-07 22:20:03 -04:00
Andrew Kaster 391beef707 Ladybird: Move Qt-specific classes and functions to a Qt subdirectory
This will help a lot with developing chromes for different UI frameworks
where we can see which helper classes and processes are really using Qt
vs just using it to get at helper data.

As a bonus, remove Qt dependency from WebDriver.
2023-08-07 14:58:04 -06:00
Liav A ccaa423372 Utilities: Add basic Package manager skeleton utility 2023-08-07 13:24:25 -06:00
Liav A 22737b70bc LibMarkdown: Add render_for_raw_print methods to Node derived classes
This method will be used by the package manager code to render an actual
Port's name to raw text as it is stored as relative URL currently in the
AvailablePorts.md file.
2023-08-07 13:24:25 -06:00
Liav A 8073c615af LibMarkdown: Add method to get access to Table columns
This will be used later when parsing the AvailablePorts.md file in the
upcoming package manager application.
2023-08-07 13:24:25 -06:00
ronak69 44a46aabeb LibLine: Refresh the line after case-change operations
Previously, case-change operations did not produce visible results.
As of now, setting `m_chars_touched_in_the_middle` to a non-zero value
results in refreshing the whole line. So case-change operations now set
that variable (causing a line refresh) in order to produce visible
results as expected.
2023-08-07 22:51:49 +03:30
Sebastian Zaha fc71403842 LibCore: Implement Process::is_being_debugged for macOS
The wait_for_debugger_and_break helper now works on macOS with this
change, tested on lldb 14.
2023-08-07 13:16:28 -06:00
Sebastian Zaha 35c45a94d3 LibCore: Implement a helper that waits for a debugger then breaks
This method can be used to force the current process to sleep, waiting
for a debugger to attach. On attach, the debugger breaks at the callsite
 directly.

This is tested on Linux and macOS, in Clion and also terminal gdb and
lldb.
2023-08-07 13:16:28 -06:00
Sebastian Zaha 216667368d LibCore+Ladybird: Extract helper into generic Process::is_being_debugged 2023-08-07 13:16:28 -06:00
Sebastian Zaha 002e206af0 LibCore: Implement Process::get_name for linux and macos 2023-08-07 13:16:28 -06:00
Monroe Clinton 1b5b1e4153 Calendar: Implement saving, loading, and displaying of calendars
The user can now save, load, and view calendars. A calendar is made up
of an array of events which are saved in a JSON file. In the future we
should implement the iCalendar standard instead of using a custom
format.
2023-08-07 13:14:58 -06:00
Timothy Flynn db3e1b128c SQLServer: Remove Core::EventReceiver parent from DatabaseConnection
This relationship was entirely unused.
2023-08-07 14:38:38 -04:00
Timothy Flynn 08d77ca6b1 SQLServer: Remove Core::EventReceiver parent from SQLStatement
This relationship was only used to provide factory methods and a parent-
child relationship between SQLStatement and DatabaseConnection.
2023-08-07 14:38:38 -04:00
Timothy Flynn 3ea4c56d04 LibSQL: Remove Core::EventReceiver parent from SQL::Relation
This relationship was only used to provide a name, factory methods, and
parent-child relationships for the relations.
2023-08-07 14:38:38 -04:00
Timothy Flynn 5ad78cab8d LibSQL: Remove Core::EventReceiver parent from SQL::Index
This relationship was only used to provide factory methods for the index
(and its BTree child).
2023-08-07 14:38:38 -04:00
Timothy Flynn 1b40bf9783 LibSQL: Remove unused HashIndex and related classes
The features provided by these classes should be used eventually, but so
far we've been maintaining these classes for over 2 years without any
actual use. We can restore them when it comes time to actually use them.
2023-08-07 14:38:38 -04:00
Timothy Flynn 1151ba333a LibSQL+SQLServer: Remove Core::EventReceiver parent from SQL::Database
This relationship was only used to provide factory methods for the
database.
2023-08-07 14:38:38 -04:00