Commit graph

52929 commits

Author SHA1 Message Date
Karol Kosek
16836e7e62 LibWeb: Remove checking for AllowedDataUrlType
CSS shouldn't probably check if a MIME type in the 'data:' URL is
correct or not. Every URL gets sent to a ResourceLoader so a client can
just validate if got file with correct media type.

This also makes loading 'data:' URLs in @import work now, as we didn't
have AllowedDataUrlType for stylesheets.
2023-08-01 14:19:05 +02:00
Karol Kosek
58017a0581 AK: Clear buffer after leaving CannotBeABaseUrlPath in URLParser
By not clearing the buffer, we were leaking the path part of a URL into
the query for URLs without an authority component (no '//host').

This could be seen most noticeably in mailto: URLs with header fields
set, as the query part of `mailto:user@example.com?subject=test` was
parsed to `user@example.comsubject=test`.

data: URLs didn't have this problem, because we have a special case for
parsing them.
2023-08-01 10:10:07 +02:00
Andreas Kling
28fdc7af05 LibWeb: Detach stale layout nodes from DOM during layout tree build
When toggling `display: none` on an element, it can go from having a
layout subtree to not having one. In the `none` case, we were previously
leaving stale layout nodes hanging off DOM nodes in the subtree.

These layout nodes could be queried for outdated information and
probably other things that we shouldn't allow.

Fix this by having TreeBuilder prune any old layout nodes hanging off
nodes in a subtree after its subtree root doesn't produce a layout node.
2023-08-01 09:19:41 +02:00
Sam Atkins
0805060e5e LibWeb: Speed up CSS namespace checking
CSSStyleSheet now caches the CSSNamespaceRule for the default namespace,
which is the only one we currently care about. This saves us from
iterating over its list of rules every time we want to know what that
default namespace is.

The spec dictates that `@namespace` rules are only valid near the start
of a stylesheet, so we also take advantage of that to quit searching
for namespaces as soon as we see a non-import rule.

Also renamed `namespace_filter()` to `default_namespace()` since that's
what it actually returns.

This makes github.com/serenityos/serenity snappy again. :^)
2023-08-01 07:41:06 +02:00
Sam Atkins
496db17c2d LibWeb: Add callback for when a CSSRuleList's rules change 2023-08-01 07:41:06 +02:00
Andi Gallo
62f15f94d2 LibWeb: Better handling of floating boxes from inline formatting context
Handle the clear property for floating boxes and add tracking for
vertical clearence within an inline formatting context.
2023-08-01 07:38:19 +02:00
Sebastian Zaha
fd86509ef8 Ladybird: Remove unused spawn helper
The spawn_helper_process method was introduced together with
get_paths_for_helper_process but was only ever used briefly to spawn
WebContent. Other helper processes (SqlServer, headless_browser etc)
are either execed or spawned with their own helpers & custom arguments.
2023-08-01 07:36:15 +02:00
Sebastian Zaha
05fc63932b Ladybird: Fix JS console crash when history is empty
Do not try to navigate JS console history forward when it is empty. A
crash was occurring because of size_t underflow.
2023-08-01 07:33:36 +02:00
Lucas CHOLLET
cd0fe4bb48 Kernel: Mark sys$poll as not needing the big lock 2023-08-01 05:35:26 +02:00
Lucas CHOLLET
00240cb0b3 LibGfx/JPEGXL: Fix property 8
The first implementation of this property was just plain wrong. Looks
like this property isn't used a lot as I found the issue by reviewing
the code and not because of a specific image.

The test image is a 32x32 mosaic of alternating black and yellow pixels,
it was generated using this code:

Bitdepth 8
RCT 1
Width 32
Height 32

if W-WW-NW+NWW > -300
 - Set -1000
 - Set 900
2023-08-01 05:35:01 +02:00
Lucas CHOLLET
6b41fef2e4 LibGfx/JPEGXL: Add default values for ToneMapping 2023-08-01 05:35:01 +02:00
Andrew Kaster
b6d60980bb Ladybird: Rename FontPluginQt -> Ladybird as it is unrelated to Qt now
The Qt relationship was removed in de31a8a4, so let's acknowledge that
and make it clearer to potential non-Qt ports that this file is usable
by them :^).
2023-08-01 05:06:40 +02:00
Tim Ledbetter
6ba38494c5 Ports: Add cowsay 2023-08-01 04:42:20 +02:00
Nico Weber
ecef13338e Meta: Only write first output file to depfile
There's no advantage to writing more than one file, and it lets the
depfile work with older versions of ninja.
2023-07-31 14:55:03 -06:00
Sam Atkins
f9ad5a450c Documentation: Fix typo in Spice documentation filename 2023-07-31 20:01:56 +01:00
ronak69
39e58f8954 Documentation: Add links of all docs that aren't mentioned anywhere 2023-07-31 19:59:33 +01:00
Andrew Kaster
804188ac0c Meta: Port 1d59a62944 to gn build 2023-07-31 12:02:17 -06:00
Timothy Flynn
1d59a62944 Ladybird: Remove macOS workaround for WebContent GUI interaction
This reverts commit 4dcdc3bd25.

Now that WebContent is a QCoreApplication, this workaround is no longer
needed.
2023-07-31 20:00:49 +02:00
Shannon Booth
aa7ca80d7c AK: Fix missing step step for serialization of IPv6 hosts
This was resulting in the incorrect host serialization of:

http://[0:1:0:1:0:1:0:1] to [::1:0:1:0:1:0:1]

and:

http://[1:0:1:0:1:0:1:0] to [1::1:0:1:0:1:0]
2023-07-31 14:48:24 +02:00
Shannon Booth
4fdd4dd979 AK: Add missing default port definitions for FTP scheme URLs
This is defined in the spec, but was missing in our table. Fix this, and
add a spec comment for what is missing. Also begin a basic text based
test for URL, so we can get some coverage of LibWeb's usage of URL too.
2023-07-31 14:48:24 +02:00
Shannon Booth
25153703c9 headless-browser: Improve error on failure to open expectation file
Mostly to output the path of the file which failed to open. This is
mostly helpful if you create a test, but forget to 'touch' the
expectation path.
2023-07-31 14:48:24 +02:00
Kemal Zebari
590f0f85e0 nohup: Don't leak fd used to open nohup.out
Since we may redirect stdout, stderr, or both to the file description
referring to the nohup.out file, there is no need to keep the fd that
created that file description around.
2023-07-31 10:47:59 +02:00
Kenneth Myhra
7da055e3e1 LibWeb: Remove unused headers in StructuredSerialize.cpp 2023-07-31 10:41:38 +02:00
Kenneth Myhra
9a007ccdbe LibWeb: Serialize strings into a more storage efficient format
This patch changes the way StructuredSerializeInternal() serialize
strings by storing four bytes into a 32-bit entry, instead of one code
point per 32-bit entry.

StructuredDeserialize() has also been changed to deserialize strings by
the same ruleset.
2023-07-31 10:41:38 +02:00
Andi Gallo
4cde5f6d76 LibWeb: Fix border for cells spanning entire table width or height
When a cell spans the entire width or height of a table, create its
border from the table box.
2023-07-31 10:40:31 +02:00
Andreas Kling
9937fcc5e1 LibWeb: Don't assume opacity values are CSS numbers
...since they can also be percentages. Better to resolve them to a pair
of absolute values, and then compare those. :^)

Regressed in 921aee8c66.
2023-07-31 09:16:18 +02:00
Andreas Kling
cb8664e2e1 LibWeb/BindingsGenerator: Fix the build
I'm not sure why this didn't break on CI, but none of my machines were
able to build without this change.
2023-07-31 07:39:49 +02:00
Tim Schumacher
5f69b0d6ad Base: Remove the empty /usr/lib and /usr/include directories
These have been there since the initial revision of the toolchain build
script, but we don't seem to require them being present in `Base` any
longer.
2023-07-31 06:26:58 +02:00
Ali Mohammad Pur
d9ed58eb39 LibRegex: Make OpCode_Compare use a switch-case instead of if-else
This has no performance impact, the if-elses have been annoying as it's
impossible to fold the entire thing in basically any IDE.
2023-07-31 05:31:33 +02:00
Ali Mohammad Pur
4e69eb89e8 LibRegex: Generate a search tree when patterns would benefit from it
This takes the previous alternation optimisation and applies it to all
the alternation blocks instead of just the few instructions at the
start.
By generating a trie of instructions, all logically equivalent
instructions will be consolidated into a single node, allowing the
engine to avoid checking the same thing multiple times.
For instance, given the pattern /abc|ac|ab/, this optimisation would
generate the following tree:
    - a
    | - b
    | | - c
    | | | - <accept>
    | | - <accept>
    | - c
    | | - <accept>
which will attempt to match 'a' or 'b' only once, and would also limit
the number of backtrackings performed in case alternatives fails to
match.

This optimisation is currently gated behind a simple cost model that
estimates the number of instructions generated, which is pessimistic for
small patterns, though the change in performance in such patterns is not
particularly large.
2023-07-31 05:31:33 +02:00
Ali Mohammad Pur
18f4b6c670 LibRegex: Add the literal string search optimisation
This switches to using a simple string equality check if the regex
pattern is strictly a string literal.
Technically this optimisation can also be made on bounded literal
patterns like /[abc]def/ or /abc|def/ as well, but those are
significantly more complex to implement due to our bytecode-only
approach.
2023-07-31 05:31:33 +02:00
Ali Mohammad Pur
221c52c696 LibRegex: Avoid slicing a RegexStringView in non-unicode Compare ops
Getting a single code point is much faster than slicing into the string.
2023-07-31 05:31:33 +02:00
Ali Mohammad Pur
11abca421a LibRegex: Always inline get_opcode()
This function's prologue was showing up as very hot in profiles, taking
almost 9% of runtime in our Regex test suite.
2023-07-31 05:31:33 +02:00
Ali Mohammad Pur
a539c261b1 Profiler: Correct the event names for 'malloc' and 'free'
These were renamed to 'kmalloc' and 'kfree' in the profile recording
infrastructure, but the Profiler application expected the old names
still.
2023-07-31 05:31:33 +02:00
Ali Mohammad Pur
7a471b7cf5 AK: Allow customising Trie's underlying map type
This makes it possible to use an ordered map and keep the insertion
order intact.
2023-07-31 05:31:33 +02:00
Hendiadyoin1
07e4358c63 AK: Use correct builtins for fmod and remainder
Similar to floor and ceil, we were forcing the values to be doubles here

Also adds a big FIXME about my findings trying to add a general
implementation for these
2023-07-31 05:22:12 +02:00
Hediadyoin1
c9808f0d4a AK: Use correct builtins for floor and ceil
We were using the double ones, forcing casts to and from them for floats
2023-07-31 05:22:12 +02:00
Hediadyoin1
29e0494e56 AK: Use builtins in fabs implementation and move it to the top
Both GCC and Clang inline this function to use bit-wise logic and/or
appropriate instructions even on -O0 and allow their use in a constexpr
context, see
https://godbolt.org/z/de1393vha
2023-07-31 05:22:12 +02:00
Hediadyoin1
594369121a AK: Add trunc and rint to AK/Math.h
These are useful in some algorithms, which require specific rounding.
2023-07-31 05:22:12 +02:00
Hediadyoin1
6573ace8f1 AK: Move rounding function to the top of AK/Math.h
These are useful in other algorithms, so lets move them up
2023-07-31 05:22:12 +02:00
MacDue
47c074ab11 Ladybird: Fix silly tiny back/forward/reload icons in context menu
Rather than set a hacky scale factor on our QIconEngine, just set the
icon size for the toolbar icons. This avoids the icons being
unnecessarily scaled in other places (i.e. the context menu).
2023-07-31 05:19:53 +02:00
Shannon Booth
3cb65645cf LibWeb: Make Web::URL::host_is_domain accept an AK::URL::Host
Which allows us to avoid serializing the host only to try and reparse it
again as either an IPv4 or IPv6 address.
2023-07-31 05:18:51 +02:00
Shannon Booth
8751be09f9 AK: Serialize URL hosts with 'concept-host-serializer'
In order to follow spec text to achieve this, we need to change the
underlying representation of a host in AK::URL to deserialized format.
Before this, we were parsing the host and then immediately serializing
it again.

Making that change resulted in a whole bunch of fallout.

After this change, callers can access the serialized data through
this concept-host-serializer. The functional end result of this
change is that IPv6 hosts are now correctly serialized to be
surrounded with '[' and ']'.
2023-07-31 05:18:51 +02:00
Shannon Booth
768f070b86 AK: Implement 'concept-host-serializer' in URL spec
This implementation will allow us to fix serialization of IPv6
addresses not being surrounded by '[' and ']'.

Nothing is calling this function yet - this will come in the next
(larger) commit where the underlying host representation inside of
AK::URL is changed from DeprecatedString to URL::Host.
2023-07-31 05:18:51 +02:00
Shannon Booth
803ca8cc80 AK: Make serialize_ipv6_address take a StringBuilder
This will allow us to implement 'concept-host-serializer' without
needing to call String::formatted.
2023-07-31 05:18:51 +02:00
Shannon Booth
a1ae701a7d AK: Move URL::cannot_have_a_username_or_password_or_port out of line
This doesn't seem trivial enough to be defining in the header like this,
and should not be a performance critical function anyhow.

Also add spec comments while we are at it, and a FIXME since we do not
seem to exactly align.
2023-07-31 05:18:51 +02:00
Shannon Booth
0c0117fc86 AK: Add typdefs for host URL definitions
And use them where applicable. This will allow us to store the host in
the deserialized format as the spec specifies.

Ideally these typdefs would instead be the existing AK interfaces, but
in the meantime, we can just use this.
2023-07-31 05:18:51 +02:00
Andrew Kaster
3dd3120a8a Meta+BindingsGenerator: Only invoke BindingsGenerator once per IDL file
This reduces the number of tasks to schedule, and the complexity of the
build system integrations for the BindingsGenerator. As a bonus, we move
the "only write if changed" feature into the generator to reduce the
build system load on generated files for this generator.
2023-07-30 17:50:44 -06:00
Andrew Kaster
f5e8bba092 AK: Add argument to LexicalPath::basename to strip the extension 2023-07-30 17:50:44 -06:00
Andrew Kaster
cc3e179b23 Meta: Port 60e35f2a97 to gn build 2023-07-30 16:52:03 -06:00