Commit graph

55586 commits

Author SHA1 Message Date
Nico Weber
cb961101c7 LibPDF: Implement CFF built-in Standard and Expert encodings
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.
2023-10-17 10:21:38 +02:00
Nico Weber
eeada4678c LibPDF: Postpone CFF encoding processing after Top DICT has been read
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.
2023-10-17 10:21:38 +02:00
Nico Weber
1cfe639b6c LibPDF: Implement CFF supplemental encoding
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.
2023-10-17 10:21:38 +02:00
Nico Weber
37daeae6fd LibPDF: Add spec comments, dbgln_if()s to CFF's parse_encoding() 2023-10-17 10:21:38 +02:00
Aliaksandr Kalenik
c41e742de4 LibWeb: Fix min-content width calculation in dimension_box_on_line()
If inline-block is sized under min-content width constraint we should
use its min-content width instead of max-content width like it was
before.
2023-10-16 21:44:48 +02:00
Ali Mohammad Pur
91bb3af505 Shell: Implement the '$*' special variable in the POSIX parser
Fixes #21421.
2023-10-16 19:11:37 +03:30
Ali Mohammad Pur
5cb994d4dd Shell: Minimally implement the 'set' builtin
This only implements the printing and argv setting behaviours.
2023-10-16 19:11:37 +03:30
Ali Mohammad Pur
867f7da017 AK: Avoid nullptr deref in DeprecatedString(DeprecatedFlyString const&)
Prior to this commit, constructing a DS from a null DFS would cause a
nullptr deref, which broke (at least) Profiler.
This commit converts the null DFS to an empty DS, avoiding the nullptr
deref (until DFS loses its null state, or we decide to not make it
convertible to a DS).
2023-10-16 09:06:15 -04:00
Timothy Flynn
a8f0fa5dd4 LibWebView+LibPublicSuffix: Merge LibPublicSuffix into LibWebView
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.
2023-10-16 09:06:02 -04:00
circl
a1cce69db0 LibWeb/HTMLInputElement: Improve appearance of color picker
Instead of a plain ButtonBox, it now appears as a color well styled
after the buttons.
2023-10-16 12:46:30 +01:00
circl
63cd6b0d3c LibWeb: Make Default.css clearer about the style of input elements
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>
2023-10-16 12:46:30 +01:00
circl
ce48ac3101 LibWeb/HTMLInputElement: Move text input shadow tree into a function 2023-10-16 12:46:30 +01:00
Liav A
81169ee6e6 DynamicLoader: Add an option to explicitly run an ELF executable binary
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.
2023-10-16 12:09:04 +02:00
Kenneth Myhra
a3073824a9 Ports/curl: Set CMake cache variable HAVE_GETADDRINFO_THREADSAFE to 1
According to the issue https://github.com/curl/curl/issues/12093 the
curl build doesn't properly detect that Serenity has getaddrinfo() and
outputs the following:
---
Performing Test HAVE_H_ERRNO_ASSIGNABLE
CMake Error: try_run() invoked in cross-compiling mode, please set the
following cache variables appropriately:
HAVE_H_ERRNO_ASSIGNABLE_EXITCODE (advanced)
---

Setting the CMake cache variable HAVE_GETADDRINFO_THREADSAFE=1 solves
the mentioned error.

Also see: https://github.com/curl/curl/pull/12094
2023-10-16 09:41:00 +02:00
Nico Weber
007d7cdd53 LibPDF: Fix sign (and fixed point) in glyph decoding opcode 24
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.
2023-10-16 08:33:35 +02:00
Nico Weber
96a4936567 LibPDF: Checking for built-in CFF encodings
Only prints a warning for them for now.

Also warn on the not-yet-implemented encoding supplement.
2023-10-16 08:32:18 +02:00
Nico Weber
414a164850 LibPDF: Be louder about unimplemented CFF dict entries 2023-10-16 08:32:18 +02:00
Nico Weber
c825194fb9 LibPDF: Reject CFFs with more than one font
The code assumes that there's just one Top DICT, so let's be loud
when that isn't the case.
2023-10-16 08:32:18 +02:00
Edwin Rijkee
8388fe51b5 Kernel: Add a framebuffer driver for 3Dfx Voodoo 3
A bit old but a relatively uncomplicated device capable of outputting
1920x1080 video with 32-bit color. Tested with a Voodoo 3 3000 16MB
PCI card. Resolution switching from DisplaySettings also works.

If the requested mode contains timing information, it is used directly.
Otherwise, display timing values are selected from the EDID. First the
detailed timings are checked, and then standard and established
timings for which there is a matching DMT mode. The driver does not
(yet) read the actual EDID, so the generic EDID in DisplayConnector now
includes a set of common display modes to make this work.

The driver should also be compatible with the Voodoo Banshee, 4 and 5
but I don't have these cards to test this with. The PCI IDs of these
cards are included as a commented line in case someone wants to give it
a try.
2023-10-16 01:25:45 +02:00
Liav A
77441079dd Kernel/HID: Introduce initial USB mouse support 2023-10-15 22:56:30 +02:00
Liav A
430e987078 Kernel/USB: Don't invoke async callback if transfer data size is 0
We can't do anything valuable with such "transfer" so just discard it.
2023-10-15 22:56:30 +02:00
Liav A
e7c1148ec6 Kernel/USB: Handle NAK correctly in a transfer status bits 2023-10-15 22:56:30 +02:00
Liav A
62c2c9df69 Kernel/HID: Add methods to attach and detach standalone devices 2023-10-15 22:56:30 +02:00
Liav A
83835c7256 Kernel/HID: Add boot option to disable PS2 Mouse 2023-10-15 22:56:30 +02:00
MacDue
95bf6ddb8e LibGfx: Fix serializing Gfx::Bitmaps
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
2023-10-15 20:34:29 +02:00
MacDue
f0cd7adaf8 LibGUI: Fix FileSystemModel/FileManager after aeee98b
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.
2023-10-15 21:34:15 +03:30
Nico Weber
6f783929dd LibPDF: Implement support for CFF charset format 2
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.
2023-10-15 15:27:15 +02:00
Nico Weber
5b915fb15c LibPDF: Add more spec comments to parse_charset() 2023-10-15 15:27:15 +02:00
Nico Weber
49275c4b17 LibPDF: Don't overflow SIDs in type 1 charset parsing
first_sid has type SID (aka u16), so don't store it in an u8.

This fixes (among other things) page 24 on the PDF 1.7 spec.
2023-10-15 15:27:15 +02:00
Jelle Raaijmakers
403d3bbdaf LibSoftGPU: Optimize GPU::Vertex lists
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.
2023-10-15 12:14:07 +02:00
Jelle Raaijmakers
c978891dda LibGL: Optimize appends in gl_vertex
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%.
2023-10-15 12:14:07 +02:00
Jelle Raaijmakers
edcb6176ce LibGL+Lib*GPU: Set model view and projection matrices separately
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%. :^)
2023-10-15 12:14:07 +02:00
Jelle Raaijmakers
126adfc392 3DFileViewer: Set timer to 15ms instead of 20ms
This approaches 60FPS and feels a bit smoother.
2023-10-15 12:14:07 +02:00
Jelle Raaijmakers
77c16d2ae7 3DFileViewer: Show correct framerate
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.
2023-10-15 12:14:07 +02:00
kleines Filmröllchen
40fb41322e Kernel: Fix SipHash aarch64 boot regression
Moving the DeviceManagement initialization, which is only needed by
userland in the first place, to after interrupt and time management
initialization (like other things that require randomness) allows the
SipHash initialization to access good randomness without problems.

Note: There currently is another, unrelated boot problem on aarch64,
which is not caused by SipHash as far as we know. This commit therefore
only fixes the SipHash regression.
2023-10-15 09:40:04 +02:00
Nico Weber
23d6e9f577 LibPDF: Implement CFF built-in charsets ISOAdobe, Expert, Expert Subset 2023-10-15 09:33:34 +02:00
Nico Weber
8060957d8d LibPDF: Use Appendix A instead of Appendix C for standard names
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.
2023-10-15 09:33:34 +02:00
Nico Weber
aba787a441 LibPDF: Implement reading of CFF String Index
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.
2023-10-15 09:33:34 +02:00
Tim Ledbetter
9e3ee0e2b5 LibGfx/ILBM: Avoid buffer overrun when reading header chunk 2023-10-15 08:37:27 +02:00
Cubic Love
f2b7224d93 GamesSettings+LibCards: Make 'Red' the default card back
The red back is a more suitable default as it's a traditional vanilla
design and red is one of Serenity's brand colors.
2023-10-15 07:25:20 +02:00
Cubic Love
bd5296d6bb Base: Rename and update card backs
CobyCat has very kindly remastered their card backs to fit the new card
back dimensions of 72 x 102px with 3px rounded corners. This gives
cards 3px of inner border which looks much neater.

Also, all card names have been capitalized and the suffix '-deck'
removed to improve their appearance in GamesSettings.

Co-authored-by: Tom L <lemtom@users.noreply.github.com>
2023-10-15 07:25:20 +02:00
Timothy Flynn
94e4d59a08 LibWeb: Remove use of UnicodeData header from DOM::Element
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).
2023-10-15 07:23:30 +02:00
Kenneth Myhra
4f0af7b4de Ports: Update mc to 4.8.30 2023-10-15 07:16:04 +02:00
Kenneth Myhra
44865a8482 Ports: Update glib to 2.78.0 2023-10-15 07:16:04 +02:00
Kenneth Myhra
12bdac92e5 Ports: Update curl to 8.4.0 2023-10-15 07:16:04 +02:00
Sam Atkins
c9c99b3c42 LibWeb: Produce resolved transform value according to spec algorithm
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.
2023-10-15 07:14:39 +02:00
Sam Atkins
c65d6964ea LibWeb: Update layout if we lack a node when getting computed style
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.
2023-10-15 07:14:39 +02:00
Sam Atkins
642ad80960 LibWeb: Make CSS Transformation struct a proper class
Move it out of ComputedValues.h into its own files, and take the
transformation-to-matrix code from StackingContext.
2023-10-15 07:14:39 +02:00
Nico Weber
3c49d0dad3 LibPDF: Add a CFF_DEBUG toggle
I'd like to put some debug prints behind this soon.

No behavior change.
2023-10-15 07:14:29 +02:00
MacDue
11f7db8f34 LibWeb: Fix null optional dereference in Node::name_or_description()
Regression/typo from aeee98b, this lead to a crash when opening the DOM
inspector.
2023-10-14 18:36:32 -04:00