Commit graph

29539 commits

Author SHA1 Message Date
Sam Atkins 7bcabbb325 LibWeb: Store ConicGradientStyleValue's position as PositionStyleValue 2023-11-07 22:00:24 +00:00
Sam Atkins 5cf85d30aa LibWeb: Store RadialGradientStyleValue's position as PositionStyleValue 2023-11-07 22:00:24 +00:00
Sam Atkins 2ae53bc5eb LibWeb: Add some helpers to PositionStyleValue
Both of these are needed by the gradient style values.
2023-11-07 22:00:24 +00:00
Sam Atkins 8917378aa7 LibWeb: Adapt parse_position() into parse_position_value()
Having two ways that `<position>` is represented is awkward and
unnecessary. So, let's combine the two paths together. This first step
copies and modifies the `parse_position()` code to produce a
`PositionStyleValue`.

Apart from returning a StyleValue, this also makes use of automatic enum
parsing instead of manually comparing identifier strings.
2023-11-07 22:00:24 +00:00
Sam Atkins 4ad58f0204 LibWeb: Store PositionStyleValue's edges as EdgeStyleValues
They can't be anything else, so this will make working with them easier.
2023-11-07 22:00:24 +00:00
Sam Atkins 875661a584 LibWeb: Remove unnecessary double->float->double round trip 2023-11-07 22:00:24 +00:00
Sam Atkins 88dc5886eb LibWeb: Use generated to_string() function for EdgeStyleValue edge 2023-11-07 22:00:24 +00:00
Sam Atkins f918785698 LibWeb: Remove redundant identifier_to_edge() function
The enums generator has this covered already.
2023-11-07 22:00:24 +00:00
iliadsh aef654592f LibJS/JIT: Bail in UnsignedRightShift fast path if result is negative 2023-11-07 21:59:03 +01:00
Sam Atkins 0875ef770f Chess: Make chess widget resilient to missing piece images
Display a warning when some images are missing, instead of crashing.

Also, don't keep old images around when loading a new set, and make use
of get_piece_graphic() more often.
2023-11-07 19:44:11 +01:00
Sam Atkins 39579436c1 GamesSettings: Make chess preview widget resilient to missing images
Previously we would give up on loading the piece images if one fails.
That was awkward because 2 out of 3 places where `set_piece_set_name()`
is called can't propagate errors, so we'd just crash.

Instead, let's skip any images that fail to load, and then when painting
the preview, skip any missing bitmaps and show a warning message that
some are missing.
2023-11-07 19:44:11 +01:00
Sam Atkins 4f99f1750e GamesSettings: Pass a String to ChessGamePreview::set_piece_set_name() 2023-11-07 19:44:11 +01:00
Matthew Olsson 13ae2a4dab LibWeb: Store all timelines associated with a document on the document
This will be required for propagating the current animation time to all
relevant timelines, which each propagate that time to all of their
relevant animations.
2023-11-07 15:17:09 +01:00
Matthew Olsson 2fbb9649e3 LibWeb: Add a default DocumentTimeline object to DOM::Document 2023-11-07 15:17:09 +01:00
Matthew Olsson 734076946b LibWeb: Add DocumentTimeline IDL object 2023-11-07 15:17:09 +01:00
Matthew Olsson 521f8bd5f2 LibWeb: Add AnimationTimeline IDL object 2023-11-07 15:17:09 +01:00
Simon Wanner 8eeb4e0aff LibJS/JIT: Use mov8/mov32 for loads in compile_get_variable 2023-11-07 14:39:13 +01:00
Simon Wanner ff63222425 LibJIT: Add mov8/mov16/mov32 with zero- or sign-extension 2023-11-07 14:39:13 +01:00
stelar7 5dfe21be85 LibWeb: Remove unused method on HTMLButtonElement 2023-11-07 11:34:21 +01:00
stelar7 d767f14df8 LibWeb: Introduce the concept of "Enumerated" values
This does _NOT_ correspond to anything in the IDL or ECMAScript spec,
but is a custom extended attribute.
We use it to define the "enumerated" values of an attribute
2023-11-07 11:34:21 +01:00
stelar7 19bf42a7e6 LibIDL: Attach extended attributes on enums 2023-11-07 11:34:21 +01:00
Shannon Booth ea2b733862 LibWeb: Port custom properties to FlyString 2023-11-07 11:33:41 +01:00
Shannon Booth 346825bd78 LibWeb: Remove unused DeprecatedFlyString include from HTMLCollection 2023-11-07 11:33:41 +01:00
Shannon Booth 7e9a40dbad LibWeb: Port attribute change steps from DeprecatedFlyString 2023-11-07 11:33:41 +01:00
Shannon Booth b337b4370a LibWeb: Port validate_and_extract from DeprecatedFlyString 2023-11-07 11:33:41 +01:00
Shannon Booth 2f009d983b LibWeb: Port Element::get_attribute_value from DeprecatedFlyString 2023-11-07 11:33:41 +01:00
Shannon Booth 3f13a50a20 LibWeb: Return FlyString from CSS::Parser::Token::ident
Instead of a StringView. This allows us to preserve the nice O(1) string
compare property of FlyString, and not needing to allocate when one is
needed.

Ideally all other places in Token should have similar changes done, but
to prevent a huge amount of churn, just change ident for now.
2023-11-07 11:33:41 +01:00
Andreas Kling 1d8ec677a3 LibJS/JIT: Add fast path for cached GetVariable accesses
We can now stay in machine code for environment variable read accesses
as long as they are cached and initialized.

20% speed-up on Octane/zlib.js :^)
2023-11-07 11:33:04 +01:00
Andreas Kling 7826c006c1 LibJS/JIT: Don't crash when dissassembling an empty basic block 2023-11-07 11:33:04 +01:00
Andreas Kling e1e7e696ac LibJS/JIT: Store the running ExecutionContext& in a dedicated register 2023-11-07 11:33:04 +01:00
Andreas Kling 5479bb6ac9 LibJIT/X86_64: Allow mul32() with immediate operand 2023-11-07 11:33:04 +01:00
iliadsh 24d5070520 LibJS/JIT: Add fast path for UnsignedRightShift 2023-11-07 10:17:04 +01:00
iliadsh c956316c98 LibJS/JIT: Add fast path for RightShift 2023-11-07 10:17:04 +01:00
iliadsh 1244e91481 LibJS/JIT: Add fast path for LeftShift 2023-11-07 10:17:04 +01:00
Adam Harald Jørgensen a1cdfe1b54 Shell: Add support for showing shortened prompt path with ellipsis 2023-11-07 07:46:52 +03:30
Adam Harald Jørgensen 4febd31dba Shell: Shorten prompt path if integer is provided with "\w" option 2023-11-07 07:46:52 +03:30
Lucas CHOLLET 8612aee640 Lagom/Fuzzers: Add a fuzzer for our TIFF decoder 2023-11-06 12:29:30 -07:00
Lucas CHOLLET 26a3be17c8 Userland: Register TIFF as a supported image file type
This includes both .tiff and .tif extensions.
2023-11-06 12:29:30 -07:00
Lucas CHOLLET 67c6af8cfe LibGfx: Sort entries of ENUMERATE_IMAGE_FORMATS 2023-11-06 12:29:30 -07:00
Lucas CHOLLET 75caccafa4 LibGfx: Add a TIFF loader 2023-11-06 12:29:30 -07:00
Lucas CHOLLET dc5bb5a4cc LibGfx: Sort entries in the definition of ImagePluginInitializer 2023-11-06 12:29:30 -07:00
Timothy Flynn 38dd284915 LibLocale: Update to CLDR version 44.0.1
https://cldr.unicode.org/index/downloads/cldr-44

Notable changes that affect us include:

* The Islamic Calendar is now localized as the Hijri Calender (in en-US)
  but has not been updated for all locales. So this patch updates tests
  where possible and removes a few test cases that currently cannot be
  localized.

* The und locale has received more likely subtag data (the und locale is
  basically a pseudo-locale meaning "undetermined").

* The exponential symbol in the Arabic number system was changed from
  U+0627 to U+0623.
2023-11-06 08:31:56 -05:00
Andreas Kling 536b9c29e4 LibJS/JIT: Resolve the EnvironmentVariableCache pointers at JIT time 2023-11-06 13:06:10 +01:00
Andreas Kling a616a682fe LibJS/JIT: Resolve the GlobalVariableCache pointers at JIT time 2023-11-06 13:06:10 +01:00
Andreas Kling f03d4a1ffe LibJS/JIT: Resolve the PropertyLookupCache pointers at JIT time
We know where the lookup cache is by the time we're jitting code, so
let's put the pointer directly into the instruction stream.
2023-11-06 13:06:10 +01:00
Andreas Kling 3b6b9b9f25 LibJS: Take VM instead of Interpreter in more common implementations 2023-11-06 13:06:10 +01:00
Andreas Kling 234ed2d466 LibJS/JIT: Resolve the GetGlobal identifier at JIT time 2023-11-06 13:06:10 +01:00
Andreas Kling c92954db36 LibJS/JIT: Resolve the GetById property name at JIT time
We can resolve the IdentifierTableIndex to a DeprecatedFlyString& once
when jitting the code, instead of every time GetById executes.
2023-11-06 13:06:10 +01:00
Shannon Booth 673e3ec57d LibWeb: Port Element::set_attribute_value from DeprecatedString
Removing the DeprecatedString / DeprecatedFlyString overloads of this
function.
2023-11-06 11:37:08 +01:00
Shannon Booth 96463e947a LibWeb: Remove some now unused deprecated functions from QualifiedName
And related callers in Element.
2023-11-06 11:37:08 +01:00
Shannon Booth 326b34c7c7 LibWeb: Port all callers of Element::namespace to Element::namespace_uri
Removing some more use of DeprecatedFlyString
2023-11-06 11:37:08 +01:00
Shannon Booth f2e77f7778 LibWeb: Port handle_readonly_attribute from DeprecatedFlyString
It's a little awkward that one caller of this is passing through an
Optional<String> and another an Optional<DeprecatedString>, but that
should be fixed some point in the future with further DeprecatedString
porting.
2023-11-06 11:37:08 +01:00
Shannon Booth 22f6abe5d6 LibWeb: Remove DeprecatedString impls of get_elements_by_tag_name{_ns}
No IDL file pulls in these requiring DeprecatedString support, so we
are now able to remove these functions! :^)

Also leave a FIXME while we are at it, as ideally this function would
take an Optional<FlyString> - but the IDL generator does not currently
support this.
2023-11-06 11:37:08 +01:00
Shannon Booth c8a4fc6c1a LibWeb: Port HTML parser quirk public IDs to StringView
These were DeprecatedFlyStrings, but had no reason to be. We were not
making use of the O(1) lookup, so instead of porting it over to a
FlyString, just make it a StringView.
2023-11-06 11:37:08 +01:00
Shannon Booth 1f8d72da8e LibWeb: Port HTMLToken::to_deprecated_string to new AK String 2023-11-06 11:37:08 +01:00
Shannon Booth d00c030fce LibWeb: Port Element::set_attribute_value namespace to FlyString 2023-11-06 11:37:08 +01:00
Shannon Booth 1812221a2d LibWeb: Add FlyString versions of NamedNodeMap::get_attribute_ns
This is the API for NamedNodeMap which we are wanting to eventually use
instead of taking a StringView. Currently we just end up deferring to
the StringView versions of these functions, but at some stage in the
future, this will allow us to have O(1) comparison when making attribute
lookups.

In the meantime, the advantage of this API is that it makes it much less
awkward to use than the StringView variant when you have an
Optional<FlyString> namespace to pass through.
2023-11-06 11:37:08 +01:00
Martin Janiczek 49dbc4b5a5 LibTest: Bump up MAX_GEN_ATTEMPTS_PER_VALUE to 30
The original value 15 was too little: it made our
`weighted_boolean_fair_false` test fail every now and then.

This is because a fair coin (P(false) = 0.5) will hit the same value 15
times in a row with a probability (1/2)^15: around once in a 32k tries.

With the bumped up value, this is now once in 1 billion tries. Should
lower the test flakiness enough (if our random number generator is
truly uniform), while 30 tries is still an OK amount of computation for
randomized tests to do, compared to 15.
2023-11-06 11:35:36 +01:00
Simon Wanner 7e3cfaf08c LibJS/JIT: Include headers before they are used
JIT_ARCH_SUPPORTED is defined in LibJIT/Assembler.h, so we need to
include it first.

This change also moves the non-JIT headers outside the #ifdef
2023-11-06 10:28:05 +01:00
Simon Wanner 64947506da LibJIT: Only include the Assembler header for the current platform 2023-11-06 10:28:05 +01:00
Nikodem Rabuliński bacbd830fe LibJIT: Make X86_64Assembler::native_call take u64 instead of void*
Now that x86-specific Assembler will be compiled on every architecture
we can't rely on void* being the right width.
It also fixes compilation on targets which have void*
be different length from u64 (WASM in particular).
2023-11-06 10:05:42 +01:00
Nikodem Rabuliński 8aa35f4fab LibJIT+LibJS: Rename Assembler to X86_64Assembler
This is in preparation for making LibJIT support multiple architectures.
Assembler will now be typedefed to the specific assembler
for a particular architecture.
Additionally, there's now JIT_ARCH_SUPPORTED which is defined on
architectures which LibJIT supports.
2023-11-06 10:05:42 +01:00
Nikodem Rabuliński 9f5450527f LibJS+LibJIT: Make Assembler::native_call accept preserved_registers
This makes JS::JIT::Compiler less architecture-specific
and unifies aligning the stack into a single operation,
where previously we were doing it separately for preserved registers
and for stack arguments.
2023-11-06 10:05:42 +01:00
0GreenClover0 8c7b393939 HackStudio: Create a progress bar update callback for each debug session
Instead of moving it out of the Debugger, which would lead to it
being null when trying to create next debug sessions afterwards.
2023-11-06 10:02:16 +01:00
0GreenClover0 eeddbb6fa6 HackStudio: Don't crash on null progress bar update function 2023-11-06 10:02:16 +01:00
Nico Weber bbd86ee4f3 LibPDF: Implement ExponentialInterpolationFunction 2023-11-06 10:01:05 +01:00
Nico Weber 1aed465efe LibPDF: Implement Fuction::create() 2023-11-06 10:01:05 +01:00
Nico Weber b78ea81de5 LibPDF: Implement SeparationColorSpace
Requires PDF::Function, which isn't implemented yet, so this has
no visual effect yet.
2023-11-06 10:01:05 +01:00
Nico Weber 9204252d02 LibPDF: Add scaffolding for function objects
See PDF 1.7 Spec, "3.9 Functions".
2023-11-06 10:01:05 +01:00
Nico Weber 21894f1cde LibPDF: Fix typos in DeviceN colorspace scaffolding
* Compare array size to 3 and 4, not 4 and 5
* Fix literal typo in error message

Fixes crash processing 0000906.pdf from 0000.zip from the pdf/a dataset.
2023-11-06 09:54:01 +01:00
Aliaksandr Kalenik b6da9abfb2 LibWeb: Implement draw_glyph_run in PaintingCommandExecutorGPU 2023-11-06 09:53:11 +01:00
Aliaksandr Kalenik ee28ba0c93 LibWeb: Use glyph run to store text paint command in RecordingPainter
Representing a text run panting command as a vector of glyphs, rather
than as a string simplifies collecting of unique glyphs which is a
prerequisite for `prepare_glyphs_texture()` call.
2023-11-06 09:53:11 +01:00
Aliaksandr Kalenik 32ea11d45c LibAccelGfx: Introduce glyph run painting support
Text painting operates in two steps:

1. Preparation of a texture that contains all the glyphs required for
   text painting, along with metadata that describes the locations of
   those glyphs within texture beforehand.
2. Blitting glyphs from the prepared texture onto corresponding glyph
   quads.

Users of LibAccelGfx will need to call `prepare_glyphs_texture()`,
passing a set of all unique (font, code_paint) pairs, before painting
any text.
2023-11-06 09:53:11 +01:00
Aliaksandr Kalenik efdbd8238e LibGfx: Decouple glyph positions calculation from draw_text_run()
This change separates a part of the `draw_text_run()` function, which
is responsible for calculating the positions for glyphs that need to be
painted, into a separate function called `get_glyph_run()`.

It is a part of the preparation for text run painting using OpenGL,
where we can't immediately blit glyph bitmaps but instead need to
prepare a sequence of quads for them in advance.
2023-11-06 09:53:11 +01:00
Timothy Flynn 818471b7a7 BrowserSettings+Ladybird: Convert home / new tab page to resource URIs 2023-11-06 09:39:59 +01:00
Timothy Flynn aa9387c76c LibCore: Add a Resource method to create a file:// URL from a resource 2023-11-06 09:39:59 +01:00
Timothy Flynn e9aa72ee98 LibCore: Remove [[nodiscard]] attribute from Resource implementations
This attribute is only needed on the declarations in the header.
2023-11-06 09:39:59 +01:00
Timothy Flynn 98a82565cd LibCore: Do not return an Optional from Resource:::filesystem_path
This API never returns OptionalNone, and all callers already assume as
much.
2023-11-06 09:39:59 +01:00
Nico Weber 30ea218e35 LibPDF: Implement IndexedColorSpace 2023-11-05 14:27:22 -07:00
Nico Weber 0b087c02a3 LibPDF: Add spec link to default_decode() 2023-11-05 14:27:22 -07:00
Nico Weber 3dca11c4e2 LibPDF: Move color space creation from name or array into ColorSpace
No behavior change.
2023-11-05 14:27:22 -07:00
Nico Weber 1dfd49ef99 LibPDF: Implement LabColorSpace 2023-11-05 14:27:22 -07:00
Daniel Bertalan 6f972c190b Everywhere: Work around Clang trunk bug with templated lambda + Variant
Since 2023-09-08, Clang trunk has had a bug which causes a segfault when
evaluating certain `requires` expressions inside templated lambdas.
There isn't an imminent fix on the horizon, so let's work around the
issue by specifying the type of the offending lambda arguments
explicitly.

See https://github.com/llvm/llvm-project/issues/67260
2023-11-05 13:41:13 -07:00
Simon Wanner eaf8c2e398 LibJS: Improve error messages for primitive strict mode property access
Using ErrorType::ReferencePrimitiveSetProperty the errors for primitives
now look like "Cannot set property 'foo' of number '123'".

The strict-mode-errors test has been adjusted and re-enabled.
2023-11-05 18:44:48 +01:00
Simon Wanner b9c9315bcb LibJS: Assign getter/setter function names as early as possible
In case of {get func() {}, set func() {}} we were wrongly setting the
function name to 'func' and then later trying to replace an empty name
with 'get func'/'set func' which failed.

Instead, set the name to 'get func'/'set func' right away.
The code in put_by_property_key is kept, for when that is called
by put_by_value.
2023-11-05 18:44:48 +01:00
Simon Wanner a3f34263fd LibJS: Allow division after this token
This fixes the root cause of #21747, so it makes the clock work on
https://toaruos.org
2023-11-05 18:44:48 +01:00
Simon Wanner 969d9e1fd3 LibJS: Remove expensive dead code in get_source_range
This was forgotten when cleaning up debug prints but has a huge
performance impact (around 1s / 15% on test-js).
2023-11-05 18:44:48 +01:00
Shannon Booth 4821d284c6 LibWeb: Add support for inline SVG element scripts 2023-11-05 11:16:16 +00:00
Shannon Booth c4efc0a5aa LibWeb: Add Web::XLink::AttributeNames
As defined by the XLink spec.
2023-11-05 11:16:16 +00:00
Shannon Booth e5d45eeeb1 LibWeb: Properly append attributes to element when creating an Element
The main behavioural difference here is that the full qualified name is
appended to the element, rather than just the local name and value.
2023-11-05 11:16:16 +00:00
Shannon Booth 8fbf72b5bf LibWeb: Port HTMLToken prefix and namespace to Optional<FlyString>
Previously these were DeprecatedStrings that contained a null state.
After the null state was removed, the nullability of these members was
broken. This doesn't seem to cause any problems currently as the HTML
parser is not inserting attributes with their full qualified name, but
after we fix that problem, this bug surfaces.
2023-11-05 11:16:16 +00:00
Shannon Booth fcde808308 LibWeb: Avoid copy of local_name in HTMLParser::create_element_for 2023-11-05 11:16:16 +00:00
Shannon Booth 19ca6f68ba LibWeb: Expose NamedNodeMap::append_attribute in Element 2023-11-05 11:16:16 +00:00
Shannon Booth 907be5a96e LibWeb: Add spec comment for HTMLParser::adjusted_current_node
I've found myself looking at this function a bunch while debugging.
2023-11-05 11:16:16 +00:00
Andreas Kling 0a8eb59a05 LibWeb: Remove Deprecated*String usage in SelectorEngine 2023-11-05 10:05:24 +01:00
Timothy Flynn cc316de0ee LibWebView: Remove the now-unused LibGUI model implementations 2023-11-05 09:11:23 +01:00
Timothy Flynn 30fac0abb9 Browser: Convert the inspector widget to the WebView model class
This creates a LibGUI-specific wrapper around the WebView model classes
and uses it for the inspector widget tree / table view models.
2023-11-05 09:11:23 +01:00
Timothy Flynn 0aa375441a Browser: Mark the DOM tree as loaded before selecting any DOM node
The first thing that `set_selection` does is return early if the DOM-
loaded flag is false. Set it to true so it can actually do something.
This fixes inspecting a DOM node from the context menu.
2023-11-05 09:11:23 +01:00
Timothy Flynn 4d356cfca5 LibWebView: Create a PropertyTableModel helper class for table models
We currently have StylePropertiesModel and AriaPropertiesStateModel in
LibWebView. These depend on GUI::Model and GUI::ModelIndex, which is the
only reason that the non-Serenity Ladybird chromes require LibGUI.
Further, these classes are very nearly idenitical.

This creates a PropertyTableModel to provide the base functionality for
all table-based model types used by all Ladybird chromes. It contains
code common to the style / ARIA table models, and handles the slight
differences between the two (namely, just the manner in which the values
are flattened into a list during construction).

The Qt and Serenity chromes can create thin wrappers around this class
to adapt its interface to their chrome-specific model classes (i.e.
QAbstractItemModel and GUI::Model).
2023-11-05 09:11:23 +01:00
Timothy Flynn 3999c74237 LibWebView: Create a TreeModel helper class for DOM/accessibility models
We currently have DOMTreeModel and AccessibilityTreeModel in LibWebView.
These depend on GUI::Model and GUI::ModelIndex, which is the only reason
that the non-Serenity Ladybird chromes require LibGUI. Further, these
classes are very nearly idenitical.

This creates a TreeModel class to provide the base functionality for all
tree-based model types used by all Ladybird chromes. It contains code
common to the DOM / accessibility tree models, and handles the slight
differences between the two (namely, just the formatting of each node's
text for display).

The Qt and Serenity chromes can create thin wrappers around this class
to adapt its interface to their chrome-specific model classes (i.e.
QAbstractItemModel and GUI::Model).
2023-11-05 09:11:23 +01:00