With this, all tables from the spec appendixes are in CFF.cpp.
This fixes a crash reading page 2 (and onward) of
2ThestructureoftheCIE1997ColourAppearanceModelCIECAM97s.pdf in
the pdffiles repo.
The encoding offset defaults to 0, i.e. the Standard Encoding.
That means reading the encoding only if the tag is present causes
us to not read it if a font uses the Standard Encoding.
Now, we always read an encoding, even if it's the (implicit) default
one.
The main encoding data maps glyph ID ("GID") to its codepoint.
If a glyph has several codepoints, then a secondary table mapping
codepoint to string ID ("SID") of the glyph's name is present.
(A separate table associates each glyph with its name already.)
I haven't seen this used in the wild, but the structure of the
supplemental data is also going to be needed for built-in encodings.
After d2c7e1ea7d, there is now only one
user of LibPublicSuffix - the URL sanitation utility within LibWebView.
Rather than having an entire library for the small Public Suffix data
accessor, merge it into LibWebView.
Previously, all input elements were given a textbox-like style by
default, this was then undone by another CSS rule in the case of certain
types of input element. This commit makes it so that the first rule
simply ignores those types instead.
Co-authored-by: Sam Atkins <atkinssj@serenityos.org>
If the user runs /usr/lib/Loader.so and pass a second string to argv, we
will try to run it as if it was running that program without invoking
the dynamic loader explicitly.
Two bugs:
1. We decoded a u32, not an i32 as the spec wants
2. (minor) Our fixed-point divisor was off by one
Fixes text rendering in Bakke2010a.pdf in pdffiles, and rendering of
other fonts with negative width adjustments from optcode 255.
That PDF was produced by "Apple pstopdf" and uses font SFBX1200,
which is apparently a variant of Computer Modern. So maybe this
helps with lots of PDFs produced from TeX files, but I haven't
checked that.
a396bb0 removed the palette field but did not update the allocation size
in `Bitmap::serialize_to_byte_buffer()`. This led to a few crashes (I
noticed this from a drag/drop crash in the file manager).
Fixes#21434
Previously, the null state of m_root_path was use to (subtly) mark the
parent of the root. The empty path is always replaced with "." so after
aeee98b there was no "parent of root" node. This lead to the file
manager crashing when opened.
I haven't seen this being used in the wild (yet), but it's easy
to implement, and with this we support all charset formats.
So we can now mention if we see a format we don't know about.
On my machine, benchmarking 3DFileViewer revealed ~2.5% of CPU time
spent in `Vector<GPU::Vertex>::try_append`. By carefully managing list
capacities, we can remove this method from profiles altogether.
Optimize a very hot function by always performing unchecked appends.
When benchmarking 3DFileViewer on my machine, this takes the time spent
in `gl_vertex` down from ~8% to ~2%.
LibSoftGPU used to calculate the normal transformation based on the
model view transformation for every primitive, because that's when we
sent over the matrix. By making LibGL a bit smarter and only update the
matrices when they could have changed, we only need to calculate the
normal transformation once on every matrix update.
When viewing `Tuba.obj` in 3DFileViewer, this brings the percentage of
time spent in `FloatMatrix4x4::inverse()` down from 15% to 0%. :^)
We were confusing the time spent rendering with the time spent rendering
_and_ waiting for the next frame, which is important since we render
frames on a timer.
From "10 String INDEX":
"Further space saving is obtained by allocating commonly occurring
strings to predefined SIDs. These strings, known as the standard
strings, describe all the names used in the ISOAdobe and Expert
character sets along with a few other strings common to Type 1 fonts. A
complete list of standard strings is given in Appendix A. The client
program will contain an array of standard strings with nStoStrings
elements. Thus, the standard strings take SIDs in the range 0 to
(nStaStrings-1)."
And "13 Charsets" says that charsets store SIDs.
Fixes all
"Couldn't find string for SID $n, going with space"
messages when going through the encoding pages (page 1010 and
thereabouts) in the PDF 1.7 spec.
Only really useful for reading SIDs in the Top DICT (copyright
text etc), which we currently don't do.
I haven't seen a difference from looking things up in the string
table. The only real effect from the commit that I need is that
it pulls a local resolve() labmda into a real function
resolve_sid(), which I want to call in a future commit.
But it makes things more spec-compliant, and if we ever want to
read SIDs in metadata in the future, now we can.
The UnicodeData header cannot be included by any file other than .cpp
files within LibUnicode itself. Outside users cannot assume the header
will exist, as it will not be generated if the CMake option to do so is
disabled (ENABLE_UNICODE_DATABASE_DOWNLOAD).
We now produce a `matrix3d()` value when appropriate.
Some sites (such as gsap.com) request the resolved style for `transform`
when there's no viewport paintable, but the element itself does already
have a stacking context. This fixes crashes in that case, because we now
do not access the stacking context at all.
We also do not wrap the result as a StyleValueList any more. The
returned StyleValue is only serialized and exposed to JS, so making it a
StyleValueList has no effect.
As noted, there are two situations where an element will have no layout
node here:
1. The element is invisible in a way that it generates no layout node.
2. We haven't built the layout yet.
This protects against the second case, which would otherwise incorrectly
send us down the path of looking directly at the computed style.
That API came from a mistake in the IDL compiler, where reflected
nullable attributes would try to call set_attribute(name, null).
This commit fixes the mistake in the IDL generator, and removes the
meaningless API.
We currently implement several forms of this method across the Ladybird
chromes. As such, we see commits to add special URL handling that only
affects a single chrome. Instead, let's consolidate all special handling
in a single location for all chromes to make use of.
This method can handle resolving file:// URLs, falling back to a search
engine query, and validation against the Public Suffix List. These cases
were gathered from the various chromes.
This makes the parser more resilient to invalid IMAP messages.
Usages of `Optional` have also been removed where the empty case is
equivalent to an empty object.
This commit removes DeprecatedString's "null" state, and replaces all
its users with one of the following:
- A normal, empty DeprecatedString
- Optional<DeprecatedString>
Note that null states of DeprecatedFlyString/StringView/etc are *not*
affected by this commit. However, DeprecatedString::empty() is now
considered equal to a null StringView.
We'd unconditionally get the int from a Variant<int, float> here,
but PDFs often have a float for defaultWidthX and nominalWidthX.
Fixes crash opening Bakke2010a.pdf from pdffiles (but while the
file loads ok, it looks completely busted).
We already set these variables and call `_init` in the dynamic linker.
As we don't care about static binaries, remove these assignments and the
call to `_init` from `_entry`.
The function referenced by DT_INIT is also not necessarily called
`_init`, so directly calling `_init` is not really correct.
`s_global_initializers_ran` and `__stack_chk_guard` are unused, so
remove them.
We currently don't call any DT_FINI_ARRAY functions, so change that.
The call to `_fini` in `exit` is unnecessary, as we now call the
function referenced by DT_FINI in `__call_fini_functions`.
We currently store a StringView into the DeprecatedString provided to
SVGUseElement::attribute_changed. This is a temporary string created by
String::to_deprecated_string, so this StringView is always a dangling
pointer.
Instead, since this string value is an ID and is primarily used as a
FlyString, store it as a FlyString from the get-go.
This was the only remaining codec that produced IndexedN bitmaps.
By removing them, we'll be able to get rid of those formats and simplify
the Bitmap and Painter classes.
Instead of resolving lengths used in the backdrop-filter during
painting, we can do that earlier in apply_style().
This change moves us a bit closer to the point when the stacking
context tree will be completely separated from the layout tree :)
Previously, every time a page switched fonts, we'd completely
re-parse the font.
Now, we cache fonts in Renderer, effectively caching them per page.
It'd be nice to have an LRU cache across pages too, but that's a
bigger change, and this already helps a lot.
Font size is part of the cache key, which means we re-parse the same
font at different font sizes. That could be better too, but again,
it's a big help as-is already.
Takes rendering the 1310 pages of the PDF 1.7 reference with
Build/lagom/bin/pdf --debugging-stats \
~/Downloads/pdf_reference_1-7.pdf
from 71 s to 11s :^)
Going through pages especially in the index is noticeably snappier.
(On the PDF 2.0 spec, ISO_32000-2-2020_sponsored.pdf, it's less
dramatic: From 19s to 16s.)
This allows the decoder to fail gracefully when reading a partial or
malformed TBSCertificate. We also now ensure that the certificate data
is valid before making a copy of it.
493dd5d93c caused the `::before`
pseudo-element node to be inserted before the element's content, which
caused issues with how we determine where to insert inline nodes into
the layout tree. At the time, I noticed the issue with contents of flex
containers, and prevented them from merging into a `::before` box.
However, a similar situation happens when we're not in a flex container,
but the pseudo-element has `display: block`. This commit fixes that
situation by using the same logic in both places, so a similar mistake
can't be made again.
This fixes the tab text being invisible on GitHub project pages. :^)
Previously, `load_from_memory()` just took a raw pointer to the data,
and then manually calculated offsets from that pointer. Instead, let's
use the MappedFile we already have, to stream in the data, to make
things a bit safer. We also now check that the entire file's data was
read, since if there was data left over, then either the file is bad or
we've done something wrong.
I've moved the code directly into `try_load_from_mapped_file()` since
`load_from_memory()` was only called from there. The extra indirection
wasn't adding anything.
Turns out this was hurting performance instead of helping it.
By removing the inline capacity, we shrink the size of ExecutionContext
by 512 bytes, which substantially reduces the stack pressure created by
JS recursion (each call creates a new ExecutionContext on the stack).
4.4% speed-up on the entire Kraken benchmark :^)
Previously every file that included Executable.h (which is pretty much
most LibJS and LibHTML files, given that VM.h needs it) had the whole
definition of LibRegex, which was slowing down source parsing.
Window.h is a rather heavy file, so let's try not to include it in
header files when we can!
Element.h now also includes LibWeb/Bindings/Intrinsics.h, but that's
just out of my laziness. Most if not all objects call
`Bindings::ensure_web_prototype<>()` anyway, so I don't think we would
gain much by sticking the header to source files instead.
We needed to keep the old versions of these functions around before all
of the IDL interfaces were ported over to new AK String, but now that is
done, we can remove the deprecated versions of these functions.
When we hit the cache in GetGlobal, we don't need the identifier string
at all, so let's defer fetching it until after the cache miss.
7% speed-up on Kraken/imaging-gaussian-blur.js :^)
We were incorrectly offsetting the static position of abspos children of
flex containers by the padding twice. This was a misguided attempt to
adjust to the abspos containing block being the padding box, not the
content box.
Fixes#21344.
Also remove the hack for SVG documents, a well-formed SVG document has
the correct xmlns attribute set, which should be automatically picked up
by the builder now.
If we have a cached environment coordinate that hasn't been screwed
by eval(), we can get the value directly without instantiating a
Reference.
15% speed-up on Octane/zlib.js :^)
The POSIX specification for `find` says that: "Each path operand shall
be evaluated unaltered as it was provided, including all trailing
<slash> characters". This also matches the behavior of `find` on
FreeBSD and Linux.
The functions for registering and unregistering MarkedVector, Handle,
etc. were quite prominent in benchmark profiles.
4% speed-up on the entire Kraken benchmark :^)
(including: 7% speed-up on Kraken/imaging-gaussian-blur.js, the current
slowest subtest)
There were some unhandled paths due to the liberally typed XHR response
object. This patch flushes out those issues by using a tighter type set
in the Variant. (NonnullGCPtr<Object> instead of Value)
These functions all have a very common case that can be dealt with a
very simple inline check, often avoiding the need to call an out-of-line
function. This patch moves the common case to inline functions in a new
ValueInlines.h header (necessary due to header dependency issues..)
8% speed-up on the entire Kraken benchmark :^)
Replaces `set_tooltip_deprecated(string);` with
`set_tooltip(MUST(String::from_deprecated_string(string)));`
purely to get rid of the deprecated function in the following commit.
This most importantly gets rid of a chain of "String to DeprecatedString
to String" transformations when setting a tooltip from GUI::Widget's
set_tooltip function.
As the newly created function has been also applied to printing the
number of matched file lines, file names will now also be colored
with the `--count` option set. :^)
Previously we had two somewhat duplicated methods: one just for handling
stdin with the standard C API, and the other one used for everything
else with our Core::File class. By using always Core::File, the code
should be now a little bit cleaner.
Additionally, grep will now use the standard input when it finds a '-'
argument (previously it tried to open a file with that name.)
For example, the locale "fr-FR" will have the preferred hour cycle list
of "H hB", meaning h23 and h12-with-day-periods. Whether date-times are
actually formatted with day-periods is up to the user, but we need to
parse the hour cycle as h12 to know that the FR region supports h12.
This bug was revealed by LibJS no longer blindly falling back to h12 (if
the `hour12` option is true) or h24 (if the `hour12` option is false).
This is an editorial change in the ECMA-262 spec. See:
https://github.com/tc39/ecma262/commit/73926a5
The idea here is to reduce duplication of these AOs between ECMA-262,
ECMA-402, and Temporal. This patch contains only the ECMA-262 changes.
We currently only return primary time zones, i.e. time zones that are
not a Link. LibJS will require knowledge of Link entries, and whether
each entry is or is not a Link.
This patch adds a fast path to the PutByValue bytecode op that bypasses
a ton of things *if* a set of assumptions hold:
- The property key must be a non-negative Int32
- The base object must not interfere with indexed property access
- The base object must have simple indexed property storage
- The property key must already be present as an own property
- The existing value must not have any accessors defined
If this holds (which it should in many common cases), we can skip all
kinds of checks and poke directly at the property storage, saving time.
16% speed-up on the entire Kraken benchmark :^)
(including: 88% speed-up on Kraken/imaging-desaturate.js)
(including: 55% speed-up on Kraken/audio-fft.js)
(including: 54% speed-up on Kraken/audio-beat-detection.js)
This patch adds a fast path to the GetByValue bytecode op that bypasses
a ton of things *if* a set of assumptions hold:
- The property key must be a non-negative Int32
- The base object must not interfere with indexed property access
- The property key must already be present as an own property
- The existing value must not have any accessors defined
If this holds (which it should in the common case), we can poke directly
at the indexed property storage and save a boatload of time.
10% speed-up on the entire Kraken benchmark :^)
(including: 31% speed-up on Kraken/audio-dft.js)
(including: 23% speed-up on Kraken/stanford-crypto-aes.js)
This function must return true if the object may intercept and customize
access to indexed properties (properties where the property name is a
non-negative integer.)
This will be used to implement fast path optimizations for array-like
accesses in subsequent commits.
The "dependency" lines really belong to the main port entry, it doesn't
make sense logically to represent them separately and handling them
together will also allow easier dependency management later on. This
commit greatly simplifies the port database parsing to facilitate this,
and removes the -d option from the command line. Instead, ports are
listed with their dependencies, if they have any.
The strings will get deduplicated when actually turned into
PrimitiveString objects at runtime anyway, and keeping the string
tables deduplicated was actually wasting a lot of time.
4.4% speed-up on Kraken/stanford-crypto-ccm.js :^)
Color::lightened() and Color::darkened() multiply the color values, so
they don't work for black. So for simplicity, we use a semi-transparent
white or black instead.
The following snippet would cause "i" to be incremented twice(!):
let a = []
let i = 0
a[++i] += 0
This patch solves the issue by remembering the base object and property
name for computed MemberExpression LHS in codegen. We the store the
result of the assignment to the same object and property (instead of
computing the LHS again).
3 new passes on test262. :^)
When the spec says to call "! TrimString", we should use MUST instead
of TRY. (We were previously using TRY in order to propagate OOM errors,
but we don't care about such OOMs anymore.)
Alter the card dimensions to be 80x110px with a corner radius of 7px.
This is inspired by the dimensions of physical playing cards. It gives
12px of padding between the illustration and the card's border.
Move the card letter and symbol closer to the edge to make space.
Adjust the Club symbol to have the same dimensions as the other symbols.
The program now terminates with an error if the command passed to
`-exec` is not terminated with a semicolon.
This commit also ensures that the argument containing the terminating
semicolon must be 1 byte long. Previously, any argument whose first
byte was a semicolon was treated as a valid terminator.
This behaves identically to the `-exec` option but prompts the user
for confirmation before executing the specified command.
A command is executed if a line beginning with 'y' or 'Y' is entered
by the user. This matches the behavior of `find` on Linux and FreeBSD
when using the POSIX locale.
Previously, we would divide the widget width and height by the tile size
and round up, which did not result in enough tiles to cover the entire
widget. Although this calculation is correct if you starting drawing
tiles in the top left corner, we have an additional offset to account
for.
Now, we take the number of tiles that fit in the widget completely and
pad it with 2 tiles to account for the partial left/right and top/bottom
sides. An additional tile is added to account for the iterator
translating by width / 2, which rounds down again.
The resulting tile rects are always intersected with the widget
dimensions, so even if we're generating more tile coordinates than
strictly necessary, we're not performing the actual download or draw
operations.
The `operator++` of the spiraling tile iterator was repeating the first
coordinates (`0, 0`) instead of moving to the next tile on the first
iteration. Swapping the move and check ensures we get to the end of the
iterator, fixing gray tiles that would sometimes pop up in the lower
right.
Since we never return from `operator++` without setting a valid
position, we can drop `current_x` and `current_y` and just use the
`Gfx::Point<T>` directly.
Since we divide the width and height of the downscaled tiles by 2,
bilinear blending is identical to box sampling and should be preferred
since it's the simpler one of the two algorithms.