Commit graph

63581 commits

Author SHA1 Message Date
Timothy Flynn
eece7697fd LibWeb: Rename CharacterData's segmenter indicate it is for graphemes
We will be adding a word segmenter as well, so this is to disambiguate
the two.
2024-09-06 07:42:59 +02:00
Timothy Flynn
feecf89d65 LibWeb: Define a helper constant for the platform word-jumping key
On Linux/Windows, the ctrl key is used in conjunction with arrow keys to
jump word-by-word in text documents. On macOS, the option key is used
(which is mapped to the alt key code).
2024-09-06 07:42:59 +02:00
Timothy Flynn
3e116769fb LibUnicode: Add code point GC queries for Punctuation and Separator 2024-09-06 07:42:59 +02:00
Timothy Flynn
ed3c450359 LibWebView+UI: Move the database and cookie jar to WebView::Application
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-22.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
The main motivator here was noticing that --disable-sql-database did not
work with AppKit. Rather than re-implementing this there, move ownership
of these classes to WebView::Application, so that each UI does not need
to individually worry about it.
2024-09-05 19:45:47 -04:00
Timothy Flynn
60f30aad72 LibWeb: Limit the minimum scrollbar size to the overflown box's size
A hard-coded value of 50px is too large for text boxes with a size that
is less than 50px. Reduce this to 24px, and further limit it by the size
of the overflown box.
2024-09-06 01:34:40 +02:00
BenJilks
7e38e12bb0 LibWeb: Use transform-box for resolving percentage transform values
Some checks are pending
CI / Lagom (true, NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-22.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Factor out computing the transform box rect into its own method. Then
use it when resolving the transformation matrix, to compute percentage
values.
2024-09-05 19:22:26 +02:00
Aliaksandr Kalenik
a9d5a99568 LibGfx+LibWeb: Replace remaining OpenType implementation with Skia
This change should move us forward toward emoji support, as we are no
longer limited by our own OpenType implementation, which was failing
to parse the TrueType Collection format used to store emoji fonts
(at least on macOS).
2024-09-05 19:21:52 +02:00
Aliaksandr Kalenik
99f64139d0 LibGfx+WebContent: Load resource://fonts after FontDatabase construction
This is a preparation for upcoming changes where Gfx::Typeface will
depend on `FontDatabase::should_force_fontconfig()`, so we will no
longer be able to construct typefaces from FontDatabase constructor
because of circular dependency.
2024-09-05 19:21:52 +02:00
Aliaksandr Kalenik
db74244fb2 LibWeb: Read header to check if a blob without mime type is WOFF/WOFF2
Currently we rely on parser returning an error if encoded data cannot be
parsed into a valid WOFF or WOFF2 font, which is not going to be true
after switching to Skia that sometimes does not fail even if a data does
not represent a valid font.
2024-09-05 19:21:52 +02:00
Aliaksandr Kalenik
8cd6682e6f LibGfx+WebContent: Remove unused Font::variant() and Typeface::variant() 2024-09-05 19:21:52 +02:00
Tim Ledbetter
b4652e4895 LibWeb: Account for scroll offset when interacting with media controls
Previously, using the mouse to interact with the media player wouldn't
work as expected if the page had been scrolled vertically or
horizontally.
2024-09-05 18:11:31 +02:00
Jamie Mansfield
936ca720b4 LibWeb: Implement WorkerNavigator.mediaCapabilities 2024-09-05 14:52:26 +01:00
Jamie Mansfield
f08946bcd2 LibWeb: Implement Navigator.mediaCapabilities
This is enough to stop Crunchyroll showing an unsupported browser
modal :^)
2024-09-05 14:52:26 +01:00
Jamie Mansfield
4c5a176354 LibWeb: Stub MediaCapabilities IDL interface 2024-09-05 14:52:26 +01:00
Timothy Flynn
1240aaa294 LibWeb: Update editable node selections with arrow/home/end keys
When an editable node is focused and one of the arrow/home/end keys are
pressed while shift is held, we will now create or update the document's
selection. There is a bit of nuance to the behavior here, which matches
how the cursor behaves in other engines.

We will of course want to abstract this in the future to extend any non-
editable node text selections. This also does not implement holding ctrl
to jump by word, rather than grapheme.
2024-09-05 14:37:57 +01:00
Timothy Flynn
7ae7e3eef3 LibWeb: Limit select-all actions to editable nodes when they are focused
If the user presses ctrl+a inside an <input> element, for example, we
now select that element's text only.
2024-09-05 14:37:57 +01:00
Timothy Flynn
6a0c67d5d2 UI/AppKit: Do not expose PUA key event code points to WebContent
AppKit uses Private Use Area code points for a large collection of
functional keys (arrows, home/end, etc.). Re-assign them to 0 to avoid
tripping up WebContent's key handler.
2024-09-05 14:37:57 +01:00
BenJilks
813612096c LibWeb: Test for hits around fragments in InlinePaintable
This allows you to select text at the end of fragments, just like in
non-inline elements.
2024-09-05 14:19:01 +01:00
BenJilks
8c465c95aa LibWeb: Pick the closest hit test result, instead of the first
When performing a hit test of type TextCursor, it would check if the
position is around each fragment and not just inside it. This resulted
in always selecting the first fragment checked.

This commit computes the distance of each hit test result, and picks the
closest one.
2024-09-05 14:19:01 +01:00
BenJilks
ef037b4152 LibWeb: Use the correct dimension when computing the max grid size
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-22.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
When deciding if the grid containers min size should be limited by a
max size. Check for a max height or width depending on the dimension,
instead of just always checking for a max width.
2024-09-04 22:41:15 +02:00
Tim Ledbetter
a56a2faf51 LibWeb: Don't handle media player key events if any modifier is pressed
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-22.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
2024-09-04 09:59:40 -04:00
Tim Ledbetter
63231fd276 LibWeb: Don't propagate key events that are handled by the media player
If a key is pressed when the media player is in focus, which causes the
media player to perform some action, that key event is no longer
propagated further.
2024-09-04 09:59:40 -04:00
Timothy Flynn
f1395a2c38 LibWebView: Properly handle new lines inside styled view-source elements
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-22.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
When we want to inject a CSS counter for a line, we need to be sure to
handle if we had previously opened a styled span for the current source
substring. For example, if we see a new line in the middle of a comment,
we will have previously opened the following tag:

    <span class="comment">

So when injecting a new line and the <span class="line"> element (for
CSS counters), we need to close the previous span and insert a newly
opened tag to continue using the style.
2024-09-04 13:14:38 +02:00
Aliaksandr Kalenik
79b57ef094 LibGfx/Font: Remove unused ScaledFont::glyph_metrics() 2024-09-04 13:14:05 +02:00
Aliaksandr Kalenik
f7891c7ec0 LibGfx/Font: Remove unused Typeface::glyph_advance() 2024-09-04 13:14:05 +02:00
Aliaksandr Kalenik
ae82bf5f7a LibGfx/Font: Use harfbuzz in ScaledFont::glyph_width() 2024-09-04 13:14:05 +02:00
Aliaksandr Kalenik
fb539b2412 LibGfx/Font: Delete unused glyphs_horizontal_kerning() 2024-09-04 13:14:05 +02:00
Aliaksandr Kalenik
4786604f8b LibGfx: Replace ad-hoc text width calculation with harfbuzz
Since harfbuzz is already used to calculate glyph positions, let's
also use it to measure width.
2024-09-04 13:14:05 +02:00
Aliaksandr Kalenik
a541a0792c LibWeb: Use harfbuzz for canvas text layout
harfbuzz is already used for regular text layout in LibWeb, so
for consistency let's also switch canvas.
2024-09-04 13:14:05 +02:00
Johan Dahlin
977e77bd4a HTMLImageElement: Improve decoding stub
Add an enum and warn when setting to sync/async.
2024-09-04 09:55:33 +02:00
Timothy Flynn
03f9915054 LibWebView: Use the download directory facility for saving files
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-22.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
2024-09-03 14:13:41 -04:00
Timothy Flynn
bf2dad5d38 UI/AppKit: Implement download directory selection 2024-09-03 14:13:41 -04:00
Timothy Flynn
4147d771a6 UI/Qt: Implement download directory selection 2024-09-03 14:13:41 -04:00
Timothy Flynn
8fbb39803e LibWebView: Add facilities to ask the user for a download directory
If the Downloads directory exists, we will use it (note that this will
respect the XDG_DOWNLOAD_DIR environment variable).

Otherwise, we will ask the UI layer to retrieve a download directory
from the user. This directory is not saved, so it will be re-prompted
every time. Once a proper settings UI is complete, we will of course
integrate with that for persistent settings.
2024-09-03 14:13:41 -04:00
Timothy Flynn
d392c38a73 LibUnicode: Cache all created icu::TimeZone objects
This cache works exactly the same as the existing icu::Locale cache.
2024-09-03 19:26:04 +02:00
Timothy Flynn
6becd13a83 LibJS: Add a non-BigInt overload of GetNamedTimeZoneOffsetNanoseconds
In some cases, we have a timestamp as a double in milliseconds. We then
would convert it to nanoseconds as a BigInt, just to bring it back to a
double for TZDB lookups. Add an overload to avoid this needless round
trip.
2024-09-03 19:26:04 +02:00
Timothy Flynn
5ee92af1d9 LibJS+WebContent: Cache the resolved system time zone identifier
Even though the underlying time zone is already cached by LibUnicode, JS
performs additional expensive lookups with that time zone. There's no
need to do those lookups again until the system time zone has changed.
2024-09-03 19:26:04 +02:00
dependabot[bot]
25e5ccd376 CI: Bump JamesIves/github-pages-deploy-action from 4.6.3 to 4.6.4
Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.6.3 to 4.6.4.
- [Release notes](https://github.com/jamesives/github-pages-deploy-action/releases)
- [Commits](https://github.com/jamesives/github-pages-deploy-action/compare/v4.6.3...v4.6.4)

---
updated-dependencies:
- dependency-name: JamesIves/github-pages-deploy-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-03 10:14:43 -06:00
Timothy Flynn
7d0e33cb27 LibJS: Implement Uint8Array.prototype.setFromHex 2024-09-03 17:43:03 +02:00
Timothy Flynn
c7afd175bc LibJS: Implement Uint8Array.fromHex 2024-09-03 17:43:03 +02:00
Timothy Flynn
440183b669 LibJS: Implement Uint8Array.prototype.setFromBase64 2024-09-03 17:43:03 +02:00
Timothy Flynn
e8f27160bf LibJS: Implement Uint8Array.fromBase64
Note that we can currently only use simdutf for Base64 decoding if the
provided stopBeforePartial option is loose, which is the default. There
is an open issue for simdutf to implement strict and stop-before-partial
options. Until then, for those options, we implement a slow decoder that
is written exactly as the spec steps dictate.

See: https://github.com/simdutf/simdutf/issues/440
2024-09-03 17:43:03 +02:00
Timothy Flynn
c69d6fab8f LibJS: Implement Uint8Array.prototype.toHex 2024-09-03 17:43:03 +02:00
Timothy Flynn
b97f9f2c55 LibJS: Implement Uint8Array.prototype.toBase64 2024-09-03 17:43:03 +02:00
Timothy Flynn
dfad1a7329 test-js: Add a helper method to convert a string to a UTF-8 byte array
In pure JS, we would have to implement a full UTF-8 encoder, so let's
add a helper method to do the work in C++.
2024-09-03 17:43:03 +02:00
Timothy Flynn
d265575269 AK: Add a Base64 decoder to decode into an existing buffer
Some callers (LibJS) will want to control the size of the output buffer,
to decode up to a maximum length. They will also want to receive partial
results in the case of an error. This patch adds a method to provide
those capabilities, and makes the existing implementation use it.
2024-09-03 17:43:03 +02:00
Timothy Flynn
35d8e7e63f AK: Add a public helper to count the decoded length of a Base64 string 2024-09-03 17:43:03 +02:00
Timothy Flynn
41e14e3fc3 AK: Add an option to the base64 encoder to omit padding
Will be used by an upcoming JS prototype
2024-09-03 17:43:03 +02:00
HolonProduction
94230acf28 LibWeb: Update Selection.collapse algorithm 2024-09-03 17:42:13 +02:00
Andreas Kling
8a6c8a1c27 LibWeb: Propagate text-decoration-* properties to anonymous wrappers
Fixes an issue where old prices were not displayed with strike-through
text on the PlayStation store. :^)
2024-09-03 17:41:05 +02:00