Commit Graph

32554 Commits

Author SHA1 Message Date
Aliaksandr Kalenik
220088480b LibWeb: Bring "apply the history step" up to date with the spec
Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
2024-03-28 15:34:52 +01:00
Aliaksandr Kalenik
18cfbb5cb4 LibWeb: Bring initialize_navigable() up to date with the spec 2024-03-28 15:34:52 +01:00
Aliaksandr Kalenik
ffd3639b17 LibWeb: Pass navigation params by const-ref to load_document() 2024-03-28 15:34:52 +01:00
Aliaksandr Kalenik
39f74d3437 LibWeb: Bring HistoryHandlingBehavior up to date with the specification
Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
2024-03-28 15:34:52 +01:00
ronak69
b6cf62d00a Shell: Correctly auto format command lines consisting of only whitespace
When the command line consists of only whitespace characters, the auto
formatter basically tries to trim the trailing whitespace. But due to a
subtle bug of decrementing an iterator (which is an unsigned integer)
past 0 (or the start of the buffer), that operation resulted in an index
out of bounds error and a crash.
2024-03-28 08:49:49 +01:00
ronak69
9454346341 headless-browser: Don't forget to load webpage before taking screenshot
For the normal non-test use case of headless-browser, the function
`load_page_for_screenshot_and_exit()` didn't actually load the requested
webpage in the `WebView`, resulting in an all white pixels screenshot.
2024-03-28 08:01:33 +01:00
Aliaksandr Kalenik
ce325a9912 LibWeb: Add SessionHistoryEntry::document()
No behaviour change intended.
2024-03-27 18:07:07 +01:00
Aliaksandr Kalenik
b590d1b48b LibWeb: Transform SessionHistoryEntry from a struct to a class
No behaviour change intended.
2024-03-27 18:07:07 +01:00
Nico Weber
5a43fc83bd LibGfx/JBIG2Loader: Add a short comment with spec history
I found this interesting, and it also explains e.g. why some
of the step numbers in 6.4 Text Region Decoding Procedure are off --
they added step 3) for COLEXTFLAG and forgot to update step references
to later steps.
2024-03-27 11:55:09 -04:00
Andreas Kling
d37c0a2cab LibWeb: Don't make flex layout responsible for flex container cross size
Although the flex algorithm as specified does say to determine the cross
size of the flex container, this is not how our layout engine works.

The parent formatting context is responsible for sizing its children,
and since that's already happening, we can simply remove the cross
sizing step from FFC.
2024-03-27 16:43:04 +01:00
Andreas Kling
ead341738e LibWeb: Don't use stretch-fit width for inline boxes with aspect ratio 2024-03-27 16:43:04 +01:00
Andreas Kling
1cfd8b3ac0 LibWeb: Retain size definiteness when transferred through aspect ratio
If a box has definite width and a preferred aspect ratio, we can
determine its height without performing layout. Hence, its height should
also be considered definite. And the other way around for width from
height as well.
2024-03-27 16:43:04 +01:00
Andreas Kling
ca53eefe11 LibWeb: Compute height early when possible for floating boxes
This is preparation for the next commit, which will make flex layout
relinquish control of the flex container cross size to the parent
formatting context.
2024-03-27 16:43:04 +01:00
Andreas Kling
aa59419529 LibWeb: Remove unnecessary check that BFC isn't clearing a flex item
A block-level box in BFC will never be a flex item. It may be a flex
container, but not an item. Hence this check was unnecessary.
2024-03-27 16:43:04 +01:00
Andreas Kling
a0ed8bdb57 LibWeb: Remove outdated comment about definite calc() sizes
We already do determine whether calc() sizes are definite, so this
comment was not necessary.
2024-03-27 16:43:04 +01:00
Matthew Olsson
e4dba9d932 LibWeb: Cache the last CSS play-state value on KeyframeEffect
This way we can just leave it alone if the property hasn't changed.
Notably, if the play-state property has been set to 'paused', and then
the user gets the animation with JS and calls .play() on it, it should
start playing despite the play-state property value.
2024-03-27 09:40:05 -06:00
Daniel La Rocque
1e1906865c LibJS: Remove ToTemporalDateTimeRoundingIncrement
This is an editorial change in the Temporal spec.

See: https://github.com/tc39/proposal-temporal/commit/aca38be
2024-03-26 17:22:46 -04:00
Nico Weber
2e6626ae3b LibGfx/JBIG2: Tweak spec comment quote characters 2024-03-26 17:21:47 -04:00
Nico Weber
6842299959 LibGfx/JBIG2: Fix a comment typo 2024-03-26 17:21:47 -04:00
Nico Weber
6ff446fd30 LibGfx/JBIG2: Fix a comment typo 2024-03-26 17:21:47 -04:00
Nico Weber
a2a5fc76aa LibGfx/JBIG2: Don't assert on unexpected OOB values in the bitstream
This should only happen on either invalid inputs or if our code has
a bug (gasp!). Printing an error instead of asserting seems nicer.
2024-03-26 17:21:47 -04:00
Nico Weber
b3c423e4ca LibGfx/ISOBMFF: Implement JPEG2000DefaultDisplayResolutionBox
Found e.g. in http://opf-labs.org/format-corpus/jp2k-formats/balloon.jpf
2024-03-26 17:19:03 -04:00
Nico Weber
a9ef2fac01 LibGfx/ISOBMFF: Introduce JPEG2000ResolutionSubboxBase
No behavior change.
2024-03-26 17:19:03 -04:00
Nico Weber
a971625c49 LibGfx/ISOBMFF: Implement UserExtensionBox
.jpf (JPEG2000) files written by Photoshop contain a whole bunch of
these boxes.

fileformats.archiveteam.org/wiki/Boxes/atoms_format lists a few
UUID types. Of those 3, these are in Photoshop-written .jpf files:

* 0537cdab-9d0c-4431-a72a-fa561f2a113e Exif
* 2c4c0100-8504-40b9-a03e-562148d6dfeb Photoshop Image Resource
* be7acfcb-97a9-42e8-9c71-999491e3afac XMP
2024-03-26 17:19:03 -04:00
Timothy Flynn
45fa6249df LibJS: Do not unnecessarily revalidate a TypedArray
No effective change, as ValidateTypedArray would call the validation AO
that the spec wants us to call manually. But no need to do it twice.
2024-03-26 17:11:26 -04:00
Ali Mohammad Pur
ea692338c2 LibCrypto: Allow CMS padding to span an entire block
This is in line with what the spec states, the previous implementation
excluded the case where the original message's length is a multiple of
block_size, which would lead to a full block of padding.
2024-03-26 19:39:03 +00:00
Timothy Flynn
d74059580c LibWeb: Return the correct substring when parsing an HTTP quoted string
We were off-by-one when returning the result of parsing a quoted string
in Web::Fetch::Infrastructure::collect_an_http_quoted_string. Instead of
backtracking the lexer and consuming the backtracked string, do a simple
substring operation.
2024-03-26 19:19:13 +00:00
Timothy Flynn
576c2f4f4d LibURL+LibUnicode+LibWebView: Handle punycode directly in LibURL
We had defined punycode handling in LibUnicode when LibURL (AK at the
time) was unable to depend on LibUnicode. This is no longer the case.
2024-03-26 12:25:21 -04:00
Timothy Flynn
5ddfcfd07e LibCore+LibTimeZone: Move TZDB utilities from LibTimeZone to LibCore
We had weakly defined a couple utilities needed by Core::DateTime when
LibCore was unable to depend on LibTimeZone. This is no longer the case.
2024-03-26 12:25:21 -04:00
Timothy Flynn
9b1b91f98a LibFileSystem: Depend on the minimal LibCore source set 2024-03-26 12:25:21 -04:00
Timothy Flynn
f7ddcb1f98 LibCore: Separate some LibCore sources into a minimal object library
We have been dancing around circular dependencies between LibCore and
generated sources. For example, LibURL currently cannot depend on
LibUnicode because the LibUnicode generators depend on LibCore, and
LibCore depends on LibURL. LibTimeZone is in a similar situation.

To alleviate this, we can define the minimal sources that the code
generators need as an object library. This will allow the generators to
depend on this library, rather than the full LibCore.
2024-03-26 12:25:21 -04:00
Timothy Flynn
4c08a1e0c0 Meta: Remove serenity_lib_static() CMake helper function
Its one user (LibMain) can now just specify a STATIC library type in an
invocation of serenity_lib().
2024-03-26 12:25:21 -04:00
Timothy Flynn
c8febe5169 LibCore: Update FIXME in LibCore's CMakeLists.txt
We have a FileWatcher implementation for macOS.
2024-03-26 12:25:21 -04:00
Tim Ledbetter
8e6e938167 LibWeb: Remove AbortSignal::follow()
This no longer has any callers.
`AbortSignal::create_dependent_abort_signal()` should be used instead.
2024-03-26 11:42:40 +01:00
Tim Ledbetter
17e64cf08b LibWeb/Fetch: Replace usages of AbortSignal::follow() in Fetch::Request
Since the introduction of `AbortSignal::any()`, the specification says
`AbortSignal::create_dependent_abort_signal()` should be used where
`AbortSignal::follow` was previously.
2024-03-26 11:42:40 +01:00
Andreas Kling
3d78f86a2f LibWeb: Don't ask RequestServer to prefetch DNS for file: and data: URLs 2024-03-26 11:39:45 +01:00
Andreas Kling
41cc8e75f2 LibJS: Make PromiseJob store callback as a HeapFunction
This is a speculative fix for a flake seen on CI where a JobCallback
captured by a PromiseJob callback was GC'd prematurely.
2024-03-26 05:47:24 +01:00
Matthew Olsson
cf54ba01ac LibWeb: Be more strict about invoking .play() on element animations
We don't want to always invoke the .play() method if an animation is
relevant and had a play state of running, as the play state is
essentially just "paused" or "not paused". We replace that relevancy
check with the inverse of the pause check so we don't constantly call
.play() on animations that are finished.

Also duplicates and moves the temporary context into both blocks, since
most of the time neither condition will be true.
2024-03-26 05:47:09 +01:00
Matthew Olsson
e2dfef90fb LibWeb: Remove useless animation relevancy check
This is already done in Animatable::get_animations()
2024-03-26 05:47:09 +01:00
Andrew Kaster
cddbdf5ae9 LibWeb: Implement skeleton of RSA-OAEP decrypt for SubtleCrypto
The actual Crypto algorithm part isn't implemented yet, so we just copy
the ciphertext and claim that's the plaintext :^)
2024-03-25 17:01:23 -06:00
Andrew Kaster
29b68a1b10 LibWeb: Implement skeleton of RSA-OAEP encrypt for SubtleCrypto
The actual Crypto algorithm part isn't implemented yet, so we just copy
the plaintext and claim that's the ciphertext :^)
2024-03-25 17:01:23 -06:00
Andrew Kaster
d71bd185c6 LibWeb: Implement skeleton of SubtleCrypto.decrypt 2024-03-25 17:01:23 -06:00
Andrew Kaster
df3d0538a9 LibWeb: Implement skeleton of SubtleCrypto.encrypt
No algorithms implement this yet, but this is the high level entry
point.
2024-03-25 17:01:23 -06:00
Andrew Kaster
ae4d90c88a LibWeb: Error out SubtleCrypto.digest with a OOM on Buffer copy error
Instead of returning a custom OperationError, let's just return a LibJS
defined OOM error instead.
2024-03-25 17:01:23 -06:00
Andrew Kaster
497f3ca0fd LibWeb: Store PBKDF2Params' salt field as a ByteBuffer directly
Rather than trying to store a Handle to a WebIDL::BufferSource, let's
look ahead to what the spec wants us to do with this field and get a
copy of the bytes held by the buffer source right away.
2024-03-25 17:01:23 -06:00
Andrew Kaster
a0623a47de LibWeb: Implement importKey for RSA-OAEP 2024-03-25 17:01:23 -06:00
Andrew Kaster
28dc076764 LibWeb: Use a forgiving base64url encoding for JWK export 2024-03-25 17:01:23 -06:00
Andrew Kaster
562068e001 LibTLS: Implement ASN.1 parser function for PrivateKeyInfo
LibWeb wants to parse these for Web Crypto. In theory Certificate
parsing in LibTLS should use it as well.
2024-03-25 17:01:23 -06:00
Andrew Kaster
7b27c1ce6c LibTLS: Export parse_subject_public_key_info
LibWeb wants to call this for Web Crypto.
2024-03-25 17:01:23 -06:00
Andrew Kaster
e422c93537 LibWeb: Make normalize_an_algorithm from SubtleCrypto public
We'll need to call this from other source files when implementing
specific algorithms.
2024-03-25 17:01:23 -06:00
Hendiadyoin1
70cfa60f56 LibCrypto: Remove now unused temporary BigInt buffers
Plus 1 drive-by division->shift optimization
2024-03-25 14:26:29 -06:00
Hendiadyoin1
c96d44e9cf LibCrypto: Use a right shift for division in NumberTheory::Power 2024-03-25 14:26:29 -06:00
Hendiadyoin1
4339868296 LibCrypto: Use Knuths algorithm D for BigInt division 2024-03-25 14:26:29 -06:00
Hendiadyoin1
1af9fa1968 LibCrypto: Implement arbitrarily sized right shifts
Previously we could only shift by words at a time
2024-03-25 14:26:29 -06: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
LekKit
760b9186a5 LibC: Fix pthread_cond_broadcast() waking only one thread 2024-03-25 14:06:32 -06:00
stelar7
0359e8848a LibCrypto: Add roundtrip test for parsing RSA private keys 2024-03-25 14:06:19 -06:00
stelar7
1be411cc73 LibCrypto: Adjust DER length encoding to follow the spec
It says to always use the smallest possible length representation
2024-03-25 14:06:19 -06:00
Nico Weber
2e142105c9 Fuzzers: Add JPEG2000 fuzzer 2024-03-25 20:35:00 +01:00
Nico Weber
a92d887ee3 LibGfx/JPEG2000: Read file structure
This is enough for `file` to print the dimensions of .jp2 / .jpx files,
and for `icc` to print color profile information embedded in the
'colr' box.
2024-03-25 20:35:00 +01:00
Nico Weber
1ab28276f6 LibGfx: Add the start of a JPEG2000 loader
JPEG2000 is the last image format used in PDF filters that we
don't have a loader for. Let's change that.

This adds all the scaffolding, but no actual implementation yet.
2024-03-25 20:35:00 +01:00
Nico Weber
1e95c08db5 LibGfx/ISOBMFF: Add JPEG2000ChannelDefinitionBox 2024-03-25 20:35:00 +01:00
Nico Weber
f080836127 LibGfx/ISOBMFF: Add JPEG2000URLBox 2024-03-25 20:35:00 +01:00
Nico Weber
c58996f4fc LibGfx/ISOBMFF: Add JPEG2000ContiguousCodestreamBox 2024-03-25 20:35:00 +01:00
Nico Weber
f372a9b346 LibGfx/ISOBMFF: Add JPEG2000UUIDListBox 2024-03-25 20:35:00 +01:00
Nico Weber
4a95e55fb3 LibGfx/ISOBMFF: Add JPEG2000CaptureResolutionBox 2024-03-25 20:35:00 +01:00
Nico Weber
b386d5bb14 LibGfx/ISOBMFF: Add JPEG2000ResolutionBox 2024-03-25 20:35:00 +01:00
Nico Weber
7d137dc480 LibGfx/ISOBMFF: Add JPEG2000UUIDInfoBox 2024-03-25 20:35:00 +01:00
Nico Weber
214ff799ce LibGfx/ISOBMFF: Add JPEG2000ColorSpecificationBox 2024-03-25 20:35:00 +01:00
Nico Weber
59bd378db8 LibGfx/ISOBMFF: Add JPEG2000ImageHeaderBox 2024-03-25 20:35:00 +01:00
Nico Weber
78deac3dca LibGfx/ISOBMFF: Give Reader::read_entire_file() a factory callback
This will allow creating different child boxes in different containers.
2024-03-25 20:35:00 +01:00
Nico Weber
b7a120c47e LibGfx/ISOBMFF: Remove Box::read_from_stream()
This doesn't have to be a virtual method: it's called from
various create_from_stream() methods that have a static type
that's created. There's no point in the virtual call here,
and it makes it harder to add additional parameters to
read_from_stream() in some subclasses.
2024-03-25 20:35:00 +01:00
Nico Weber
c84487ed2d LibGfx/ISOBMFF: Give JPEG2000HeaderBox its own type
...and make SuperBox a pure superclass that's not usable by itself.
2024-03-25 20:35:00 +01:00
Nico Weber
65bd090815 LibGfx/ISOBMFF: Start creating JPEG2000 box types
`isobmff` can now dump the id in a JPEG2000SignatureBox.
Creates JPEG2000Boxes.{h,cpp} to house JPEG2000 box types.
2024-03-25 20:35:00 +01:00
Nico Weber
a073b2d047 LibGfx/ISOBMFF: Read JPEG2000HeaderBox 2024-03-25 20:35:00 +01:00
Nico Weber
15ba0a7e18 LibGfx/ISOBMFF: Make BoxStream MaybeOwn its stream
...and make Reader always have a BoxStream.
2024-03-25 20:35:00 +01:00
Nico Weber
a72770cdf6 LibGfx/ISOBMFF: Add JPEG2000 box types
I prefixed the types that are labeled as "JPEG2000" on
https://mp4ra.org/registered-types/boxes with "JPEG2000".
2024-03-25 20:35:00 +01:00
Nico Weber
cdbdc334de LibGfx/ISOBMFF: Alphabetize box type ENUMERATE_ONE() lines 2024-03-25 20:35:00 +01:00
Nico Weber
e81009b338 LibGfx/ISOBMFF: Put string literals in box type ENUMERATE_ONE()
This allows types that have spaces in their FourCC.
2024-03-25 20:35:00 +01:00
Nico Weber
bdb4f6bd49 LibGfx/ISOBMFF: Remove prototypes for nonexistent methods 2024-03-25 20:35:00 +01:00
Nico Weber
270d3303ce LibGfx/ISOBMFF: FileTypeBox is not a FullBox 2024-03-25 20:35:00 +01:00
Nico Weber
7dd5457b8f LibGfx/JBIG2: Add support for refinement coding template 1
This is used when refining a symbol in 0000337.pdf.
2024-03-25 13:16:02 -04:00
Nico Weber
ef9bfce0e7 LibGfx/JBIG2: Add support for SDREFAGG=1 symbol segments
...but only as long as REFAGGNINST == 1. That's enough for 0000337.pdf.
Except that it also needs GRTEMPLATE=1 support in the generic
refinement region decoding procedure, so no behaivor change yet.
2024-03-25 13:16:02 -04:00
Nico Weber
3fa2ecdd65 LibGfx/JBIG2: Extract read_id() into a class
We'll need this for refinement/aggregate coding of symbols.
2024-03-25 13:16:02 -04:00
Nico Weber
68d47cb84a LibGfx/JBIG2: Implement support for symbols segments with input symbols
Needed for 0000337.pdf. It now fails complaining about missing SDREFAGG
support.
2024-03-25 13:16:02 -04:00
Nico Weber
59e6a10f30 LibGfx/JBIG2: Initialize POD members of refinement region input struct
I missed putting this in #23696 while juggling local branches.

No behavior change.
2024-03-25 12:07:18 -04:00
Aliaksandr Kalenik
1036e104ef LibWeb: Remove cache for Paintable::is_visible()
...because it depends on computed values that could be changed without
rebuilding paintable tree.
2024-03-25 14:17:30 +01:00
Ali Mohammad Pur
61148e9bc2 LibCore: Ignore timer events after stop() has been called 2024-03-25 14:16:55 +01:00
Nico Weber
8e9157d6ce LibGfx/JBIG2: Implement decode_end_of_stripe() a bit
This is enough to be able to decode 0000857.pdf p1-4 and
0000372.pdf p11.
2024-03-25 14:08:40 +01:00
Nico Weber
c4a45bb521 LibGfx/JBIG2: Make compute_context() a function pointer
...instead of a lambda that checks the template on every call.

Doesn't make a performance difference locally, but seems maybe nicer?

No behavior change.
2024-03-25 14:08:40 +01:00
Nico Weber
828c640087 LibGfx/JBIG2: Make get_pixel static constexpr
...so it doesn't need to be captured.
2024-03-25 14:08:40 +01:00
Nico Weber
b45a4508c7 LibGfx/JBIG2: Implement support for context templates 1, 2, and 3
Template 2 is needed by some symbols in 0000372.pdf page 11 and
0000857.pdf pages 1-4. Implement the others too while here.  (The
mentioned pages in those two PDFs also use the "end of stripe" segment,
so they still don't render yet.

We still don't support EXTTEMPLATE.
2024-03-25 14:08:40 +01:00
Nico Weber
7035c2a2ff LibGfx/JBIG2: Add some debug logging to decode_page_information() 2024-03-25 14:08:40 +01:00
Andreas Kling
9af966f87d LibWeb: Avoid unnecessary Vector copying when generating line boxes
Carry the same Vector<Gfx::DrawGlyphOrEmoji> all the way from the inline
level iterator to the final line box fragment.
2024-03-25 12:39:23 +01:00
Andreas Kling
f48024c2d1 LibGfx/OpenType: Make glyph_width() only fetch the glyph advance
Instead of fetching a generic set of metrics for each glyph, only fetch
the advance when that's all we need.

This is extremely hot in LibWeb text layout, where it makes a nice dent.
2024-03-25 12:39:23 +01:00
Nico Weber
d2998c1f5e LibGfx/JBIG2: Implement generic_refinement_region_decoding_procedure()
With this, we can decode all pages of 0000425.pdf, 0000215.pdf,
0000882.pdf, and 0000057.pdf.
2024-03-25 08:15:36 +01:00
Nico Weber
0d2e91b4ea LibGfx/JBIG2: Reject things in refinement decoding
These aren't hit for my 1000 page PDF test set.
2024-03-25 08:15:36 +01:00
Nico Weber
562d8ed619 LibGfx/JBIG2: Stub out generic_refinement_region_decoding_procedure()
...and make text_region_decoding_procedure() call it.

generic_refinement_region_decoding_procedure() still just returns
"unimplemented", so no behavior change yet.
2024-03-25 08:15:36 +01:00
Nico Weber
c4c48c1d5f LibGfx/JBIG2: Sketch out text segment refinement coding a bit 2024-03-25 08:15:36 +01:00