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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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).
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).
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.
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.
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.
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.
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.