Commit graph

47720 commits

Author SHA1 Message Date
Timothy Flynn
c4d78c29a2 AK: Invalidate overlong UTF-8 code point encodings
For example, the code point U+002F could be encoded as UTF-8 with the
bytes 0x80 0xAF. This trick has historically been used to bypass
security checks.
2023-03-03 11:46:42 -05:00
Timothy Flynn
796a615bc1 AK: Replace UTF-8 string validation with a constexpr implementation
This will allow validating UTF-8 strings at compile time, such as from
String::from_utf8_short_string.
2023-03-03 11:46:42 -05:00
Andreas Kling
f6f62d7ff6 TerminalSettings: Move scrollback settings from "Terminal" to "View"
The scrollback is really a property of the view, not the terminal.
2023-03-03 15:38:59 +01:00
Andreas Kling
3823f77d20 TerminalSettings: Spruce up the "Terminal" tab a bit
- Use sentence style capitalization for CheckBox and GroupBox titles
- Remove excessive explanation of bell mode.
- Put a "lines" label after the scrollback history length input instead
  of saying "(Lines)" in the GroupBox title.
- Tweak bell mode titles to make them self explanatory.
- Tweak language for exit confirmation.
2023-03-03 15:38:59 +01:00
Andreas Kling
880504e51d TerminalSettings: Spruce up the "View" tab a bit
- Use sentence style capitalization for CheckBox and GroupBox titles.
- Move the terminal font to the top.
- Split the cursor settings into two GroupBoxes (one for the shape,
  and one for the blinking behavior).
2023-03-03 15:38:59 +01:00
Andreas Kling
df0bf51441 TerminalSettings: Adjust layouts
Remove assymmetric vertical padding in various places.
2023-03-03 15:38:59 +01:00
Andreas Kling
165b077815 TerminalSettings: Change tab order
Let's put the "View" tab first, since the most common reason to open
TerminalSettings is to adjust something about the appearance.
2023-03-03 15:38:59 +01:00
Andreas Kling
460303b2fe LibGfx: Draw checkbox check in the center of the checkbox rect
This looks better at larger checkbox sizes than just drawing it in the
top left corner. Ideally we'd have a scalable checkmark, of course.
2023-03-03 15:38:59 +01:00
Andreas Kling
ee001cc417 LibGUI: Make CheckBox height adapt to the current font size 2023-03-03 15:38:59 +01:00
Andreas Kling
fdcdc14fce LibGUI: Make RadioButton height adapt to the current font size 2023-03-03 15:23:47 +01:00
Andreas Kling
f1e0eb8a25 LibGUI: Round up font sizes in various widget size calculations 2023-03-03 15:23:47 +01:00
Andreas Kling
c44bc58aaa HackStudio: Don't hard-code a default code font
If no HackStudio specific code font is set, we fall back to the system
default fixed-width font.
2023-03-03 15:23:47 +01:00
Andreas Kling
d0977ac566 LibCore+LibGUI+About: Use String in Core::Version and GUI::AboutDialog
The Core::Version API now returns ErrorOr<String>, and the
GUI::AboutDialog API was adjusted to accommodate this.
2023-03-03 15:23:47 +01:00
Linus Groh
ad4b4046f4 LibWeb/Fetch: Propagate OOM errors from HeaderList::extract_mime_type() 2023-03-03 11:02:21 +00:00
Linus Groh
2d7ce38ee2 LibWeb/MimeSniff: Port MimeType to new String 2023-03-03 11:02:21 +00:00
Linus Groh
fabea2a6a7 LibWeb/MimeSniff: Rename MimeType::from_string() to MimeType::parse()
This matches the spec's "parse a MIME type".
2023-03-03 11:02:21 +00:00
Linus Groh
65ab6d3b6f LibWeb/XHR: Fix blob type in XMLHttpRequest::response()
The type attribute of a blob is supposed to be a complete mime type of
the form "type/subtype", not just the determined mime type's type.
2023-03-03 11:02:21 +00:00
Linus Groh
45dc3d8a3e AK: Add String::ends_with{,_bytes}() 2023-03-03 11:02:21 +00:00
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