Commit graph

47552 commits

Author SHA1 Message Date
Linus Groh
bfdbb4b6ed AK: Add missing const qualifier to HashCompatible HashMap::contains() 2023-03-03 11:02:21 +00:00
Linus Groh
11023a3c53 LibWeb/Fetch: Port infrastructure to new String 2023-03-03 09:25:34 +00:00
Linus Groh
7f9ddcf420 LibWeb/Fetch: Port JS interfaces to new String
Since BodyInit and Headers are tightly coupled to both Request and
Response, I chose to do all of them at once instead of introducing a
bunch of temporary conversion glue code.
2023-03-03 09:25:34 +00:00
Linus Groh
f561940e54 LibWeb: Fix duplicate enum-to-string conversion in generated code
This regressed in e3a9ed0.
2023-03-03 09:25:34 +00:00
Linus Groh
9afcbdf452 LibWeb: Update generated code in Bindings/FetchMethod.cpp
Also update the incomplete and slightly incorrect dummy interface code
snippet I used to generate this.
2023-03-03 09:25:34 +00:00
Linus Groh
d68623698c LibIDL: Use OrderedHash{Table,Map} to store Enumeration values
Seems nice to keep these in the same order as the input and have
deterministic codegen of interfaces in LibWeb (for the purpose of
diffing two build revisions, for example).
2023-03-03 09:25:34 +00:00
Nico Weber
b898a46d7f AK: Make FixedPoint(FloatingPoint) ctor round instead of truncating
This is needed to have code for creating an in-memory sRGB profile using
the (floating-ppoint) numbers from the sRGB spec and having the
fixed-point values in the profile match what they are in other software
(such as GIMP).

It has the side effect of making the FixedPoint ctor no longer constexpr
(which seems fine; nothing was currently relying on that).

Some of FixedPoint's member functions don't round yet, which requires
tweaking a test.
2023-03-03 09:23:02 +00:00
Timothy Flynn
62f2f0a081 LibGfx: Handle multi-code point emoji widths when drawing text runs
This API is used by LibWeb's text painter. Bring it up to date with the
glyph width computations performed in draw_text_line() used by other GUI
applications.
2023-03-02 18:33:44 +01:00
Timothy Flynn
61f794d473 LibGfx: Handle multi-code point emoji when computing scaled glyph width 2023-03-02 18:33:44 +01:00
Rodrigo Tobar
4a20751ff6 LibPDF: Detect CFF encodings with supplements
These are not yet actually parsed, but detecting them means we at least
don't fail to understand the *actual* format value, which was causing
some CFF fonts to fail to load.
2023-03-02 12:18:53 +01:00
Rodrigo Tobar
9bca62c5fa LibPDF: Increase argument stack for Type1FontPrograms
Type1 imposes a stack limit of 24 elements, but Type2 has a limit of 48.
We are better off relaxing the limit of the former in favour of properly
supporting the latter.
2023-03-02 12:18:53 +01:00
Rodrigo Tobar
de5e7b487c LibPDF: Improve Type2 hint counting
There were two issues with how we counted hints with Type2 CharString
commands: the first was that we assumed a single hint per command, even
though there are commands that accept multiple hints thanks to taking a
variable number of operands; and secondly, the hintmask/ctrlmask
commands can also take operands (i.e., hints) themselves in certain
situations.

This commit fixes these two issues by correctly counting hints in both
cases. This in turn fixes cases when there were more than 8 hints in
total, therefore a hintmask/ctrlmask command needed to read more than
one byte past the operator itself.
2023-03-02 12:18:53 +01:00
Rodrigo Tobar
bf61f94413 LibPDF: Don't crash when a font hasn't been loaded yet
This could happen because there was a problem while loading the first
font in the document.
2023-03-02 12:18:53 +01:00
Rodrigo Tobar
79b4293687 LibPDF: Prevent crashes when loading XObject streams
These streams might need a Filter that isn't implemented yet, and thus
cannot be blindly MUST()-ed.
2023-03-02 12:18:53 +01:00
Rodrigo Tobar
2a8e0da71c LibPDF: Improve error support for Filter class
The Filter class had a few TODO()s that resulted in crashes at runtime.
Since we now have a better way to report errors back to the user let's
use that instead.
2023-03-02 12:18:53 +01:00
MacDue
7bd78d40e9 LibGfx+LibWeb: Propagate OOM when appending CanvasGradient color stops 2023-03-02 11:49:13 +01:00
MacDue
3a0a7e3e96 LibGfx+LibWeb: Propagate OOM when creating PaintStyles 2023-03-02 11:49:13 +01:00
dependabot[bot]
f0a99634dd CI: Bump JamesIves/github-pages-deploy-action from 4.1.1 to 4.4.1
Bumps [JamesIves/github-pages-deploy-action](https://github.com/JamesIves/github-pages-deploy-action) from 4.1.1 to 4.4.1.
- [Release notes](https://github.com/JamesIves/github-pages-deploy-action/releases)
- [Commits](https://github.com/JamesIves/github-pages-deploy-action/compare/4.1.1...v4.4.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-02 05:49:02 +00:00
Liav A
6b849fc8b1 Kernel: Move TYPEDEF_* TTY macros to API/ttydefaults.h file
This allows us to get rid of an include to LibC/sys/ttydefaults.h in the
Kernel TTY implementation.

Also, move ttydefchars static const struct to another file called
Kernel/API/ttydefaultschars.h, so it could be used too in the Kernel TTY
implementation without the need to include anything from LibC.
2023-03-01 19:36:53 -07:00
Liav A
800e244ed9 Kernel+LibC: Move the FD_SETSIZE declaration to API/POSIX/select.h file 2023-03-01 19:36:53 -07:00
Liav A
77486a0d08 Kernel: Remove includes to LibC stdarg definitions
We don't actually need the va_list and other stdarg definitions in the
kernel, because we actually don't use the "pure" printf interface in any
kernel code at all, but we retain the snprintf declaration because the
libstdc++ library still need it to be declared and extern'ed.
2023-03-01 19:36:53 -07:00
Liav A
5416a37fde Kernel: Remove heuristics for detecting malformed malloc memory access
I never saw these kind of messages in any debug session I had, and it
helps us to remove an include to LibC/mallocdefs.h file.
2023-03-01 19:36:53 -07:00
Kenneth Myhra
9da09e4fd3 LibWeb: Port URL and URLSearchParams to new String 2023-03-01 22:44:20 +00:00
Kenneth Myhra
843c9d6cd7 AK: Add new String constructor to URL 2023-03-01 22:44:20 +00:00
Kenneth Myhra
c0559e8a10 LibWeb: Handle optional return values for getters returning new String 2023-03-01 22:44:20 +00:00
Kenneth Myhra
98705ecf71 LibWeb: Add new String support for parameters with empty string defaults
This adds new string support for parameters with an optional default
value of empty string ("").
2023-03-01 22:44:20 +00:00
Timothy Flynn
7f717b8414 LibWeb: Store all members of WebIDL::ExceptionOr<T> in a single Variant
This reduces the size of WebIDL::ExceptionOr<T> as follows for a few
different Ts:

WebIDL::ExceptionOr<void>: 48 bytes to 40 bytes
WebIDL::ExceptionOr<JS::Value>: 48 bytes to 40 bytes
WebIDL::ExceptionOr<String>: 56 bytes to 40 bytes
2023-03-01 17:33:03 -05:00
Linus Groh
8f1d13e73b LibJS: Use a Variant instead of two Optionals for ThrowCompletionOr
Comes with the usual benefit of saving some space on the stack, as well
as making a situation where both or neither Optionals hold a value
impossible.

The various unwrapping additions are required as we can no longer
construct a ThrowCompletionOr<T> from an Optional<T> - rightfully so.
2023-03-01 17:55:42 +00:00
Linus Groh
e77503e49b LibJS: Make string_to_number() return double instead of Optional<Value>
This would never return an empty optional or non-numeric value, and in
fact every caller as_double()'d the value right away.
Let's make the type match reality instead :^)
2023-03-01 17:55:42 +00:00
Timothy Flynn
9fb7f7fceb Ladybird: Specify the emoji image path in Ladybird's font plugin 2023-03-01 14:54:16 +00:00
Timothy Flynn
fd1fbad1d2 LibGfx+LibUnicode: Support specifying the path to search for emoji
Similar to the FontDatabase, this will be needed for Ladybird to find
emoji images. We now generate just the file name of emoji image in
LibUnicode, and look for that file in the specified path (defaulting to
/res/emoji) at runtime.
2023-03-01 14:54:16 +00:00
Timothy Flynn
fb6ca386cc LibWeb: Delete entire grapheme clusters on backspace/delete key presses 2023-03-01 14:24:01 +00:00
Timothy Flynn
4734214ac1 LibWeb: Skip over grapheme clusters on left/right arrow key presses
Currently, if you use the left/right arrow keys to move over a multi-
code point glyph, we will move through that glyph one code point at a
time. This means you can "pause" your movement in the middle of a glyph
and delete a subsection of a grapheme cluster. This now moves the cursor
across the entire cluster.
2023-03-01 14:24:01 +00:00
Timothy Flynn
2c4acba883 LibWeb: Convert Web::DOM::Position::to_deprecated_string to String 2023-03-01 14:24:01 +00:00
Tim Schumacher
cd5868a0f1 Toolchain: Don't abuse crt{begin,end}.o for shared or PIE binaries
aarch64 required this to successfully build, but the actual fix to that
is to just make sure that crtbeginS and crtendS get built as a part of
the toolchain.

This partially reverts commit c18c84dbfd.
2023-03-01 12:41:56 +00:00
Sam Atkins
64eb326f26 LibGUI: Give SeparatorWidget a minimum size
Without this, it can be squished down into nothing, which looks really
odd.
2023-03-01 10:55:20 +01:00
Luke Wilde
ddc7bedca6 LibJS: Make int_part a double in StringPrototype::to_string
u64 is not big enough to hold extremely large numbers, such as
4.192938423e+54. This would cause an integer underflow on the radix
index when performing something like `toString(36)` and thus cause an
OOB Array read.
2023-03-01 10:53:31 +01:00
Luke Wilde
52a6f1ff8c LibWeb: Bail FrameLoader's load callbacks if associated BC is discarded
This prevents us setting up the document of a removed browsing context
container (BCC, e.g. <iframe>), which will cause a crash if the
document contains a script that inserts another BCC as this will use
the stale browsing context it previously set up, even if it's
reinserted.

Required by Prebid.js, which does this by inserting an `<iframe>` into
a `<div>` in the active document via innerHTML, then transfers it to
the `<html>` element:
7b7389c5ab/src/utils.js (L597)

This is done in the spec by removing all tasks and aborting all fetches
when a document is destroyed:
https://html.spec.whatwg.org/multipage/document-lifecycle.html#destroy-a-document

See the code comments for a simplified example.
2023-03-01 10:51:04 +01:00
Ali Mohammad Pur
23c514cda3 LibCore+Userland: Remove ArgsParser::add*(Vector<char const*>&)
This finally makes ArgsParser's value API free of silly char*'s!
2023-03-01 10:47:19 +01:00
Ali Mohammad Pur
500044906d LibCore+Everywhere: Remove ArgsParser::add*(char const*&)
This is not guaranteed to always work correctly as ArgsParser deals in
StringViews and might have a non-properly-null-terminated string as a
value. As a bonus, using StringView (and DeprecatedString where
necessary) leads to nicer looking code too :^)
2023-03-01 10:47:19 +01:00
Andreas Oppebøen
60908adcbe SoundPlayer: Add action with icon for toggling mute
This adds a button on the menubar next to the volume slider to
indicate mute state and allow toggling the mute. Pressing the M key
will still toggle the mute, as before. When muted, the volume scroll
bar now gets disabled.
2023-03-01 09:04:48 +00:00
Tim Ledbetter
e33791502f PixelPaint: Do not change layers when scaling with the move tool
The move tool will no longer change the foreground layer if the cursor
is currently hovering over a resize anchor.
2023-03-01 08:15:46 +00:00
Linus Groh
51c3967516 Everywhere: Use '_{short_,}string' literals more
This mostly updates code what was written before but merged after these
were added.
2023-02-28 15:15:36 +00:00
Andreas Kling
d0ba5f2ed7 ImageViewer: Add list of recently open files to the File menu :^) 2023-02-28 14:39:32 +01:00
Andreas Kling
5f23515796 TextEditor: Add list of recently open files to the File menu :^) 2023-02-28 14:39:32 +01:00
Andreas Kling
544366ff2a LibGUI: Add a simple "recently open files" feature
This feature allows any application to easily install an automatically
updating list of recently open files in a GUI::Menu.

There are three main pieces to this mechanism:

- GUI::Application::set_config_domain(domain): This must be called
  before using the recent files feature. It informs the Application
  object about which config domain to find the relevant RecentFiles
  list under.

- GUI::Menu::add_recently_open_files(callback): This inserts the list
  in a menu. A callback must be provided to handle actually opening
  the recent file in some application-specific way.

- GUI::Application::set_most_recently_open_file(path): This updates
  the list of recently open files, both in the configuration files,
  and in the GUI menu.
2023-02-28 14:39:32 +01:00
CanadaHonk
3e2ceef8c3 LibWeb: Add size to URLSearchParams
Added new size parameter to URLSearchParams.

Spec: https://url.spec.whatwg.org/#dom-urlsearchparams-size
Co-Authored-By: Linus Groh <mail@linusgroh.de>
2023-02-28 13:24:27 +00:00
Timothy Flynn
e231f72f61 LibGfx: Render text presentation emoji as text if we have its glyph 2023-02-28 13:22:58 +00:00
Timothy Flynn
42c272c059 LibUnicode: Allow ignoring text presentation emoji in sequence detection
This adds an option to only detect emoji that should always present as
emoji. For example, the copyright symbol (unless followed by an emoji
presentation selector) should render as text.
2023-02-28 13:22:58 +00:00
Sam Atkins
c06f4ac6f5 AK+Everywhere: Make GenericLexer::ignore_until() stop before the value
`consume_until(foo)` stops before foo, and so does
`ignore_until(Predicate)`, so let's make the other `ignore_until()`
overloads consistent with that so they're less confusing.
2023-02-28 12:55:10 +00:00