Commit graph

56081 commits

Author SHA1 Message Date
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
Andreas Kling
3ac77dac99 Tests/LibWeb: Remove the "scroll.html" layout test for now
This test is flaky, so let's remove it until we have a stable version.
2023-11-06 09:42:41 +01:00
Timothy Flynn
9249f8bda8 Ladybird: Convert theme configuration to resource URIs 2023-11-06 09:39:59 +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
1b30b510b9 Ladybird: Load all icons uses Core::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
Tim Ledbetter
2a1fc96650 AK: Avoid unnecessary String allocations for URL username and password
Previously, `URLParser` was constructing a new String for every
character of the URL's username and password. This change improves
performance by eliminating those unnecessary String allocations.

A URL with a 100,000 character password can now be parsed in ~30ms vs
~8 seconds previously on my machine.
2023-11-06 09:19:12 +01:00
Nico Weber
1ce422db08 Meta: Let test_pdf.py print number of files without problems 2023-11-06 09:17:46 +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
cf3c8a216b CMake: Disable Clang 18+ -Wvla-cxx-extension warning
This warning warns about variable-length arrays being a non-standard
extension to the C++ language. We still have a few instances of VLAs, so
let's disable the warning for now.

This does not interfere with `-Wvla`, which we use to completely forbid
this (potentially dangerous) feature in the Kernel and LibCrypto.
2023-11-05 13:41:13 -07:00
Daniel Bertalan
63a2039b51 Ladybird/AppKit: Fix -Wmissing-field-initializers with Clang 18+
Clang now warns about missing field initializers even when using
designated initializers.
2023-11-05 13:41:13 -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
Timothy Flynn
6c29fc07fc CI: Ensure test262 and test262-jit results are stored in the same file
This will allow BuggieBot to display both results from the /test262
command on Discord.
2023-11-05 15:02:21 -05: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
Ali Mohammad Pur
7a83870905 Meta: Run test262 with JIT compilation enabled in CI
This will let us have more :yakgraph:s!
2023-11-05 17:35:58 +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
bb43bd2dee Ladybird: Remove the now-unused ModelTranslator 2023-11-05 09:11:23 +01:00
Timothy Flynn
cc316de0ee LibWebView: Remove the now-unused LibGUI model implementations 2023-11-05 09:11:23 +01:00
Timothy Flynn
55b53e98d7 Ladybird/Qt: Convert the inspector widget to the WebView model class
This creates a Qt-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
c72b42ebb2 Ladybird/Qt: Add a couple of missing header includes
These are currently included implicitly, but this will no longer be the
case after upcoming refactoring.
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
Uku Loskit
2bec281ddc Kernel: Fix panic for Nagel's algorithm
It seems like the current implementation returns 0 in case we do not
have enough data for a whole packet yet. The 0 value gets propagated
to the return value of the syscall which according to the spec
should return non-zero values for non-errors cases. This causes panic,
as there is a VERIFY guard checking that more than > 0 bytes are
written if no error has occurred.
2023-11-05 09:07:39 +01:00
Rummskartoffel
dcbb8cf0ac NotificationServer: Make notifications not overlap when they appear
Before this patch, if two or more notifications were created after one
another, they would overlap. This was caused by the previously lowest
notification's m_original_rect being used to calculate the position for
each new notification instead of the notification's actual rect, which
can be different.
This patch makes notifications use each others' rect() method instead,
which makes them appear in the correct position. With that,
m_original_rect has no use anymore, so this patch removes it.
2023-11-05 09:06:33 +01:00
Rummskartoffel
a281fa3902 NotificationServer: Don't shuffle notifications on first hover
Before this patch, hovering with the mouse over one of at least two
newly created notifications would cause all notifications to be
reordered on the screen, when previously they appeared in order of
creation, growing downwards.
This happened because the position of all notifications is updated when
any of them is hovered, in case the hovered notification was resized.
By using an ordered HashMap instead, creation order is preserved.
2023-11-05 09:06:33 +01:00
Tim Ledbetter
438e9e146c LibGfx/JPEG: Refill reservoir if necessary when discarding bits
This condition was hit 157 times out of the 109,233 JPEG images in the
Govdocs1 corpus. This change allows all of these
images to load correctly.
2023-11-05 09:01:15 +01:00
MacDue
4c5d48f861 LibWeb: Support transforms, stroking, gradients, etc for SVG <text>
This makes use of the new Gfx::Path::text() to handle SVG text elements,
with this text is just a regular path, and can be manipulated like any
other graphics element.

This removes the SVGTextPaintable and makes both <text> and geometry
elements use a new (shared) SVGPathPaintable. This is identical to the
old SVGGeometryPaintable. This simplifies painting as once something is
resolved to a Gfx::Path, the painting logic is the same.
2023-11-05 02:46:46 +01:00
MacDue
50d33f79fa LibGfx: Allow extracting paths from fonts and add Gfx::Path::text()
This updates fonts so rather than rastering directly to a bitmap, you
can extract paths for glyphs. This is then used to implement a
Gfx::Path::text("some text", font) API, that if given a vector font
appends the path of the text to your Gfx::Path. This then allows
arbitrary manipulation of the text (rotation, skewing, etc), paving the
way for Word Art in Serenity.
2023-11-05 02:46:46 +01:00
kleines Filmröllchen
b4cabde4a4 LibELF: Add initial RISC-V support
This is an almost-minimal patchset to get RISC-V ELF files to pass
validation. Unlike other architectures, eflags are actually used here.
2023-11-04 22:13:52 +01:00