Commit graph

41151 commits

Author SHA1 Message Date
Tim Schumacher
72c059535e Ports: Follow symlinks while discovering whether a port has patches
This enables us to use `./package.sh dev` with LLVM and GCC.
2022-09-18 13:00:46 +04:30
Tim Schumacher
4d29489705 Ports: Keep [...] prefixes while importing patches
This stops us from mangling our LLVM patch names and titles when using
`./package.sh dev`, as they like to put their category names in square
brackets.
2022-09-18 13:00:46 +04:30
Andreas Kling
e6ef366859 LibWeb: Implement basic support for Document.all
The finer details are missing here, but the basic API is up.
2022-09-18 02:17:29 +02:00
Andreas Kling
3df9861814 LibWeb: Capture self as a WeakPtr in ResourceClient::set_resource()
It's not safe to capture `this` as a raw pointer here, since nothing
is guaranteed to keep the ResourceClient alive (even if the Resource
stays alive.)
2022-09-18 02:15:01 +02:00
Andreas Kling
fa2dd4cbe3 LibWeb: Make Document vend the same HTMLCollections every time 2022-09-18 02:08:01 +02:00
Andreas Kling
1903dff365 LibWeb: Support getting and setting Attr.textContent 2022-09-18 02:08:01 +02:00
Andreas Kling
530675993b LibWeb: Rename Attribute to Attr
This name is not very good, but it's what the specification calls it.
2022-09-18 02:08:01 +02:00
Andreas Kling
3c3ae3a768 LibWeb: Only uppercase qualified names in HTML documents
This takes care of an old FIXME now that we can distinguish between HTML
and non-HTML documents.
2022-09-18 00:53:26 +02:00
Andreas Kling
dc6e625680 LibWeb: Make ParentNode.children vend the same HTMLCollection every time
Instead of creating a new HTMLCollection every time you access
.children, we now follow the spec and vend the same object.

This was annoyingly difficult before, and trivial now that the DOM is
garbage-collected. :^)
2022-09-18 00:42:33 +02:00
Andreas Kling
6b3293a74b LibWeb: Support getElementsByTagName() properly in non-HTML documents 2022-09-18 00:39:42 +02:00
Andreas Kling
bd0648a492 LibWeb: Simplify getElementsByTagName{,NS}() filters
Everything below the collection root is a descendant of the collection
root, so there's no need to check is_descendant_of() :^)
2022-09-18 00:37:24 +02:00
Mykola
b371b31841 Base: Add some cool new emojis
Some emojis were modified to be more in style with
the new calendar emoji.

Date has been changed from July 24 to October 10.
October 10 is the date of the first release of SerenityOS.

   Modified:
📅 - U+1F4C5 CALENDAR
📆 - U+1F4C6 TEAR-OFF CALENDAR

   New:
🗓 - U+1F5D3 SPIRAL CALENDAR
🌳 - U+1F333 DECIDUOUS TREE
🔪 - U+1F52A KITCHEN KNIFE
🪐 - U+1FA90 RINGED PLANET
🎶 - U+1F3B6 MUSICAL NOTES
🏷️ - U+1F3F7 LABEL
🧰 - U+1F9F0 TOOLBOX
2022-09-18 00:28:47 +02:00
Timothy Flynn
302b6e966f LibTimeZone: Generate DST rule timestamps at compile time
Rather than invoking AK::Time::from_timestamp at runtime, we can do so
at compile time. This reduces invoking TimeZone::get_time_zone_offset
100,000 times in a loop from about 7 seconds to 30 milliseconds.
2022-09-17 23:21:32 +02:00
Andreas Kling
e72896e35e LibWeb: Get default fonts via Platform::FontPlugin
Instead of asking Gfx::FontDatabase for the "default font" and the
"default fixed-width font", we now proxy those requests out via
the Platform::FontPlugin. This will allow Ladybird to use other default
fonts as fallback.
2022-09-17 21:27:32 +02:00
Sam Atkins
07a0d9df30 WrapperGenerator: Use the new shiny Overload Resolution Algorithm :^)
We compute the effective overload sets for each argument count at build
time, to save us having to do it every time a function with overloads
is called.
2022-09-17 21:27:17 +02:00
Sam Atkins
ebc29842c8 LibWeb: Start implementing the IDL Overload Resolution Algorithm :^)
There are a *lot* of FIXME's here. :yakoverflow:
2022-09-17 21:27:17 +02:00
Sam Atkins
0d2d5ba02c LibIDL: Implement EffectiveOverloadSet
This requires a little explanation. The overload resolution algorithm,
where this is used, repeatedly has steps like this:

> Otherwise: if V is a platform object, and there is an entry in S that
> has one of the following types at position i of its type list,
>  - an interface type that V implements
>  - object
>  - a nullable version of any of the above types
>  - an annotated type whose inner type is one of the above types
>  - a union type, nullable union type, or annotated union type that has
>    one of the above types in its flattened member types
> then remove from S all other entries.

So, the API here tries to match that. We save the matching entry when
checking through them and then use that in `remove_all_other_entries()`.

Removing all those entries when all we actually care about is looking at
that one matching entry feels silly, but sticking to the spec is more
important while things are still half-implemented. :^)
2022-09-17 21:27:17 +02:00
Sam Atkins
8b4cc07a54 LibIDL+WrapperGenerator: Implement Type::is_distinguishable_from()
As part of this, I've moved a couple of methods for checking for
null/undefined from UnionType to Type, and filled in more of their
steps.

This now detects more, and so causes us to hit a `TODO()` which is too
big for me to go after right now, so I've replaced that assertion with
a log message.
2022-09-17 21:27:17 +02:00
Sam Atkins
7c8ef79898 LibIDL+WrapperGenerator: Make it easier to work with IDL::Type classes
Track the kind of Type it is, and use that to provide some convenient
`is_foo()` / `as_foo()` methods. While I was at it, made these all
classes instead of structs and made their data private.
2022-09-17 21:27:17 +02:00
Sam Atkins
c4668053d1 LibIDL+WrapperGenerator: Move IDL code into a library
IDL function overload resolution requires knowing each IDL function's
parameters and their types at runtime. The simplest way to do that is
just to make the types the generator uses available to the runtime.

Parsing has moved to LibIDL, but code generation has not, since that is
very specific to WrapperGenerator.
2022-09-17 21:27:17 +02:00
Sam Atkins
634a52b589 WrapperGenerator: Clarify function-length getter name
These all return the shortest length of the function, so let's name them
as such.
2022-09-17 21:27:17 +02:00
Sam Atkins
4424a50bc4 WrapperGenerator: Move generation code out of IDLTypes.h 2022-09-17 21:27:17 +02:00
Jelle Raaijmakers
6c87c98ed0 LibGL: Remove GL::present_context
No need for a static method if all it does is invoke the object method.
2022-09-17 19:38:30 +02:00
Jelle Raaijmakers
09d211e08a Ports: Make SDL2 build since recent GL::create_context changes
We also directly invoke `::present` on `GLContext` instead of going
through the static method `GL::present_context`.
2022-09-17 19:38:30 +02:00
Andreas Kling
83c69fa62e LibWeb: Handle JavaScript source code with non-UTF-8 encoding
When fetching scripts in HTMLScriptElement's "prepare a script"
algorithm, we now re-encode the script sources to UTF-8.
2022-09-17 18:53:26 +02:00
Andreas Kling
da451467b1 LibWeb: Implement basic "scroll" events at the document level 2022-09-17 18:53:26 +02:00
Andreas Kling
07c4bf03b5 LibWeb: Add "scripts to execute in order as soon as possible"
Previously, we had accidentally conflated this set with the
similar-but-distinct "scripts to execute as soon as possible".
2022-09-17 18:53:26 +02:00
Andreas Kling
df7e64d103 LibWeb: Handle multiple class names in getElementsByClassName()
The input string is actually a space-separated list of class names,
not a single class name.
2022-09-17 18:53:26 +02:00
Andreas Kling
2371446952 LibWeb: Update layout in HTMLElement.offset{Top,Left}
We can't report layout-dependent metrics without first ensuring that
layout is up-to-date.
2022-09-17 18:53:26 +02:00
Andreas Kling
9e274d9501 LibWeb: Make Document.createElement() lowercase HTML local names
Bring createElement() a little bit closer to spec-compliance.
2022-09-17 18:53:26 +02:00
davidot
03c468fb7d LibJS: Parse date strings like "9/17/2022" 2022-09-17 18:53:14 +02:00
djwisdom
4a0f4eb07a Base: Update Magnifier.md use visual impairment vs sight impaired 2022-09-17 16:08:01 +00:00
b14ckcat
3452cbd1ed Kernel/USB: Hotplug multiple USB device crash hotfix 2022-09-17 17:11:13 +02:00
Jelle Raaijmakers
f6dfd77268 LibGL: Prevent segfault due to texture destruction
Destruction of `GL::GLContext` resulted in the destruction of
`GPU::Driver` _before_ the destruction of the allocated textures, which
in turn point to `GPU::Image` objects. Since the destruction of
`GPU::Driver` unloads the shared library, we were trying to invoke
non-existing code.

Fix this by moving `m_driver` up in `GLContext` so that it's last in
line for destruction.
2022-09-17 09:21:52 +00:00
Mykola
645f6e3c4a Base: Add a lot of emoji
This commit adds many many many flags.

📢 - U+1F4E2 LOUDSPEAKER
📣 - U+1F4E3 MEGAPHONE
📐 - U+1F4D0 TRIANGULAR RULER
🔫 - U+1F52B WATER PISTOL
🏹 - U+1F3F9 BOW AND ARROW
🔰 - U+1F530 JAPANESE SYMBOL FOR BEGINNER
🇦🇨 - U+1F1E6 U+1F1E8 FLAG: ASCENSION ISLAND
🇦🇩 - U+1F1E6 U+1F1E9 FLAG: ANDORRA
🇦🇫 - U+1F1E6 U+1F1EB FLAG: AFGHANISTAN
🇦🇮 - U+1F1E6 U+1F1EE FLAG: ANGUILLA
🇦🇱 - U+1F1E6 U+1F1F1 FLAG: ALBANIA
🇦🇷 - U+1F1E6 U+1F1F7 FLAG: ARGENTINA
🇦🇸 - U+1F1E6 U+1F1F8 FLAG: AMERICAN SAMOA
🇧🇱 - U+1F1E7 U+1F1F1 FLAG: ST. BARTHÉLEMY
🇧🇲 - U+1F1E7 U+1F1F2 FLAG: BERMUDA
🇧🇳 - U+1F1E7 U+1F1F3 FLAG: BRUNEI
🇧🇶 - U+1F1E7 U+1F1F6 FLAG: CARIBBEAN NETHERLANDS
🇧🇿 - U+1F1E7 U+1F1FF FLAG: BELIZE
🇨🇨 - U+1F1E8 U+1F1E8 FLAG: COCOS (KEELING) ISLANDS
🇨🇰 - U+1F1E8 U+1F1F0 FLAG: COOK ISLANDS
🇨🇻 - U+1F1E8 U+1F1FB FLAG: CAPE VERDE
🇨🇽 - U+1F1E8 U+1F1FD FLAG: CHRISTMAS ISLAND
🇨🇾 - U+1F1E8 U+1F1FE FLAG: CYPRUS
🇩🇬 - U+1F1E9 U+1F1EC FLAG: DIEGO GARCIA
🇩🇲 - U+1F1E9 U+1F1F2 FLAG: DOMINICA
🇩🇿 - U+1F1E9 U+1F1FF FLAG: ALGERIA
🇪🇨 - U+1F1EA U+1F1E8 FLAG: ECUADOR
🇪🇷 - U+1F1EA U+1F1F7 FLAG: ERITREA
🇪🇹 - U+1F1EA U+1F1F9 FLAG: ETHIOPIA
🇫🇯 - U+1F1EB U+1F1EF FLAG: FIJI
🇫🇰 - U+1F1EB U+1F1F0 FLAG: FALKLAND ISLANDS
🇬🇩 - U+1F1EC U+1F1E9 FLAG: GRENADA
🇬🇪 - U+1F1EC U+1F1EA FLAG: GEORGIA
🇬🇮 - U+1F1EC U+1F1EE FLAG: GIBRALTAR
🇬🇲 - U+1F1EC U+1F1F2 FLAG: GAMBIA
🇬🇵 - U+1F1EC U+1F1F5 FLAG: GUADELOUPE
🇬🇶 - U+1F1EC U+1F1F6 FLAG: EQUATORIAL GUINEA
🇬🇸 - U+1F1EC U+1F1F8 FLAG: SOUTH GEORGIA & SOUTH SANDWICH ISLANDS
🇬🇺 - U+1F1EC U+1F1FA FLAG: GUAM
🇮🇴 - U+1F1EE U+1F1F4 FLAG: BRITISH INDIAN OCEAN TERRITORY
🇰🇾 - U+1F1F0 U+1F1FE FLAG: CAYMAN ISLANDS
🇲🇸 - U+1F1F2 U+1F1F8 FLAG: MONTSERRAT
🇳🇺 - U+1F1F3 U+1F1FA FLAG: NIUE
🇳🇿 - U+1F1F3 U+1F1FF FLAG: NEW ZEALAND
🇵🇳 - U+1F1F5 U+1F1F3 FLAG: PITCAIRN ISLANDS
🇸🇭 - U+1F1F8 U+1F1ED FLAG: ST. HELENA
🇹🇦 - U+1F1F9 U+1F1E6 FLAG: TRISTAN DA CUNHA
🇹🇨 - U+1F1F9 U+1F1E8 FLAG: TURKS & CAICOS ISLANDS
🇹🇻 - U+1F1F9 U+1F1FB FLAG: TUVALU
🇻🇬 - U+1F1FB U+1F1EC FLAG: BRITISH VIRGIN ISLANDS
2022-09-17 10:14:22 +01:00
djwisdom
378f004a28 Base: Update Durrque theme for a better look and feel 2022-09-17 10:08:59 +01:00
Julian Offenhäuser
77f5f7a6f4 LibPDF: Support parsing page tree nodes that are in object streams
conditionally_parse_page_tree_node used to assume that the xref table
contained a byte offset, even for compressed objects. It now uses the
common facilities for parsing objects, at the expense of some
performance.
2022-09-17 10:07:14 +01:00
Julian Offenhäuser
6225c03256 LibPDF: Rename argument for the latin character set enumeration macro
The previous name "V" collided with one of the entries.
2022-09-17 10:07:14 +01:00
Julian Offenhäuser
633e1632d0 LibPDF: Allow whitespace other than EOL after an object marker 2022-09-17 10:07:14 +01:00
Julian Offenhäuser
65e83bed53 LibPDF: Disallow parsing indirect values as operands
An operation like 0 0 0 RG would have been confused for [ 0, 0 0 R ] G
2022-09-17 10:07:14 +01:00
Julian Offenhäuser
04cb00dc9a LibPDF: Fix handling of differences array in custom encodings
When looking up differences in the specified encoding, we previously
didn't recognize a lot of characters, namely those that are referred to
by a string in the PDF itself, like "/germandbls".

We now create a mapping of those characters to the code points they are
referring to, and correctly look them up when needed.
2022-09-17 10:07:14 +01:00
Julian Offenhäuser
36828f1385 LibPDF: Don't expect glyph width arrays to contain integers
They might also contain floats, in which case we convert them to int
before use.
2022-09-17 10:07:14 +01:00
Julian Offenhäuser
97ed4106e5 LibPDF: Fix text positioning with operator TJ
As per spec, the positioning (or kerning) parameter of this operator
should translate the text matrix before the next showing of text.
Previously, this calculation was slightly wrong and also only applied
after the text was already shown.
2022-09-17 10:07:14 +01:00
Julian Offenhäuser
563d91b6c4 LibPDF: Implement loading compressed objects from object streams
Now, whenever the xref table points to a compressed object,
parse_object_with_index will look it up in the corresponding object
stream as if it were a regular object.

With this, our parser gains the bare minimum support for xref streams.
2022-09-17 10:07:14 +01:00
Julian Offenhäuser
f9beff7b5e LibPDF: Initial work on parsing xref streams
Since PDF version 1.5, a document may omit the xref table in favor of
a new kind of xref stream object. This is used to reference so-called
"compressed" objects that are part of an object stream.

With this patch we are able to parse this new kind of xref object, but
we'll have to implement object streams to use them correctly.
2022-09-17 10:07:14 +01:00
Julian Offenhäuser
4887aacec7 LibPDF: Move document-specific parsing functionality into its own class
The Parser class is now a generic PDF object parser, of which the new
DocumentParser class derives. DocumentParser now takes over all
functions relating to linearization, pages, xref and trailer handling.

This allows the use of multiple parsers in the same document's
context, which will be needed in order to handle PDF object streams.
2022-09-17 10:07:14 +01:00
Julian Offenhäuser
9f4659cc63 LibPDF: Move consume and match helper functions to the Reader class 2022-09-17 10:07:14 +01:00
Ben Wiederhake
8de7a91571 LibCompress+Tests: Demonstrate and fix faulty metadata length
The test-case is heavily inspired by:
https://github.com/google/brotli/blob/master/tests/testdata/x.compressed.01
Or in words: A metadata meta-block containing `Y` (which should be
ignored), and then the actual data (a single `Z`). The bug used to skip
one metadata byte too few, and thus read garbage.
2022-09-17 04:10:11 +00:00
Ben Wiederhake
fe48fed4fa LibWeb: Break inclusion cycle by removing unnecessary include 2022-09-17 04:00:54 +00:00
Ben Wiederhake
e909231d78 LibWeb: Break inclusion cycle through forward-declaration 2022-09-17 04:00:54 +00:00