Commit graph

36577 commits

Author SHA1 Message Date
Ali Mohammad Pur
d6ce3e63e2 Kernel: Disallow elevating pledge promises with no_error set
8233da3398 introduced a not-so-subtle bug
where an application with an existing pledge set containing `no_error`
could elevate its pledge set by pledging _anything_, this commit makes
sure that no new promise is accepted.
2022-03-29 12:11:56 +02:00
Sebastian Rueth
4707b3a8a1 Ports: Update zlib to 1.2.12 2022-03-29 12:10:13 +02:00
Andreas Kling
03008d9c9c LibWeb: Ensure that TextNode::ChunkIterator emits preserved newlines
When doing max-content layout, we were not committing newlines even
though we were supposed to due to white-space:pre*.

This broke the WPT harness due to a VERIFY() in ChunkIterator where we
were assuming the commit would always succeed.

Thanks to Orphis for reporting this! :^)
2022-03-29 03:05:11 +02:00
Andreas Kling
a6eb031058 LibWeb: Use correct top content edge when calculating auto block heights
When the spec tells us to measure from the top content edge of a block,
that just means we should measure from Y=0. We don't need to go looking
for a child box with a negative top offset and measure from there.
2022-03-29 02:59:00 +02:00
Matthew Olsson
4e81663b31 LibPDF: Attempt to unecrypt strings and streams 2022-03-29 02:52:57 +02:00
Matthew Olsson
60c3e786be LibPDF: Require Document* in Parser constructor
This makes it a bit easier to avoid calling parser->set_document, an
issue which cost me ~30 minutes to find.
2022-03-29 02:52:57 +02:00
Matthew Olsson
a8de9cf541 LibPDF: Keep track of the current object index/generation while Parsing
This information is required to decrypt encrypted strings/streams.
2022-03-29 02:52:57 +02:00
Matthew Olsson
5b316462b2 LibPDF: Add implementation of the Standard security handler
Security handlers manage encryption and decription of PDF files. The
standard security handler uses RC4/MD5 to perform its crypto (AES as
well, but that is not yet implemented).
2022-03-29 02:52:57 +02:00
Matthew Olsson
c98bda8ce6 LibPDF: Get rid of PlainText/Encoded StreamObject
This was a small optimization to allow a stream object to simply hold
a reference to the bytes in a PDF document rather than duplicating
them. However, as we move into features such as encryption, this
optimization does more harm than good. This can be revisited in the
future if necessary.
2022-03-29 02:52:57 +02:00
Matthew Olsson
15b7999313 LibPDF: Change CommonNames' enumerator macro parameter name
Apparently "V" is a PDF property. Let's hope "A" isn't!
2022-03-29 02:52:57 +02:00
Matthew Olsson
9a4a3318a9 LibPDF: Store a PDFFont in the Renderer's text state 2022-03-29 02:52:57 +02:00
Matthew Olsson
0624472768 LibPDF: Add initial support for Type1 fonts
This is enough to get a char code -> code point mapping
2022-03-29 02:52:57 +02:00
Matthew Olsson
8441fa2bc4 LibPDF: Add support for builtin and custom Encodings 2022-03-29 02:52:57 +02:00
Andreas Kling
1f9aed2617 LibWeb: Load and use fonts described by @font-face rules :^)
When encountering a @font-face rule, StyleComputer will now fire off
a resource request and download the first source URL specified.

Once downloaded, we try to parse it as a TrueType font file, and if it
works, it's added to a cache in StyleComputer. This effectively makes
fonts per-document since every document has its own StyleComputer.

This is very unoptimized and could definitely use some caching, etc.
But it does work on Acid3. :^)
2022-03-29 02:14:20 +02:00
Karol Kosek
dcb24e943d Tests: Add a basic UTF-8 to UTF-8 LibTextCodec test 2022-03-29 01:01:32 +02:00
Karol Kosek
b006a60366 LibTextCodec: Pass code points instead of bytes on UTF-8 string process
Previously we were passing raw UTF-8 bytes as code points, which caused
CSS content properties to display incorrect characters.

This makes bullet separators in Wikipedia templates display correctly.
2022-03-29 01:01:32 +02:00
Simon Wanner
7e4793df63 LibWeb: Size table cells using a combination of min- and max-widths
This gets us a bit closer to the recommended algorithms in CSS 2.2 and
CSS Table Module 3.

A couple of table heavy websites (e.g. news.ycombinator.com,
html5test.com, etc.) now look quite okay. :^)
2022-03-29 00:39:57 +02:00
Simon Wanner
bc4974648c LibWeb: Add HTMLTableCellElement::rowSpan 2022-03-29 00:39:57 +02:00
Simon Wanner
b7b647e9cd LibWeb: Add HTMLTableCellElement::colSpan 2022-03-29 00:39:57 +02:00
Simon Wanner
b92cc3670b LibWeb: Only size width: auto table-cells by min-content 2022-03-29 00:39:57 +02:00
Daniel Bertalan
3d0178a2f7 Meta: Do not try to unzip the already decompressed WASM test suite .tar
WASM_SPEC_TEST_TAR_PATH actually refers to a tarball that has already
been decompressed with gzip, so running `tar -xzf` on it fails.

I introduced this mistake in 66582a875f.

There is no need to keep an intermediary plain .tar file around, we can
pass the WASM_SPEC_TEST_GZ_PATH .tar.gz directly to `tar -xzf`.
2022-03-29 00:00:36 +02:00
Ali Mohammad Pur
5a0123fd2f LibWeb: Load X(HT)ML documents and transform them into HTML DOM 2022-03-28 23:11:48 +02:00
Ali Mohammad Pur
c1649e3372 LibWeb: Define HTML::perform_a_microtask_checkpoint()
This was declared and not defined.
2022-03-28 23:11:48 +02:00
Ali Mohammad Pur
67357fe984 LibXML: Add a fairly basic XML parser
Currently this can parse XML and resolve external resources/references,
and read a DTD (but not apply or verify its rules).
That's good enough for _most_ XHTML documents as the HTML 5 spec
enforces its own rules about document well-formedness, and does not make
use of XML DTDs (aside from a list of predefined entities).

An accompanying `xml` utility is provided that can read and dump XML
documents, and can also run the XML conformance test suite.
2022-03-28 23:11:48 +02:00
Ali Mohammad Pur
06cedf5bae AK: Add a 'OneOf' concept
Similar to 'SameAs', but for multiple types.
2022-03-28 23:11:48 +02:00
Ali Mohammad Pur
2a1a619eed AK: Display SourceLocation function name in color
It's much easier to spot the function name (which is what you often
expect) like this.
2022-03-28 23:11:48 +02:00
Ali Mohammad Pur
b3c18db463 AK: Add a 'is_not_any_of' similar to 'is_any_of' to GenericLexer
It's often useful to have the negated version, so instead of making a
local lambda for it, let's just add the negated form too.
2022-03-28 23:11:48 +02:00
Ali Mohammad Pur
e21fa158dd AK: Make Vector capable of holding forward-declared types
This is pretty useful for making trees.
2022-03-28 23:11:48 +02:00
Hendiadyoin1
bd6927ecab Meta: Refactor the IPC-compiler and port it to LibMain
This does a few things in total:
* Ports the IPC-compiler to LibMain
* Extract some compiler steps into separate functions
* Minify some appends to use appendln (or appendff in the case of
  StringBuilder)

This reduces the clang-tidies maximum cognitive-complexity score for
this file from 325 to under 100.
2022-03-28 23:08:08 +02:00
Hendiadyoin1
50b6e74d33 LibIPC: Add IPCErrorOr Type alias 2022-03-28 23:08:08 +02:00
Hendiadyoin1
6b20496758 AK: Add appendln helper to SourceGenerator 2022-03-28 23:08:08 +02:00
Hendiadyoin1
f6f7280fe3 AK: Explicitly move value String in SourceGenerator::set 2022-03-28 23:08:08 +02:00
Hendiadyoin1
14caecefb1 AK: Make SourceGenerator move constructible
This makes us able to return one from a function
2022-03-28 23:08:08 +02:00
Sam Atkins
6672c19c93 LibWeb: Parse @font-face rules
This is very limited for now, only caring about `font-family` and `src`.
2022-03-28 22:25:25 +02:00
Sam Atkins
804b8c85e8 LibWeb: Implement initial CSSFontFaceRule and FontFace classes
For now, this is the bare minimum that's needed: font-family and src.
2022-03-28 22:25:25 +02:00
Sam Atkins
1dcde57922 LibWeb: Bring "parse a list of declarations" closer to spec
The work to create a PropertyOwningCSSStyleDeclaration is now moved to
convert_to_style_declaration() instead.
2022-03-28 22:25:25 +02:00
Sam Atkins
da1a819858 LibWeb: Rename parse_css_declaration() -> parse_css_style_attribute() 2022-03-28 22:25:25 +02:00
Ali Mohammad Pur
bcbe258619 LibCore: Set the correct invariant length for consecutive short options
When completing `ls -l` to add another short option, the invariant
length should be zero as we are not replacing anything with our
suggestion.
Also skip the initial dash if there already is one.
Fixes #13301.
2022-03-28 20:02:49 +02:00
Karol Kosek
d665492e35 Spreadsheet: Don't remove on_change tab function after loading a file
Forgot to remove that in c0c9825f67, as
this function was no longer declared and used... Until the previous
commit.

This meant that pressing the F2 key after opening a file no longer
matched the current tab.
2022-03-28 22:28:40 +04:30
Karol Kosek
07b369b7d9 Spreadsheet: Create rename action using the GUI::CommonActions helper
Besides from reusing more parts from the code, this allows us to call
the action using the F2 key. That is also the reason why we have
to reassign `m_tab_context_menu_sheet_view` on tab change.
2022-03-28 22:28:40 +04:30
Karol Kosek
3b352e46d6 Spreadsheet: Reuse save and rename actions
These parts of code were identical to their action counterparts.
2022-03-28 22:28:40 +04:30
Daniel Bertalan
b23edd418c LibC: Fix inttypes.h macros for x86-64 and extend them
On x86-64, `int64_t` is defined to be `long` (not `long long`) , so for
printing, the "l" format specifier has to be used instead of i686's
"ll".

A couple of these macros weren't updated when the x86-64 target was
added, so using them produced warnings like this:

> warning: format specifies type 'long long' but the argument has type
> 'int64_t' (aka 'long') [-Wformat]
>
>       "DW_CFA_GNU_negative_offset_extended(%" PRId64 ")\n", offset);
>       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~

This commit changes the macros to be correct for both architectures, and
reorders them to be consistent and adds a couple missing ones for the
sake of completeness.
2022-03-28 22:24:05 +04:30
Tim Schumacher
022aed2541 Ports: Upgrade to sed 4.8 2022-03-28 10:38:02 -07:00
Tim Schumacher
4917a610ab LibC: Partially implement __fpending 2022-03-28 10:38:02 -07:00
Simon Wanner
304dbb0242 LibWeb: Set a cell's content width based on the column(s) it's in 2022-03-28 15:25:25 +02:00
Simon Wanner
6dbd00970d LibWeb: Calculate a cell's width using min-content 2022-03-28 15:25:25 +02:00
Simon Wanner
e5a779aecf LibWeb: Apply the layout_mode argument in BFC::compute_width 2022-03-28 15:25:25 +02:00
Simon Wanner
9b3229da17 LibWeb: Distribute the width of a table cell spanning multiple columns 2022-03-28 15:25:25 +02:00
Simon Wanner
4fe154bd6a LibWeb: Expand the last cell in a row to the right edge 2022-03-28 15:25:25 +02:00
Simon Wanner
5f265eebf5 LibWeb: Apply a table row's height to all cells 2022-03-28 15:25:25 +02:00