Commit graph

54008 commits

Author SHA1 Message Date
Liav A 6cb88e224e Kernel: Remove checks for signed numbers in the prctl syscall
When doing PR_{SET,GET}_PROCESS_NAME, it's not expected to pass a signed
integer for the buffer size (in arg2). Therefore, cast it immediately to
a size_t integer type, and let the FixedStringBuffer StdLib memory copy
functions in such cases to worry about possible overflows.
2023-08-25 11:51:52 +02:00
Andreas Kling 13e2ca6b59 LibWeb: Parse src: local(...) in CSS @font-face rules
Note that we don't load the local font as specified, but at least we no
longer reject such src properties in the CSS parser.

This makes the custom fonts used on http://apple.com/ actually load. :^)
2023-08-25 11:51:28 +02:00
Andreas Kling e924ea002f LibWeb: Add Referer HTTP header to CSS font requests
If we don't do this, we just get 404 Not Found for all fonts used by
https://apple.com/
2023-08-25 11:51:28 +02:00
Tim Ledbetter d730cd89f5 Ports/gnuplot: Update formatting to be consistent with other ports 2023-08-25 10:33:30 +02:00
Tim Ledbetter 2512544b6b Ports/gnuplot: Explicitly specify which optional dependencies to enable
This change explicitly enables support for `libgd` and the lua
terminal in `gnuplot`, while explicitly disabling `cairo` terminals,
which don't work with our `cairo` port. Adding `libgd` as a
dependency requires us to manually link against the dependencies of
`libgd`, as this is not done automatically by the configure script.

This fixes an issue where building `gnuplot` would fail if `libgd`
was already installed.
2023-08-25 10:33:30 +02:00
Tim Ledbetter 673d6bf2d2 Ports/gnuplot: Update to version 5.4.8
We also no longer build the tutorial, as that directory no longer
exists.
2023-08-25 10:33:30 +02:00
Timothy Flynn 5a2bf7fdd1 LibWeb: Set the correct end position of HTML attribute names
We were previously setting the end position of attribute names in self-
closing HTML tags to the end of the attribute value. To illustrate the
previous behavior, consider this tag and its attribute's start and end
positions (shown inclusively below):

    <meta charset="UTF-8" />
          ^ name start
                  ^ value start
                        ^ value end
                        ^ name end

Rather than setting the end position of the attribute name when we parse
the closing slash, ensure the end position is already set while we are
in the AttributeName state. We now have:

    <meta charset="UTF-8" />
          ^ name start
                ^ name end
                  ^ value start
                        ^ value end

The tokenizer unit test has been extended to test these positions.
2023-08-25 08:22:24 +02:00
Timothy Flynn 5b2bc90b50 LibWeb: Set consistent positions for the start and end of HTML tags
To illustrate the previous behavior, consider these tags and their start
and end positions (shown inclusively below):

    Start tag:    End tag:
    <span>        </span>
     ^ start       ^ start
         ^end           ^end

The start position of a tag is the first ASCII-alpha code point after
the opening brace. The start position of a close tag is the slash just
before the first ASCII-alpha code point. And the end position of both
is the closing brace. So the opening brace is not included in the
emitted tag, but the closing brace is. And the end tag including the
slash is an oddity that had to be worked around in its only use case
(syntax highlighting).

We now consistently exclude the braces from the emitted tag, and also
exclude the slash from the end tag, so that it does not need to be
accounted for in syntax highlighting. That is, we now have:

    Start tag:    End tag:
    <span>        </span>
     ^ start        ^ start
        ^end           ^end

The tokenizer unit test has been extended to test these positions.
2023-08-25 08:22:24 +02:00
Timothy Flynn 70a87795e4 LibWeb: Remove the Tests subfolder
These were used only by test-web, which was removed in commit 81aa60163.
2023-08-25 05:39:58 +02:00
Timothy Flynn 18bbbab78c Browser: Do not visualize trailing whitespace in the source viewer
Trailing whitespace in the source view is not actionable, so there's no
benefit to showing it.
2023-08-25 05:39:32 +02:00
Karol Kosek 6808b52c1b LibGUI: Use default button in PasswordInputDialog 2023-08-24 22:56:03 +01:00
Sam Atkins 565ed9b06c LibWeb: Comment out invalid display-outside rules from Default.css
This property was removed from the CSS specs, and efforts to correct the
HTML spec have stalled. For now, let's comment them out so that I don't
get spammed with the meaningless log warnings that they didn't parse,
every time I launch Ladybird. :^)
2023-08-24 22:51:11 +01:00
Jonatan Klemets f0a772edef LibWeb: Improve table colspan and rowspan spec alignment
This patch improves the spec alignment [1] for the table `colspan` and
`rowspan` attributes by:
- Handling min and max for `colspan`.
- Handling max for `rowspan`.

[1] https://html.spec.whatwg.org/multipage/tables.html#algorithm-for-processing-rows
2023-08-24 22:26:53 +01:00
Jonatan Klemets 04bc9b14d0 LibWeb: Use parse_non_negative_integer for colspan and rowspan parsing
`DeprecatedString::to_int` calls `StringUtils::convert_to_int`
internally. However, the integer parsing is not done in an HTML
spec-compliant way. For example, `colspan="2;"` is valid according to
the spec. But, with the current implementation, we will fail to parse
"2;", and instead fall back to using 1 as the colspan value.

This patch changes the `HTMLTableCellElement::col_span` and
`HTMLTableCellElement::row_span` methods to use the
`Web::HTML::parse_non_negative_integer` function that will parse the
attribute value in an HTML spec-compliant way.
2023-08-24 22:26:53 +01:00
Jonatan Klemets 9812031a02 LibWeb: Implement spec-compliant integer parsing
We have code inside LibWeb that uses the
`AK::StringUtils::convert_to_uint`and `AK::StringUtils::convert_to_int`
methods for parsing integers. This works well for the most part, but
according to the spec, trailing characters are allowed and should be
ignored, but this is not how the `StringUtil` methods are implemented.

This patch adds two new methods named `parse_integer` and
`parse_non_negative_integer` inside the `Web::HTML` namespace that uses
`StringUtils` under the hood but adds a bit more logic to make it spec
compliant.
2023-08-24 22:26:53 +01:00
Niklas Poslovski ebc5b33b77 LibCore: Don't include sys/sysctl.h on Solaris 2023-08-24 22:07:28 +01:00
Andreas Kling 418f9ceadd LibWeb: Invalidate font cache when web fonts are downloaded
In case we've looked up the family name before and cached the result of
font fallback, we now invalidate any cached entries with the same family
name so that the next lookup may consider the newly downloaded font.
2023-08-24 22:07:00 +01:00
Andreas Kling c98829f7c9 LibWeb: Move FontCache into the Web namespace 2023-08-24 22:07:00 +01:00
Aliaksandr Kalenik 6267037a74 Tests/LibWeb: Split grid/positions-and-spans.html into smaller tests
This giant grid test has been a source of problems while iterating on
GFC for a long time. Let's split it into smaller tests to make it
easier to identify issues without needing further reductions on the
test.
2023-08-24 20:18:00 +02:00
Sam Atkins 29b2022303 LibWeb: When growing or shrinking a border-radius, ignore it if it's 0
This function is used to calculate a matching radius that goes inside or
outside of the border. For example, if the border-radius is 10px and we
are 5px further out, the radius needs to be 15px to look right.
However, if the radius is 0 it isn't rounded, and we want to keep the
same sharp corner no matter how far we go.

This makes our outline rendering better match Chrome and Firefox.
2023-08-24 20:17:45 +02:00
Andrew Kaster d1aea87889 LibWeb: Add NavigateEvent, the main event of the Navigation API
This event is the star of the show, and the main way that web content
can react to either programmatic or user-initiated navigation.

All of the fun algorithms will have to come later though.
2023-08-24 11:03:57 -06:00
Andrew Kaster 5374fbfbcf LibWeb: Make Document::determine_the_indicated_part public
We need to call this from NavigateEvent as part of the Navigation API.
2023-08-24 11:03:57 -06:00
Andrew Kaster 3dd3b2019d LibWeb: Add NavigationTransition, a transient property of Navigation
This property is useful for web content to determine whether an ongoing
navigation has settled or not.
2023-08-24 11:03:57 -06:00
Andrew Kaster 4989375191 LibWeb: Add NavigationDestination, used for NavigateEvents
This class will be used in the algorithms for the navigate event firing
algorithms to populate the destination field of the NavigateEvent.
2023-08-24 11:03:57 -06:00
Andrew Kaster 8e03f8cb4a LibWeb: Use window.navigation in NavigationHistoryEntry::index 2023-08-24 11:03:57 -06:00
Andrew Kaster 7f043e3083 LibWeb: Add window.navigation property 2023-08-24 11:03:57 -06:00
Andrew Kaster 0c2f758067 LibWeb: Implement the start of the Navigation API
This API is how JavaScript can manipulate the new Navigable concepts
directly. We are still missing most of the interesting algorithms on
Navigation that do the actual navigation steps, and call into the
currently WIP navigable AOs.
2023-08-24 11:03:57 -06:00
Andrew Kaster 51c2835044 LibWeb: Add NavigationCurrentEntryChangeEvent, fired when navigating
This event will be fired by Navigation when changing the current
NavigationHistoryEntry.
2023-08-24 11:03:57 -06:00
Andrew Kaster 3c1d4eab24 LibWeb: Add NavigationHistoryEntry, a wrapper around SessionHistoryEntry 2023-08-24 11:03:57 -06:00
Andrew Kaster daa9c4a650 LibWeb: Add NavigationType to prep for Navigation API platform objects
This enum is used in many Navigation API classes, so stick it in its own
IDL file. However, we have no way to ask the BindingsGenerator to create
just an enum class that's not defined in an IDL file without an
 ``interface`` class at the top level, so implement the expected enum
 and stringification method manually.
2023-08-24 11:03:57 -06:00
Andrew Kaster 6856634ebc LibWeb: Add fields to SessionHistoryEntry required by Navigation API 2023-08-24 11:03:57 -06:00
Andrew Kaster cf0ffc12cc BindingsGenerator: Handle nullable enum properties
Add some checks to the statement wrapping code to make sure we properly
handle the expected pattern of returning ``Optional<Enum>`` from
nullable enum properties.
2023-08-24 11:03:57 -06:00
Andrew Kaster d3a8ee6e4b LibWeb: Remove unused SessionHistoryEntry::serialized_state
We never implemented this for History::pushState/popState, and now that
we're working on the Navigable changes, we don't need this legacy entry
with its legacy name.
2023-08-24 11:03:57 -06:00
Andrew Kaster ca233b5cf4 LibWeb: Implement more of the shared history push/replace state steps
Add the seralization and URL validation steps, but skip the actual
navigation for now. This might cause more pages to throw exceptions
when trying to push state that contains objects that we don't know how
to serialize.
2023-08-24 11:03:57 -06:00
Andi Gallo eb40d16b2e LibWeb: Change the default color for inset and outset borders
Make it match Chromium.
2023-08-24 15:49:49 +02:00
Andi Gallo 11e5865d53 LibWeb: Apply the color for inset and outset border styles
There's no specification for what the dark and light colors should be,
match the behavior of other browsers instead.
2023-08-24 15:49:49 +02:00
Aliaksandr Kalenik c3f38c6cb8 Tests/LibWeb: Adjust "clip-abspos-children" ref-test to actually pass
Fixed the "clip-abspos-children" test which previously passed due to
black backgrounds on CI blending with the test's black borders.
2023-08-24 15:48:34 +02:00
Andreas Kling 7cd975268c LibWeb: Use Gfx::FontDatabase::for_each_typeface_with_family_name()
This avoids looking at every single installed typeface to see if there's
a family name match.

Fixes a large performance regression introduced when making
StyleComputer consider system fonts in CSS font fallback.

Regressed with 69a81243f5.
2023-08-24 14:58:22 +02:00
Andreas Kling 2cd89531f9 LibGfx: Add FontDatabase::for_each_typeface_with_family_name()
Some clients (e.g LibWeb) want to look up typefaces by name. Since we
already store typefaces in a HashMap keyed by family name, let's also
have a nice & fast API that takes advantage of this.
2023-08-24 14:58:22 +02:00
Sam Atkins 82ccc49b52 LibWeb: Adjust ref-tests to reduce flakiness
These two ref-tests involve two boxes positioned in the same place, with
outlines. Outlines always have a border-radius, meaning that the corner
pixels are not 100% opaque. (It seems to be 254 instead of 255.) With
the test files painting two outlines, and the ref test only painting
one, slight changes in the background color of the page would make that
slight variation visible sometimes. So, let's avoid that inconsistency
by always painting one outline instead of two.
2023-08-24 13:46:28 +01:00
Tim Ledbetter ad5df3bef8 Ports/aria2: Update formatting to be consistent with other ports 2023-08-24 13:16:58 +02:00
Tim Ledbetter 87c17c9bb9 Ports/aria2: Explicitly disable Firefox/Chromium cookie support
Previously, this would only be enabled if the `sqlite` port was
already installed. This change explicitly disables the feature, as it
isn't that useful on SerenityOS. This ensures a consistent build
regardless of whether the `sqlite` port is installed or not.
2023-08-24 13:16:58 +02:00
Tim Ledbetter 434c97010f Ports/aria2: Explicitly disable c-ares support
This was causing the build to fail when the `c-ares` port was
installed.
2023-08-24 13:16:58 +02:00
Tim Ledbetter 637eb3179a Ports/libssh2: Update formatting to be consistent with other ports 2023-08-24 13:16:58 +02:00
Tim Ledbetter 6678a3ad00 Ports/libssh2: Prefer openssl over libgcrypt as the crypto backend
Previously,`openssl` would be used as the crypto backend for `libssh2`
if the `openssl` port was installed and the `libgcrypt` dependency
would be ignored.

With this change we install `openssl` as a dependency and explicitly
specify that it should be used as the crypto backend. We also add
`zlib` as an explicit dependency and specify that `zlib` compression
should be used.
2023-08-24 13:16:58 +02:00
Tim Ledbetter 0cb339bad1 Ports/dtc: Specify NO_PYTHON when running make install
Previously, the install step was failing when the `python3` port was
installed.
2023-08-24 12:27:52 +02:00
Tim Ledbetter c8f78066c4 Ports/SDL2: Update to version 2.28.2 2023-08-24 12:26:19 +02:00
Tim Ledbetter aa322c0014 Ports: Update explanation of files syntax in README 2023-08-24 11:52:12 +02:00
Sam Atkins eab44f982a Meta: Use embed_as_string_view() for stringify_gml() 2023-08-24 07:42:12 +01:00
Sam Atkins abba6f7b54 LibWeb: Use embed_as_string_view() for style sheet source generation 2023-08-24 07:42:12 +01:00