Commit graph

53808 commits

Author SHA1 Message Date
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
Aliaksandr Kalenik 48e9097aa4 LibWeb: Fix "stack-use-after-return" in "process_response" callback
Fixes stack-use-after-return bug found by ASAN that happens when
`response` reference captured by `process_response` is modified
after navigation has been canceled.
2023-08-23 19:49:26 +02:00
Andreas Kling 234a73e43e LibWeb: Implement "document-tree child navigables" 2023-08-23 19:49:26 +02:00
Timothy Flynn d56f127c80 Ladybird+LibWebView: Rename some "on get" notifications to "on received"
The old names sounded like awkward English to me, as they implied the
WebContent process is asking for information. In reality, WebContent is
*providing* the information.
2023-08-23 12:07:02 -04:00
Timothy Flynn edec5b1d91 Ladybird+LibWebView: Migrate input completions to LibWebView callbacks 2023-08-23 12:07:02 -04:00
Timothy Flynn 5116e97a9d Ladybird+LibWebView: Migrate tooltip changes to LibWebView callbacks 2023-08-23 12:07:02 -04:00
Timothy Flynn 78d9339aa9 Ladybird+LibWebView: Migrate scrolling changes to LibWebView callbacks 2023-08-23 12:07:02 -04:00
Timothy Flynn 00fe122b0a Ladybird+LibWebView: Migrate cursor changes to LibWebView callbacks 2023-08-23 12:07:02 -04:00
Timothy Flynn bf464665a7 Ladybird+LibWebView: Migrate layout notification to LibWebView callbacks 2023-08-23 12:07:02 -04:00
Timothy Flynn 682a5f9b70 Ladybird+LibWebView: Move APIs which only repaint to LibWebView
We can easily add hooks to notify the browsers of these events if any
implementation-specific handling is needed in the future, but for now,
these only repaint the client, which we can do in ViewImplementation.
2023-08-23 09:59:04 -04:00
Timothy Flynn ea7e1b5f53 Ladybird+LibWebView: Move most of paint handling to LibWebView
Storing the backup bitmap is the same across Browser and Ladybird. Just
peform that work in LibWebView, and handle only the implementation-
specific nuances within the browsers.
2023-08-23 09:59:04 -04:00
Timothy Flynn 15da77f4c4 Ladybird+LibWebView: Migrate file APIs to LibWebView callbacks
This also sets the default callback to do what every non-Serenity
browser is doing, rather than copy-pasting this callback into every
implementation. The callback is still available for any platform which
might want to override the default behavior. For example, OOPWV now
overrides this callback to use FileSystemAccessClient.
2023-08-23 09:59:04 -04:00
Timothy Flynn ebdcba8b3b Ladybird+LibWebView: Migrate dialog APIs to LibWebView callbacks 2023-08-23 09:59:04 -04:00
Timothy Flynn e6c01ef6e2 LibWebView: Replace OOPWV inclusion with ViewImplementation.h
This is the header WebContentClient actually needs. Just noticed by
clangd when OOPWV.h has errors that don't apply to WebContentClient at
all.
2023-08-23 09:59:04 -04:00
Aliaksandr Kalenik d06d4eb388 LibWeb: Apply "clip" property in apply_clip_overflow_rect()
Fixes bug when "clip" property does not affect abspos children.
This change makes "clip" property to be applied together with
"overflow: hidden" in `apply_clip_overflow_rect()` that already
handles abspos children correctly.
2023-08-23 15:49:06 +02:00
Aliaksandr Kalenik 5896c0ed06 LibWeb/CSS: Set "inherited" to false for "clip" property
"clip" should not be inherited.
2023-08-23 15:49:06 +02:00
Tim Ledbetter 81d9a6f44a Ports/build_all: Read port directory names into an array immediately
The script previously failed early after building `mandoc`, as it
failed to switch to the correct directory for the next port. With this
change, the script now runs to completion.
2023-08-23 15:42:49 +02:00
Andi Gallo b13fe9397d LibWeb: Support border attribute on the table element
Fixes #19938.
2023-08-23 15:40:41 +02:00
Aman Singh fb4a20ade5 Kernel: Fix condition for write to succeed on pseudoterminal
As "\n" is translated to "\r\n" in TTYs, the condition for a write
to succeed on a pseudoterminal should check if the underlying buffer
has 2 bytes empty rather than 1.

Fixes SerenityOS#18888
2023-08-23 15:26:03 +02:00
Tim Ledbetter d7c1a1ecac Ports/libgd: Update formatting to be consistent with other ports 2023-08-23 13:33:49 +02:00
Tim Ledbetter 1f2aef4028 Ports/libgd: Explicitly specify which dependencies to include
Previously, building `libgd` with `fontconfig` already installed would
cause the build to fail.
2023-08-23 13:33:49 +02:00
implicitfield 2114c27656 Flood: Replace usage of DeprecatedString 2023-08-23 13:28:07 +02:00
implicitfield adaf4a9ed5 Flood: Use the new GML compiler 2023-08-23 13:28:07 +02:00
implicitfield 8434b3a0c6 Flood: Propagate errors when creating SettingsDialog 2023-08-23 13:28:07 +02:00
Hendiadyoin1 239293a8b4 Meta: Disable misc-use-anonymous-namespace clang-tidy warning
This flags nearly every static function, so let's disable it
2023-08-23 12:25:40 +01:00
Bastiaan van der Plaat c88f14902b LibWeb: Add DOMQuad and text tests 2023-08-23 12:11:21 +01:00
Bastiaan van der Plaat e4270bc01d LibWeb: Make DOMRectReadOnly use double instead of float 2023-08-23 12:11:21 +01:00
Bastiaan van der Plaat 2e1d6f624d LibIDL: Fix bug where Type::is_json doesn't look at parent interface 2023-08-23 12:11:21 +01:00
Bastiaan van der Plaat 43825acc79 Meta+BindingsGenerator: Add postfix to member_value_name to make unique 2023-08-23 12:11:21 +01:00
Tim Schumacher dbc25f18ec LibCompress: Let BrotliDecompressionStream take a MaybeOwned 2023-08-23 12:03:37 +01:00
Tim Schumacher 8a853278d0 LibCompress: Port ZlibDecompressor to AK::Stream 2023-08-23 12:03:37 +01:00
Tim Schumacher 90780d9ade LibCompress: Let GzipDecompressor take a MaybeOwned<Stream> 2023-08-23 12:03:37 +01:00
0GreenClover0 f165d2e7ec LibWeb: Update <use> visuals after changing the referenced element 2023-08-23 11:55:24 +01:00
Tim Ledbetter 5af7d5da2f Ports: Simplify the output from identify when installing icons
This ensures that the correct index is always used when selecting an
image of a particular size.
2023-08-23 12:55:00 +02:00
Tim Ledbetter d09271be35 Ports/SDL_sound: Ensure build is run in parallel 2023-08-23 12:23:33 +02:00
Tim Ledbetter b885be8046 Ports/SDL_sound: Specify which optional dependencies to include
This fixes an issue where building `SDL_sound` with the `libphysfs`
port installed would cause the build to fail.

Ogg support has also been enabled. This allows playback of the sound
effects in GLTron.

Both FLAC and `libmodplug` support are currently disabled, even
though the build succeeds with them enabled, as there is currently no
way to test whether they would work or not.
2023-08-23 12:23:33 +02:00
Tim Ledbetter 9e5d430fbd Ports/SDL_sound: Update formatting to be consistent with other ports 2023-08-23 12:23:33 +02:00
Andreas Kling 354d2ccc3c LibWeb: Support fast_is<T>() for table, table sections, rows and cells
3.2x speed-up on WebKit/PerformanceTests/DOM/GridSort.html
2023-08-23 08:06:25 +02:00
Andreas Kling 76580bb9ba LibWeb: Cache lowercased tag name for getElementsByTagName() iteration
Instead of calling to_lowercase() on two strings for every step while
iterating over the HTMLCollection returned by getElementsByTagName(),
we now cache the lowercased tag name beforehand and reuse it.

2.4x speed-up on WebKit/PerformanceTests/DOM/DOMDivWalk.html
2023-08-23 08:06:25 +02:00
Sam Atkins ec340f03a5 WebContent+LibWebView: Add support for user style sheets 2023-08-23 05:32:10 +02:00
Sam Atkins 6dcd8d4a2c LibWeb: Add support for "User" CascadeOrigin
User styles are applied after the UserAgent's built-in styles, and
before the Author styles that are part of the web page.

Because they're neither part of the page, but can still be modified
while the page is open, caching is a little tricky. The approach here
is to piggy-back on the StyleComputer's rule caches, which already get
rebuilt whenever the styles change. This is not the smartest approach,
since it means re-parsing the style sheet more often than is necessary,
but it's simple and works. :^)
2023-08-23 05:32:10 +02:00
Sam Atkins 7bc5949e35 LibWeb: Implement the :placeholder-shown pseudo-class
This matches if the element has a placeholder, and that placeholder is
currently visible. This applies to `<input>` and `<textarea>` elements,
but our `<textarea>` is very limited so does not support placeholders.
2023-08-23 05:30:59 +02:00