Commit graph

62783 commits

Author SHA1 Message Date
Nico Weber 37e75223b7 LibGfx/PNGWriter: Add a stream-based encode() overload 2024-08-15 06:35:48 -04:00
Ali Mohammad Pur c9bfa4a3f4 LibWeb: Keep Wasm-imported functions alive
The user is not required to keep the object alive, this commit makes it
so the lifetime of these functions is extended to match the Wasm module
it is imported into.
Fixes the crash in #907.

(cherry picked from commit 1fa528b19fb4551ebc6b4d33b408e456ba367acc)
2024-08-13 18:00:24 -04:00
Liav A. a52deb23a2 Utilities/du: Set minimum width when printing sizes
This change should help forcing basic alignment either on human readable
sizes (or just raw number).
2024-08-13 20:53:28 +01:00
Tim Ledbetter cbf1905621 LibWeb: Account for header size when reading MessagePort message payload
Previously, the fact that this wasn't accounted for could lead to a
crash when large messages were received.

(cherry picked from commit 34e465a67e41b82b276050dde0b4b321c2cf1b18)
2024-08-13 15:44:49 -04:00
Aliaksandr Kalenik 0283f334af LibWeb: Apply scroll offset and clip rectangle to table borders
Moves paint_table_borders() call into PaintableBox::paint() to make
scroll offset and clip rectangle of enclosing scrollable be applied
in ::before_paint().

(cherry picked from commit 2cc2646f5585e4a1f617ac809806bf05e8e515a4)
2024-08-13 15:44:11 -04:00
Diego Frias 56bd11d00f LibWeb: No longer return undefined on null table entry in Wasm API
Return `null` instead, as per the specification.

(cherry picked from commit 3c5e3eef10a5e88284a78182585899962b76a8c3)
2024-08-13 15:43:53 -04:00
Timothy Flynn c4f8b961b0 LibWebView: Make open file limit modifications non-fatal
If setrlimit fails, let's just report the error rather than failing to
start the browser at all.

(cherry picked from commit cf25a06d6715c8ef699973db7634016f8659c9d7)
2024-08-13 15:43:40 -04:00
Timothy Flynn 5d70ea62db LibCore: Use Error::from_syscall to report get/setrlimit errors
(cherry picked from commit 9e7e22dc74ff1bb99e0e8dff63128ef087623480)
2024-08-13 15:43:40 -04:00
BenJilks 736c931a15 LibWeb: Add additional padding to the end of the scrollable overflow
Adds additional padding to the end-side of the scrollable overflow
rectangle as necessary to enable a scroll position that satisfies
the requirements of `place-content: end` alignment.

(cherry picked from commit 963cf1c2c4e4b1cd482c41d6f673b7207bbcc067)
2024-08-13 15:43:28 -04:00
Sam Atkins a7cf06b288 LibWebView: Sort vendor-prefixed properties last in the inspector
Previously, the legacy `-webkit-foo` properties would all be top of the
list, when they are generally not useful to inspect. Instead, put them
at the bottom, so that users can still see them if they want to, but
they're not in the way.

(cherry picked from commit 113b4da1df7ec65a8686af4e7b91e2f8d4114e2c)
2024-08-13 15:43:00 -04:00
Timothy Flynn 8999ebae52 LibWebView: Use an overflow-x value of 'auto' for Inspector containers
The Inspector looks a bit nicer if we don't paint the horizontal scroll
bars unless we need to.

(cherry picked from commit 5c73a31b4f3e18acb783b6a5c6c9a479d2956de8)
2024-08-13 15:42:42 -04:00
Timothy Flynn 75eea197c2 LibWebView: Improve scrolling of Inspector content containers
Currently, the feel of scrolling containers in the Inspector is a bit
awkward. We make the entire split-view container scrollable, then we
absolutely position the tab control buttons to force them to not scroll.
The result is that the scroll bar is painted over the tab controls, and
the tab content that we actually want to scroll has to scroll under the
tab controls. This never looked quite right.

It was basically:

    <div tab-container> <!-- Scrollable -->
        <div tab-controls /> <!-- Pinned to not be scrollable -->
        <div tab-content /> <!-- The part we actually want to scroll -->
    </div>

This patch moves the "scrollability" to just the tab content. We then
don't need to go out of our way to ensure only the content is actually
scrollable.

So we now have:

    <div tab-container> <!-- Not scrollable -->
        <div tab-controls /> <!-- Not pinned, uses normal layout -->
        <div tab-content /> <!-- Scrollable -->
    </div>

(cherry picked from commit d2c775b0ca202aa9be81ab21b0c71a8f8ac005e3)
2024-08-13 15:42:42 -04:00
Andreas Kling 055f4ec64f LibURL: Make URL a copy-on-write type
This patch moves the data members of URL to an internal URL::Data struct
that is also reference-counted. URL then uses a CopyOnWrite<T> template
to give itself copy-on-write behavior.

This means that URL itself is now 8 bytes per instance, and copying is
cheap as long as you don't mutate.

This shrinks many data structures over in LibWeb land. As an example,
CSS::ComputedValues goes from 3024 bytes to 2288 bytes per instance.

(cherry picked from commit 936b76f36e87a6d4cf267c15c95786ef677515fc)
2024-08-13 15:42:19 -04:00
Andreas Kling bee67f187c LibWeb: Make CSS::PercentageOr<T> non-virtual
This shrinks each instance of PercentageOr by 8 bytes and avoids virtual
dispatch when resolving calc() values. It's a win-win!

Many data structures shrink as a result. An example is ComputedValues
which goes from 3376 bytes to 3024 bytes per instance.

(cherry picked from commit c282138fd0b20604384b39bfc0a8c5f6ccab56bd)
2024-08-13 15:42:19 -04:00
Andreas Kling 9348ea160a LibWeb: Use bitmaps for important/inherited bits in StyleProperties
This avoids padding the style value array, shrinking StyleProperties
from 4368 bytes to 2288 bytes per instance.

(cherry picked from commit b42b7c8dd02911504e6947fc2816b85220cdcf9f)
2024-08-13 15:42:19 -04:00
Andreas Kling 225dc0be5a LibWeb: Only remember source CSSStyleDeclaration for animation-name
We were saving to source declarations for *every* property, even though
we only ever looked it up for animation-name.

This patch gets rid of the per-property source pointer and we now keep
a single pointer to the animation-name source only.

This shrinks StyleProperties from 6512 bytes to 4368 bytes per instance.

(cherry picked from commit c288bfb40453d4abe95af694dfc7c2175cd04a14)
2024-08-13 15:42:19 -04:00
Timothy Flynn b69d81d459 WebContent: Limit the Console client to the top-level navigable client
We don't want to set the intrinsic Console object's client to non-top-
level clients, created for e.g. subframes. We also want to make sure the
Console client is updated if the top-level document has changed.

(cherry picked from commit 0e640f6f706e7682b8a0004945ef0ddec2d44988)
2024-08-13 15:39:53 -04:00
Timothy Flynn 6159f71e4d LibWeb+WebContent: Store console clients on the DOM document
We explicitly stopped visting the map of documents to console clients in
commit 44659f2f2a to avoid keeping the
document alive. However, if nothing else visits the console clients, we
may set the top-level console client to a client that has been garbage
collected.

So instead of storing this map, just store the console client on the
document itself. This will allow the document to visit its client.

(cherry picked from commit 0a819e628eb296200b8b5e609b4936a1a4bf330f)
2024-08-13 15:39:53 -04:00
Timothy Flynn facfe12682 WebContent: Do not create JS consoles for fragment-parsing documents
There's no need to go through this setup.

(cherry picked from commit a1c57ed79a355fae8601a3f40a10f30831122f8f)
2024-08-13 15:39:53 -04:00
Timothy Flynn aab5320900 LibWeb: Indicate documents are for fragment parsing during construction
This will allow testing if they are for fragment parsing during methods
invoked from Document::initialize.

(cherry picked from commit c838ca78c81261e6111aa255c79e4a0599759c80)
2024-08-13 15:39:53 -04:00
Sönke Holz c3c5378c82 Kernel/USB: Always check for the Intel xHCI port routing quirk
The quirk previously only worked when USBLEGSUP was present and the BIOS
owned the host controller.
2024-08-12 10:54:00 -04:00
Nico Weber 82053da343 LibGfx/PNGWriter: Remove one output data copy
Now that we do two passes, we can easily write into
uncompressed_block_data directly.

Somewhat surprisingly, this is perf-neutral.
2024-08-11 13:50:11 -04:00
Nico Weber 32855d2c49 LibGfx/PNGWriter: Compute which predictor to use first, store data then
Before, we would compute and store the output of each predictor,
then pick the best one, and then copy its data.

Now, we compute the output of each predictor but only compute its
score and do not store the predicted data. We then pick the best
one, and do a second pass that re-computes the output of the best
predictor, and stores it.

Instead of computing the output of the 5 different predictors, we now
compute the output of the 5 different predictors, and then the output of
one of them again. In exchange, we only write each output row once
instead of 5 times. (We also have to read the input row twice instead of
once, but the second time round it'll come from L1 or L2.)
Making the simplifying assumption that each predictor takes the same
time to compute, this increases compute to 6/5th, and reduces memory
bandwidth to 3/6th. (Before: 1 input row read, 5 output row writes;
after: 2 input row reads, 1 output row write.)

Produces exactly the same output, but is faster:

    image -o sunset_retro.png sunset_retro.bmp --png-compression-level 0
       34.8 ms ± 0.9 ms ->  22.7 ms ± 0.8 ms (34.7% faster)

    image -o sunset_retro.png sunset_retro.bmp --png-compression-level 1
       64.2 ms ± 4.9 ms ->  50.5 ms ± 0.5 ms (31.3% faster)

    image -o sunset_retro.png sunset_retro.bmp --png-compression-level 2
      190.3 ms ± 1.6 ms -> 179.0 ms ± 2.8 ms (5.8% faster)

    image -o sunset_retro.png sunset_retro.bmp --png-compression-level 3
      646.5 ms ± 4.7 ms -> 635.3 ms ± 4.4 ms (3.3% faster)

Compression level 2 is the default, so about a 6% speedup in practice.

`sips` still needs 49.9 ms ± 3.0 ms to convert sunset_retro.bmp to
sunset_retro.png at its default compression level 1.
We used to take 1.27x as long as sips, now we take 1.01x as long,
while producing a smaller output :^)

(For other, larger, input files sips is still faster and produces
smaller output.)
2024-08-11 13:50:11 -04:00
Nico Weber ae57f6cad6 LibGfx/PNGWriter: Extract filter computation into new Filter::predict()
No behavior change.
2024-08-11 13:50:11 -04:00
Nico Weber 3cb83860fa LibGfx/PNGWriter+AK: SIMDify paeth predictor more
Takes

    (cd Tests/LibGfx; ../../Build/lagom/bin/BenchmarkPNG)

from 59ms to 32ms on my system.

Adds AK::SIMD::bitselect() (modeled after the wasm SIMD equivalent),
and AK::SIMD::abs() implemented on top of it.

No behavior change.
2024-08-10 13:07:01 -04:00
Nico Weber 4492de4e37 Tests: Add a test for paeth_predictor() 2024-08-10 13:07:01 -04:00
Nico Weber a1586e9c03 Tests: Add a benchmark for the PNG paeth predictor 2024-08-10 13:07:01 -04:00
Alec Murphy ebde452262 PDFViewer: Fix outline page number off-by-one
This PR fixes an off-by-one in the outline tree view, where the page
number did not match the corresponding page in the document.
2024-08-10 13:00:23 -04:00
brody-qq a0b021cbcf Kernel/Memory: Fix crash on writes to shared file mmaps
Writes to SharedInodeVMObjects could cause a Protection Violation if a
page was marked as dirty by a different process.

This happened due to a combination of 2 things:
* handle_dirty_on_write_fault() was skipped if a page was already marked
  as dirty
* when a page was marked as dirty, only the Region that caused the page
  fault was remapped

This commit:
* fixes the crash by making handle_fault() stop checking if a page was
  marked dirty before running handle_dirty_on_write_fault()
* modifies handle_dirty_on_write_fault() so that it always marks the
  page as dirty and remaps the page (this avoids a 2nd bug that was
  never hit due to the 1st bug)
2024-08-10 16:19:12 +02:00
Liav A. 79d9abd3cc Kernel: Create coredump by using the crashed process VFS root context
Resolve a regression caused by 01e1af732b.

This unbreaks coredump generation, because we need to use the VFS root
context of the crashed process and not of the FinalizerTask, as it will
hold an empty VFS root context that is assigned to kernel processes.
2024-08-10 10:14:37 -04:00
doctor-rd 2a8032bc68 Meta: Remove /mod
This directory was introduced with
commit a43b115a6c
and is no longer needed.
2024-08-10 10:13:52 -04:00
EWouters 48f578a898 Ports/git: Update to version 2.46.0 2024-08-10 10:10:55 -04:00
EWouters 54b6c3cbc5 Ports/bison: Update to version 3.8.2 2024-08-10 10:10:55 -04:00
EWouters d8d5691f7d Ports/ca-certificates: Update to version 2024-07-02 2024-08-10 10:10:55 -04:00
EWouters 5f661ba571 Ports/bash: Update to version 5.2.32 2024-08-10 10:10:55 -04:00
EWouters 126b2e638e Ports/curl: Update to version 8.9.1 2024-08-10 10:10:55 -04:00
EWouters 00afd803fd Ports/pcre2: Update to version 10.44 2024-08-10 10:10:55 -04:00
EWouters 724b3f4c36 Ports/ncurses: Update to version 6.5 2024-08-10 10:10:55 -04:00
Hendiadyoin1 832b5ff603 AK: Add simd_cast<T> and replace to_TxN with it 2024-08-08 22:43:53 -04:00
brody-qq e0242abf93 Tests/Kernel: Add test for Ext2FS reads and writes
This commit adds a new test case which carries out the following steps:
* write() to a block of an ext2 file, verify the write() was successful
* read() the same block back, verify the read() was successful
* verify that the data from the read() is identical to the data that was
  written in the write()

The test runs the above steps on the following blocks of an ext2 file:
* the first and last direct blocks
* the first and last singly indirect blocks
* the first and last doubly indirect blocks
* the first and last triply indirect blocks
2024-08-08 19:04:04 -04:00
Sönke Holz c247aac15e Meta: Add ahci option to SERENITY_BOOT_DRIVE 2024-08-07 18:30:06 -04:00
Sönke Holz bb9aa6c7c6 Meta: Allow choosing between UHCI and xHCI HCs for USB storage in run.py 2024-08-07 18:30:06 -04:00
Sönke Holz c7903e30f4 Meta: Combine boot drive environment variables into SERENITY_BOOT_DRIVE
This allows you to simply use e.g. SERENITY_BOOT_DRIVE=usb instead of
setting SERENITY_NVME_ENABLE=0 and SERENITY_USE_USBDRIVE=1.
2024-08-07 18:30:06 -04:00
Sönke Holz f2d3202e1d Meta: Remove unnecessary sdhci-pci devices from run.py
This allows us to have a more stable device address "root=sd0:0:0" for
SERENITY_USE_SDCARD.
2024-08-07 18:30:06 -04:00
Sönke Holz de3e864a80 Meta: Remove microvm machine type from run.py
Running in the microvm doesn't work anymore, since we removed IDE
support. Currently, we only support PCI(e)-attached storage devices,
which are not compatible with the microvm, as it doesn't support PCI(e)
at all.
2024-08-07 18:30:06 -04:00
Sönke Holz 4c307e9073 Meta: Remove bochsrc
Running in bochs was broken at least since the removal of IDE support.
2024-08-07 18:30:06 -04:00
Sönke Holz 6a195b6616 Kernel/USB: Add support for xHCI bulk transfers
Bulk transfers also use Normal TRBs, so move the reusable normal TRB
setup code from submit_async_interrupt_transfer into a new function
prepare_normal_transfer.

submit_bulk_transfer and submit_async_interrupt_transfer use this
function and then either block on the completion or submit it
asynchronously and wrap it into a PeriodicPendingTransfer.
2024-08-07 18:30:06 -04:00
Sönke Holz d82148aae1 Kernel/USB: Don't truncate the max packet size in the MassStorage driver 2024-08-07 18:30:06 -04:00
Nico Weber cf8210175f LibGfx/PNGWriter: Inline the now not very useful append(u8)
No behavior change.
2024-08-06 23:00:32 -04:00
Nico Weber 781a39e613 LibGfx/PNGWriter: Use SIMD for PNG score calculation
Produces exactly the same output, but a bit faster.

The speedup is relatively bigger for worse compression:

    image -o sunset_retro.png sunset_retro.bmp --png-compression-level 0
       56.8 ms ±  1.5 ms ->  34.8 ms ± 0.9 ms (38.7% faster)

    image -o sunset_retro.png sunset_retro.bmp --png-compression-level 1
       84.6 ms ±  1.7 ms ->  64.2 ms ± 4.9 ms (24.1% faster)

    image -o sunset_retro.png sunset_retro.bmp --png-compression-level 2
      212.1 ms ±  2.5 ms -> 190.3 ms ± 1.6 ms (10.3% faster)

    image -o sunset_retro.png sunset_retro.bmp --png-compression-level 3
      671.4 ms ± 12.3 ms -> 646.5 ms ± 4.7 ms (3.7% faster)

Compression level 2 is the default, so about a 10% speedup in practice.

For comparison, `sips` needs 49.9 ms ± 3.0 ms to convert
sunset_retro.bmp to sunset_retro.png, and judging from the output file
size, it uses something similar to our compression level 1.
We used to take 1.7x as long as sips, now we take 1.29x as long.
2024-08-06 23:00:32 -04:00