Commit graph

50083 commits

Author SHA1 Message Date
Jelle Raaijmakers 3af92a76be Ports: De-special case ./package.sh dev
There is nothing special about the `dev` command; move its logic to
`do_dev` and invoke it generalized.
2023-05-09 06:36:30 +02:00
Jelle Raaijmakers a81e83f3b5 Ports: Only remove dir contents on clean, not the dir itself
The entirety of `.port_include.sh` depends on having a current working
directory for the respective port. If we were to remove the directory,
some actions such as `fetch` could fail since our current working
directory would now be an invalid inode.

This issue was exposed by running `./package.sh` followed by
`./package.sh dev` and answering 'y' to the question on cleaning the
build directory.
2023-05-09 06:36:30 +02:00
Jelle Raaijmakers 71671e0921 Ports: Alphabetize commands in .port_include.sh
Also remove a stray newline.
2023-05-09 06:36:30 +02:00
Nico Weber dd2ca56ee4 LibGfx/WebP: Add two missing closing quotes for spec comments 2023-05-09 06:35:56 +02:00
Nico Weber bc207fd0a0 LibGfx/WebP: Move lossy decoder to its own file
Pure code move (except of removing `static` on the two public functions
in the new header), not behavior change.

There isn't a lot of lossy decoder yet, but it'll make implementing it
more convenient.

No behavior change.
2023-05-09 06:35:56 +02:00
Nico Weber 83da7ad875 LibGfx/WebP: Give VP8 decoding functions same interface as VP8L ones
Namely:
* Store compressed data in VP8Header
* Make the functions just take ReadonlyBytes instead of a Chunk

Having a function that takes a header and does decoding of the data
after the header isn't really necessary for VP8. For VP8L, it's needed
because the ALPH chunk stores VP8L data without the VP8L header.
But it's nice to make the functions consistent, and it's kind of a
nice structure.

No behavior change.
2023-05-09 06:35:56 +02:00
Nico Weber d15dc28833 LibGfx/WebP: Tell decode_webp_chunk_VP8() if it needs an alpha channel
decode_webp_chunk_VP8() itself will only ever decode RGB data from a
lossy webp stream, but a separate ALPH chunk could add alpha data
later on. Let the function know if that will happen, so that it can
return a bitmap with an alpha channel if appropriate.

Since lossy decoding isn't implemented yet, no behavior change. But it
makes it a bit easier to implement lossy decoding in the future.
2023-05-09 06:35:56 +02:00
Nico Weber e13c319972 LibGfx/WebP: Remove pointless decode_webp_chunk_VP8L() function
The one caller checked the chunk type, so the VERIFY() for that did
nothing.

The VERIFY() for vp8l data only being in files that start with
VP8L or VP8X chunks wasn't completely useless, but also not very
useful.

Remove the now-unused context parameter of decode_webp_image_data().
2023-05-09 06:35:56 +02:00
Nico Weber 1ec5c8395c LibGfx/WebP: Remove context.error() now that it is a no-op
Also remove `context` from many function parameter lists where the
parameter is now no longer needed.
2023-05-09 06:35:56 +02:00
Nico Weber ddc2cc886b LibGfx/WebP: Redo error handling
Most places used to call `context.error()` to report an error,
which would set the context's state to `Error` and then return an
`Error::from_string_literal()`.

This is somewhat elegant, but it doesn't work: Some functions this
code calls returns ErrorOr<>s that aren't created by `context.error()`,
and for these we wouldn't enter the error state.

Instead, manually check error-ness at the leaf entry functions of the
class:

1. Add a set_error() helper for functions returning bool
2. In the two functions returning ErrorOr<>, awkwardly check the error
   manually.  If this becomes a very common pattern, maybe we can add
   a `TRY_WITH_HANDLER(expr, error_lambda)` which would invoke a
   lambda on error. We could use that here to set the error code.

No real behavior change (except we enter the error state more often
when something goes wrong).
2023-05-09 06:35:56 +02:00
Nico Weber bdba70b38f LibGfx/WebP: Change ImageData optional-ness
Instead of ImageData having an Optional<Chunk> for the image data,
have it have a Chunk, and give the context an Optional<ImageData>.

This allows sharing a single code path for checking that either the
main image or an animation frame has a main image data chunk, and
that an alpha chunk is only present with a lossy main image data
chunk.

No behavior change.
2023-05-09 06:35:56 +02:00
Nico Weber 119ccfe5da LibGfx/WebP: Minor cosmetical changes in WebPLoaderLossless.h
Add a comment, remove a parameter name that doesn't add anything,
and remove a weird newline in WebPLoader.cpp too.

No behavior change.
2023-05-09 06:35:56 +02:00
Kemal Zebari eda2a2f5da AK: Remove must_set() from JsonArray
Due to 582c55a, both `must_set()` and `set()` should be providing the
same behavior. Not only is that a reason to remove `must_set()`, but
it also performs erroneous behavior since it inserts an element at
a specified index instead of modifying an element at that index.
2023-05-09 06:21:34 +02:00
Cubic Love c7e08c3266 Base: Add some Arrows & General Punctuation to Csilla Regular 12
Csilla Regular 12 is used for inline code in LibMarkdown. It was
missing basic arrows and ellipsis needed by man pages referencing menu
items. I have added these and some extras.

General Punctuation
https://www.unicode.org/charts/PDF/U2000.pdf
2010, 2012-2026, 2032-203A, 203F-2040, 2044, 2047-2048, 204B

Arrows
https://www.unicode.org/charts/PDF/U2190.pdf
2190-2193
2023-05-09 06:18:30 +02:00
Cubic Love f5caf363e7 Base: Improve some application man pages
- FontEditor.md
- Magnifier.md
- Presenter.md
- Terminal.md

Where an arrow is indicated by -> turn it into an actual arrow →
(U+2192 Rightwards Arrow). This looks much neater.
Inspired by Notion doing this automatically when you type "->".

I've made various corrections: fixing grammatical errors, removing
unnecessary or adding-in missing spaces. Made the style of references
to menu items more consistent. Generally I've tried to make the pages
read better. Terminal has had more adjustment than the others as its
Settings were recently changed and the man page now reflects this.
2023-05-09 06:18:30 +02:00
MacDue 09773048b6 Ladybird: Allow right clicking and inspecting elements
This adds "Inspect Element" (currently the only entry) to the context
menu for the page, which will do what you expect (most of the time),
and bring up the Inspector with hovered element selected.
2023-05-09 06:16:58 +02:00
Andreas Kling 15211cd753 Userland: Show "Ladybird" instead of "Browser" in titles, menus, etc
While the binary is still called "Browser" for now, let's make it clear
that we're converging on a single name for this application.
2023-05-09 06:12:09 +02:00
Lucas CHOLLET 07c6cebbab Applets/ClipboardHistory: Add persistent storage
Clipboard entries are now preserved upon reboot :^). Unfortunately, it
only supports data with the mimetype "text/".

This is done by writing all entries as a JSON object in a file located
in ~/.data.

Co-authored-by: Sagittarius-a <sagittarius-a@users.noreply.github.com>
2023-05-08 21:06:13 -06:00
Tim Ledbetter c09d0c4816 LibManual: Allow querying on a help URL
This allows Help and man to open pages from a help URL specified on
the command line.
2023-05-08 21:03:19 -06:00
Tim Ledbetter 6ab13489ee LibManual: Ensure page exists when opening a help URL
Previously, Help could crash when attempting to open a help URL for a
page that doesn't exist.
2023-05-08 21:03:19 -06:00
Timothy Flynn d6b786b3fe AK: Use consteval String factories on macOS
Xcode 14.3 ships with clang 15, which supports our usage of consteval to
validate short strings at compile time.
2023-05-08 20:54:31 -06:00
Timothy Flynn 872e18f660 LibWeb: Convert Navigable::navigate's csp_navigation_type to an enum
Some versions of clang will have an issue using a consteval function to
set the optional parameter's default value. For example, see:
https://stackoverflow.com/questions/68789984/immediate-function-as-default-function-argument-initializer-in-clang

This doesn't need to be a String anyways, so let's make it an enum.
2023-05-08 20:54:31 -06:00
martinfalisse f7c27556fa Documentation: Homogenize Ladybird build instructions
Change the file name so that it is similar to the other build
instructions and may be easier to find :^).
2023-05-08 20:53:25 -06:00
Lucas CHOLLET 844e374de1 LibGfx/JPEG: Fix faded 4-channels images 2023-05-08 19:28:51 +02:00
Lucas CHOLLET e81baa0464 LibGfx/JPEG: Discard the correct number of bytes
This path has never been tested as it requires a non-standard APP
segment. We (un?)fortunately found one, and it exposed a silly bug.
2023-05-08 19:26:17 +02:00
Aliaksandr Kalenik 5896f4c400 LibWeb: Implement "populate session history entry" step in navigate()
Implements
https://html.spec.whatwg.org/multipage/browsing-the-web.html#finalize-a-cross-document-navigation
2023-05-08 17:53:59 +02:00
Aliaksandr Kalenik 0444df1a7c LibWeb: Implement "clear the forward session history" for traversable
https://html.spec.whatwg.org/multipage/browsing-the-web.html#clear-the-forward-session-history
2023-05-08 17:53:59 +02:00
Andreas Kling 1ebae7a779 LibWeb: Stop changing width of block-level flex containers during layout
If the parent BFC can come up with a nice stretch-fit width for the flex
container, it will have already done so *before* even entering flex
layout. There's no need to do it again, midway through the flex layout
algorithm.

This wasn't just unnecessary, but we were also doing it incorrectly and
not taking margins into account when calculating the amount of available
space for stretch-fit. This led to oversized flex containers in the
presence of negative margins.

Fixes #18614
2023-05-08 15:56:00 +02:00
Aliaksandr Kalenik 771208d2e2 LibWeb: Fix auto height calculation for table inside BFC
`calculate_max_content_height` expects the available width as the
second argument. However, the available height was mistakenly passed
before. This did not seem to cause any problems because TFC currently
does not respect height sizing constraints but still needs to be fixed.
2023-05-08 14:52:48 +02:00
martinfalisse ea61296738 LibWeb: Use layout-test-mode for layout tests
Also do some test changes to test it out :^)
2023-05-08 14:47:52 +02:00
martinfalisse c719a542c5 LibWeb: Add --layout-test-mode flag to HeadlessBrowser
The `layout-test-mode` flag changes the font to be SerenitySans as this
is the font used for layout tests for cross-platform compatibility of
tests.
2023-05-08 14:47:52 +02:00
martinfalisse af26b76e0a LibWebView: Use Vector for arguments to WebContent
In a future commit will add some more conditional arguments to the
array and so it's easier to have it be a Vector.
2023-05-08 14:47:52 +02:00
martinfalisse 00e446facd Ladybird: Move arguments parsing before FontPluginQt init
In a future commit will pass arguments parsed to the FontPluginQt
constructor.
2023-05-08 14:47:52 +02:00
Nico Weber 65c7145e69 LibGfx/WebP: Move lossless decoder to its own file
Pure code move (except of removing `static` on the two public functions
in the new header), not behavior change.
2023-05-08 12:52:05 +02:00
Nico Weber 4f1c9a4ba2 LibGfx/WebP: Let decode_webp_chunk_VP8L_header() take ReadonlyBytes
Both callers already have the assert, and that way the function
doesn't have to know about Chunk.
2023-05-08 12:52:05 +02:00
Nico Weber 9d4da5af43 LibGfx/WebP: Store pointer to lossless data in VP8LHeader struct
This way, the size of the header in bytes is only known in
decode_webp_chunk_VP8L_header().
2023-05-08 12:52:05 +02:00
Nico Weber 5252f1cd60 LibGfx/WebP: Stop storing vp8_header and vp8l_header in context
They're not needed on the context.
2023-05-08 12:52:05 +02:00
Nico Weber 135b029250 LibGfx/WebP: Stop passing context to decode_webp_chunk_VP8L_contents()
It was used only for context.error(), and the calling code needs to
be changed to deal normal Errors anyways, since CanonicalCode can
produce them.
2023-05-08 12:52:05 +02:00
Nico Weber 97d085abea LibGfx/WebP: Stop passing context to decode_webp_chunk_VP8L_image()
It was used only for context.error(), and the calling code needs to
be changed to deal normal Errors anyways, since CanonicalCode can
produce them.
2023-05-08 12:52:05 +02:00
Nico Weber 356cadc350 LibGfx/WebP: Stop passing context to decode_webp_chunk_VP8L_prefix_code
It was used only for context.error(), and the calling code needs to
be changed to deal normal Errors anyways, since CanonicalCode can
produce them.
2023-05-08 12:52:05 +02:00
Nico Weber 2f1f62cb3b LibGfx/WebP: Stop passing context to decode_webp_chunk_VP8L_header()
It was used only for context.error(), and the calling code needs to
be changed to deal normal Errors anyways, since CanonicalCode can
produce them.
2023-05-08 12:52:05 +02:00
Andreas Kling 3f4de06fc2 LibWeb: Cache the root element font metrics when calculating them
The root element font metrics were getting queried again and again
during style computation. Before this change we would do some work to
recalculate them each time.

This patch simply caches them in a StyleComputer member. Since style
updates always start with the root element, we know that it'll be
up-to-date by the time we look at any other element.

Before this change, we were spending ~5% of CPU time on Google Groups
in root_element_font_metrics().
2023-05-08 12:13:20 +02:00
Ahmed Hussein 214eaebe73 LibGUI: Use cursor position when calculating autoscroll delta
Autoscroll delta now takes into account the cursor
position relative to the widget inner rect height
to allow for faster rubber band autoscrolling.
2023-05-08 11:28:52 +02:00
Andreas Kling 064b7a6216 LibWeb: Make HTMLObjectElement invalidate the document layout
This is an oversized hammer for sure, but we have to make sure the
layout tree gets rebuilt in case the object representation changes.
Since "throw out the entire layout tree" is the finest tool we have
right now, it'll have to do.

This fixes an issue where the eyes on Acid2 would sometimes not show up
until the next layout invalidation occurred.
2023-05-08 10:26:09 +02:00
Kenneth Myhra 11a89a9d6e Documentation: Add libslirp-dev as a required dependency for QEMU
After the update to QEMU 8.0 libslirp-dev is a required dependency.
2023-05-08 09:30:09 +02:00
Andreas Kling 70db40c9b0 LibWeb: Don't include Layout/Node.h from DOM/Element.h
This required moving the CSS::StyleProperty destruct out of line.
2023-05-08 09:29:44 +02:00
Andreas Kling e43027091d LibWeb: Don't include HTML/Window.h from DOM/Element.h
This required moving HTML::ScrollOptions to its own header file.
2023-05-08 09:29:44 +02:00
Andreas Kling ac0c30ce62 LibWeb: Don't include WindowGlobalMixin from DOM/Element.h 2023-05-08 09:29:44 +02:00
Andreas Kling 67d2e32984 LibWeb: Don't include DOM/NamedNodeMap.h from DOM/Element.h 2023-05-08 09:29:44 +02:00
Andreas Kling f7678e2797 LibWeb: Don't include Layout/TreeBuilder.h from DOM/Element.h 2023-05-08 09:29:44 +02:00