Commit Graph

21433 Commits

Author SHA1 Message Date
Jonah
e361025cfb Browser: Add Accessibility Tab to Inspector Widget
This tab allows you to view the accessibility tree like you do
the DOM tree. The implementation limited to the role currently,
once we add the name and description calculation algorithm, those
will be displayed here as well. Selections are also not currently
supported.
2023-01-07 10:51:53 +00:00
Jonah
367b1634fd LibWebView+WebContent: Expose the Accessibility Tree to Other Processes
This patch also stubs out notify_server_did_get_accessiblity_tree in
ladybird since ViewImplementation now has it. However, this feature
is still immature, so just stubbing out in ladybird for now. Once we
have more robust support in Serenity (namely ARIA properties/state
and accessible names and descriptions) we can port this
functionality over.
2023-01-07 10:51:53 +00:00
Jonah
a469bbd178 LibWeb: Add Functionality to Dump to Accessibility Tree
This will be used to display the accessibility tree in the inspector.
2023-01-07 10:51:53 +00:00
Jonah
3eef54823a LibWeb: Add Function To Build Accessiblity Tree
With this patch, the accessibility tree can be build from the root
node of a document. This can then be serialzed and sent to (soon
to come) consumers.
2023-01-07 10:51:53 +00:00
Jonah
cd95e5f656 LibWeb: Add (exclude/include)_from_accessibility_tree
These functions will be used in building the accessibility tree.
2023-01-07 10:51:53 +00:00
Jonah
ef48bd1878 LibWeb: Add has_global_aria_attribute
This helper will be used to help determine tree inclusion.
2023-01-07 10:51:53 +00:00
Jonah
e63d9d4925 LibWeb: Add Support for the ARIA Element Properties
Element now supports getting and setting ARIA properties from
JS and HTML.
2023-01-07 10:51:53 +00:00
Karol Kosek
e9d73a6256 Spreadsheet: Port ExportDialog to Core::Stream 2023-01-07 04:03:01 +03:30
Karol Kosek
3a8450ae11 Spreadsheet: Port XSV writer to Core::Stream 2023-01-07 04:03:01 +03:30
Karol Kosek
5793f7749c Spreadsheet: Make file export functions return ErrorOr<> 2023-01-07 04:03:01 +03:30
Karol Kosek
29a3cdcfb7 Spreadsheet: Generate file previews in memory and save directly to file
When we were asked to make a new preview text, we first generated the
whole file in the /tmp directory and then read the first 8 lines to put
them in a text box. This was doing a bit of unnecessary work at first,
but more importantly, didn't work on a given file descriptor from
FileSystemAccessServer as we were copying a file to a filename instead,
meaning that we also had to unveil the whole home directory.

Anyway, previews will be written now to a MemoryStream by the generator,
which will limit to 8 lines. File saves will omit /tmp entirely,
allowing us to tighten program unveil list a little. :^)
2023-01-07 04:03:01 +03:30
Karol Kosek
c74441395b Spreadsheet: Use has_flag helper functions for XSV WriterBehaviors 2023-01-07 04:03:01 +03:30
Cody Hein
e0aae9e60a Spreadsheet: Remove cursor keys from is_navigation
This change allows for cursor navigation of a forumula while editing
rather than having to use the mouse to edit the cursor position within
a cell. Tab and Enter still allow you to navigate out of the cell to
next row or columns. :)
2023-01-07 03:46:52 +03:30
Nico Weber
a03d42b098 LibCrypto: Use default Crypto::Hash::Digest comparison operators
They do the same thing we previously laboriously did manually.
No behavior change.
2023-01-06 23:57:46 +01:00
Eli Youngs
96d3d3b0fe sed: Perform case insensitive substitutions with "/i" 2023-01-06 13:52:21 -07:00
Eli Youngs
0dc65cd835 sed: Write substitution output to a file with "/w"
A substitution command like "s/x/y/wabc" will now write all substituted
lines to a file called "abc". Note that this is in addition to writing
to stdout.
2023-01-06 13:52:21 -07:00
Eli Youngs
0ecbc5c02a Userland: Add a sed utility 2023-01-06 13:52:21 -07:00
Eli Youngs
87a961534f LibRegex: Prevent patterns from matching the empty string twice
Previously, if a pattern matched the empty string (e.g. ".*"), it would
match the string twice instead of once. Among other issues, this caused
a Regex replacement to duplicate its expected output, since it would
replace "both" empty matches.
2023-01-06 13:52:21 -07:00
Eli Youngs
5bf2cce839 LibRegex: Allow the SingleMatch flag to be used as a PosixFlag 2023-01-06 13:52:21 -07:00
Sam Atkins
0c24522635 LibGUI+Everywhere: Use fallible Window::set_main_widget() everywhere :^)
Rip that bandaid off!

This does the following, in one big, awkward jump:
- Replace all uses of `set_main_widget<Foo>()` with the `try` version.
- Remove `set_main_widget<Foo>()`.
- Rename the `try` version to just be `set_main_widget` because it's now
  the only one.

The majority of places that call `set_main_widget<Foo>()` are inside
constructors, so this unfortunately gives us a big batch of new
`release_value_but_fixme_should_propagate_errors()` calls.
2023-01-06 13:36:02 -07:00
Nico Weber
d223477bc6 LibGfx+icc: Print device attribute flags
These flags are always 0 in practice in all profiles I've seen so far,
but hey, probably nice to dump them anyways.

And hey, it's just 86 lines to print 4 bits.
2023-01-06 21:33:46 +01:00
Nico Weber
915cc5d4e3 LibGfx: Fix incorrect bitmask in Gfx::ICC::Flags 2023-01-06 21:33:46 +01:00
Andreas Kling
80ce0419b6 LibWeb: Fix abspos flex container with height:auto getting zero height
When laying out abspos boxes, we compute the height twice: before and
after the inside of the box has been laid out.

The first pass allows percentage vertical values inside the box to be
resolved against the box's height. The second pass resolves the final
used value for the height of the box itself.

In cases where the box height depends on the results of inside layout,
we were incorrectly setting the box to having a definite zero height.
This led to incorrect results when sizing an abspos flex container,
since the FFC sizes containers (in row layouts) based on whether the
container has a definite height.

To avoid this problem, this patch adds an enum so we can differentiate
between the two abspos height computation passes. If the first pass
discovers a dependency on the inside layout, we simply bail out of
computing the height, leaving it as indefinite. This allows the FFC
to size its container correctly, and the correct height gets set by
the second pass.
2023-01-06 21:12:55 +01:00
Kenneth Myhra
6d54e5ce9a LibWeb: Verify optional argument has a value before static_cast-ing it 2023-01-06 20:51:21 +01:00
Nico Weber
c00ce2fba0 LibGfx+icc: Verify ICCProfile ID at parse time instead of in icc
Always computing computing the md5 takes some time, but most
icc profiles are small. So that's probably fine.

If this ends up being a perf problem in the future, or if it ends up
rejecting tons of embedded proiles from images, we can row it back.
But let's see if we can get away with this first.
2023-01-06 20:26:14 +01:00
Nico Weber
31af741c66 LibGfx: Rename variable in parse_profile_id() to match spec better 2023-01-06 20:26:14 +01:00
Nico Weber
b0068c387b LibGfx: Verify ICC reserved header bytes are zero
I checked that they are zero for all profiles in Compact-ICC-Profiles
and for all .icc files in /Library/ColorSync and
/System/Library/ColorSync on my Mac (running macOS 12.6.2).
2023-01-06 19:17:22 +01:00
Nico Weber
090bd02a88 LibGfx: Extract all_bytes_are_zero() function in ICCProfile 2023-01-06 19:17:22 +01:00
Nico Weber
aa107ef2d6 LibGfx: Add quotes and reflow for glanceability 2023-01-06 19:17:22 +01:00
Nico Weber
478bd97b25 LibGfx: Rename ICCHeader::profile_md5 to profile_id to match spec 2023-01-06 19:17:22 +01:00
Rodrigo Tobar
a5620fd41f LibPDF: Load destinations from Catalogue -> Names -> Dests name tree
PDF allows for named destinations to be provided as string. These can be
either found in the Dests dictionary in the document catalogue (as
already implemented), or in the Name Tree specified by the Dests key in
the Names dictionary of the document catalogue (missing).

This commit adds this missing case. Once the named destination is found
in the name tree, its value is interpreted just like in the first case,
so a new utility method encapsulates the common behavior.
2023-01-06 18:06:41 +01:00
Rodrigo Tobar
5420261347 LibPDF: Implement name tree lookups
Name Trees are hierarchical, string-keyed, sorted-by-key dictionary
structures in PDF where each node (except the root) specifies the bounds
of the values it holds, and either its kids (more nodes) or the
key/value pairs it contains.

This commit implements a series of lookup calls for finding a key in
such name trees. This implementation follows the tree as needed on each
lookup, but if that becomes inefficient in the long run we can switch to
creating a HashMap with all the contents, which as a drawback will
require more memory.
2023-01-06 18:06:41 +01:00
Rodrigo Tobar
8c79f0e0cf LibPDF: Add more utility methods to {Dict,Array}Object
Being both of them containers, these classes already offered a set of
methods to retrieve an inner element by key or index, respectively, with
different methods for the different subtypes of the PDF::Object type
returning the element cast to the correct type pointer. On top of
that, DictObject offered an additional method to obtain an element as an
Object pointer.

While these methods were useful, they have some shortcomings:

 * They always take a Document pointer to first perform an object
   resolution, in case the element is a Reference. This is not always
   necessary though, as there are values that are always meant to be
   immediate, and hence the resolution lookup adds overhead.
 * There was no easy way to get an individual Object element from an
   ArrayObject like there is in DictObject. This makes it difficult to
   obtain such values, as one first needs to call dict.get() to get a
   Value, then cast it manually to a NonnullRefPtr<Object>.

This commit fixes these two issues by:

 * Adding a new method that returns an Object for a given index.
 * Adding overloads for this new method, and all the existing methods
   described above, that do *not* take a Document, and therefore do
   *not* perform an object resolution lookup.
2023-01-06 18:06:41 +01:00
Rodrigo Tobar
0e1c858f90 LibPDF: Move casting code to its own cast_to function
This functionality was previously part of the resolve_to() Document
method, and thus only available only when resolving objects through the
Document class. There are many use cases where this casting can be used,
but no resolution is needed.

This commit moves this functionality into a new cast_to function, and
makes the resolve_to function call it internally. With this new function
in place we can now offer new versions of DictObject::get_* and
ArrayObject::get_*_at that don't perform Document resolution
unnecessarily when not required.
2023-01-06 18:06:41 +01:00
Rodrigo Tobar
f510b2b180 LibPDF: Support null destination parameters
Destination arrays contain a page number, a mode name, and parameters
specific to that mode. In many cases these parameters can be set to
"null", which our code wasn't taking into consideration.

This commit parses these parameters taking into account whether they are
null or actual numbers, and stores them as Optional<float> instead of
plain floats. The parameters are not yet used anywhere else other than
when formatting a Destination object, so the change is fairly small.
2023-01-06 18:06:41 +01:00
Rodrigo Tobar
2485c500a3 LibPDF: Fix Destination formatting
This was not correctly written, and thus printed confusing output.
2023-01-06 18:06:41 +01:00
Rodrigo Tobar
b406f1d5a4 PDFViewer: Inform users of underlying issue when loading document
While this is not super useful to end users, it's still better than the
simpler, generic "failed to load" error message.
2023-01-06 18:06:41 +01:00
Simon Danner
b10fe7c136 LibGfx: Prefer largest image with best depth for ICO display
Some favicons contain multiple icons of the same size, but with
increasing depth. Use the largest one to make things look nicer.
2023-01-06 17:31:05 +01:00
Tim Ledbetter
6b3688147f PixelPaint: Fix typo in variable name 2023-01-06 15:09:56 +00:00
Tim Ledbetter
a30b956e94 PixelPaint: Allow move tool to scale in all directions
It is now possible to scale the current layer using the move tool from
all four corners of the layer boundary. Previously scaling was only
possible from the bottom right of the image.
2023-01-06 15:09:56 +00:00
Sam Atkins
98603e2b20 Solitaire: Replace animation Card with manual painting
Repeatedly allocation a new Card object is unnecessary, and makes
propagating OOM awkward. We also don't need a full card, just which
suit/rank it is and its position. So, let's save all the extra
allocation and just paint the card bitmap directly.
2023-01-06 16:03:50 +01:00
Sam Atkins
80c7ac0d0e Spider: Highlight valid target stack when hovering over it
This is largely copied and pasted from Solitaire. Moving this into
LibCards somehow would be nice but I can't think of a nice way to do so
right now.
2023-01-06 16:03:50 +01:00
Sam Atkins
e193679352 Spider: Make Game creation fallible 2023-01-06 16:03:50 +01:00
Sam Atkins
f9f6bf3cd4 Spider: Save and load u32 config values as u32s 2023-01-06 16:03:50 +01:00
Sam Atkins
c79110d5bf Solitaire: Save and load u32 config values as u32s
This removes a bunch of awkward i32 casts. Being able to read/write enum
types directly would be even nicer, but I'm not going there right
now. :^)
2023-01-06 16:03:50 +01:00
Sam Atkins
306676792c Solitaire: Make Game creation fallible 2023-01-06 16:03:50 +01:00
Sam Atkins
d7ba577c90 LibCards+Games: Make CardGame::add_stack() fallible
And while we're at it, handle the CardStack allocation (and failure
thereof) internally.
2023-01-06 16:03:50 +01:00
Timothy Flynn
08ff87b3ce Solitaire: Preview cards in a stack with the right mouse button 2023-01-06 15:55:37 +01:00
Timothy Flynn
2a1fb77faf LibCards: Support "previewing" cards that may be covered by other cards
For example, in Solitaire, the vertical normal stacks cover the suit of
all but the topmost card in the stack. To see the suit of covered cards
the user currently has to move the cards on top of them out of the way.

This adds an API for games to set a card at a location to be previewed,
which will draw that card on top of all other cards without moving it.
2023-01-06 15:55:37 +01:00
Lucas CHOLLET
c0bc3b9814 FileSystemAccessServer: Use Core::Stream
This patch also updates corresponding functions from
`LibFileSystemAccessServerClient`.

From the FileSystemAccessClient point of view, it only makes the server
take `Core::Stream::OpenMode` instead of `Core::OpenMode`. So, `enum`
conversions only happen within deprecated functions and not in the new
`Core::Stream` friendly API.

On the server side, it just removes two usages of `Core::File::open()`.
2023-01-06 14:52:29 +00:00