Commit Graph

27512 Commits

Author SHA1 Message Date
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
Timothy Flynn
4a04438e43 LibSQL: Remove Core::EventReceiver parent from SQL::Heap
This relationship was only used to provide a name and factory methods
for the heap.
2023-08-07 14:38:38 -04:00
Zaggy1024
50c73d02f0 LibAudio: Add a test for creating and destructing a PlaybackStream
This will ensure that we don't leak any memory while playing back
audio.

There is an expectation value in the test that is only set to true when
PulseAudio is present for the moment. When any new implementation is
added for other libraries/platforms, we should hopefully get a CI
failure due to unexpected success in creating the `PlaybackStream`.

To ensure that we clean up our PulseAudio connection whenever audio
output is not needed, add `PulseAudioContext::weak_instance()` to allow
us to check whether an instance exists without creating one.
2023-08-07 10:40:34 -06:00
Zaggy1024
515b255fa4 LibAudio: Clear callbacks and disconnect PulseAudioStream in destructor
If we don't clear the callbacks, they may be called after our functions
are deleted.

Disconnecting the stream also doesn't appear to be done automatically
when calling `pa_stream_unref()` for the last time, so let's do that.
2023-08-07 10:40:34 -06:00
Zaggy1024
2de3cee8ea LibAudio: Disconnect from and unref the PulseAudio context with lock
We don't want to pull the stream out from under our PulseAudio main
loop, so call these with the lock to ensure that nothing is touching
them.

The `pa_threaded_mainloop_stop()` call does not require lock as it sets
a flag to tell the main loop to exit.
2023-08-07 10:40:34 -06:00
Zaggy1024
37acdc9ba7 LibAudio: Unlock the mutex in PulseAudioContext::instance() before exit
The mutex used to protect from multiple threads creating PulseAudio
contexts simultaneously could remain locked when an application exited.
The static variables' destructors could be called on the main thread
while another thread is running `PulseAudioContext::instance()` and
synchronously connecting to a PulseAudio daemon. This would cause an
assertion in Mutex that it is unlocked upon its destructor being
called.

By creating a static `ScopeGuard` that locks and immediately unlocks
the mutex, we can ensure that the main thread waits for the connection
to succeed or fail. In most cases, this will not take long, but if the
connection is timing out, it could take a matter of seconds.
2023-08-07 10:40:34 -06:00
Zaggy1024
f22d7bbb90 LibAudio: Remove invalid FIXME from PulseAudioContext::create_stream()
The entire API is designed to run synchronously, the API callers must
implement the asynchronicity.
2023-08-07 10:40:34 -06:00
Zaggy1024
c3ded6d56c LibAudio: Improve PulseAudio stream connection error messages
We were missing a formatted error message printout when the connection
failed after the initial `pa_stream_connect_playback()` API call.
2023-08-07 10:40:34 -06:00
Zaggy1024
5ea5ae85d2 LibAudio: Remove the strong reference to the PulseAudio control thread
Now that `Thread` keeps itself alive when it is running detached, we do
not need to hold onto it in the PulseAudio playback stream's internal
state object. This was a hack that did not work correctly because the
`Thread` object and its action `Function` would be deleted before the
action had exited and cause a crash.
2023-08-07 10:40:34 -06:00
Zaggy1024
aff64b6a03 LibThreading: Make Thread keep itself alive while its action is running
Previously, a `Thread` could be deleted while its action was running,
even if it was running detached.

By changing it to be atomically reference counted, and incrementing the
count when starting the action, we can keep the Thread and its running
action `Function` alive until it exits. Thus, detached `Thread` objects
can be deleted by the thread creating them and allowed to die
naturally.
2023-08-07 10:40:34 -06:00
Zaggy1024
71df0ee994 LibThreading: Remove Thread's inheritance from Core::EventReceiver
Inheritance from `EventReceiver` on the `Thread` class was only used in
the `BackgroundAction` class, where the children vector was keeping the
action alive until the work was completed. However, this can be
accomplished by instead capturing a `NonnullRefPtr` of `this`. The work
function can then avoid having to remove the `BackgroundAction` from
its parent `Thread` when the work completes.
2023-08-07 10:40:34 -06:00
Andreas Kling
25eee91811 AK: Make "foo"_fly_string infallible
Stop worrying about tiny OOMs.

Work towards #20405.
2023-08-07 16:03:27 +02:00
Andreas Kling
34344120f2 AK: Make "foo"_string infallible
Stop worrying about tiny OOMs.

Work towards #20405.
2023-08-07 16:03:27 +02:00
Zaggy1024
db2a8725c6 LibCore: Only use coarse time in the Unix event loop wait_for_events()
A typo in the changes to our userland timekeeping classes caused us to
make a syscall every time we want to check whether a timer is ready to
fire in `EventLoopManagerUnix::wait_for_events()`. Instead, only use
coarse time, and get it immediately before it is used in both cases.

This reduces CPU usage by an (eyeballed) 20-30% while playing back
video with VideoPlayer.
2023-08-07 13:38:20 +02:00
Andi Gallo
ea6e079e07 LibWeb: Snap table grid to device pixels in collapsed borders mode
Before painting the borders, build a grid snapped to device pixels and
use it to construct the rectangles for the cell edges. Also adjust
their starting coordinate and size such that they join correctly
without overhangs. This approach works at all zoom levels.
2023-08-07 05:51:19 +02:00
Jelle Raaijmakers
9466512847 LibGUI: Traverse into directory upon filename entry in FilePicker
Previously, typing e.g. `/home/anon` in the filename field of the
FilePicker resulted in an error for applications expecting an existing
file to open. Intuitively I expected the file picker to navigate to the
directory I typed there, similar to what we have with the location text
box at the top, so I changed it to do exactly that :^)
2023-08-07 05:25:12 +02:00
Aliaksandr Kalenik
c985a1b2af LibWeb: Add non-const version of paintable_box() in DOM::Node 2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
6868ace8f4 LibWeb: Add non-const version of paintable_box() in Layout::Node
Allows to remove a bunch of const_cast's
2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
433d3f988d LibWeb: Add ad-hoc implementation for Element::scroll(x, y)
Adds very naive implementation for js function to trigger scroll but
that is enough to start using it in tests :)
2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
4160f13174 LibWeb: Include scroll offset in paint tree dump 2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
b89481564b LibWeb: Null check dom_node() in PaintableBox::scroll_offset() 2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
fee5b4deb6 LibWeb: Move set_scroll_offset() from Layout::Box to PaintableBox
Nodes in layout tree should not be aware of scroll state.
2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
5b7926fa53 LibWeb: Move scroll_offset() from Layout::Box to PaintableBox
Nodes in layout tree should not be aware of scroll state.
2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
23a07a8ab6 LibWeb: Introduce PaintableBox::scroll_by()
Moves code responsible for calculation of new scroll offset into
scroll_by() so it could be reused for JS functions that trigger
scroll.
2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
fa56ce11a9 LibWeb: Take in account scroll offset in painting 2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
3eb9ae4ed5 LibWeb: Find closest scrollable paintable to call handle_mousewheel()
This makes event handler to try to find scrollable paintable in the
chain of containing blocks of hit box. This is very naive and will
have to be improved in the future.
2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
c7673605bb LibWeb: Move mouse wheel handling from Paintable to PaintableBox
It is only PaintableBox that can have scrollable overflow so it doesn't
make sense to have handle_mousewheel() implementation in Paintable.

Also new implementation of handle_mousewheel() takes in account overflow
limits from scrollable_overflow_rect().
2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
55b5c61a79 LibWeb: Move scroll offset state from layout tree to dom tree
Scroll offset state should not be reset by layout tree rebuilt.
2023-08-07 05:23:31 +02:00
Aliaksandr Kalenik
b6ea4b002b LibWeb: Add info about pseudo element type in Layout::Node 2023-08-07 05:23:31 +02:00
Zaggy1024
74636ccb57 LibWeb: Move the media volume slider 1:1 with the mouse cursor
The volume control's slider is drawn in a rectangle shrunken by its
slider handle's size, so the handle did not move 1:1 with the user's
mouse movement.

To fix this, it will now check for a mousedown in the volume control
with a rectangle sized to fit any possible position of the handle, but
the volume value result will be calculated based on the center of the
handle instead. This allows it to move 1:1 with the mouse cursor.

Co-authored-by: trflynn89 <trflynn89@serenityos.org>
2023-08-06 22:23:00 -04:00
aryanbaburajan
eb85291a18 Chess: Replace usage of DeprecatedString 2023-08-06 22:21:10 +02:00
aryanbaburajan
bc8cad31de 2048: Replace usage of DeprecatedString 2023-08-06 22:21:10 +02:00
Andreas Kling
ddbe6bd7b4 Userland: Rename Core::Object to Core::EventReceiver
This is a more precise description of what this class actually does.
2023-08-06 20:39:51 +02:00
Andreas Kling
bdf696e488 LibCore: Remove unused Core::Object::dump_tree() 2023-08-06 18:09:25 +02:00
Andreas Kling
887dfd72b9 LibCore+LibGUI: Remove leftover gunk after Inspector removal
Just some functions in Core::Object and GUI::Widget that aren't called
from anywhere anymore.
2023-08-06 18:09:25 +02:00
Andreas Kling
26647f2b10 LibCore: Remove the Core::Objects::all_objects() list
Nobody actually used the list of all Core::Objects anyway.
2023-08-06 18:09:25 +02:00
Andreas Kling
405187993a LibGUI+LibCore: Move GML property system from LibCore to LibGUI
Since Core::Object properties are really only used by GML now that the
Inspector is long gone, there's no need for these to pollute
Core::Object.

This patch adds a new GUI::Object class to hold properties, and makes
it the new base class of GUI::Window, GUI::Widget and GUI::Layout.
The "instantiate an object by name" mechanism that GML uses is also
hoisted into GUI::Object as well.
2023-08-06 18:09:25 +02:00
Andreas Kling
9f6ceff7cf LibWeb: Implement basic version of CSSOM View's VisualViewport
We got some errors while loading https://twinings.co.uk/ about this
interface missing, and it looked fairly simple so I sketched it out.
Note that I did leave some FIXMEs where it's not clear exactly which
metrics we should be returning.
2023-08-06 16:29:24 +02:00
MacDue
2a914a7a59 LibGfx: Track edge extent in EdgeFlagPathRasterizer
This allows avoiding accumulating values we know will be zero, this is
not a huge speedup but does shave off a few %.
2023-08-06 16:24:28 +02:00
Andreas Kling
ec24d7555a LibWeb: Add a simple internals objects only available during testing
This object is available as `window.internals` (or just `internals`) and
is only accessible while running in "test mode".

This first version only has one API: gc(), which triggers a garbage
collection immediately.

In the future, we can add more APIs here to help us test parts of the
engine that are hard or impossible to reach via public web APIs.
2023-08-06 15:26:34 +02:00
Zaggy1024
ba236e3f21 PixelPaint: Don't const_cast to update the editor on filter application 2023-08-06 11:56:21 +02:00
Tim Ledbetter
7f99f3bf29 fortune: Use simple formatting when stdout isn't connected to a terminal
This changes the default behavior, so that, by default, color codes,
hyperlinks and additional spacing are only emitted when standard
output is connected to a terminal.

The default coloring behavior can be overridden with the `--color`
option. Valid arguments for this option are: 'always', 'never' and
'auto' (default).
2023-08-06 08:58:00 +02:00
Shannon Booth
98666b012d AK: Remove URL::ApplyPercentEncoding
Everywhere only ever expects percent encoding to occur, so let's just
remove this flag altogether. At the same time, replace some
DeprecatedString with StringView.
2023-08-06 08:57:23 +02:00
Aliaksandr Kalenik
c72a2f9e46 LibWeb/CSS: Serialize short version if possible for "place-" properties
Output short version when both parts of place-content, place-items,
place-self are the same.
2023-08-06 08:26:36 +02:00
Aliaksandr Kalenik
da2cd73bcf LibWeb: Add place-self css property support 2023-08-06 08:26:36 +02:00
Hendiadyoin1
36dcb0ada7 LibWeb: Use int-hash for CSSPixels 2023-08-05 20:03:09 +02:00
Hendiadyoin1
6c341ca985 LibWeb: Implement rounding for PixelUnits 2023-08-05 20:03:09 +02:00
Hendiadyoin1
cc74083f27 LibWeb: Inline and constexpr most PixelUnits methods 2023-08-05 20:03:09 +02:00
Hendiadyoin1
1e5ba09d76 LibWeb: Saturate PixelUnits on creation when needed 2023-08-05 20:03:09 +02:00
Hendiadyoin1
95d00553c9 LibWeb: Use default comparator for PixelUnits 2023-08-05 20:03:09 +02:00
Hendiadyoin1
71f56d8697 LibWeb: Saturate result in PixelUnits::operator/ 2023-08-05 20:03:09 +02:00
Hendiadyoin1
f9fc0505fb LibWeb: Add propper rounding to PixelUnits::operator*
Also moves related constants into the class to make them accessible for
tests.
2023-08-05 20:03:09 +02:00
Hendiadyoin1
4896ba11dc LibWeb: Use Checked::saturating_[add|sub] where applicable in PixelUnits 2023-08-05 20:03:09 +02:00
Hendiadyoin1
618f889486 LibWeb: Add and use convinient from_raw helper in PixelUnits 2023-08-05 20:03:09 +02:00
MacDue
22d06a4ff0 LibWeb: Set scroll step size to a value consistent with Qt/Ladybird
This probably should not be hardcoded, but for now having a consistent
value makes things feel nice.
2023-08-05 19:50:17 +02:00
Liav A
29fb3a1a60 Utilities/ls: Add an option to print raw inode numbers
This is only possible if listing an entire directory, because the LibC
readdir function will return the raw inode number in each struct dirent,
therefore allowing to print it as well.
2023-08-05 18:41:01 +02:00
Liav A
93ef955597 LibCore: Keep the raw inode number value in DirectoryEntry
This will be used later on by other userspace programs that need it.
2023-08-05 18:41:01 +02:00
Bastiaan van der Plaat
220e34b69d LibWeb: Add Canvas Context2D basic text align and text baseline support
Add the CanvasTextDrawingStyles mixin with the textAlign and
textBaseline attributes. Update fill_text in CanvasRenderingContext2D
to move the text rect by the text align and text baseline attributes.
Wrote a simple HTML example to showcase the new features.
2023-08-05 17:17:08 +02:00
Ali Mohammad Pur
e689422564 LibRegex: Keep track of instruction positions for backwards tree jumps 2023-08-05 16:40:04 +02:00
Andreas Kling
64c06c345e LibWeb: Parse :host() selector
We were already parsing non-function-syntax :host, so let's also do
the :host(...) variant. Note that we don't have matching for these yet.

This fixes many issues on sites generated by Wix, as they often have
selector lists that include some :host() selector, and we'd reject the
entire rule after failing to parse it.
2023-08-05 13:23:12 +02:00
Zaggy1024
2582b85ab1 LibWeb: Update reactive images according to spec after fetches finish
Reactive images that had an image source selected based on viewport
size would only update when the images were first fetched, meaning the
last valid image source would become stuck in an image element. By
implementing the last step for reacting to environment changes, we can
run the proper updates even when the image does not need to be fetched.
2023-08-05 11:41:41 +02:00
Tim Ledbetter
256084b0b9 top: Disable echo and line buffering on startup
This means we no longer show any characters the user types while top
is running.

Disabling line buffering has the same effect as enabling
non-blocking I/O, but it doesn't crash the terminal when we exit the
program without restoring stdin to its original state. This would
previously happen when a SIGKILL signal was received, for example.
2023-08-05 11:08:16 +02:00
Andreas Kling
41e7c5766e LibWeb: Support more kinds of indefinite widths on flex column items
This stuff is pretty hairy since the specifications don't give any
guidance on which widths to use when calculating the intrinsic height of
flex items in a column layout.

However, our old behavior of "treat anything indefinite as fit-content"
was definitely not good enough, so this patch improves the situation by
considering values like `min-content`, `max-content` and `fit-content`
separately from `auto`, and making the whole flex layout pipeline aware
of them (in the cross axis context).
2023-08-05 10:58:12 +02:00
Andi Gallo
7b0b501418 LibWeb: Improve adjustment of automatic table width with percentages
Use the max-width of percentage cells instead of min-width as the
reference to be used to compute the total table width. The specification
only suggests that the UA should try to satisfy percentage constraints
and this behavior is more consistent with other browsers.
2023-08-05 10:32:48 +02:00
Aliaksandr Kalenik
d32bf4cd41 LibWeb: Set min-width for inline child boxes after inside layout
min-width for boxes with inline children can only be applied after
inside layout is done and width of box content is known.
2023-08-05 09:25:24 +02:00
Hediadyoin1
50bf303edd LibJS: Capture UnrealizedSourceRanges in ExecutionContext, not ASTNodes
This loosens the connection to the AST interpreter and will allow us to
generate SourceRanges for the Bytecode interpreter in the future as well

Moves UnrealizedSourceRanges from TracebackFrame to the JS namespace for
this
2023-08-05 06:39:06 +02:00
Lucas CHOLLET
cd9bb985d4 LibGfx/JPEGXL: Add support for the self-correcting predictor
This predictor is much more complicated than the others. Indeed, to be
computed, it needs its own value but for other pixels. As you can guess,
implementing it involved the introduction of a structure to hold that
data.

Fundamentally, this predictor uses the value of the error between the
predicted value and the true value (aka decoded value) of pixels around.
One of this computed error (namely max_error) is used as a property, so
this patch also solves a FIXME in `get_properties`.

To ease the access to value that are close in the channel and moving
their values around, this patch adds a `Neighborhood` struct which holds
this data. It has been used in `prediction()` and it allowed to simplify
the signature and to remove the explicit retrieval of the underlying
data.

All this work allows us to decode the default image that appears when
loading `https://jxl-art.surma.technology`. However, we still render it
incorrectly due to the lack of support for orientation values different
from 1.
2023-08-05 06:30:59 +02:00
MacDue
a01a2f712e LibWeb: Fix calculating the corner radius values for SVG <rect>
Previously, this would treat having both rx and ry set as if just rx
was set. The checks are now updated to match the spec comments above
them :).
2023-08-05 04:50:33 +02:00
Aliaksandr Kalenik
b549f2d1d9 WebContent: Coalesce multiple sequential MouseWheel events
Same as a58d84407f but for MouseWheel :)
2023-08-05 04:47:46 +02:00
0GreenClover0
259228d8d2 Spreadsheet: Set Help window mode to Modeless in the constructor
And don't try to do it every time the Help button is clicked.
This fixes a crash when clicking the Help button twice (setting window
mode on an already visible window is not supported).

This also fixes a situation where when opening the Help window with an
action, we didn't set its mode to "Modeless".
2023-08-05 02:14:51 +03:30
ronak69
1453028975 Shell: Color bareword yellow if it's a prefix of at least one command
Before, if a bareword wasn't a runnable program's filename it got
colored red and white otherwise. Now, additionally it will be checked if
it is a "prefix" of a possible command and colored yellow if it is and
red if not.

Coloring this way provides another "feedback" to the user: If while
typing out a command name the color changes from yellow to red then a
typo occurred :^)

To check if a bareword is a prefix the `Shell::complete_program_name()`
function is utilized (if pressing tab gives you some suggestions then it
is a prefix).
2023-08-04 23:27:59 +03:30
Zaggy1024
ad440f9e9a LibWeb/Ladybird: Use the abstract audio output in a new audio plugin
The implementation of this plugin is meant to eventually replace all
current audio plugins in Ladybird. The benefits over the current Qt-
based audio playback plugin in Ladybird are:

- Low latency: With direct access to PulseAudio, we can ask for a
specific latency to output to allow minimal delay when pausing or
seeking a stream.
- Accurate timestamps: The Qt audio playback API does not expose audio
time properly. When we have access directly to PulseAudio APIs, we can
enable their timing interpolation to get an accurate monotonically-
increasing timestamp of the playing audio.
- Resiliency: With more control over how the underlying audio API is
called, we have the power to fix most bugs we might encounter. The
PulseAudio wrappers already avoid some bugs that occur with QAudioSink
when running through WSLg.
2023-08-04 13:49:36 -06:00
Zaggy1024
bc4d4f0f95 LibAudio: Create a playback class with a PulseAudio implementation
This adds an abstract `Audio::PlaybackStream` class to allow cross-
platform audio playback to be done in an opaque manner by applications
in both Serenity and Lagom.

Currently, the only supported audio API is PulseAudio, but a Serenity
implementation should be added shortly as well.
2023-08-04 13:49:36 -06:00
Zaggy1024
fe672989a9 LibCore: Add a class for thread-safe promises
Since the existing Promise class is designed with deferred tasks on the
main thread only, we need a new class that will ensure we can handle
promises that are resolved/rejected off the main thread.

This new class ensures that the callbacks are only called on the same
thread that the promise is fulfilled from. If the callbacks are not set
before the thread tries to fulfill the promise, it will spin until they
are so that they will run on that thread.
2023-08-04 13:49:36 -06:00
Zaggy1024
8626404ddb LibCore: Store the event loop stack as a function-scope thread_local
By allocating the event loop stack onto the heap, we were leaking it
when exiting. This way, we should avoid ASAN being unhappy with us.
2023-08-04 13:49:36 -06:00
Aliaksandr Kalenik
2bd7d1426b LibWeb: Remove unused CSSPixels::epsilon() 2023-08-04 19:00:02 +02:00
Aliaksandr Kalenik
79cbbfc67f LibWeb: Fix infinite spinning while distributing extra space in GFC
Fixes infinite spinning in the cases when CSSPixels does not have
enough precision to represent increase per track which happens when
very small extra_space got divided by affected tracks number.
2023-08-04 19:00:02 +02:00
Fabian Dellwing
0003381a71 sed: Keep correct owner and permissions with sed -i 2023-08-04 09:02:31 -06:00
Karol Kosek
49df2e1e3a Ladybird+Browser: Update zoom text on menu after clicking zoom button 2023-08-04 15:16:48 +02:00
Andi Gallo
3e70c1b6a3 LibWeb: Improve precision when computing size of replaced elements
Change associativity in computing of replaced element size to improve
precision of division.

Fixes vertically squashed image from Mozilla splash page MDN example.
2023-08-04 13:36:29 +02:00
Andi Gallo
e9ad8d5e4f LibWeb: Use i64 for intermediate value in CSSPixels multiplication
Reduce the chance of overflow due to fixed point denominator being
squared when multiplying the raw values, before adjusting the final
value back.
2023-08-04 13:36:29 +02:00
ronak69
bed5a752df LibMarkdown: Preserve blank lines in CodeBlocks
Specifically, `CodeBlock::render_lines_for_terminal()` eats up blank
lines because it uses `DeprecatedString::split()` without the
`SplitBehavior::KeepEmpty` enum. Easy fix: use the enum.
2023-08-04 13:16:32 +02:00
Fabian Neundorf
413e212ea8 Piano: Cache buffers in Track and WaveWidget
The Track itself caches the Samples after each processing step which
allows it to be queried without the need to process it every time.

This result is queried by the WaveWidget which then caches the result to
prevent unnecessary heap allocations every paint event.
2023-08-04 12:56:27 +02:00
Fabian Neundorf
885e35e92c Piano: Use Sample struct from LibDSP
Removes the Sample struct inside Piano and replaces it with the struct
from LibDSP.

It automatically scales the height of the wave depending on the maximum
amplitude, as the Samples now contain floats and not integers.
2023-08-04 12:56:27 +02:00
Aliaksandr Kalenik
0019b901a0 LibWeb: Remove hardcoded span = 2 while sizing spanning items in GFC 2023-08-04 12:41:11 +02:00
Torstennator
5e6f5a524a PixelPaint: New submenu for masking actions
This patch moves the mask related menu actions into a submenu in order
to keep the menu more clear.
2023-08-04 12:11:13 +02:00
Torstennator
d8320d0a14 WindowServer: Fix menu height when invisible items are involved
This patch checks for visible items to determine the menu height. Now
the last visible item is used to determine the height of the menu.
Before this patch that menu height could be wrong e.g. if the last item
was not visible.
2023-08-04 12:11:13 +02:00
Torstennator
8c681a1603 PixelPaint: Add color-masking for editing masks
This patch adds the ability to refine a editing mask by a color-range
based on the pixels of the content image. This is useful for image
editing where mask restirction via luminosity might not fit or just
certain color ranges should be edited.
2023-08-04 12:11:13 +02:00
Torstennator
df4904f61d PixelPaint: Use editing masks in filter gallery
With this change the image modifications of a filter is only applied to
regions of the image where a editing mask is defined. If no editing
mask is defined the filter modifications are applied to the whole
image.
2023-08-04 12:11:13 +02:00
Torstennator
dbbf54df2c PixelPaint: Add luminosity masking for editing masks
This adds a function where editing masks can be refined by selecting
a luminosity range that is applied to the content image and mapped to
the editing mask. This function allows the editing of image regions
that match only certain luminosity values.
2023-08-04 12:11:13 +02:00
Torstennator
660d6f171c PixelPaint: Add function to visualize editing-masks
This patch adds a function to make the editing-eask visible while
beeing in mask-mode so that the user can see which parts are covered
by the masks and can therefore be modified by other tools that support
editing masks.
2023-08-04 12:11:13 +02:00
Torstennator
69650a5812 LibGUI: Add new RangeSlider widget
A new widget that allows the selection of a range between a defined min
and max value.
2023-08-04 12:11:13 +02:00
Ali Mohammad Pur
da7bf5f785 Shell: Add support for the '!' POSIX pipeline prefix
This prefix simply inverts the exit code of the pipeline, which we
implement using the 'not' builtin.
2023-08-04 13:28:59 +03:30
Ali Mohammad Pur
b6d7c5fb0e Shell: Correctly track nested expansions in POSIX mode
Previously any expansion closing sequence would've caused the entire
expansion chain to be terminated, fix this by keeping track of active
expansions and running the parser in 'skip' mode.

Fixes #19110.
2023-08-04 13:28:59 +03:30
Karol Kosek
68ef7dba70 LibWeb: Add support for encoding Canvas to JPEG 2023-08-04 11:05:55 +02:00
Karol Kosek
b731705fec LibWeb: Implement HTMLCanvasElement.toBlob() 2023-08-04 11:05:55 +02:00
Karol Kosek
3239f0fb7b LibWeb: Implement HTMLCanvasElement.toDataURL() closer to spec
- Requesting an unsupported image type will now fallback to PNG
  (which is now always the case),
- Errors should return 'data:,' instead of empty string,
- Added spec comments
2023-08-04 11:05:55 +02:00
Zaggy1024
a112e2f8c5 LibAudio: Add a seek point at the first sample in MP3Loader
A previous commit made it so that SeekTable doesn't provide a seek
point from `seek_point_before()` if there is not a seek point before
the requested sample index. However, MP3Loader was only setting a seek
point after the first 10 frames, meaning that it would do nothing when
seeking back to 0.

To fix this, add a seek point at byte 0 for the first sample, so that
`seek_point_before()` will never fail.
2023-08-04 08:53:19 +01:00
Andreas Kling
cf9565551a LibWeb: Don't filter CSS rules into separate list based on @namespace
Instead, perform the filtering for each rule as we go. This avoids
creating a separate list of rules, which was ~5% of runtime when
mousing around on the Discord web interface.
2023-08-04 05:28:41 +02:00
Andreas Kling
bb39ca9b4a LibWeb: Add fast_is<SVGGraphicsElement>()
This dynamic_cast was ~6% of runtime when mousing around on Discord.
2023-08-04 05:28:41 +02:00
Andreas Kling
37a618b7ad LibWeb: Add missing visit in CSSStyleSheet::visit_edges()
Gotta visit m_default_namespace_rule.
2023-08-04 05:28:41 +02:00
Tim Ledbetter
d0fd925126 watch: Use alternate buffer to display output 2023-08-04 05:25:44 +02:00
Tim Ledbetter
ba1c4bc1d1 watch: Use stdout rather than stderr to display output
Previously, the header was printed to stderr.

This matches the behavior of watch on Linux.
2023-08-04 05:25:44 +02:00
Tim Ledbetter
2f3c41e033 watch: Replace LibC function calls with their LibCore equivalents 2023-08-04 05:25:44 +02:00
Bastiaan van der Plaat
958c79da64 LibWeb: Don't clear clip rect history but restore previous state 2023-08-03 20:08:53 +01:00
Bastiaan van der Plaat
9469531100 LibWeb: Convert text_indent css pixels to device pixels 2023-08-03 20:08:53 +01:00
Bastiaan van der Plaat
148d74b103 LibWeb: Use CSS text-indent property on input type="submit" elements 2023-08-03 20:08:53 +01:00
Aliaksandr Kalenik
1e953f2acc LibWeb: Reset planned_increase while distributing space to "fr" tracks
Fixes bug when planned_increase is not reset after adding it to
base_size.
2023-08-03 17:05:57 +02:00
Sergey Bugaev
f0a5276063 LibWebView: Create BGRA bitmaps instead of BGRx
This helps the GTK version of Ladybird to import them into the GTK
rendering machinery, since GdkMemoryFormat supports BGRA and BGR, but
not BGRx.
2023-08-03 15:49:47 +01:00
Niklas Poslovski
6ea4be36b5 LibCore: Fallback to fstat() on systems without d_type support 2023-08-03 12:25:07 +01:00
Andreas Kling
4011a107a4 LibWeb: Propagate overflow modes from <html> or <body> to viewport
This patch implements "Overflow Viewport Propagation" from CSS-OVERFLOW.
It fixes an issue where many websites were not scrollable because they
had `overflow: scroll` on the body element and we didn't propagate it.
2023-08-03 13:21:26 +02:00
Andreas Kling
09eed8eea2 LibWeb+headless-browser: Include paint tree in layout test output
This will give us a more comprehensive look at what actually gets
rendered in the end, and also allows us to catch more behavior changes.
2023-08-03 13:21:26 +02:00
Andrew Kaster
7d7c419ce6 Ladybird: Add WebSocket server for use by Lagom networking
Hide its use behind the same flag as RequestServer in WebContent.
2023-08-03 09:55:20 +02:00
Andrew Kaster
dd694215bc LibWebView+LibProtocol: Allow app to pass custom WebSocketClients 2023-08-03 09:55:20 +02:00
Andrew Kaster
bb831a27dd LibCore: Add Core::System::current_executable_path()
This is based on Jakt::File::current_executable_path() and all the other
sources I looked at to figure out the per-platform way to do this. My
goodness, every platform has its own bespoke way.
2023-08-03 09:55:20 +02:00
Andrew Kaster
506b03740c Ladybird: Move classes and types into the Ladybird namespace
We were super inconsistent about this, with most "new" classes living in
the Ladybird namespace, while "old" ones were in the global namespace,
or even sitting in the Browser namespace.
2023-08-03 09:55:20 +02:00
Sam Atkins
73fa58da34 LibWeb: Implement the CSS outline-offset property
This allows you to push the outline a certain distance away from the
border (or inside it, if the offset is negative).
2023-08-03 05:25:48 +02:00
Sam Atkins
fe7e797483 LibWeb: Implement the CSS outline property :^)
...along with `outline-color`, `outline-style`, and `outline-width`.

This re-uses the existing border-painting code, which seems to work well
enough!

This replaces the previous code for drawing focus-outlines, with generic
outline painting for any elements that want it. Focus outlines are now
instead supported by this code in Default.css:

```css
:focus-visible {
    outline: auto;
}
```
2023-08-03 05:25:48 +02:00
Sam Atkins
5640779838 LibWeb: Allow single-value shorthand properties to parse as CompositeSV
Don't give up if we can't parse that single value for the property
directly, but let the parsing code carry on and see if we can produce a
CompositeStyleValue.
2023-08-03 05:25:48 +02:00
Sam Atkins
d98bc0da87 LibWeb: Make it clearer that several line-styles are not implemented 2023-08-03 05:25:48 +02:00
Sam Atkins
14e6bae593 LibWeb: Implement the :focus-visible pseudo-class
This is very naive for now, and matches whenever `:focus` does.
2023-08-03 05:25:48 +02:00
Sam Atkins
8520afaa11 LibWeb: Rename PaintPhase::FocusOutline -> Outline
Any element can have an outline, whether because of focus or not.
2023-08-03 05:25:48 +02:00
Andreas Kling
9e5c7abd94 LibGfx/OpenType: Return metrics from hmtx even if there is no glyf entry
This fixes an issue with some typefaces where the space character has an
advance width, but no glyf entry (and thus no ascent/descent). Before
this change, we'd render whitespace with zero advance in such cases.
2023-08-02 19:22:36 +02:00
Karol Kosek
5b1aa2d55e LibWeb: Don't collapse boxes with CSS clear property set
I'm not sure if this is exactly correct, the link to CSS2 spec above
says something that clearance cannot separate boxes, but I'm not sure if
I understood it correctly or if I've done it in the right place.

However, this change fixes our block-and-inline/clearfix.html test again
(was regressed in previous commit).
2023-08-02 17:35:54 +02:00
Karol Kosek
142d498f14 LibWeb: Include anonymous boxes with no lines into computing BFC height
Pseudo-elements like ::before and ::after were discarded when their
content property was an empty string (ignoring whitespace), because they
are anonymous containers with no lines.

Our previous way around it was to add an empty line box (see b062a0fb7c)
however it didn't actually work for cases described in the previous
commit.

This makes avatars and cover arts square on last.fm and "fixes" the test
css-pseudo-element-should-not-be-affected-by-presentational-hints.html.
Unfortunately, this also regresses on block-and-inline/clearfix.html,
but that hopefully will be handled in subsequent commit.
2023-08-02 17:35:54 +02:00
Karol Kosek
d4b5205482 Revert "LibWeb: Make TextNode::ChunkIterator emit an empty chunk for content:"""
This reverts commit b062a0fb7c.

This made a calculation of pseudo-elements' height incorrect when they
had `height` set to `auto` and used other techniques (like setting
`padding-top`) to set height, as it was now also adding an empty line.

Additionally, the case didn't work for content containing whitespace
characters, so a pseudo-element with `content: " "` didn't have *this*
particular problem.
2023-08-02 17:35:54 +02:00
Kenneth Myhra
cf2c2cb4d7 LibWeb: Make sure we fallback to "Unsupported type" if type unrecognized
If we do not recognize the Type being serialized make sure we always
fallback to setting m_error to "Unsupported type".
2023-08-02 14:52:37 +02:00
Sam Atkins
5cf6d51753 LibWeb: Reformat inconsistent CSS JSON files
Mostly this is about 2-space indentation, but we now also only have one
key:value pair per line.
2023-08-02 12:49:46 +01:00
Tobias Christiansen
aabdb6a801 LibWeb: Make the linter happy in Properties.json
There was a space missing and the linter complained.
2023-08-02 11:35:57 +01:00
Tobias Christiansen
8709369d43 LibWeb: Add object-fit support to HTMLImageElement
This patch adds handling of the 'object-fit' CSS property to the
painting of HTML Image Elements.
This is achieved by first calculating the rect which the image would
need if it were to fully expand into open space and then adequately
cropping it to fit into the image's box.

scale-down is not supported for now.
2023-08-02 11:35:57 +01:00
Tobias Christiansen
5fc6bff582 LibWeb: Add 'object-fit' property
This patch adds support for the 'object-fit' CSS property. :^)
2023-08-02 11:35:57 +01:00
Karol Kosek
86ad896f35 Mail: Fetch mailbox contents with BODY.PEEK[] type instead of BODY[]
We don't want to mark the entire mailbox as read when checking emails,
don't we? :^)
2023-08-02 11:21:03 +01:00
Karol Kosek
2132e0f1bb LibIMAP: Implement serializing FetchCommands with PeekBody type 2023-08-02 11:21:03 +01:00
Andrew Kaster
b5bfe732d7 Ladybird: Add RequestServer process to optionally replace Qt Networking
LibTLS still can't access many parts of the web, so let's hide this
behind a flag (with all the plumbing that entails).

Hopefully this can encourage folks to improve LibTLS's algorithm support
:^).
2023-08-02 05:44:43 +02:00
Andrew Kaster
ec3267e002 LibProtocol+LibWebView: Allow callers provide their own RequestClient
This will be used by Ladybird when it spawns its RequestServer in a
Lagom-specific way rather than using SystemServer to do it.
2023-08-02 05:44:43 +02:00
Andrew Kaster
28d3d3c9fc LibTLS: Allow applications to provide a custom default CA Cert path
On Lagom, we also need to allow the initial load of /etc/cacert.pem to
fail.
2023-08-02 05:44:43 +02:00
Andrew Kaster
5062ba347b Ladybird+LibWebView: Move Lagom code to Ladybird, Qt code to Utilities
Re-organize our helper files here a bit, to make a clearer distinction
between Qt-specific helpers and generic non-serenity helpers.

A future commit will move Lagom specific code from LibSQL to ladybird
as well, so that we can see about future generic apis for spawning
helper procesess.
2023-08-02 05:44:43 +02:00
Aliaksandr Kalenik
1f28fdacf0 LibWeb: Set max-width for inline child boxes after inside layout
max-width for boxes with inline children can only be applied after
inside layout is done and width of box content is known.

Fixes https://github.com/SerenityOS/serenity/issues/20235
2023-08-02 05:27:56 +02:00
MacDue
24c848607c LibWeb: Don't lay out light DOM children of elements with a shadow root
This fixes the "last changed" time for files on GitHub. Note that this
appears to be in accordance with the shadow DOM specification, but I
can't find a line that neatly says it. Though on Google's post about
shadow DOM v1 it says:

> "the element's shadow DOM is rendered in place of its children."
https://web.dev/shadowdom-v1/#creating-shadow-dom-for-a-custom-element
2023-08-02 05:25:53 +02:00
Timothy Flynn
a14f6e42a8 LibWeb: Begin support for requesting blob URLs with Fetch infrastructure
This does not yet implement requests with a Range header.
2023-08-02 00:52:33 +01:00
Timothy Flynn
9957d48f48 LibWeb: Implement URL.createObjectURL and URL.revokeObjectURL 2023-08-02 00:52:33 +01:00
Timothy Flynn
dd36a0c12d LibWeb: Implement extracting the origin of a blob URL 2023-08-02 00:52:33 +01:00
Timothy Flynn
b3f82f724d LibWeb: Implement an ephemeral Blob URL store
The Blob URL store is intended to be a singleton across all WebContent
instances. But for now, this implements a per-WebContent store, which
only lives as long as the WebContent process itself.
2023-08-02 00:52:33 +01:00
Simon McMahon
2ce416a676 LibWeb: Parse header value lists for some CORS headers
This adds a simple and incomplete implementation for extracting some
specific CORS headers that are used by fetch. This unifies the existing
ad-hoc parsing that already existed for Access-Control-Allow-Headers
and Access-Control-Allow-Methods, as well as adding
Access-control-Expose-Headers.
2023-08-02 00:52:23 +01:00
Simon McMahon
3a1f510af0 LibWeb: Support for Access-Control-Expose-Headers in Fetch
This adds the headers named in Access-Control-Expose-Headers to the
response's CORS-exposed header-name list which allows those headers to
be accessed from JS.
2023-08-02 00:52:23 +01:00
Andreas Kling
15440b156f LibWeb: Ignore flex container size constraints during intrinsic sizing
Properties like min-width, max-width, etc, should be ignored while we're
trying to determine the intrinsic size of a flex container.

This fixes an infinite recursion when using an intrinsic size keyword as
the max-width of a flex column container.

Note that this behavior is marked as AD-HOC in code comments because
specs don't tell us how to achieve intrinsic sizing.

We can now load product pages on the Twinings site, such as
https://twinings.co.uk/products/earl-grey-100-tea-bags :^)
2023-08-01 20:15:20 +02:00
Sam Atkins
f6e4caf197 LibWeb: Implement the :buffering and :stalled pseudo-classes
Currently, HTMLMediaElement doesn't implement the stall timeout, so
`:stalled` always returns false.
2023-08-01 12:50:40 -04:00
Sam Atkins
eb7cda1172 LibWeb: Implement the :volume-locked pseudo-class 2023-08-01 12:50:40 -04:00
Sam Atkins
c8a51f232d LibWeb: Implement the :muted pseudo-class 2023-08-01 12:50:40 -04:00
Sam Atkins
7b4ae43b91 LibWeb: Implement the :seeking pseudo-class
This matches while a media element is seeking.
2023-08-01 12:50:40 -04:00
Sam Atkins
4df5e24926 LibWeb: Implement the :playing and :paused pseudo-classes
These match media elements (`<video>` and `<audio>`) which are playing
or paused, respectively.
2023-08-01 12:50:40 -04:00
Sam Atkins
a336fe4fc4 LibWeb: Include all pseudo-classes in SimpleSelector::serialize
Rather than logging ones that are missed, just rely on the compiler to
complain if one is missing. `:indeterminate` was. :^)
2023-08-01 12:50:40 -04:00
Timothy Flynn
44911173f5 LibWeb: Make VideoPaintable's clip rect temporary
Otherwise, in a simple page such as:

    <video src=...>
    <audio src=...>

The video's clip rect would "leak" to the AudioPaintable, preventing the
audio controls from rendering at all.
2023-08-01 11:14:26 -04:00
Timothy Flynn
902c2ef5a3 LibWeb: Add a clip rect for AudioPaintable
Not a huge deal because the base MediaPaintable class goes very out of
its way to paint within the confines of its own box, but just to be
safe, this was missed when adding the AudioPaintable class.
2023-08-01 11:14:26 -04:00
Timothy Flynn
c31e8cad1e LibWeb: Remove unused VideoBox preferred width/height methods
These were copied from some other paintable, but were never used for
video.
2023-08-01 11:14:26 -04:00
Aliaksandr Kalenik
338fa8261e LibWeb: Use item minimum contribution while sizing "fr" track in GFC
Fixes the issue that before "automatic minimum size" were used to size
flexible tracks even though specification says is should be "minimum
contribution"
2023-08-01 16:25:10 +02:00
Andreas Kling
e91bdedc93 LibJS: Use correct this value when callee is a with binding
If we're inside of a `with` statement scope, we have to take care to
extract the correct `this` value for use in calls when calling a method
on the binding object via an Identifier instead of a MemberExpression.

This makes Vue.js work way better in the bytecode VM. :^)

Also, 1 new pass on test262.
2023-08-01 16:08:21 +02:00
Tom
e61fdd1dc6 LibWeb: Use viewbox attribute in SVG symbol element
Previously when a viewBox was passed to a SVG symbol element it would
not be taken into account when drawing the SVG.
2023-08-01 14:40:51 +02:00