Commit graph

3935 commits

Author SHA1 Message Date
Timothy Flynn 683c08744a Userland: Avoid some conversions from rvalue strings to StringView
These are all actually fine, there is no UAF here. But once e.g.
`ByteString::view() &&` is deleted, these instances won't compile.
2024-04-04 11:23:21 +02:00
Timothy Flynn b5f22b6e90 AK+Userland: Remove some needlessly explicit conversions to StringView 2024-04-04 11:23:21 +02:00
Timothy Flynn c23060e21b Userland: Avoid some now-unneeded explicit conversions to Bytes 2024-04-04 11:23:21 +02:00
Andrew Kaster d1fdfead54 LibWebView+Browser: Collect memory and cpu usage for helpers on Serenity 2024-04-03 20:56:33 +02:00
Andrew Kaster a6220501ab Browser: Add a simple TaskManager window for tracking helper proccesses 2024-04-02 09:52:34 -06:00
Andrew Kaster 096feaaeb8 Ladybird+LibWebView: Add ProcessManager to track live processes
This model will be used to add a Processes tab to the inspector.
2024-04-02 09:52:34 -06:00
Timothy Flynn 8ff3cd6d76 Ladybird: Reset the default favicon when starting a new page load
This matches the AppKit chrome. This resets the favicon so that we do
not keep using the previous site's favicon if the new site does not have
one.
2024-03-29 08:52:01 -04:00
Timothy Flynn 245489e68c Browser: Implement history state change mechanics
We now appropriately update the current history item or create a new
history item in the chrome process.
2024-03-29 08:52:01 -04:00
Cubic Love 41d5fa2b07 Base+ImageViewer: Restore correct app icon
Restore ImageViewer's new application icon, which was accidentally
changed back to using the filetype icon by e800605.
Additionally, use the correct icon in the ImageViewer manpage.
2024-03-28 22:32:03 -04:00
Timothy Flynn 59fb811159 Browser: Display an audio button on tabs that are playing audio
When audio begins playing, add a button to the left of the favicon with
a speaker icon to indicate which tab is playing audio. This button is
currently disabled, but in the future may be used to mute the tab.
2024-03-28 21:08:23 +01:00
Timothy Flynn 06d1477312 Browser: Display a default favicon and title
This ensures we consistently show a favicon and that we update the title
to at least display the page URL when there isn't a <title> tag. We
would otherwise continue displaying the previous page's title.
2024-03-28 21:08:23 +01:00
Sönke Holz 6654021655 Kernel/riscv64: Don't hard-code the page fault reason on RISC-V
Instead, rewrite the region page fault handling code to not use
PageFault::type() on RISC-V.

I split Region::handle_fault into having a RISC-V-specific
implementation, as I am not sure if I cover all page fault handling edge
cases by solely relying on MM's own region metadata.
We should probably also take the processor-provided page fault reason
into account, if we decide to merge these two implementations in the
future.
2024-03-25 14:18:38 -06:00
ronak69 22586c9cc6 AnalogClock: Add feature to change and show time zone
The said time zone is local to each instance of the AnalogClock and is
separate from the system time zone.

This allows user to have clocks that use different time zones
simultaneously.
2024-03-25 14:09:23 -06:00
Timothy Flynn 0069390e1c Browser: Implement pasting content from the clipboard 2024-03-25 08:14:00 +01:00
Shannon Booth e800605ad3 AK+LibURL: Move AK::URL into a new URL library
This URL library ends up being a relatively fundamental base library of
the system, as LibCore depends on LibURL.

This change has two main benefits:
 * Moving AK back more towards being an agnostic library that can
   be used between the kernel and userspace. URL has never really fit
   that description - and is not used in the kernel.
 * URL _should_ depend on LibUnicode, as it needs punnycode support.
   However, it's not really possible to do this inside of AK as it can't
   depend on any external library. This change brings us a little closer
   to being able to do that, but unfortunately we aren't there quite
   yet, as the code generators depend on LibCore.
2024-03-18 14:06:28 -04:00
Nico Weber 21917e7b1e LibPDF+PDFViewer+MacPDF: Don't draw hidden text by default
Text can be rendered in various ways in PDFs: Filled, stroked,
both filled and stroked, set as clipping path, hidden, or
some combinations thereof.

We don't implement any of this at the moment except "filled".

Hidden text is used in scanned documents: The image of the scan is
drawn in the background, and then OCRd text is "drawn" as hidden
on top of the scanned bitmap. That way, the (hidden) text can be
selected and copied, and it looks like you're selecting text from
the scanned bitmap. Find-in-page also works similarly. (We currently
have neither text selection nor find-in-page, but one day we will.)

Now that we have pretty good support for CCITT and are growing some
support for JBIG2, we now draw both the scanned background image
as well as the foreground text. They're not always perfectly aligned.

This change makes it so that we don't render text that's marked as
hidden. (We still do most of the coordinate math, which will probably
come in handy at some point when we implement text selection.)

This makes these scanned documents appear as they're supposed to
appear (at least in documents where we manage to decode the background
bitmap).

This also adds a debug option to force rendering of hidden text.
2024-03-16 13:10:48 -04:00
Timothy Flynn 764286676f Browser: Implement <input type=file> file type filtering 2024-03-16 08:42:33 +01:00
Timothy Flynn 6760d236e4 Ladybird+LibWeb+WebContent: Parse the <input type=file> accept attribute
This parses the accept attribute value for file input types and passes
it along to the browser chromes.
2024-03-16 08:42:33 +01:00
Sam Atkins f00afa4a71 HexEditor: Avoid painting white rectangle on a white background
Most of the time, the background color for the hex and text areas will
be the widget's normal background color, so skip painting it in those
cases.
2024-03-15 08:37:21 +00:00
Sam Atkins d4c051ece2 HexEditor: Add gaps between byte groups 2024-03-15 08:37:21 +00:00
Sam Atkins 4a2a40a3c8 HexEditor: Break bytes-per-row into numbers of groups of bytes 2024-03-15 08:37:21 +00:00
Cubic Love 3bec616893 Base+ImageViewer: Add new icons for ImageViewer
Add ImageViewer application icons (16 and 32px) and matching image
filetype icons.
2024-03-12 08:08:19 +00:00
Bastiaan van der Plaat bd86beb7e4 Maps: Add FavoritesModel and remove hacky misusage of JSONArrayModel 2024-03-11 10:40:23 +00:00
Bastiaan van der Plaat 29026ce965 Maps: Move TileProviders.json to user independent folder 2024-03-11 10:40:23 +00:00
Timothy Flynn 07a27b2ec0 AK: Replace the boolean parameter of StringView::lines with a named enum 2024-03-08 14:43:33 -05:00
Timothy Flynn 928287b782 LibCrypto: Store ASN1 certificate timestamps as UnixDateTime
We are currently using Core::DateTime, which is meant to represent local
time. However, we are doing no conversion between the parsed time in UTC
and local time, so we end up comparing time stamps from different time
zones.

Instead, store the parsed times as UnixDateTime, which is UTC. Then we
can always compare the parsed times against the current UTC time.

This also lets us store parsed milliseconds.
2024-03-08 00:41:23 +01:00
Nico Weber 2e2cae26c6 LibGfx+Fallout: Make ImageDecoder return ErrorOr
...from try_create_for_raw_bytes().

If a plugin returns `true` from sniff but then fails when calling
its `create()` method, we now no longer swallow that error.

Allows `image` (and other places in the system) to print a more
actionable error if early image headers are invalid.

(We now no longer try to find another plugin that can also handle
the image.)

Fixes a regression from #20063 / #19893 -- before then, we didn't
do fallible work this early.
2024-03-07 11:20:06 -05:00
Ali Mohammad Pur 6dfb2f9dc8 Everywhere: Merge the WebSocket service into RequestServer
This keeps the APIs separate as they are wildly different, a future
improvement could be to somehow unify the APIs (if possible).

Closes #23080.
2024-03-06 10:07:27 +01:00
Hugh Davenport d8f756ce1d Escalator: Allow failed password attempts to be retried
There is a limit of 3 attempts before quitting, but the user can try
again after that.

The error messages now display to help the user understand the issue.
2024-03-04 13:25:22 -05:00
Timothy Flynn d392375a08 Revert "Browser: Allow system shortcuts to function"
This reverts commit 2e8ff1855c.

We had some awkward timing around the merging of this commit and commit
b073fdd570. With both commits in tree, we
are now processing hotkey activations twice. For example, ctrl+t will
open 2 tabs.
2024-03-04 10:49:43 +01:00
Kyle Lanmon a099d0e140 PDFViewer: Hide the rendering diagnostics window by default
You can enable it in the Debug menu and we will remember your choice.
2024-03-04 10:43:41 +01:00
Hugh Davenport 0d6573be14 Escalator: Set focus to password input automatically 2024-03-03 11:00:05 -05:00
Nico Weber 03fab7089a LibPDF+PDFViewer: Extract Renderer::apply_page_rotation()
No behavior change.
2024-02-27 07:02:02 +01:00
Nico Weber 29f5182e51 LibGfx+PDFViewer: Add RotationDirection::Flip and use it in PDFViewer
No behavior change.
2024-02-27 07:02:02 +01:00
Timothy Flynn ab4d4f0711 Browser: Implement the <input type=file> UI 2024-02-26 14:18:49 +01:00
Shannon Booth 9ce8189f21 Everywhere: Use unqualified AK::URL
Now possible in LibWeb now that there is no longer a Web::URL.
2024-02-25 08:54:31 +01:00
Hugh Davenport 2e8ff1855c Browser: Allow system shortcuts to function
Before shortcuts like ALT-F4, etc did not work. This makes the window
ignore keydown events. In the future this may be altered to allow for
custom shortcuts from within ladybird?
2024-02-24 16:30:50 -07:00
implicitfield 896f213c6f LibFileSystem+Userland: Rename size() to size_from_stat()
This reflects what the functions does more accurately, and allows for
adding functions to get sizes through other methods.

This also corrects the return type of said function, as size_t may only
hold sizes up to 4GB on 32-bit platforms.
2024-02-24 15:54:52 -07:00
Hugh Davenport b365356eba Assistant: Check for access before showing file results
Fixing up from #22597.

This change checks whether a file is readable to the user before adding
files to the cache.
2024-02-23 09:48:28 +01:00
Hugh Davenport bba53441ef Assistant: Enable escalation of commands that need it
Ideal for applications such as PartitionEditor. Previously an error
about how it needs to run as root was displayed which differed from
the behaviour when clicking from the system menus.

Use the new AppFile::spawn_with_escalation to perform the escalation
2024-02-23 09:47:27 +01:00
Tim Ledbetter 3f6f3a90c1 HexEditor: Fix typo in parameter name 2024-02-21 23:32:15 +01:00
Tim Ledbetter f742334b93 HexEditor: Prefer enum class to enum for FindDialog::OptionId 2024-02-21 23:32:15 +01:00
Tim Ledbetter b330d83be4 HexEditor: Prefer ErrorOr to Result in FindDialog 2024-02-21 23:32:15 +01:00
Tim Ledbetter ad62e433f0 PixelPaint: Don't crash when cancel is pressed when saving a file
Previously, we were attempting to add an empty string to the most
recently open files list when no file was saved.
2024-02-21 22:37:34 +01:00
Lucas CHOLLET 8e2102fb73 ImageViewer: Transform the image's dimension accordingly to the metadata
Exif metadata have two tags to store the pixel density along each axis.
If both values are different and no action is taken, the resulting image
will appear deformed. This commit scales the displayed bitmap
accordingly to these tags in order to show the image in its intended
shape. This unfortunately includes a lot of plumbing to get this
information through IPC.
2024-02-21 08:31:17 +00:00
Tim Ledbetter cfbd14b958 Userland: Use MUST() to unwrap String values 2024-02-14 17:46:06 -05:00
Tim Ledbetter 2331d2bafa Userland: Propagate errors with TRY() where possible 2024-02-14 17:46:06 -05:00
Sam Atkins c6e5581682 HexEditor: Include annotation text in the "Delete annotation?" dialog
It's helpful to have some description of what you're deleting. :^)

40 characters is chosen completely arbitrarily, but seems reasonable.
2024-02-09 17:00:15 +00:00
Sam Atkins 56eb45ccbc HexEditor: Add toolbar and context menus to the Annotations panel
The Annotations panel is the most obvious place to perform actions
related to annotations, so let's make that possible. :^)

The toolbar gets open/save/save-as actions for annotations, and one for
adding an annotation. The table itself gets a context menu for editing
or deleting the selected annotation.
2024-02-09 17:00:15 +00:00
Sam Atkins a5d11c0a26 HexEditor: Convert panels to DynamicWidgetContainer
This lets the user swap them around and pop them out as separate windows
as desired. We do lose the ability to individually resize them though,
until DynamicWidgetContainer supports that.
2024-02-09 17:00:15 +00:00
Sam Atkins 6850ef9014 HexEditor: Respond to font changes 2024-02-09 16:59:02 +00:00
Sam Atkins 3318563ad9 HexEditor: Size the offset area based on the text width
This gets rid of the last use of the offset_margin_width() magic number.

I initially tried using `character_width() * 10` and found it was not
accurate enough with between-character spacing, so instead this measures
a specific string. All offset strings should be the same width in a
fixed-width font.
2024-02-09 16:59:02 +00:00
Sam Atkins 0fdbdc5084 HexEditor: Use glyph_fixed_width() for character width 2024-02-09 16:59:02 +00:00
Sam Atkins d3012f2df1 HexEditor: Share the code for updating the content size
And make setting the bytes_per_row a no-op if it's the same value.
2024-02-09 16:59:02 +00:00
Sam Atkins db23d0f464 HexEditor: Save and reuse horizontal positions when painting 2024-02-09 16:59:02 +00:00
Sam Atkins 60f52aa0ef HexEditor: Save and reuse vertical positions when painting rows
Rather than repeatedly calculating the same y offset over and over,
calculate it once per row, and re-use that result.
2024-02-09 16:59:02 +00:00
Sam Atkins 4af565362c HexEditor: Remove redundant checks in offset_at()
Neither of these is possible based on the if statement above them.
2024-02-09 16:59:02 +00:00
Sam Atkins ca3f21f273 HexEditor: Account for padding in offset_at()
Compare the x position with the start of the hex characters, which is
m_padding pixels to the right of hex_start_x. (And the same for the
text characters.) If the position is within the padding area, clamp it
so it's on the nearest character.

This was previously covered-up somewhat by using the buggy
m_address_bar_width value to calculate the start and end x positions of
these areas. Fixing that in the previous commit made this more obvious.
2024-02-09 16:59:02 +00:00
Sam Atkins c4dc150ed7 HexEditor: Extract some content-width calculations
We repeat the same calculations a lot, and it's easy to make mistakes.

m_address_bar_width and offset_margin_width() have basically the same
purpose, but both are a little wrong. This removes the former, but
we'll get to the latter soon.
2024-02-09 16:59:02 +00:00
Sam Atkins 4dc3816853 HexEditor: Combine row-iteration loops 2024-02-09 16:59:02 +00:00
Sam Atkins 8b5d2c710b HexEditor: Make border of offset area straight down
Subtracting 1 from both axes causes a kink in the line, because the
start point isn't also translated. The clip rect prevents us from
painting too far down, so we can just remove the translated() call.
2024-02-09 16:59:02 +00:00
Sam Atkins f57d9789f8 HexEditor: Paint byte characters with correct width 2024-02-09 16:59:02 +00:00
Sam Atkins e2f927a7a7 HexEditor: Give i and j variables clearer names 2024-02-09 16:59:02 +00:00
Sanil 433fe3dc26 Calendar: Add ability to view events 2024-02-08 08:13:04 -07:00
ronak69 90d68d43ce KeyboardMapper: Convert Utf-8 char in String to Utf-32 code point
Ensure that the Utf-8 encoded "mapping character" in String (from
InputBox) gets converted to Utf-32 code point. Before, only the first
byte of Utf-8 char sequence was used as a Utf-32 code point.

That used to result in incorrect characters getting written in the
keymap file for all the "non-ascii" characters used as the mapping
character.
2024-02-08 07:07:25 -07:00
Tim Ledbetter f961a0eb61 TerminalSettings: Ensure automark setting is reverted on cancel 2024-02-07 13:35:49 +01:00
Tim Ledbetter fa37a220d6 Terminal: Propagate changes in automark settings to the terminal 2024-02-07 13:35:49 +01:00
Tim Ledbetter 0bdb222953 Terminal: Deduplicate bell mode parsing code 2024-02-07 13:35:49 +01:00
Tim Ledbetter 5c8962b8f1 LibVT+TerminalSettings: Move settings parsing functions to LibVT
This change moves the automark and bell settings parsing functions to
LibVT, so that they can be shared between Terminal and TerminalSettings.
2024-02-07 13:35:49 +01:00
Tim Ledbetter 2850bb881a TerminalSettings: Provide default values for terminal settings
The change ensures that functions that parse string values for terminal
settings fall back to a default value, if there is no value present or
the value is invalid.
2024-02-07 13:35:49 +01:00
Tim Ledbetter 1df31e426d TerminalSettings: Use correct name for the automark_off radio button
This was causing a segfault when opening the Terminal Settings window.
2024-02-07 13:35:49 +01:00
Ali Mohammad Pur 54ab6fe5b9 LibVT+Everywhere: Introduce 'automarks' and 'clear previous command'
Automarks are similar to bookmarks placed by the terminal, allowing the
user to selectively remove a single command and its output from the
terminal scrollback.
This commit implements a single way to add marks: automatically placing
them when the shell becomes interactive.

To make sure the shell behaves correctly after its expected prompt
position changes, the terminal layer forces a resize event to be passed
to the shell on such (possibly) partial clears; this also has the nice
side effect of fixing the disappearing prompt on the preexisting "clear
including history" action: Fixes #4192.
2024-02-07 00:43:11 +01:00
Gabriel Tassinari 946a4d6f0f Presenter: Add Manual link in help menu 2024-02-06 20:43:31 +00:00
Bastiaan van der Plaat 582bf1eaf3 Run: Fix bug where it would crash because uninitialized main widget
The set_main_widget<T>() function only calls the construct and not
`try_create()` that the GMLCompiler generates so all calls to
`find_descendant_of_type_named()` would result in null
pointers that would resolve in a crash.
2024-02-06 08:41:01 +01:00
Bastiaan van der Plaat f4d5ff9ed9 Welcome: Move tips.txt to /usr/share/Welcome because it's system wide 2024-02-05 16:30:52 +01:00
Andrew Kaster 677bdc2a4f Ladybird: Add IPC call for creating a new child tab
This will be used for choosing a navigable that requires opening a new
tab or new window. Such as calls to window.open(), or specific WebDriver
calls.
2024-02-03 20:51:37 -05:00
Sam Atkins d930ea1242 HexEditor: Add an option to load an annotations file on startup 2024-01-31 17:38:56 +00:00
Sam Atkins 4cef57a021 HexEditor: Parse arguments using ArgsParser 2024-01-31 17:38:56 +00:00
Sam Atkins 56caee44e3 HexEditor: Save and load annotations to/from JSON files
This is a fairly simple JSON format: A single array, containing objects,
with the Annotation fields as key:value pairs.

When reading a file, we let invalid or missing keys fall back to the
default values. This is mostly intended to set a pattern so that if we
add new fields in the future, we won't fail to load old annotations
files. If loading the file fails though, we keep the previously loaded
set of annotations.
2024-01-31 17:38:56 +00:00
Sam Atkins aa07c232f1 HexEditor: Optionally display annotations in the side panel 2024-01-30 23:34:49 +00:00
Sam Atkins 8cac2e89a9 HexEditor: Store annotations in a Model
A model is necessary for displaying a list of them in the UI. We might
as well make that their home.
2024-01-30 23:34:49 +00:00
Sam Atkins a54952795a HexEditor: Add comments to annotations
The comment appears as a tooltip when hovering over the annotation.

A couple of properties of the TextEditor would ideally be set in GML,
but either don't have a setter exposed, or the GML compiler doesn't
recognise the enum. I'll fix those up after the current big GML
compiler PR gets merged.
2024-01-30 23:34:49 +00:00
Brendan Kelly 00ab8e0a14 Maps: Add massage_for_display for lat and long
This prevents a crash when attempting to add a
favorite or load favorites list in Maps application
2024-01-30 21:07:37 +00:00
Sam Atkins 1750af83b0 3DFileViewer: Use ByteString for file paths 2024-01-29 23:14:39 +00:00
Sam Atkins 90240c0e02 Spreadsheet: Use ByteString for file paths 2024-01-29 23:14:39 +00:00
Sam Atkins 44ca55aaf8 LibFileSystemAccessClient+Userland: Return file paths as ByteStrings
Where it was straightforward to do so, I've updated the users to also
use ByteStrings for their file paths, but most of them have a temporary
String::from_byte_string() call instead.
2024-01-29 23:14:39 +00:00
Bastiaan van der Plaat 350affe406 LibGUI+WindowServer: Add menu minimum width support 2024-01-29 05:29:41 -07:00
kleines Filmröllchen adc845e0cb Userland: Port to automatic GML initializer where possible 2024-01-29 05:21:48 -07:00
Timothy Flynn dcd9962d7b Browser: Remove some needless indirection from Cookie-related IPCs
We don't need to forward Cookie-related IPCs from the WebView through
the Tab to the BrowserWindow. We can skip the Tab like we do in other
chromes.

This is primarily to reduce overhead when changing Cookie IPCs in future
patches.
2024-01-26 20:22:39 +01:00
Sam Atkins 388856dc7e AK+Userland: Return String from human_readable_size() functions 2024-01-25 09:07:32 +01:00
Sam Atkins 7e8cfb60eb AK+Userland: Return String from human_readable_[digital_]time() 2024-01-25 09:07:32 +01:00
Sam Atkins 9657f4cabb LibGUI+Userland: Take ByteString in set_most_recently_open_file() 2024-01-24 11:07:03 +00:00
Mr.UNIX 69ffdd5738 Welcome: Port to GML Compiler 2024-01-23 21:14:12 +01:00
Dan Klishch b5f1a48a7c AK+Everywhere: Remove JsonValue APIs with implicit default values 2024-01-21 15:47:53 -07:00
Nico Weber 475cef8afd PDFViewer: Remove an unneeded indirection
No behavior change.
2024-01-21 09:32:22 -05:00
Nico Weber d9267a388d PDFViewer: Add Debug menu entries for disabling clipping 2024-01-21 09:32:22 -05:00
Sam Atkins 3df3a85235 LibGfx+Userland: Move FontWeight enum into its own file
FontDatabase.h with its includes add up to quite a lot of code. In the
next commit, compiled GML files are going to need to access the
FontWeight enum, so let's allow them to do that without pulling in lots
of other things.

Also, change users to include FontWeight.h instead of FontDatabase.h
where appropriate.
2024-01-21 09:32:10 -05:00
Tim Ledbetter d06f1cbb9c DisplaySettings: Disable custom color scheme combobox by default
Previously, the GML property declaration that does this was being
ignored, as the value was in quotes.
2024-01-21 08:38:18 -05:00
Tim Ledbetter fd8e8e7f31 DisplaySettings: Remove redundant text_alignment property from GML
Previously, this was causing an error to be shown on the debug console,
as `CenterMiddle` is not a valid value for this property.
2024-01-21 08:38:18 -05:00
Nico Weber 176e9db6cd PDFViewer: Move debug actions from toolbar into a menu
This makes it easier to add more entries. Also, debug toggles
don't need to be quite as visible as they were on the toolbar :^)
2024-01-21 08:22:27 -05:00