Commit graph

28017 commits

Author SHA1 Message Date
Aliaksandr Kalenik
ed0dc2ff72 LibWeb: Use flex layout for button content alignment
Using flex layout inside button solves the issue with wrongly calculated
height when it has: pseudo element and whitespaces inside.

Also using flex instead of a table layout allows for the same vertical
alignment but with fewer layout nodes: a flex container and anonymous
wrapper for content instead of a table wrapper, table, row, and cell.
2023-09-03 12:33:10 +02:00
Andrew Kaster
6e8f1549a3 AK+LibCore: Don't use unsupported features on Android 2023-09-03 11:38:51 +02:00
Daniel Bertalan
725584881a LibC: Set (U)LONG_WIDTH correctly for 64-bit
All supported targets use an LP64 ABI, where both `long` and `long long`
are 64 bits wide. We set `LONG_WIDTH` to 32, which caused an error when
compiling gnulib's `vasnprintf` routine.

We might consider using built-in macros to avoid such issues in the
future.
2023-09-03 09:18:22 +02:00
Andreas Kling
e2dcd97c88 LibWeb: Stub out HTMLDialogElement APIs
This makes https://null.com/ load instead of throwing a React internal
error and showing a black background.
2023-09-03 07:51:11 +02:00
René Hickersberger
f2bd3904da LibC: Implement memccpy 2023-09-03 06:21:40 +02:00
René Hickersberger
ad560cff0f LibC: Implement vdprintf and dprintf
These functions work just like `vfprintf` and `fprintf`, except that
they take a file descriptor as their first argument instead of a FILE*.
2023-09-03 06:21:40 +02:00
Zaggy1024
daf3d4c6ef LibWeb: Don't send audio time updates until audio is playing
We would start the timer to send playback time updates to the element
before playback had started, so in cases where the `HTMLMediaElement`
(incorrectly) creates both an `AudioTrack` and `VideoTrack`, it will
not cause the seek bar to flicker between the current video position
and zero.
2023-09-02 19:36:09 -04:00
Shannon Booth
a53459192f LibWeb: Add Optional<String> overload for Element::set_attribute
Which for now will just call the DeprecatedString version of this
function. This is intended to be used in porting code over to using the
new String equivalent with the end goal of removing the DeprecatedString
version of this function.

This allows us to port a whole heap of IDL interfaces from
DeprecatedString to String.
2023-09-02 19:23:41 +01:00
Shannon Booth
d4a890080d LibWeb: Switch IDL from UseNewAKString to UseDeprecatedAKString
NewAKString is effectively the default for any new IDL interface, so
let's mark this as the default behavior. It also makes it much easier to
figure out whatever interfaces are still left to port over to new AK
String.
2023-09-02 19:23:41 +01:00
Timothy Flynn
f05d291b41 LibWeb: Use the spec-mandated set-value when setting an attribute 2023-09-02 13:55:32 -04:00
Timothy Flynn
5ec76331e8 LibWeb: Invoke our internal attribute change handler from Attr
Currently, every public DOM::Element method which changes an attribute
fires this handler itself. This was missed in commit 720f7ba, so any
user of that API would not fire the internal handler.

To fix this, and prevent any missing invocations in the future, invoke
the handler from from Attr::handle_attribute_changes. This method is
reached for all attribute changes, including adding/removing attributes.
This ensures the handler will always be fired, and reduces the footprint
of this ad-hoc behavior.

Note that our ad-hoc handler is not the "attribute change steps" noted
by the spec. Those are overridden only by a couple of specific elements,
e.g. HTMLSlotElement. However, we could easily make our ad-hoc handler
hook into those steps in the future.
2023-09-02 13:55:32 -04:00
Timothy Flynn
9aae50a9c3 LibWeb: Handle attribute changes after actually changing the attribute
This is a normative change in the DOM spec. See:
https://github.com/whatwg/dom/commit/3fb0aa6
2023-09-02 13:55:32 -04:00
Timothy Flynn
2d97dd019e LibWeb: Use the spec-mandated change-attribute when setting an attribute 2023-09-02 13:55:32 -04:00
Timothy Flynn
50ec91fbe3 LibWeb: Add a missing spec-mandated return in Element::toggle_attribute 2023-09-02 13:55:32 -04:00
Andreas Kling
c78506d79b LibJS: Only update EC instruction pointer when pushing to EC stack
Instead of trying to keep a live reference to the bytecode interpreter's
current instruction stream iterator, we now simply copy the current
iterator whenever pushing to the ExecutionContext stack.

This fixes a stack-use-after-return issue reported by ASAN.
2023-09-02 19:24:29 +02:00
Liav A
2966188ea3 Userland: Always call syscall(SC_prctl, ...) with 4 arguments
The arguments are passed on registers, so if we pass only 3 defined
arguments then the fourth argument for the prctl syscall could have
garbage value within it.

To avoid possible bugs, always pass 3 arguments to a raw syscall prctl
call in addition to the prctl sub-option (the first argument).
2023-09-02 18:22:07 +02:00
Cubic Love
ab4262d49e About: Display Application's Icon in File Manager
Before, when looking in /bin in File Manager, the About application's
icon was missing. Now it is a serenity_app instead of serenity_bin the
icon is visible!
2023-09-02 16:27:08 +01:00
Shannon Booth
5b8be3a08d LibWeb: Handle immutable state for HTMLInputElement pickers
Which should not be shown if the element is not mutable.
2023-09-02 15:53:33 +02:00
Shannon Booth
7167d6a1c8 LibWeb: Support readonly attribute for input elements 2023-09-02 15:53:33 +02:00
Andreas Kling
1c06111cbd LibJS: Add file & line number to bytecode VM stack traces :^)
This works by adding source start/end offset to every bytecode
instruction. In the future we can make this more efficient by keeping
a map of bytecode ranges to source ranges in the Executable instead,
but let's just get traces working first.

Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
2023-09-02 15:37:53 +02:00
Timothy Flynn
720f7ba746 LibWeb: Define getting and setting an attribute value 2023-09-02 01:46:37 +03:30
Timothy Flynn
2c096486a4 LibWeb: Extract changing an attribute to its own method
This will be needed outside of this the method to set an existing
attribute, so do not inline this implementation.
2023-09-02 01:46:37 +03:30
Tim Ledbetter
889e6ab43d find: Add the -empty option
This predicate returns true for empty regular files or directories.
2023-09-01 23:48:44 +02:00
Tim Ledbetter
64bb5652a1 find: Add the -newer, -anewer and -cnewer options
These return true if the last modification time, last access time or
creation time of a file is greater than the given reference file.

If the `-L` option is in use and the given reference file is a
symbolic link then the timestamp of the file pointed to by the
symbolic link will be used.
2023-09-01 21:19:22 +02:00
Bastiaan van der Plaat
57a1d99cf4 LibWeb: Fix DOMMatrix Gfx::Matrix row/column ordering
The matrix used in the spec is column-major but Gfx::Matrix4x4 is
row-major so we need to transpose the values. This will fix internal
operations on that matrix. Because we also transposed the readonly
matrix property getters the matrix is again transposed when reading
so the JavaScript world only sees a column-major matrix.
2023-09-01 20:58:13 +02:00
Bastiaan van der Plaat
b4ae719664 LibWeb: Add DOMPoint matrixTransform and DOMMatrix transformPoint 2023-09-01 20:58:13 +02:00
Bastiaan van der Plaat
38bc8836d6 LibWeb: Remove exceptions from DOMPoint because allocate is unfailable 2023-09-01 20:58:13 +02:00
kleines Filmröllchen
271bfa63f3 LibAudio: Fix uncommon 16-bit block size symbol
This was a silly typo :^)
2023-09-01 20:04:55 +02:00
Andrew Kaster
1cd3826ad6 Userland+Tests: Don't use MAP_FILE when mmap-ing
MAP_FILE is not in POSIX, and is simply in most LibCs as a "default"
mode. Our own LibC defines it as 0, meaning "no flags". It is also not
defined in some OS's, such as Haiku. Let's be more portable and not use
the unnecessary flag.
2023-09-01 19:50:35 +02:00
Andreas Kling
ef9b6c25fa LibWeb: Consolidate consecutive inlines in a single anonymous flex item
Before this change, we were creating a new anonymous flex item for every
inline-level child of a flex container, even when we had a sequence of
inline-level children.

The fix here is to simply keep putting things in the last child of the
flex container, if that child is already an anonymous flex item.
2023-09-01 12:45:38 +02:00
Andreas Kling
d54cd23615 LibWeb: Never blockify HTML <br> elements
This is a bit iffy, but since <br> elements can't be implemented in
"just CSS" today, we should also exclude them from the blockification
algorithm. This is important, since <br> is expected to always have
inline-like behavior.
2023-09-01 12:45:38 +02:00
kleines Filmröllchen
a7c770268f Userland: Migrate to String in notification system 2023-09-01 12:06:08 +02:00
circl
3056ff6b11 LibWeb: Add presentational hints to the canvas element
There is only one, width/height -> aspect-ratio. This brings us
very slightly closer to spec and triggers a re-layout after
updating these values from JavaScript, which wasn't the case
before.
2023-09-01 10:43:37 +01:00
circl
22220cf116 LibWeb: Bring parsing of width/height attributes in canvas up to spec 2023-09-01 10:43:37 +01:00
Andrew Kaster
e6b8c2bd59 LibCore: Don't print class_name() from EventReceiver::stop_timer()
If stop_timer() is called from ~EventReceiver(), then the virtual
functions will end up calling the overload from the base class. As
EventReceiver::class_name() is pure virtual, this calls
__cxa_pure_virtual and crashes. We should not be calling virtual
functions from the destructor, and especially not pure virtual ones.

This "fixes" a crash in Piano, but the root cause of the problem is
still unfixed.
2023-09-01 11:19:18 +02:00
Zaggy1024
709767cc4b LibWeb: Don't convert to floating point in CSS::EdgeRect 2023-09-01 09:40:14 +02:00
Zaggy1024
9d4a1ac2b3 LibWeb: Apply CSS clip property to an element as well as its children
d06d4eb made the `clip` property apply to children of an absolute-
positioned element, but caused it not to be applied to the element the
property was applied to directly.

To fix this, apply the clip in new `before_paint()` and `after_paint()`
functions. Doing so keeps painter state from leaking from `paint()`,
but still allows subclasses of `PaintableBox` clip their contents
correctly without repeating the application of the clip rectangle.
2023-09-01 09:40:14 +02:00
Jonatan Klemets
0adda642a6 LibWeb: Fix int parsing in Element::tab_index
We now have functions for parsing integers in a spec-compliant way. This
patch replaces the `to_int` call with a call to the spec-compliant
`Web::HTML::parse_integer` function.
2023-08-31 22:27:48 +01:00
Jonatan Klemets
acd46b5974 LibWeb: Fix int parsing in Document::shared_declarative_refresh_steps
We now have functions for parsing integers in a spec-compliant way. This
patch replaces the `to_uint` call with a call to the spec-compliant
`Web::HTML::parse_non_negative_integer` function.
2023-08-31 22:27:48 +01:00
Andrew Kaster
088af86c90 LibWeb: Implement Navigable::target_name() 2023-08-31 22:23:39 +01:00
Aliaksandr Kalenik
a482166087 LibWeb: Bring html element height calculation closer to the spec
Previously we always set the height of the HTML element equal to the
viewport height but now this will only happen in quirks mode as it is
intended. Otherwise the html element height will be computed as auto.
2023-08-31 21:43:58 +02:00
Shannon Booth
6e9aeccf90 LibWeb: Implement releaseLock interface for ReadableStreamBYOBReader 2023-08-31 19:28:56 +02:00
Shannon Booth
b06d80e6fd LibWeb: Implement ReadableStreamBYOBReaderRelease Streams AO 2023-08-31 19:28:56 +02:00
Shannon Booth
8ce4f5597c LibWeb: Implement ReadableStreamBYOBReaderErrorReadIntoRequests AO 2023-08-31 19:28:56 +02:00
Shannon Booth
e08072ac2b LibWeb: Explicitly clear read requests for default stream reader
Expecting the list to be cleared from the move() is quite strange and
not particularly clear. Explicitly clear the requests instead.
2023-08-31 19:28:56 +02:00
Shannon Booth
c279d514e9 LibWeb: Implement ReadableStreamBYOBReader constructor 2023-08-31 19:28:56 +02:00
Timothy Flynn
e26ead0995 Ladybird+LibWebView: Move creation of the SQL client to LibWebView
This lets us remove the direct dependency from Ladybird to LibSQL.
2023-08-31 19:19:45 +02:00
Timothy Flynn
5c5a00dd3a Ladybird+LibWebView: Move CookieJar, Database, and History to LibWebView
These classes are used as-is in all chromes. Move them to LibWebView so
that non-Serenity chromes don't have to awkwardly reach into its headers
and sources.
2023-08-31 19:19:45 +02:00
Timothy Flynn
f7adc3320d Meta: Replace Lagom's LibWebView setup with LibWebView's CMakeLists.txt
This lets us add new sources to LibWebView in a single location.
2023-08-31 06:33:04 -04:00
Timothy Flynn
204a6f9241 Ladybird+LibWebView: Move console history tracking to ConsoleClient
This will allow other chromes to make use of history in their console
implementations.
2023-08-31 12:20:10 +02:00