Commit graph

53849 commits

Author SHA1 Message Date
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
Sam Atkins
af4642c826 Meta: Make embed_as_string_view.py usable by CMake builds :^) 2023-08-24 07:42:12 +01:00
Andreas Kling
4ead33d8fc LibWeb: Remove "LibWeb+LibJS/1.0" from the default User-Agent string
As it turns out, there are popular User-Agent blacklists out there with
the string "LibWeb" in them. Such entries have been added long before
our LibWeb existed, so "LibWeb" has presumably been used by some bot
that people got tired of.

Trying to chase down everyone who has installed these blacklists is
obviously a losing battle, so this patch simply removes the engine part
of our default UA string.
2023-08-24 07:14:51 +02:00
Andi Gallo
6175fcdaeb LibWeb: Add a table row to the layout tree for buttons
We were relying on the table fixup algorithm to insert the missing table
row, which fails to do so when we only have an image in the button.
While that might be a problem with the table fixup algorithm, we should
build a correct layout tree explicitly anyway.

Fixes crashes on GitHub.
2023-08-24 07:08:21 +02:00
Timothy Flynn
4f563e346d Ladybird: Ensure we release CoreFoundation references
Once we are done with our references to some CoreFoundation types, we
must be sure to manually release those references.
2023-08-23 19:16:53 -04:00
MacDue
2d154bf90a LibWeb: Fix accidentally skipping post-paint actions for positioned SCs
Regressed in 2a067b5601.

I could not find anything obviously broken by this, but it definitely
was unintentional on my part.
2023-08-24 01:01:47 +02:00
Karol Kosek
fdb27c5851 LibWeb: Use StringView in calls to Vector<String>::contains_slow() 2023-08-23 20:21:09 +02:00
Karol Kosek
9663ccff77 AK: Use Iterator's trait when comparing a value
It's not needed, from what I can gather, but I changed it just for
the correctness sake.
2023-08-23 20:21:09 +02:00
Karol Kosek
e575ee4462 AK+Kernel: Unify Traits<T>::equals()'s argument order on different types
There was a small mishmash of argument order, as seen on the table:

                 | Traits<T>::equals(U, T) | Traits<T>::equals(T, U)
   ============= | ======================= | =======================
   uses equals() | HashMap                 | Vector, HashTable
defines equals() | *String[^1]             | ByteBuffer

[^1]: String, DeprecatedString, their Fly-type equivalents and KString.

This mostly meant that you couldn't use a StringView for finding a value
in Vector<String>.

I'm changing the order of arguments to make the trait type itself first
(`Traits<T>::equals(T, U)`), as I think it's more expected and makes us
more consistent with the rest of the functions that put the stored type
first (like StringUtils functions and binary_serach). I've also renamed
the variable name "other" in find functions to "entry" to give more
importance to the value.

With this change, each of the following lines will now compile
successfully:

    Vector<String>().contains_slow("WHF!"sv);
    HashTable<String>().contains("WHF!"sv);
    HashMap<ByteBuffer, int>().contains("WHF!"sv.bytes());
2023-08-23 20:21:09 +02:00
Aliaksandr Kalenik
5ff7448fee LibWeb: Move viewport subscriptions from BrowsingContext to Document
With this change, elements that want to receive viewport rect updates
will need to register on document instead of the browsing context.

This change solves the problem where a browsing context for a document
is guaranteed to exist only while the document is active so browsing
context might not exit by the time DOM node that want to register is
constructed.

This is a part of preparation work before switching to navigables where
this issue becomes more visible.
2023-08-23 20:14:20 +02:00