Commit graph

55959 commits

Author SHA1 Message Date
Andrew Kaster
c9499a9755 Ladybird: Install ImageDecoder 2023-11-01 14:30:30 -06:00
Andrew Kaster
2cc6abf309 LibAccelGfx: Don't predicate using EGL/egl.h on Linux
Any platform that has OpenGL and EGL should be able to use the class.
2023-11-01 14:30:30 -06:00
Andrew Kaster
40363f54d8 WebContent: Use the accelerated_graphics CMake helper
Instead of relying on AK_OS_LINUX, actually use the more accurate
HAS_ACCELERATED_GRAPHICS define to figure out if we should try to use
the generic LibAccelGfx GPU painter.
2023-11-01 14:30:30 -06:00
Andrew Kaster
26e5c20cfa LibJS: Don't try to use backtrace(3) on Android below API level 33 2023-11-01 14:30:30 -06:00
Nico Weber
f8799885de LibPDF: Clamp sRGB channels before converting to u8 in CalRGB code
Sometimes the numbers end up just slightly above 1.0f, which previously
caused an overflow.
2023-11-01 11:45:13 -04:00
Nico Weber
bdd2404453 LibPDF: Ignore input whitepoint in convert_to_d65()
CalRGBColorSpace::color() converts into a flat xyz space,
which already takes input whitepoint into account.

It shouldn't be taken into account again when converting from
the flat color space to D65.
2023-11-01 11:45:13 -04:00
Nico Weber
e35a5da2fb LibPDF: Update dead link in a comment 2023-11-01 11:45:13 -04:00
Nico Weber
1fcf0142d2 LibPDF: Fix unfortunate typo in CalRGBColorSpace::create()
We always ignored the /Matrix key in /CalRGB dicts.
2023-11-01 11:45:13 -04:00
Nico Weber
d24289eef4 LibPDF: Always log unhandled type 1 and type 2 font program opcodes
This would've made it easy to see that we were missing flex opcodes for
https://developer.apple.com/library/archive/documentation/mac/pdf/Text.pdf
2023-11-01 11:40:16 -04:00
Nico Weber
e1a743f286 LibPDF: Implement type 2 flex, hflex, hflex1, flex1 operators
This is the type 2 equivalent to type2 othersubr, from what I can tell.

See "4.1 Path Construction Operators" in 5177.Type2.pdf,
"The Type 2 Charstring Format".

Makes text show up alright on
https://developer.apple.com/library/archive/documentation/mac/pdf/Text.pdf
2023-11-01 11:40:16 -04:00
Nico Weber
3e707efdfa LibPDF: Move type1 subr 0 handling into othersubr handler
https://adobe-type-tools.github.io/font-tech-notes/pdfs/T1_SPEC.pdf,
8.4 First Four Subrs Entries:

"""If Flex or hint replacement is used in a Type 1 font program, the
first four entries in the Subrs array in the Private dictionary must be
assigned charstrings that correspond to the following code sequences. If
neither Flex nor hint replacement is used in the font program, then this
requirement is removed, and the first Subrs entry may be a normal
charstring subroutine sequence. The first four Subrs entries contain:

Subrs entry number 0:
3 0 callothersubr pop pop setcurrentpoint return
"""

othersubr handler 0 gets three arguments:
* The flex height (the distance after which the bezier splines
  are replaced with just straight lines)
* The current position after the flex

It pushes that position on the postscript stack, where predefined subr
handler number 0 then pops it from. It then passes it to
setcurrentpoint.

In theory, we now correctly do that setcurrentpoint call, which we
previously weren't.

In practice, that setcurrentpoint call always receives the last point of
the flex -- and our path api apparently gets confused when move_to() is
called on it when the current point is already at that same location.

So tweak the SetCurrentPoint handler to not set the current point on
the path if it's already the path's current point, with a FIXME to
figure out what exactly is happening in Gfx::Path.

No big behavior change if flex is used, but this is more correct if it
isn't.

(This only works because our `return` handler is empty, else we would
have to make the callothersubr handler start a call frame.)
2023-11-01 11:38:41 -04:00
Nico Weber
0bb8249780 LibPDF: Move type1 subr 1 and 2 handling into othersubr handler
https://adobe-type-tools.github.io/font-tech-notes/pdfs/T1_SPEC.pdf,
8.4 First Four Subrs Entries:

"""If Flex or hint replacement is used in a Type 1 font program, the
first four entries in the Subrs array in the Private dictionary must be
assigned charstrings that correspond to the following code sequences. If
neither Flex nor hint replacement is used in the font program, then this
requirement is removed, and the first Subrs entry may be a normal
charstring subroutine sequence. The first four Subrs entries contain:

[...]

Subrs entry number 1:
0 1 callothersubr return

Subrs entry number 2:
0 2 callothersubr return
"""

So subr entry numbers 1 and 2 just call othersubr 1 and and 2, which
means we can just move the handling code over.

No behavior change if flex is used, but more correct if it isn't.

(This only works because our `return` handler is empty, else we would
have to make the callothersubr handler start a call frame.)
2023-11-01 11:38:41 -04:00
Timothy Flynn
f630a5ca71 AK+LibJS: Remove error-prone JsonValue constructor
Consider the following:

    JsonValue value { JsonValue::Type::Object };
    value.as_object().set("foo"sv, "bar"sv);

The JsonValue(Type) constructor does not initialize the underlying union
that stores its value. Thus JsonValue::as_object() will A) refer to an
uninitialized union member, B) deference that member.

This constructor only has 2 users, both of which initialize the type to
Type::Null. Rather than implementing unused functionality here, replace
those uses with the default JsonValue constructor, and remove the faulty
constructor.
2023-11-01 11:15:26 -04:00
david072
53d73b95ce HackStudio: Also ask about unsaved changes when running
HackStudio now also asks about unsaved changes when trying to run,
instead of only on build.
2023-11-01 12:05:57 +00:00
david072
02cc2e0f8f HackStudio: Don't crash when saving is denied on build
When running build while having unsaved changes in HackStudio, it asks
whether you want to save the unsaved files with a separate dialog. When
you click "Yes" to saving the files, but deny the save-file dialog,
HackStudio would crash, since we were expecting there to be a file
to save to. Now, we check whether a file was picked, and if not, we
abort the build.
2023-11-01 12:05:57 +00:00
0GreenClover0
88cc019275 FlappyBug: Unify the way of getting the final score
Previously we would display the score rounded to the nearest integer,
but save the high score by using a static_cast<u32>, which would
always round the score down. This could lead to the final score being
higher than the new high score, when they should be equal.
Now we always round the score to the nearest integer.
2023-11-01 10:43:55 +01:00
Ali Mohammad Pur
7976e1852c AK: Ensure unions with bitfield structs actually have correct sizes
The fun pattern of `union { struct { u32 a : 1; u64 b : 7; }; u8 x; }`
produces complete garbage on windows, this commit fixes the two
instances of those that exist in AK.
This commit also makes sure that the generated unions have the correct
size (whereas FloatExtractor<f32> previously did not!) by adding some
nice static_asserts.
2023-11-01 09:10:38 +03:30
Aliaksandr Kalenik
4676b288a2 LibWeb: Set table width to GRIDMAX if calculated value is max-content
If the width of the table container is specified as max-content, then
it seems sensible to resolve it as the sum of the maximum widths of the
columns.
2023-10-31 18:13:14 +01:00
networkException
387ab57eb1 LibWeb/Tests: Add test for a <script type=module> inside <head> 2023-10-31 18:09:14 +01:00
networkException
ff6d7cf3e4 LibJS+LibWeb: Bring script fetching closer to the spec
This patch updates various parts of the script fetching implementation
to match the current specification.

Notably, the implementation of changes to the import assertions /
attributes proposal are not part of this patch(series).
2023-10-31 18:09:14 +01:00
networkException
5b1d0d4d1b LibWeb: Add FetchContext as HostDefined JS::GraphLoadingState field
This patch adds FetchContext as the type to be used in the HostDefined
slot of JS::GraphLoadingState in web script fetching.
2023-10-31 18:09:14 +01:00
networkException
c3b02ae65a LibJS: Add GraphLoadingState Record
This patch adds the GraphLoadingState Record with a struct HostDefined
for use in the HostDefined field.
2023-10-31 18:09:14 +01:00
networkException
dd90ed11b3 LibWeb: Add helper to create default classic script fetch options 2023-10-31 18:09:14 +01:00
networkException
d1c1218d42 LibWeb/Fetch: Implement changes to priority
This patch updates the priority member of fetch requests to be
an enum. The implementation defined struct previously named Priority
has been renamed to InternalPriority in line with the spec.
2023-10-31 18:09:14 +01:00
networkException
5aa7c51956 LibWeb: Pass around JS::HeapFunctions when fetching scripts
This patch replaces the use of JS::SafeFunction for the
OnFetchScriptComplete in various script fetching functions with
JS::HeapFunction. The same applies for callbacks in ModuleMap.

This also removes DescendantFetchingContext, which stashed the
on complete function in fetch_descendants_of_a_module_script
for multiple calls to fetch_internal_module_script_graph
previously.
2023-10-31 18:09:14 +01:00
networkException
33b40eaeed LibJS: Add LoadedModules to Script and CyclicModule 2023-10-31 18:09:14 +01:00
networkException
d60e8c9df5 LibJS: Add ModuleWithSpecifier for LoadedModules
This patch adds ModuleWithSpecifier as the record type to be used in
the LoadedModules field of Realm, Script and Cyclic Module Records.
2023-10-31 18:09:14 +01:00
networkException
7c7ca7f230 LibWeb: Add New as a possible enum variant of ModuleStatus 2023-10-31 18:09:14 +01:00
networkException
89ea444967 LibWeb: Use proper helper for appending to scripts to run after parsing
Instead of appending manually to the
scripts_to_execute_when_parsing_has_finished list, lets use the proper,
currently unused function for this.
2023-10-31 18:09:14 +01:00
networkException
4aa5816651 Toolchain: Use gcc13 serenity.nix 2023-10-31 18:09:14 +01:00
networkException
31a17b42d0 Ladybird: Use gcc13 in ladybird.nix 2023-10-31 18:09:14 +01:00
networkException
2cf3c3913a Ladybird: Use pkg-config instead of pkgconfig in ladybird.nix
pkgconfig was renamed to pkg-config in nixpkgs.

See e773b9abe9
2023-10-31 18:09:14 +01:00
Timothy Flynn
92e9145edc CI: Switch export of test262/Wasm test results to libjs-data 2023-10-31 11:33:15 -04:00
Timothy Flynn
99216b2a87 ClockSettings: Use a Vector as the time zone model's container type
The time zones were stored as a static Span until commit 0bc401a1d6, and
are now stored in a Vector. By continuing to tell the ItemListModel that
the container is a Span, we create a temporary Span in its constructor,
which the model tries to hold a constant reference to. Use the default
Vector container type now instead to prevent creating such temporaries.
2023-10-31 15:21:34 +01:00
Tim Ledbetter
a6f9ad6012 LibGfx/OpenType: Ensure offsets are strictly less than the file size
Previously, an offset that was equal to the size of the file would
cause a crash.
2023-10-31 14:15:24 +01:00
Andrew Kaster
49d21619d4 CMake: Use a helper file to find GL and EGL in a platform agnostic way
Also add a flag to turn off accelerated graphics entirely.
2023-10-31 02:32:58 -06:00
Ali Mohammad Pur
bec1c1fff7 AK: Explicitly instantiate FormatBuilder::put_f32_or_f64<{f32,f64}>
The default visibility of this function's implicit instantiation was
somehow different on macOS, this fixes that and doesn't affect anything
else.
2023-10-31 11:31:17 +03:30
Aliaksandr Kalenik
141f56accc LibWeb: Position abspos items inside grid relative to their grid area
Since grid item's containing block is not grid container but
corresponding grid area, it affect positioning of abspos items.
2023-10-31 08:46:17 +01:00
Aliaksandr Kalenik
44001d2178 LibWeb: Separate grid item's area rect calculation in a function in GFC
We would also have to find grid area rect while abspos items layout so
it makes sense to have this code in a separate function.
2023-10-31 08:46:17 +01:00
Andreas Kling
9f50c2c718 Tests/LibWeb: Update test expectation after float serialization changes 2023-10-31 07:25:56 +01:00
Uku Loskit
98ad5a7141 LibHTTP: Fix issues with HTTP POST request and requests with a body
The previous implementation created invalid HTTP requests in cases
where the request method was POST or when the request contained a
body. There were two bugs for these cases:

1) the 'Content-Type' header was sent twice
2) a stray CRLF was appended to the request
2023-10-31 07:09:26 +01:00
Aliaksandr Kalenik
549dee4db1 LibWeb: Call prepare_for_replaced_layout() on replaced boxes in GFC
We need to call prepare_for_replaced_layout() on grid items to populate
their natural sizes and aspect ration.
2023-10-31 07:08:30 +01:00
stelar7
a559dca816 LibTLS: Fix supported signature algorithms typo
The ED curve is INTRINSIC/ED25519, not INTRINSIC/ECDSA
2023-10-31 07:07:53 +01:00
Simon Wanner
fb7b4b9c59 LibJS/JIT: Provide source location information for JIT code
This works by walking a backtrace until the currently executing
native executable is found, and then mapping the native address
to its bytecode instruction.
2023-10-31 07:07:17 +01:00
Simon Wanner
112eadc863 LibJS/JIT: Annotate disassembly with bytecode information 2023-10-31 07:07:17 +01:00
Simon Wanner
9f78e56823 LibJS/JIT: Record machine code location to bytecode location mapping 2023-10-31 07:07:17 +01:00
Timothy Flynn
cf93e56833 headless-browser: Use LibWebView to sanitize input URLs
Remove the ad-hoc sanitization in favor of LibWebView. This was missed
after commit 191e20d639.
2023-10-31 07:03:15 +01:00
Tobias Christiansen
3c41ac5ae4 Tests/LibWeb: Add object-{fit,position} test 2023-10-31 07:03:05 +01:00
Tobias Christiansen
3b1083c4cb Tests/LibWeb: Add object-position to the getComputedStyle test
The test was failing because we now support the new and shiny
object-position property.
2023-10-31 07:03:05 +01:00
Tobias Christiansen
e60253d64c LibWeb: Respect offsets always when painting with object-position
Previously we didn't always set the bitmap_intersect correctly when
applying an object-position. This lead to images not correctly being
centered when the axis that it should move along was not the specified
axis.
2023-10-31 07:03:05 +01:00