Commit graph

44652 commits

Author SHA1 Message Date
Alexander Narsudinov 7679d38c5f LibWeb: Fix incorrect behaviour in NamedNodeMap::removeNamedItem()
According to the spec we should return removed attribute, but the old
implementation returned nullptr instead.

Now we return the element's removed attribute.
2022-12-17 18:27:57 +01:00
Alexander Narsudinov f2d7690702 LibWeb: Add NamedNodeMap::getNamedItemNS()
This patch allows us to use method getNamedItemNS() of NamedNodeMap API.
2022-12-17 18:27:57 +01:00
Alexander Narsudinov ce6cf5bab8 LibWeb: Make method NamedNodeMap::set_attribute() closer to the spec
This patch eliminates 1 FIXME that I've got during fixme roulette! :^)
2022-12-17 18:27:57 +01:00
Alexander Narsudinov 1a0fbe1e85 LibWeb: Add internal get_attribute_ns() methods of NamedNodeMap
This patch adds methods for querying element by namespace and
local name.

These methods are defined by the spec for internal
usage, but weren't implemented in LibWeb yet.
2022-12-17 18:27:57 +01:00
Freakness109 1f1e58ed75 Kernel/Plan9FS: Propagate errors in Plan9FSMessage::append_data 2022-12-17 09:37:04 +00:00
Eli Youngs 0dd8066a79 tsort: Suppress warnings with -q 2022-12-16 10:41:56 -07:00
Eli Youngs 9caa3d2b55 Userland: Add a tsort utility 2022-12-16 10:41:56 -07:00
Eli Youngs 950b36f95d AK: Add a try_ensure() method to HashMap 2022-12-16 10:41:56 -07:00
Eli Youngs a2024cfb69 AK: Support popping an arbitrary element from a HashTable 2022-12-16 10:41:56 -07:00
Andre Eisenbach e80f0b23e3 CatDog: Simplify animation frame logic and fix minor bugs
Moved all images into a Vector instead of storing every animation frame
in its own member variable. This greatly simplifies the bitmap selection
logic and removes redundant if() checks.

Also fixes minor state bugs. For example, CatDog woudld go to sleep
immediately after actively moving for > 5 seconds. Also fixes arbitrary
hardcoded values for mouse offset movement tresholds as well as
inconsistent movement increments. This allows clicking anywhere on the
CatDog window without moving CatDog.

In addition to removing many member variables, the API interface is
also cleaned up a bit to expose less CatDog internals. Nobody likes
exposed CatDog internals ;).

Variables and function are also renamed where necessary to (hopefully)
improve readability.
2022-12-16 08:50:35 -07:00
Tim Ledbetter 213d82f39b PixelPaint: Fix move tool scaling function when zoomed
The move tool enters scaling mode when the user mouses within 10
pixels either side of the the bottom right of the active layer
boundary.

Previously, the bounding box used to determine whether the mouse was
at the bottom right of the layer used coordinates that were scaled to
the size of the image. This made the size of the area
you need to enter proportional the current zoom level.

This commit fixes the issue by using non-scaled coordinates to
calculate the bounding box, meaning its size is unaffected by the
current zoom level.
2022-12-16 10:24:34 +00:00
Tim Ledbetter 5ba0b551f4 PixelPaint: Display a preview image when scaling with the move tool
A preview of the scaled image and an outline of the updated layer
boundary are now shown when scaling with the move tool.
2022-12-16 10:24:34 +00:00
Timothy Slater 7b4e5d6ac0 PixelPaint: Add Text Tool 2022-12-16 10:14:20 +00:00
Timothy Slater 7b62e02bc3 LibGUI: Prevent key_down event from bubbling for Key_Up and Key_Down
This just corrects an oversight in EditingEngine where we do not
properly signal "we handled this event" for Key_Up and Key_Down like we
do for the other keys
2022-12-16 10:14:20 +00:00
Timothy Slater 296b76095f PixelPaint: Change tool keydown handle to non-const
This was changed to const in PR #15788 but presents problems for tools
that may need to forward this event to non-const event handlers.
2022-12-16 10:14:20 +00:00
Timothy Slater 159f6cf0ac PixelPaint: Account for rulers on Tool second paint events
This change makes ImageEditor provide an altered PaintEvent to the
active tool when rulers are visible. This PaintEvent has a rect that has
been adjust to account for the thickness of the rulers. Tools use this
rect for Painter clipping and this prevents a Tool's on_second_paint
from drawing over top of the rulers
2022-12-16 10:14:20 +00:00
Timothy Slater a321df12e1 PixelPaint: Allow tools to know when the user has left them 2022-12-16 10:14:20 +00:00
Timothy Flynn d28c9ba054 AK: Synchronize explicit instantiations of to_int and to_uint
1. Ensure long and long long are instantiated for to_int.
2. Ensure long and long long are not instantiated for to_uint.
2022-12-16 10:06:26 +01:00
Timothy Flynn a67ad665b1 LibLine: Convert strings to time_t using signed conversion methods
The time_t type itself is signed, and the result of this conversion is
always stored as time_t, so let's not use to_uint<>.
2022-12-16 10:06:26 +01:00
Rodrigo Tobar d4ecdf3ced PDFViewer: Avoid errors due to copying of ErrorOr
The handle_error took PDFErrorOr<T> objects by value, meaning that their
inner values (the error or value stored in the underlying Variant) were
somehow copied over. In the first instance where this lambda is called
with T = NonnullRefPtr, resulting in funky behavior (invalid
NonnullRefPtr state with a VALIDATE fail): if there is no error then the
PDFErrorOr<T> copy is destroyed, which might be causing the underlying
NonnullRefPtr to be destroyed, but somehow the original in the caller
context gets affected and fails verification.

The solution seems simple anyway: just pass the value by reference
(lvalue or rvalue) so the original object can be used directly, avoiding
destruction.
2022-12-16 10:04:23 +01:00
Rodrigo Tobar 124ab5bec6 PDFViewer: Remove unnecessary ternary operation 2022-12-16 10:04:23 +01:00
Rodrigo Tobar 6d0869c14a PDFViewer: Add TreeView to communicate rendering errors
Now that the rendering process communicates all errors upstream, and
PDFViewer has a way to tap into those errors as they occur, we can
visualise them more neatly.

This commit adds a TreeView that we populate with the errors stemming
from the rendering process. The TreeView has two levels: at the top sit
pages where errors can be found, and under each page we can see the
errors that have been found on that page. The TreeView sits below the
main PDF rendering.
2022-12-16 10:04:23 +01:00
Rodrigo Tobar c4bc27f274 LibPDF: Don't abort on unsupported drawing operations
Instead of calling TODO(), which will abort the program, we now return
an Error specifying that we haven't implemented the drawing operation
yet. This will now nicely trickle up all the way through to the
PDFViewer, which will then notify its clients about the problem.
2022-12-16 10:04:23 +01:00
Rodrigo Tobar e87fecf710 LibPDF: Switch to best-effort PDF rendering
The current rendering routine aborts as soon as an error is found during
rendering, which potentially severely limits the contents we show on
screen. Moreover, whenever an error happens the PDFViewer widget shows
an error dialog, and doesn't display the bitmap that has been painted so
far.

This commit improves the situation in both fronts, implementing
rendering now with a best-effort approach. Firstly, execution of
operations isn't halted after an operand results in an error, but
instead execution of all operations is always attempted, and all
collected errors are returned in bulk. Secondly, PDFViewer now always
displays the resulting bitmap, regardless of error being produced or
not. To communicate errors, an on_render_errors callback has been added
so clients can subscribe to these events and handle them as appropriate.
2022-12-16 10:04:23 +01:00
Rodrigo Tobar 96fb4b20f1 LibPDF: Add Errors class that accumulate multiple errors
This will be used to perform a best-effort rendering, where an error in
rendering won't abort the whole rendering operation, but instead will be
stored for later reference while rendering continues.
2022-12-16 10:04:23 +01:00
Rodrigo Tobar d9718064d1 LibPDF: Add support for multi-line comments
The code parsing comments parsed only a single line of comments, but
callers assumed they parsed all comments that appeared contiguously in a
block. The latter is an easier to understand API, so this commit changes
the parse_comment function to parse entire blocks of comments instead of
single lines.
2022-12-16 10:04:23 +01:00
Liav A d94f3b902c Kernel: Propagate properly errors from ISAIDEController initialization 2022-12-16 10:00:31 +01:00
Linus Groh e785c66f91 LibJS: Convert get_this_environment() to NonnullGCPtr 2022-12-16 09:59:56 +01:00
Linus Groh c132064ee9 LibJS: Convert new_private_environment() to NonnullGCPtr 2022-12-16 09:59:56 +01:00
Linus Groh 208be8b86d LibJS: Convert new_function_environment() to NonnullGCPtr 2022-12-16 09:59:56 +01:00
Linus Groh 111a38c464 LibJS: Convert new_object_environment() to NonnullGCPtr 2022-12-16 09:59:56 +01:00
Linus Groh 107e06a396 LibJS: Convert new_declarative_environment() to NonnullGCPtr 2022-12-16 09:59:56 +01:00
Baitinq 4c732abed5 HackStudio: Add a factory function for DebugInfoWidget
Thanks to this patch we now do error propagation in the DebugInfoWidget
creation and as a result we get rid of 4 FIXMEs :)
2022-12-16 09:58:51 +01:00
Baitinq 55a903911b HackStudio: Add a factory function for HackStudioWidget
This will allow us to handle errors while creating the HackStudioWidget.

(tip: check next commit :^)
2022-12-16 09:58:51 +01:00
Baitinq 61789de11d LibGUI: Add GUI::TabWidget::add_tab() that takes a constructed tab
This patch adds a new add_tab() function in GUI::TabWidget that takes
an already created NonnullRefPtr<Widget> object. This allows us to
handle errors while creating the Tab object and then pass it to this
function to actually add the object to the TabWidget.
2022-12-16 09:58:51 +01:00
Andreas Kling c355e9692d LibWeb: Add spec links to IDL APIs in HTMLTableElement 2022-12-16 09:58:03 +01:00
Andreas Kling 2ded895107 LibWeb: Allow setting HTMLTableElement.tFoot to null value
This annihilates 2 FIXMEs :^)
2022-12-16 09:58:03 +01:00
Andreas Kling 346737701d LibWeb: Allow setting HTMLTableElement.tHead to null value
This deals with 2 FIXMEs :^)
2022-12-16 09:58:03 +01:00
Andreas Kling 2d791cf90f LibWeb: Allow setting HTMLTableElement.caption to null value
This takes care of 2 FIXMEs :^)
2022-12-16 09:58:03 +01:00
Andreas Kling 6e127f62d7 LibWeb: Add spec link and comment to HTMLTableElement::caption() 2022-12-16 09:58:03 +01:00
Aliaksandr Kalenik 992b4489ad LibWeb: Fix bug in BFC that independent FC assigned to wrong variable
Bug was introduced in 210bf8adf0c431be05659140fd6de3a2cc5b7d99
It makes new variable for independent_formatting_context instead
of using earlier declared one which means that
parent_context_did_dimension_child_root_box will never be called.
2022-12-16 09:57:37 +01:00
Cody Hein 8d6283c229 PixelPaint: Replace vectorscope boxes with colored corner brackets
This completes a FIXME which requested us to replace the rects/boxes
with just corner brackets. I also added some color to the brackets
matching the colors they represent. The text remains white :)
2022-12-16 01:25:50 -07:00
Rodrigo Tobar a1af79dca6 LibPDF: Follow a FontFile's Length values
These can be references (at least from what I've found in some
documents), so we want to resolve them before using them.
2022-12-16 01:24:43 -07:00
Rodrigo Tobar cb1a7cc721 LibPDF: Simplify outline construction
While the Outline Items making up the document's Outline have all sorts
of cross-references (parent, first/last chlid, next/previous sibling,
etc), not all documents out there have fully-consistent references. Our
implementation already discarded some of that information too (e.g.,
/Parent and /Prev were never read), and trusted that /First and /Next
were good enough to traverse the whole hierarchy.

Where the current implementation failed was in assuming that /Last was
also a good source of information. There are documents out there were
/Last also points to dead ends, and were therefore causing a crash when
we verified that the last child found on a chain was the /Last child
declared by the parent. To fix this I'm simply removing the check, and
simplifying the function call to remove any references to /Last. This
way we affirm our commitment to /First and /Next as the main sources of
information.
2022-12-16 01:24:43 -07:00
Rodrigo Tobar 41bd304a7f LibPDF: Ignore seac PS1 commands for now
This command is meant to print an Standard Encoding Accented Character.
It's not critical to implement it yet, but if we want to render more
documents we need to handle the instruction, even if simply ignore it.
2022-12-16 01:24:43 -07:00
Tim Ledbetter 8353df03a8 PixelPaint: Disable bucket tool outside of the current selection
Previously, if the user clicked outside of the current selection with
the bucket tool, the selection would be filled.
2022-12-16 08:10:33 +00:00
Agustin Gianni d233dcce08 Meta: Add libssl-dev as a dependency to the devcontainer
The library `libssl-dev` was missing from the installed dependencies.
This made impossible to compile the system on a devcontainer.
2022-12-16 01:04:11 -07:00
Gurkirat Singh c2597c3856 Documentation: Add libssl-dev in the debian / ubuntu requirements
In the fresh and minimal installations dev package are often
stripped. This commit will install the libssl dev packages
required in `Utilities/cmcurl/CMakeLists.txt:608`.
2022-12-16 01:03:23 -07:00
Liav A d97aa9cf8c DynamicLoader: Annotate all loaded library ranges as immutable
To further protect all virtual memory regions of the loaded libraries,
don't allow to mutate these regions both in changing their annotations
nor the protection bits.
2022-12-16 01:02:00 -07:00
Liav A 8585b2dc23 Kernel/Memory: Add option to annotate region mapping as immutable
We add this basic functionality to the Kernel so Userspace can request a
particular virtual memory mapping to be immutable. This will be useful
later on in the DynamicLoader code.

The annotation of a particular Kernel Region as immutable implies that
the following restrictions apply, so these features are prohibited:
- Changing the region's protection bits
- Unmapping the region
- Annotating the region with other virtual memory flags
- Applying further memory advises on the region
- Changing the region name
- Re-mapping the region
2022-12-16 01:02:00 -07:00