Commit Graph

47699 Commits

Author SHA1 Message Date
Sam Atkins
92b128e20a LibGUI: Support folding regions in TextEditor 2023-02-28 13:23:55 +01:00
Sam Atkins
3d25b4eb34 LibGUI: Add folding regions to TextDocument
A `TextDocumentFoldingRegion` represents a region of the document which
the user can collapse/expand to make code easier to navigate.
2023-02-28 13:23:55 +01:00
Sam Atkins
96cf9355b2 LibGUI: Add TextRange::line_count() 2023-02-28 13:23:55 +01:00
Sam Atkins
640f6f476c LibGUI: Store Utf32Views in TextEditor::LineVisualData
Previously this stored the position of each visual line break, meaning
that all the text would always be painted. By storing each visual
line's Utf32View, we can skip over parts of the text, such as for code
folding.
2023-02-28 13:23:55 +01:00
Sam Atkins
b5e1babc26 LibGUI: Create TextAttributes for unspanned text once, not repeatedly
Also, stop unnecessarily creating a RefPtr for the unspanned font - just
use `font()`, which returns a reference.
2023-02-28 13:23:55 +01:00
Sam Atkins
e8b7bdbd57 LibGUI: Skip painting TextEditor spans that end on previous lines
This only becomes a problem with folding, since arbitrary lines may be
invisible, meaning we try to apply a span for an invisible line N, on
line N+X instead, causing occasional crashes.

This check means we can remove the loop that skips spans occurring at
the end of the line.
2023-02-28 13:23:55 +01:00
Ali Mohammad Pur
db886fe18b Userland+AK: Stop using getopt() for ArgsParser
This commit moves the implementation of getopt into AK, and converts its
API to understand and use StringView instead of char*.
Everything else is caught in the crossfire of making
Option::accept_value() take a StringView instead of a char const*.

With this, we must now pass a Span<StringView> to ArgsParser::parse(),
applications using LibMain are unaffected, but anything not using that
or taking its own argc/argv has to construct a Vector<StringView> for
this method.
2023-02-28 15:52:24 +03:30
Ali Mohammad Pur
b2b851b361 Shell: Convert the POSIX parser/lexer to ErrorOr 2023-02-28 15:52:24 +03:30
Ali Mohammad Pur
0c28fd41ed Shell: Convert all immediately convertible fallible functions to ErrorOr 2023-02-28 15:52:24 +03:30
Ali Mohammad Pur
e403dbabfa Shell: Convert the remaining fallible AST functions to ErrorOr 2023-02-28 15:52:24 +03:30
Ali Mohammad Pur
5f950df3d4 Shell: Make Immediate expression invocation fallible
This removes a whole bunch of FIXMEs in the immediate expr
implementations as well :^)
2023-02-28 15:52:24 +03:30
Ali Mohammad Pur
007767fc14 Shell: Convert builtins to use the modern main() style
That is, return ErrorOr<int>, handle fallible ops with TRY() and accept
a Main::Arguments.
Note that we do not populate the argc/argv members of Main::Arguments,
so all accesses have to go through .strings.
2023-02-28 15:52:24 +03:30
Ali Mohammad Pur
6e5ba82929 LibCore: Make ArgsParser tolerate Main::Arguments with only .strings
This currently allocates in .parse(), but that's better than making the
caller do the exact same before passing us the values.

Note that this is only temporary to aid in conversion, a future commit
will remove this and switch to requiring the users to allocate the
vector instead.
2023-02-28 15:52:24 +03:30
Ali Mohammad Pur
d575c50f3e Shell: Make AST::dump() ErrorOr-aware 2023-02-28 15:52:24 +03:30
Ali Mohammad Pur
beeb58bd93 Shell+LibCodeComprehension: Start replacing {Deprecated => }String
This starts by switching all AST members to Strings, and dealing with
the fallout.
2023-02-28 15:52:24 +03:30
Ali Mohammad Pur
79e4027480 AK: Add two starts_with{bytes,}() APIs to String 2023-02-28 15:52:24 +03:30
Andreas Kling
3a5802540e LibWeb: Follow-up fixes for Linus's comments in #17658 2023-02-28 13:16:39 +01:00
Luke Wilde
4d0277cd9a LibWeb: Implement navigator.{plugins,mimeTypes} 2023-02-28 12:36:14 +01:00
Luke Wilde
5e422bdae0 LibWeb: Move pdfViewerSupported's answer to Page
This will also be accessed by navigator.{plugins,mimeTypes} to
determine if they should expose any information.
2023-02-28 12:36:14 +01:00
Luke Wilde
57d28c57f7 LibWeb: Restore Storage as a legacy platform object 2023-02-28 12:36:14 +01:00
Luke Wilde
54f58e2662 LibWeb: Restore proper functionality of legacy platform objects
With the GC heap conversion, the functionality of legacy platform
objects was broken. This is because the generated implementation of one
of them was used for all of them, removing functionality such as
deletion.

This re-adds all functionality, where questions such as "does the
object support indexed properties?" is instead answered by virtual
functions instead of by the IDL generator checking the presence of
certain keywords/attributes.
2023-02-28 12:36:14 +01:00
Andreas Kling
7e76a51cb0 LibWeb: Rename Layout::InitialContainingBlock to Layout::Viewport
The name "initial containing block" was wrong for this, as it doesn't
correspond to the HTML element, and that's specifically what it's
supposed to do! :^)
2023-02-28 12:21:56 +01:00
Cubic Love
60f699338d Base: Improve Presenter Icons
Before, the shading of the Presenter icons was the wrong way round and
the external contrast was not as good as it could be. This has been
rectified and the icons are now light on the left- and dark on the
right-side. Also, they now use the same gray colors as other system
icons, making them sit much more nicely together, and have been
generally improved.
2023-02-28 10:17:40 +01:00
Cubic Love
80d1fc39a4 Base: Update Presenter man page with correct icon + Add a link to open
Use the correct icon in the Presenter application man page and add a
link to open the executable.
2023-02-28 10:17:40 +01:00
Luke Wilde
e864444fe3 LibTextCodec/Latin1: Iterate over input string with u8 instead of char
Using char causes bytes equal to or over 0x80 to be treated as a
negative value and produce incorrect results when implicitly casting to
u32.

For example, `atob` in LibWeb uses this decoder to convert non-ASCII
values to UTF-8, but non-ASCII values are >= 0x80 and thus produces
incorrect results in such cases:
```js
Uint8Array.from(atob("u660"), c => c.charCodeAt(0));
```
This used to produce [253, 253, 253] instead of [187, 174, 180].

Required by Cloudflare's IUAM challenges.
2023-02-28 08:46:06 +00:00
Luke Wilde
1c918e826c LibWeb: Define navigator/clientInformation with define_native_accessor
Defining it as a direct property causes it to have no getter/setter
function, which causes an empty Optional crash when attempting to
access such getter on a cross-origin iframe.

Fixes amazon.com crashing on this particular crash.
2023-02-28 08:45:23 +00:00
Tim Ledbetter
f3d1be933a PixelPaint: Remove shrink_to_fit property from LevelsDialog GML
This was causing the levels dialog to be displayed incorrectly.
2023-02-28 08:44:05 +00:00
Luke Wilde
57cc2bab4b Ports: Add Mednafen 2023-02-28 08:42:45 +00:00
Tim Ledbetter
3112a6b44f PixelPaint: Fix clicking on the layer menu with no image loaded
Previously, clicking on the layer menu with no image loaded would
cause a crash.
2023-02-28 08:37:10 +00:00
Tim Ledbetter
ef54a3c0d2 PixelPaint: Disable levels dialog action when no image is loaded
Previously, clicking on the levels dialog with no image loaded would
cause a crash.
2023-02-28 08:37:10 +00:00
Lucas CHOLLET
a139c77c71 LibGfx: Bubble up allocation failure instead of panicking 2023-02-28 08:33:01 +00:00
Luke Wilde
fc538bc00b LibJS: Add [[nodiscard]] to ThrowCompletionOr<void> 2023-02-27 23:57:08 +00:00
Luke Wilde
8f4bec2b4a LibJS: Add missing TRY in StringIteratorPrototype::next 2023-02-27 23:57:08 +00:00
Luke Wilde
53852452b2 LibJS: Propagate errors from Intrinsics initialization 2023-02-27 23:57:08 +00:00
Luke Wilde
af118f2a67 LibJS: Add missing error propagation to global object initializations 2023-02-27 23:57:08 +00:00
Luke Wilde
fb7aaeff3e LibJS/Bytecode: Return ThrowCompletionOr<void> from CreateVariable op 2023-02-27 23:57:08 +00:00
Luke Wilde
f4be95af69 LibJS: Don't discard ThrowCompletionOr<void> from declaration iteration 2023-02-27 23:57:08 +00:00
Luke Wilde
a964ebc255 LibWeb: Implement Path2D#addPath
Required by Ruffle.
2023-02-27 20:55:09 +01:00
Luke Wilde
1f97adbee8 LibGfx: Add a function that adds two paths together
This will be used by Path2D#addPath in LibWeb.
2023-02-27 20:55:09 +01:00
Luke Wilde
a90667e79c LibWeb: Add initial implementation of DOMMatrix(ReadOnly)
This is currently missing a lot of functions and initialisation from a
<transform-list> string, but is enough for Ruffle.
2023-02-27 20:55:09 +01:00
Luke Wilde
e3a9ed0c26 LibWeb: Make [UseNewAKString] work for enums and stringifiers 2023-02-27 20:55:09 +01:00
Luke Wilde
dec09333a3 LibGfx: Add method to Matrix that determines if the matrix is invertible 2023-02-27 20:55:09 +01:00
Luke Wilde
fcd3b16d63 LibWeb: Visit CallbackType's stored EnvironmentSettingsObject reference 2023-02-27 20:49:00 +01:00
Tim Schumacher
8331d7cd82 LibAudio: Use the proper functions to read WAV samples
Turns out that, if we don't use functions that ensure reading until the
very end of the buffer, we only end up getting the very beginning of
samples and fill the rest with uninitialized data.

While at it, make sure that we read the data that is little endian as a
LittleEndian.
2023-02-27 18:28:12 +01:00
Timothy Flynn
4edd8e8c5e LibGUI: Ensure the "End" key sets the cursor to the visual line end
We are currently setting the physical mouse position to the visual
cursor content location. In a line containing only a multi-code point
emoji, this would set the cursor to column 1 rather than however many
code points there are.
2023-02-27 09:36:37 -05:00
Nico Weber
a81e1a8c4f file: Use StringView instead of DeprecatedString for paths 2023-02-27 15:18:55 +01:00
Nico Weber
4193e53f62 file: Use StringView instead of DeprecatedString for description 2023-02-27 15:18:55 +01:00
Nico Weber
f989d2bb1f file: Use StringView instead of DeprecatedString for mime types 2023-02-27 15:18:55 +01:00
Nico Weber
9f5343e29e file: Remove unnecessary DeprecatedString ctor call
path is already a DeprecatedString.
2023-02-27 15:18:55 +01:00
Patryk Pilipczuk
b87b1472e1 HexEditor: Add BE decoding for UTF16String column in ValueInspector 2023-02-27 13:39:40 +01:00