Commit graph

35014 commits

Author SHA1 Message Date
Timothy Flynn c2d5e30a35 LibWeb: Remove debug spam when clicking a link 2024-08-02 08:07:00 +02:00
Timothy Flynn facaf953eb LibWeb+WebContent: Add a page hook to invoke the did-click-link IPC 2024-08-02 08:07:00 +02:00
Timothy Flynn 3ff965d672 WebContent: Remove unnecessary [[maybe_unused]] attributes
Noticed while copy-pasting this method to a did-click-link method.
2024-08-02 08:07:00 +02:00
Timothy Flynn 71b25e3e5a LibWeb: Define a helper constant for the platform ctrl-ish key
For all intents and purposes, the cmd (super) key on macOS should be
treated as the ctrl key.
2024-08-02 08:07:00 +02:00
Timothy Flynn ee00730225 LibUnicode+LibJS: Normalize spaces in formatted date-time strings
ICU 72 began using non-ASCII spaces in some formatted date-time strings.
Every major browser has found that this introduced major breakage in web
compatibility, as many sites and tools expect ASCII spaces. This patch
removes these non-ASCII spaces in the same manner as the major engines.
Such behavior is also tested by WPT.
2024-08-02 08:05:52 +02:00
Aliaksandr Kalenik 9e22233be9 LibWeb: Enable fast path of animation invalidation for pseudo-elements
3abd3ef5e2 made possible using fast
invalidation path for pseudo-element by saving previously computed style
in DOM::Element.
2024-08-02 08:05:31 +02:00
Aliaksandr Kalenik 4049cce40c LibWeb: Add slots for pseudo-elements animation cache in Animatable
Fixes the bug when animation does not run at all if an element has a
pseudo-element, because both of them use the same cache.
2024-08-02 08:05:31 +02:00
Tim Ledbetter 2854113ee6 LibWebView+WebContent: Add a --force-cpu-painting option
This option forces Skia to use the CPU backend rather than using the
GPU.
2024-08-01 23:26:45 +01:00
Tim Ledbetter ae51fbd5de WebDriver: Use correct WebDriver IPC path argument name
Previously, the incorrect name for this argument  was being used when
attempting to launch `headless-browser`.
2024-08-01 16:40:19 -04:00
Timothy Flynn ce5f2861d8 LibWebView+UI: Allow profiling any helper process
This removes the --enable-callgrind-profiling flag, and replaces it with
a --profile-process=<process-name> flag. For example:

    ladybird --profile-process=WebContent
    ladybird --profile-process=RequestServer

This allows profiling any helper process with callgrind.
2024-08-01 15:40:49 +02:00
Timothy Flynn 7106a7bd58 LibWebView+UI: Allow debugging any helper process
This removes the --debug-web-content flag, and replaces it with a
--debug-process=<process-name> flag. For example:

    ladybird --debug-process=WebContent
    ladybird --debug-process=RequestServer

This allows attaching gdb to any helper process.
2024-08-01 15:40:49 +02:00
Aliaksandr Kalenik bbc89a383d LibWeb: Fix overflow clip when "complicated" CSS transform is used
Overflow clipping is currently implemented as:
1. Create clip frame for each box with hidden overflow
2. Calculate clip rect for each clip frame by intersecting padding boxes
   of all boxes with hidden overflow in containing block chain
3. Assign enclosing clip frame (closest clip frame in containing block
   chain) to each PaintableBox
4. Apply clip rect of enclosing clip frame in Paintable::before_paint()

It breaks when any CSS transform other than simple translation is lying
between box with hidden overflow and a clipped box, because clip
rectangle will be applied when transform has already changed.

The fix is implemented by relying on the following rule:
"For elements whose layout is governed by the CSS box model, any value
other than none for the transform also causes the element to establish
a containing block for all descendants."

It means everything nested into a stacking context with CSS transform
can't escape its clip, so it's safe to apply its clip for all children.
2024-08-01 12:03:13 +02:00
Aliaksandr Kalenik e75791d9e1 LibWeb: Add missing border-radius clip in refresh_clip_state()
Adds missing clip of border-radius for clip frame. While we have already
accounted for the border-radius of containing blocks, the box itself was
not being clipped.
2024-08-01 12:03:13 +02:00
Aliaksandr Kalenik 1829ec56e2 LibWeb: Apply scroll offset to transform origin in PushStackingContext 2024-08-01 12:03:13 +02:00
Aliaksandr Kalenik c47ec26bcd LibWeb: Delete m_clipping_overflow in PaintableBox 2024-08-01 12:03:13 +02:00
Diego Frias 23cfee2205 LibWasm: Clean up module sections API
Remove `for_each_section_of_type` in favor of making the module's
sections defined as distinct fields. This means it is no longer possible
to have two of the same section (which is invalid in WebAssembly, for
anything other than custom sections).
2024-08-01 11:44:07 +02:00
Shannon Booth 9f24176cac HTML: Partially implement HTMLInputElement's selection{Start,End}
Now that the implementation is in FormAssociatedElement, the
implementation in HTMLInputElement is effectively just a passthrough,
with some minor differences to handle small behavioural quirks between
the two (such as the difference in nullability of types).
2024-08-01 11:42:39 +02:00
Shannon Booth 62bf428a7f HTML: Put HTMLTextAreaElement selection helpers in FormAssociatedElement
This will allow us to more closely follow the spec and share these
functions with HTMLInputElement.
2024-08-01 11:42:39 +02:00
Shannon Booth 28ed8e5d0f HTML: Add const qualified form_associated_element_to_html_element
Put the const cast in a common location to make the helper more
convenient to use.
2024-08-01 11:42:39 +02:00
Ali Mohammad Pur 1fa528b19f LibWeb: Keep Wasm-imported functions alive
The user is not required to keep the object alive, this commit makes it
so the lifetime of these functions is extended to match the Wasm module
it is imported into.
Fixes the crash in #907.
2024-08-01 11:41:19 +02:00
Timothy Flynn 1eced20521 LibJS: Change Intl.Locale.prototype.firstDayOfWeek to be a string
This is a normative change in the Intl Locale Info proposal. See:

https://github.com/tc39/proposal-intl-locale-info/commit/5cb45fd
https://github.com/tc39/proposal-intl-locale-info/commit/6d80e69
https://github.com/tc39/proposal-intl-locale-info/commit/04039b8
2024-08-01 11:40:37 +02:00
Tim Ledbetter 34e465a67e LibWeb: Account for header size when reading MessagePort message payload
Previously, the fact that this wasn't accounted for could lead to a
crash when large messages were received.
2024-08-01 11:39:43 +02:00
sideshowbarker f735c464d3 LibWeb/Fetch: Don’t cache redirects
This change disables caching for 301, 302, 303, 307, and 308 responses.
This is just for now, ad-hoc — not adhering to any particular spec.
Fixes https://github.com/LadybirdBrowser/ladybird/issues/863
2024-08-01 11:39:27 +02:00
Timothy Flynn 5f8d852dae LibWebView+UI: Migrate Ladybird's command line flags to LibWebView
Currently, if we want to add a new e.g. WebContent command line option,
we have to add it to all of Qt, AppKit, and headless-browser. (Or worse,
we only add it to one of these, and we have feature disparity).

To prevent this, this moves command line flags to WebView::Application.
The flags are assigned to ChromeOptions and WebContentOptions structs.
Each chrome can still add its platform-specific options; for example,
the Qt chrome has a flag to enable Qt networking.

There should be no behavior change here, other than that AppKit will now
support command line flags that were previously only supported by Qt.
2024-08-01 11:38:42 +02:00
Timothy Flynn 0e640f6f70 WebContent: Limit the Console client to the top-level navigable client
We don't want to set the intrinsic Console object's client to non-top-
level clients, created for e.g. subframes. We also want to make sure the
Console client is updated if the top-level document has changed.
2024-08-01 11:35:49 +02:00
Timothy Flynn 0a819e628e LibWeb+WebContent: Store console clients on the DOM document
We explicitly stopped visting the map of documents to console clients in
commit 44659f2f2a to avoid keeping the
document alive. However, if nothing else visits the console clients, we
may set the top-level console client to a client that has been garbage
collected.

So instead of storing this map, just store the console client on the
document itself. This will allow the document to visit its client.
2024-08-01 11:35:49 +02:00
Timothy Flynn a1c57ed79a WebContent: Do not create JS consoles for fragment-parsing documents
There's no need to go through this setup.
2024-08-01 11:35:49 +02:00
Timothy Flynn c838ca78c8 LibWeb: Indicate documents are for fragment parsing during construction
This will allow testing if they are for fragment parsing during methods
invoked from Document::initialize.
2024-08-01 11:35:49 +02:00
Aliaksandr Kalenik 2cc2646f55 LibWeb: Apply scroll offset and clip rectangle to table borders
Moves paint_table_borders() call into PaintableBox::paint() to make
scroll offset and clip rectangle of enclosing scrollable be applied
in ::before_paint().
2024-07-31 21:43:17 +02:00
Timothy Flynn cf25a06d67 LibWebView: Make open file limit modifications non-fatal
If setrlimit fails, let's just report the error rather than failing to
start the browser at all.
2024-07-31 10:12:37 -06:00
Timothy Flynn 9e7e22dc74 LibCore: Use Error::from_syscall to report get/setrlimit errors 2024-07-31 10:12:37 -06:00
Sam Atkins 3abd3ef5e2 LibWeb: Compute pseudo-element style when computing element style
Previously, pseudo-elements had their style computed while the layout
tree was being built. Instead, do so inside Element::recompute_style(),
using the same invalidation mechanism that the element itself uses.

This also has the effect of invalidating the layout much less often.
2024-07-31 12:15:39 +02:00
Sam Atkins d58c1c1176 LibWeb/CSS: Make content property change require full invalidation
`content` determines the element or pseudo-element's layout, including
its children.
2024-07-31 12:15:39 +02:00
Timothy Flynn 4a166a45ec LibWeb: Avoid allocating UTF-16 strings only the UTF-16 length is needed 2024-07-31 05:55:34 -04:00
Andrew Kaster 2fa6c445cb CMake: Work around two upstream CMake issues for Swift files
https://gitlab.kitware.com/cmake/cmake/-/issues/26174
https://gitlab.kitware.com/cmake/cmake/-/issues/26175
2024-07-30 18:38:02 -06:00
Andrew Kaster d1969851ce LibGfx: Add an implementation of #rrggbb color parsing in Swift 2024-07-30 18:38:02 -06:00
Andrew Kaster 45301e8169 Everywhere: Remove AK_DONT_REPLACE_STD macro
Let's just always include `<utility>`. Placing our own incompatible with
the STL declaration of these functions in AK was always fishy to begin
with.
2024-07-30 18:38:02 -06:00
Andrew Kaster cf42bf2bca LibGfx: Factor out #rrggbb Color parsing into its own helper function 2024-07-30 18:38:02 -06:00
Diego Frias 3c5e3eef10 LibWeb: No longer return undefined on null table entry in Wasm API
Return `null` instead, as per the specification.
2024-07-30 23:43:44 +02:00
Ali Mohammad Pur 93216a875e RequestServer: Actually hold on to the preload job until it's done
This was some nonsense code left in by mistake, ref commit:
4211639e45

Fixes #904.
2024-07-30 12:03:30 -04:00
Sam Atkins 7daf5cdaff LibWeb: Invalidate layout if pseudo-element style changes
Pseudo-elements' style is only computed while building the layout tree.
This meant that previously, they would not have their style recomputed
in some cases. (Such as when :hover is applied to an ancestor.)

Now, when recomputing an element's style, we also return a full
invalidation if one or more pseudo-elements would exist either before or
after style recomputation.

This heuristic produces some false positives, but no false negatives.
Because pseudo-elements' style is computed during layout building, any
computation done here is then thrown away. So this approach minimises
the amount of wasted style computation. Plus it's simple, until we have
data on what approach would be faster.

This fixes the Acid2 nose becoming blue when the .nose div is hovered.
2024-07-30 09:45:45 +02:00
Sam Atkins f23f0721bd LibWeb: Combine Element's pseudo-element data together
Rather than maintain two dynamically-allocated arrays of data for
pseudo-elements, put them in a single array, which is easier to manage.
2024-07-30 09:45:45 +02:00
Aliaksandr Kalenik 2c0f03f5b6 LibWeb: Delete BlitCornerClipping display list command
Contrary to LibGfx, where corner clipping was implemented by sampling
and blitting pixels under corners into a temporary bitmap, Skia allows
us to simply apply a mask. As a result, we no longer need the
BlitCornerClipping command, which has become a no-op.

- SampleUnderCorners is renamed to AddRoundedRectClip
- The optimization that skipped unnecessary blit and sample commands has
  been removed. However, this should not result in a performance
  regression because Skia seems to perform mask rasterization lazily.
2024-07-30 09:43:43 +02:00
Aliaksandr Kalenik 333c9270b1 LibWeb: Simplify outer box shadow's bounding box calculation
There is no need in the overly complicated OuterBoxShadowMetrics after
switching to use Skia for painting.
2024-07-30 09:43:20 +02:00
Timothy Flynn 4f5604c7db WebContent: Ignore invalid attributes set via the Inspector
Rather than crash, just ignore these values for now. We should invent a
mechanism to send feedback to the user (perhaps via the JS console).
2024-07-30 09:41:35 +02:00
Timothy Flynn 93f2af38b1 LibWebView: Escape HTML entities in attribute names
Otherwise, we can embed invalid HTML in the Inspector web view.
2024-07-30 09:41:35 +02:00
Timothy Flynn 657bbd1542 LibWeb: Append attributes to the correct element
The spec indicates we should append attributes to the top element of the
stack of open elements. We were appending the attribute to the bottom.
2024-07-30 09:41:35 +02:00
Timothy Flynn 9fe35ddddf LibWeb: Use an infallible method to add attributes to nodes
In the HTML parser spec, there are 2 instances of the following text:

    add the attribute and its corresponding value to that element

The "add the attribute" text does not have a corresponding spec link to
actually specify what to do. We currently use `set_attribute`, which can
throw an exception if the attribute name contains an invalid character
(such as '<'). Instead, switch to `append_attribute`, which allows such
attribute names. This behavior matches Firefox.

Note we cannot yet make the unclosed-html-element.html test match the
expectations of the unclosed-body-element.html due to another bug that
would prevent checking if the expected element has the right attribute.
That will be fixed in an upcoming commit.
2024-07-30 09:41:35 +02:00
Timothy Flynn c1b0e180ba LibWebView: Insert line numbers before each line in about:srcdoc
The behavior chosen here (fixed-width counters, alignment, etc.) matches
Firefox.
2024-07-29 18:27:16 +01:00
Sam Atkins 5abe246385 LibWeb/CSS: Treat counters() function with 1 argument as invalid
Fixes #887.
2024-07-29 12:57:43 -04:00
Aliaksandr Kalenik 0bfcf73524 LibWeb: Inline apply_backdrop_filter function into paint_backdrop_filter
No need to have a separate file for this small function.
2024-07-29 17:48:56 +02:00
Aliaksandr Kalenik 8164be7ac8 LibWeb: Delete create_gfx_paint_style() for SVG gradients
No longer used after switching to Skia.
2024-07-29 16:25:05 +01:00
Sam Atkins 2a55ab13ef LibWeb: Update DOMStringList to match PlatformObject changes
- is_supported_property_index() no longer needs to be overridden
- item_value() now returns Optional
2024-07-29 11:17:05 +01:00
Jamie Mansfield 75216182c9 LibWeb: Implement DOMStringList 2024-07-29 11:19:00 +02:00
Aliaksandr Kalenik aa08e52548 LibWeb/Painting: Delete unused LinearGradientData.h 2024-07-29 11:17:55 +02:00
bbb651 014a069157 WebAudio: Stub remainder of AudioBufferSourceNode 2024-07-28 21:41:15 +02:00
bbb651 779e3072f9 WebAudio: Stub AudioDestinationContext
And expose it through `BaseAudioContext::destination`
2024-07-28 21:41:15 +02:00
bbb651 9c17398429 WebAudio: Import AudioNode directly in GainNode 2024-07-28 21:41:15 +02:00
bbb651 150cef62a0 WebAudio: BiquadFilterNode: Implement AudioParams and stub rest 2024-07-28 21:41:15 +02:00
bbb651 6d33cc2b3a WebAudio: Stub/implement more of AudioNode 2024-07-28 21:41:15 +02:00
Tim Ledbetter 354e5a6624 LibWeb: Set correct prototype for WorkerLocation 2024-07-28 21:40:30 +02:00
doctortheemh 7f40a19c71 LibWeb: Fix some typos with text clips
While working on this section of code, I noticed some older names were
still being used. This just brings them up to date and fixes a couple
moves.
2024-07-28 13:45:40 +02:00
Ali Mohammad Pur 4211639e45 RequestServer+LibHTTP: Cancel requests on client exit
That usually happens in "exceptional" states when the client exits
unexpectedly (crash, force quit mid-load, etc), leading to the job flush
timer firing and attempting to write to a nonexistent object (the
client).

This commit makes RS simply cancel such jobs; cancelled jobs in this
state simply go away instead of sending notifications around.
2024-07-28 13:02:49 +02:00
Diego Frias 41dc58f702 LibWasm: Remove unused ParseError variant 2024-07-28 13:02:36 +02:00
Diego Frias 9800ef6047 LibWasm: Introduce TRY_READ for parser
Convenience macro akin to `TRY` for reading from a stream.
2024-07-28 13:02:36 +02:00
Diego Frias dc52998341 LibWasm: Remove Module::functions
`Module::functions` created clones of all of the functions in the
module. It provided a _slightly_ better API, but ended up costing around
40ms when instantiating spidermonkey.
2024-07-28 02:56:32 +02:00
Ángel Carias 9624e0d2a2 LibWeb/DOM: Implement Node.lookupPrefix
Adds https://dom.spec.whatwg.org/#dom-node-lookupprefix
2024-07-28 00:51:55 +01:00
Sam Atkins 9e32c9329a LibWeb: Reserve enough space for span>1 columns in BorderConflictFinder
This code previously only allocated enough space in
m_col_elements_by_index for 1 slot per column, meaning that columns
with a span > 1 would write off the end of it.
2024-07-27 20:23:14 +01:00
Sam Atkins 0cec68ea99 LibWeb: Correct logic for removing end nodes from HTMLOptionsCollection
This test case would previously crash.

Found with domato.
2024-07-27 20:23:14 +01:00
Aliaksandr Kalenik f61e54b10c LibGfx: Remove code responsible for glyph rasterization
No longer needed after switching to Skia.
2024-07-27 18:37:40 +01:00
Sam Atkins 6ae2b8c3d9 LibWeb/CSS: Parse custom-idents more consistently
These have a few rules that we didn't follow in most cases:
- CSS-wide keywords are not allowed. (inherit, initial, etc)
- `default` is not allowed.
- The above and any other disallowed identifiers must be tested
  case-insensitively.

This introduces a `parse_custom_ident_value()` method, which takes a
list of disallowed identifier names, and handles the above rules.
2024-07-27 14:45:33 +02:00
Ali Mohammad Pur d3f089dc26 Utilities/js: Make it possible to exit via two consecutive ^C's
Apparently this is common in the js repl world.
Fixes #743.
2024-07-27 11:49:45 +01:00
Diego Frias fc57f5111d LibWasm: Remove needless and costly copies
Speeds up spidermonkey.wasm instantiation by around 60ms (240ms -> 180ms)
2024-07-27 08:19:51 +02:00
Diego Frias 2192c149e2 LibWasm: Stop using ConstrainedStream for function parsing
Speeds up spidermonkey.wasm instantiation by around 20ms (260ms -> 240ms)
2024-07-27 08:19:51 +02:00
Diego Frias 5cde327d46 LibWasm: Provide size hint when parsing instructions into a vector
Speeds up spidermonkey.wasm instantiation by around 20ms (280ms -> 260ms)
2024-07-27 08:19:51 +02:00
Aliaksandr Kalenik 1bd0871ed8 LibWeb+LibGfx: Use Skia for text rasterization
The main incentive is much better performance. We could have gone a bit
further in optimizing the Skia painter to blit glyphs produced by LibGfx
more efficiently from the glyph atlas, but eventually, we also want Skia
to improve correctness.

This change does not completely replace LibGfx in text handling. It's
still used at all stages, including layout, up until display list
replaying.
2024-07-27 08:18:54 +02:00
Jamie Mansfield b7f0241ab5 LibWeb: Use "en" as a fallback when setting preferred languages
This will set the preferred languages to [ "en" ] if an empty list is
provided.
2024-07-27 08:18:16 +02:00
Jamie Mansfield 7b105e1ecf LibWeb: Add a default for the navigator's languages
This will mean that non-Qt frontends don't return an empty array.
2024-07-27 08:18:16 +02:00
Sam Atkins 59778d2b36 LibWeb/CSS: Make CSS Parser::create() infallible
Now that `Tokenizer::tokenize()` just returns a String, there are no
errors to propagate, and we can simplify the user code a bit.
2024-07-26 17:29:20 +02:00
Sam Atkins 89c5f25016 LibWeb/CSS: Remove tiny-oom propagation from CSS Tokenizer 2024-07-26 17:29:20 +02:00
Shannon Booth 22969a8e92 Bindings: Avoid second property index lookup for platform objects
While conceptually is_supported_property_index is a cheap index lookup,
it is not currently cheap for an container such as HTMLAllCollection
that is operating on an uncached collection. Instead - just do the
lookup once. It also happens to look a little nicer to not blindly
dereference an optional.
2024-07-26 14:26:16 +02:00
Shannon Booth 8a5985b87f Bindings: Use is_supported_property_name instead of contains_slow
This uses a faster hashtable lookup in the case of HTMLCollection.

Also port invoke_named_property_setter to FlyString to avoid a
FlyString->String->FlyString conversion that surfaces from this change.
2024-07-26 14:26:16 +02:00
Shannon Booth 9b1af542e7 Bindings: Implement is_supported_property_index in terms of item_value
Greatly simplifying the code :^)
2024-07-26 14:26:16 +02:00
Shannon Booth c5c1a8fcc7 Bindings: Make item_value return an Optional<JS::Value>
This removes some ambiguity about what the return value should be if
the index is out of range.

Previously, we would sometimes return a JS null, and other times a JS
undefined.

It will also let us fold together the checks for whether an index is a
supported property index, followed by getting the value just afterwards.
2024-07-26 14:26:16 +02:00
Shannon Booth 9b59dc5e8b Bindings: Remove exception handling for named_item_value 2024-07-26 14:26:16 +02:00
Shannon Booth 081c92bf3d Bindings: Remove exception handling for named_item
We don't need this for any case, so just remove it to simplify handling
in PlatformObject.
2024-07-26 14:26:16 +02:00
Andreas Kling 273593afba LibWeb: Don't proceed with Element.click() on disabled form controls
Fixes an infinite reload loop on some of the dom/events/ tests in WPT.
2024-07-26 14:25:04 +02:00
Sam Atkins 696ccc1aa9 LibWeb: Prevent elements with no layout box from modifying counters 2024-07-26 11:04:30 +01:00
Sam Atkins 898e3bd898 Last: LibWeb: Add counter() and counters() functions to content property
These let you format counters' current values as strings for use in
generated content.
2024-07-26 11:04:30 +01:00
Sam Atkins 576a431408 LibWeb: Implement CounterStyleValue
This is `counter(name, style?)` or `counters(name, link, style?)`. The
difference being, `counter()` matches only the nearest level (eg, "1"),
and `counters()` combines all the levels in the tree (eg, "3.4.1").
2024-07-26 11:04:30 +01:00
Sam Atkins 017d6c3314 LibWeb: Implement counter-[increment,reset,set] properties
These control the state of CSS counters.

Parsing code for `reversed(counter-name)` is implemented, but disabled
for now until we are able to resolve values for those.
2024-07-26 11:04:30 +01:00
Sam Atkins 4c42e93853 LibWeb: Format Properties.json 2024-07-26 11:04:30 +01:00
Sam Atkins ca10fb4129 LibWeb/CSS: Refactor contains_single_none_ident() to actually parse it
The new method is Parser::parse_all_as_single_none_value(), which has a
few advantages:

1. There's no need for user code to manually create a StyleValue.
2. It consumes tokens so that doesn't have to be done manually.
3. Whitespace before or after the `none` is consumed correctly.

It does mean we create and then discard a `none` StyleValue in a couple
of places, namely parsing for `grid-*` properties. We may or may not
want to migrate those to returning the IdentifierStyleValue instead.
2024-07-26 11:04:30 +01:00
Sam Atkins 6f2f91d1f5 LibWeb: Stop computing content in NodeWithStyle::apply_style()
This seems to have been required when pseudo-elements were first
implemented, but has since become unused. It's also awkward because we
don't have access to the DOM Element and its CountersSet at this point.
So, let's remove it.

For reference, Chrome&Firefox both return the computed value for
`content: counter(foo)` as `counter(foo)`, not as the computed string.
So not computing it here seems like the intended behaviour.
2024-07-26 11:04:30 +01:00
Sam Atkins 708f49d906 LibWeb: Give DOM Elements a CountersSet
This represents each element's set of CSS counters.
https://drafts.csswg.org/css-lists-3/#css-counters-set

Counters are resolved while building the tree. Most elements will not
have any counters to keep track of, so as an optimization, we don't
create a CountersSet object until the element actually needs one.

In order to properly support counters on pseudo-elements, the
CountersSet needs to go somewhere else. However, my experiments with
placing it on the Layout::Node kept hitting a wall. For now, this is
fairly simple at least.
2024-07-26 11:04:30 +01:00
Kenneth Myhra a744a9ebe7 LibWeb: Append fetch record to client's fetch group when request is a
...subresource.
2024-07-26 10:22:17 +02:00
Kenneth Myhra e36607bdba LibWeb: Add spec link to fetch group concept 2024-07-26 10:22:17 +02:00
Kemal Zebari c5f1e47883 LibWeb: Implement Blob::bytes()
Implements https://w3c.github.io/FileAPI/#dom-blob-bytes.
2024-07-26 10:21:32 +02:00
Timur Sultanov ad7b2b7c26 LibWeb: Improve HTMLSelectElement spec compliance
Set default `size` value according to spec
2024-07-26 09:15:39 +01:00
Timur Sultanov 9d4f3c938f LibWeb: Improve HTMLOptionElement spec compliance
Implement ask_for_a_reset() function
2024-07-26 09:15:39 +01:00
Timur Sultanov f4102b1dc9 LibWeb: Implement selectedness algorithm
Implement selectedness setting algorithm in HTMLSelectElement
2024-07-26 09:15:39 +01:00
doctortheemh 9cbb3fac12 LibWeb: Parse fill and stroke values
Use the CSS color data type using the CSS parser.
2024-07-26 09:14:09 +01:00
Jamie Mansfield 793248aec9 LibWeb/HTML: Implement HTMLMediaElement.addTextTrack
Removes some noise from the console when browsing bbc.co.uk :^)
2024-07-26 09:30:19 +02:00
Jamie Mansfield ff08c2f735 LibWeb/HTML: Add readiness state to TextTrack 2024-07-26 09:30:19 +02:00
Jamie Mansfield 4b16f1df05 LibWeb/HTML: Implement TextTrack.mode 2024-07-26 09:30:19 +02:00
Tim Ledbetter ea2bb52962 LibWeb: Make DocumentType::node_name() return DocumentType::name()
This aligns our implementation with the specification.
2024-07-26 07:19:23 +02:00
sideshowbarker cdb9081a86 LibWebView: Emit “submit an issue” suggestion when Ladybird crashes 2024-07-25 18:37:02 -06:00
Andrew Kaster cdffc4238a WebContent: Ignore GC for page client member of BackingStoreManager
This is very non-ideal, but the use of a reference for this member is
technically ok in its current usage as a member of the PageClient
itself.
2024-07-25 18:35:57 -06:00
Andrew Kaster b73bd76571 LibWeb: Visit the DataTransfer member of DragEvent 2024-07-25 18:35:57 -06:00
Andrew Kaster f314f58fca LibJS+ClangPlugins: Add escape hatch for GCPtr checks 2024-07-25 18:35:57 -06:00
Andrew Kaster 88176d4be2 LibThreading: Guard closing the background thread on the thread existing
This prevents a crash in ImageDecoder when it's closed before any
image decoding requests have been made.
2024-07-25 20:55:31 +01:00
Andreas Kling de2b9eebe6 LibWeb: Inherit CSS variables across shadow boundaries
This fixes a bunch of issues on https://wpt.fyi/
2024-07-25 21:38:32 +02:00
Tim Schumacher cf6929fef3 Meta: Guard everything that installs headers with an option 2024-07-25 13:25:09 -06:00
Andreas Kling d49ae5af32 LibWeb: Make offsetTop and offsetLeft behave more like other browsers
We now follow the rules from the spec more closely, along with an
unspecified quirk for when the offsetParent is a non-positioned body
element. (Spec bug linked in a comment.)

This fixes a whole bunch of css-flexbox tests on WPT, which already had
correct layout, but the reported metrics from JS API were wrong.
2024-07-25 18:52:04 +02:00
Timur Sultanov afb2e063b7 LibWeb: Set the first added <option> element under <select> as selected 2024-07-25 16:58:12 +02:00
Timur Sultanov d1a7caa35d LibWeb: Use queue_a_task() function to queue an element task
Remove direct usage of task_queue() and use a helper function instead
2024-07-25 16:58:12 +02:00
Timur Sultanov 93b6334966 LibWeb: Schedule Microtasks on Microtask queue 2024-07-25 16:58:12 +02:00
Tim Ledbetter 3802d9ccc4 LibWeb: Calculate length for all CharacterData type nodes correctly
We now ensure that `Node::is_character_data()` returns true for all
nodes of type character data.

Previously, calling `Node::length()` on `CDataSection` or
`ProcessingInstruction` nodes would return an incorrect value.
2024-07-25 15:57:21 +01:00
Tim Ledbetter f8b1e96e2b LibWeb: Assert that cloned node is not null before returning
This makes potential issues easier to track down.
2024-07-25 15:57:21 +01:00
Tim Ledbetter 72ed62a560 LibWeb: Don't crash when cloning a CDATASection node 2024-07-25 15:57:21 +01:00
paaspaas00 cdfc7a92f7 LibWeb: Fix typo "rtr" -> "rtl" 2024-07-25 14:51:26 +01:00
Andreas Kling 007c292af3 LibWeb: Execute the correct script in XMLDocumentBuilder::element_end()
We were mistakenly executing the current node's script instead of the
document's pending parsing-blocking script.

This caused ~1000 WPT tests to time out, since we never ended up firing
a load event for XHTML pages that load multiple external scripts.
2024-07-25 15:05:28 +02:00
Andreas Kling b011d47b86 LibCore: Guess MIME type of .xhtml files to be application/xhtml+xml 2024-07-25 15:05:28 +02:00
Aliaksandr Kalenik 61da1236e7 LibWeb: Add a very basic glyph texture cache in Skia painter
This prevents repeated uploading of the same glyph textures into
GPU-memory.
2024-07-25 14:33:33 +02:00
Aliaksandr Kalenik 67d68eac64 LibWeb: Save "background-clip: text" mask as a nested display list
Before this change, "background-clip: text" was implemented by saving a
Vector<Gfx::Path> of all glyphs needed to paint a mask for the
background. The issue with this approach was that once glyphs were
extracted into vector paths, the glyph rasterization cache could no
longer be utilized.

With this change, all text required for mask painting is saved in a
nested display list and rasterized as a regular text.
2024-07-25 14:33:33 +02:00
Aliaksandr Kalenik 50ab5642cc LibWeb: Make DisplayList ref-counted
This change is a preparation for the upcoming changes where display
list will be nested and the same display could be owned by multiple
display list items.
2024-07-25 14:33:33 +02:00
Aliaksandr Kalenik e8b7c88881 LibWeb: Move display list command dispatch into player
With this change display list player will be able to recurse into
executing another display list, without having to construct new display
list player. It is going to be useful in the upcoming changes to paint
a mask from a display list owned by a command.
2024-07-25 14:33:33 +02:00
Tim Ledbetter 5a796629c6 LibWeb: Make document.createElementNS() case-sensitive
Previously, when creating a HTML element with
`document.createElementNS()` we would convert the given local name to
lowercase before deciding which element type to return. We now no
longer perform this lower case conversion, so if an uppercase local
name is provided, an element of type `HTMLUnknownElement` will be
returned. This aligns our implementation with the specification.
2024-07-25 13:12:34 +02:00
Edwin Hoksberg e5deaa1c07 LibWeb: Implement grid-template function fit-content() 2024-07-25 13:12:26 +02:00
Edwin Hoksberg de84e6f93a LibWeb: Move css_clamp function to FormattingContext
Since we need it in the FlexFormattingContext and
GridFormatting context now.
2024-07-25 13:12:26 +02:00
Andreas Kling 4d78c66b3d LibWeb: Cache name->element mappings in HTMLCollection
This makes https://wpt.fyi/ load today instead of tomorrow, although
there's a lot of room for improvement still.
2024-07-25 13:12:02 +02:00
Jamie Mansfield 2ca8fd1832 LibWeb: Make preferred languages configurable
This also changes fetch to use the preferred languages for the
Accept-Language header.
2024-07-25 11:38:59 +01:00
Diego Frias 2cfc1873c0 LibWasm: Flatten instructions in one continuous loop during parsing
Instead of multiple loops and multiple vectors, parse Wasm expressions
in a simple loop. This gets us from ~450ms to instantiate spidermonkey
to ~280ms.
2024-07-25 12:16:45 +02:00
Jamie Mansfield f774d75f89 LibWeb/DOM: Check if name is valid in Element.toggleAttribute
This resolves a test in https://wpt.live/dom/nodes/attributes.html.
2024-07-25 06:46:28 +02:00
Tim Ledbetter 0127190dcf LibWeb: Perform DOMTokenList token validation in the correct order 2024-07-25 06:43:31 +02:00
Tim Ledbetter ec1f7779cb LibWeb: Follow the specification steps to serialize a DOMTokenList
This ensures that calling `element.classList.toString()` always
produces the correct value.
2024-07-25 06:43:31 +02:00
Tim Ledbetter 21e21abeed LibWeb: Update Element class list is when class attribute is removed 2024-07-25 06:43:31 +02:00
Mohamed amine Bounya 6e77fff698 LibWeb: Bring 'construct_entry_list' closer to specs 2024-07-25 06:42:43 +02:00
Diego Frias 4e8376d07e LibWasm: Remove unused vector methods of the interpreter 2024-07-24 23:23:09 +02:00
Diego Frias 9cc3e7d32d LibWasm: Fix SIMD shuffle and swizzle
`swizzle` had the wrong operands, and the vector masking boolean logic
was incorrect in the internal `shuffle_or_0` implementation. `shuffle`
was previously implemented as a dynamic swizzle, when it uses an
immediate operand for lane indices in the spec.
2024-07-24 23:23:09 +02:00
Diego Frias d841742c35 LibWasm: Fix SIMD bit shift right
Set the sign in the vector's element type (even though it's a bit
redundant).
2024-07-24 23:23:09 +02:00
Aliaksandr Kalenik 40f9c9f82a LibWeb: Remove optional prepare step from DisplayListPlayer
This was only needed by removed LibGfx painter to ensure capacity of a
vector with border corner clippers.
2024-07-24 17:49:14 +02:00
Aliaksandr Kalenik 54cb888e2f LibWeb: Remove step to prepare bitmap cache in display list player
This was only used by old OpenGL GPU painter.
2024-07-24 17:49:14 +02:00
Aliaksandr Kalenik a10576d016 LibWeb: Remove step to prepare glyphs texture in display list player
This was only used by old OpenGL GPU painter.
2024-07-24 17:49:14 +02:00
Sam Atkins 6160400ab7 Revert "WebContent: Limit the Console client to the top-level navigable"
This reverts commit 758f4887bc.

This commit was causing ASAN to complain about a use-after-poison, see
https://github.com/LadybirdBrowser/ladybird/issues/809
2024-07-24 16:44:52 +01:00
Aliaksandr Kalenik 6ae9b54f11 LibWeb: Remove stacking context painting failure handling
CommandResult was needed by LibGfx display list player that could have
failed to allocate a temporary bitmap for painting a stacking context
with CSS transforms. This is no longer an issue with Skia painter, so
we can delete CommandResult::SkipStackingContext handling path.
2024-07-24 14:57:19 +02:00
sideshowbarker 70e053bbf4 LibWeb: WebIDL::OverloadResolution, minor code streamlining 2024-07-24 11:23:58 +02:00
sideshowbarker cc7c49e235 LibWeb: WebIDL::OverloadResolution::resolve_overload, add dbgln FIXMEs
Relates to https://github.com/LadybirdBrowser/ladybird/issues/801
2024-07-24 11:23:58 +02:00
Shannon Booth 52ccd69e49 WebAudio: Avoid throwing exception for stubbed AudioNode.connect
This stubs out enough to get https://athenacrisis.com/ far enough to
actually load :^)
2024-07-24 11:14:46 +02:00
Shannon Booth 52be4925bc WebAudio: Avoid throwing exception for stubbed setValueAtTime
Instead, just log an error and continue on gracefully, returning an
instance of ourselves as spec'd.
2024-07-24 11:14:46 +02:00
Shannon Booth a51095f705 WebAudio: Add stub for AudioDestinationNode.destination
This is called by https://athenacrisis.com/ and passed through to
AudioNode.connect, which expects an AudioNode.

Implement this function enough so that we return an AudioNode so that
AudioNode.connect does not throw a TypeError.
2024-07-24 11:14:46 +02:00
Shannon Booth 5eb80b8697 WebAudio: Add IDL interface for AudioDestinationNode
This is an AudioNode representing the final audio destination and is
what the user will ultimately hear.

This node is used as one of the connecting nodes in athenacrisis.com

Add a placeholder for the interface without anything backing it for now.
2024-07-24 11:14:46 +02:00
Andreas Kling 9a7e6158af LibJS: Fix crash in bytecode generator on https://twinings.co.uk/
If the current block has already been terminated, we should just skip
creating a per-iteration environment.
2024-07-24 11:13:53 +02:00
Aliaksandr Kalenik c5afe70f77 LibWeb: Add optimized painting command for repeated background
With this change, instead of recording a display list item for each
instance of a repeated background, a new DrawRepeatedImmutableBitmap
type is used. This allows the painter to use optimized repeated image
painting and, when the GPU backend is used, avoid re-uploading the image
texture for each repetition.

Some screenshot tests are affected, but there are no visible
regressions.

https://null.com/games/chainstaff works a lof faster with this change.
2024-07-24 11:13:04 +02:00
Andreas Kling 4c326fc5f6 LibWeb: Implement :host and :host(<compound-selector>) selector matching
The :host family of pseudo class selectors select the shadow host
element when matching against a rule from within the element's shadow
tree.

This is a bit convoluted due to the fact that the document-level
StyleComputer keeps track of *all* style rules, and not just the
document-level ones.

In the future, we should refactor style storage so that shadow roots
have their own style scope, and we can simplify a lot of this.
2024-07-23 18:03:46 +02:00
Andreas Kling 274c46a3c9 LibWeb: Don't infer descendant combinator for <compound-selector>
This fixes an issue where :host(foo) would parse as if "foo" was the
on the right side of a descendant combinator.

Not testable yet, but will be in the next commit.
2024-07-23 18:03:46 +02:00
Timothy Flynn 758f4887bc WebContent: Limit the Console client to the top-level navigable client
We don't want to set the intrinsic Console object's client to non-top-
level clients, created for e.g. SVG elements or subframes. We also want
to make sure the Console client is updated if the top-level document has
changed.
2024-07-23 18:00:27 +02:00
Sam Atkins 64d45afd8a LibWeb: Check CanvasTextDrawingStyles.font assignment is valid
Checking that the string parsed for the `font` property is not enough,
the spec also wants to rule out CSS-wide keywords like `inherit`. The
simplest way to do so is to check if it's a ShorthandStyleValue, which
also rules out use of `var()`; this matches other browsers' behaviour.

The newly-added test would previously crash, and now doesn't. :^)
2024-07-23 18:00:12 +02:00
simonkrauter 54066ec5a4 LibWeb: Use absolute padding box to calculate max scroll offset
In `PaintableBox::set_scroll_offset()` the scrollport size was measured
by `content_size()` instead of `absolute_padding_box_rect()`.

Fixes #788
2024-07-23 17:59:17 +02:00
Andreas Kling 14beda00c9 LibJS: Rename Value::typeof() to Value::typeof_()
This to avoid clashing with the GCC typeof extension, which apparently
confuses clang-format.
2024-07-23 11:47:37 +02:00
Andreas Kling d0b11af387 LibJS: Make typeof a lot faster by caching all possible results
The typeof operator has a very small set of possible resulting strings,
so let's make it much faster by caching those strings on the VM.

~8x speed-up on this microbenchmark:

    for (let i = 0; i < 10_000_000; ++i) {
        typeof i;
    }
2024-07-23 11:47:37 +02:00
Andreas Kling 3b7534b362 LibWeb: Use correct scope when removing style sheet inside a shadow tree
Before this change, removing a style element from inside a shadow tree
would cause it to be unregistered with the document-level list of sheets
instead of the shadow-root-level list.

This would eventually lead to a verification failure if someone tried to
update the text contents of that style element, since it was still in
the shadow-root-level list, but now with a null owner element.

Fixes a crash on https://www.swedbank.se/
2024-07-23 11:12:18 +02:00
Andreas Kling ebacb921da LibWeb: Verify something was removed in StyleSheetList::remove_sheet()
This would have saved me an hour of debugging, so putting it here for
the next person. :^)
2024-07-23 11:12:18 +02:00
Jamie Mansfield 835986de7b LibWeb/WebGL: Stub missing properties in WebGLRenderingContextBase 2024-07-23 09:04:57 +02:00
Timothy Flynn d58a8b5146 LibWebView+UI: Raise the chrome process open file limit
The default limit (at least on Linux) causes us to run out of file
descriptors at around 15 tabs. Increase this limit to 8k. This is a
rather arbitrary number, but matches the limit set by Chrome.
2024-07-23 09:04:42 +02:00
Timothy Flynn 4451b4fda0 LibCore: Log errors from pipe2 when creating an event loop 2024-07-23 09:04:42 +02:00
Timothy Flynn 0d6115e8ae LibCore: Add system call wrappers around getrlimit and setrlimit 2024-07-23 09:04:42 +02:00
bbb651 64663d53fa WebAudio: Stub BiquadFilterNode 2024-07-23 09:02:43 +02:00
bbb651 6672fb4b47 WebAudio: Stub AudioBufferSourceNode 2024-07-23 09:02:43 +02:00
Kenneth Myhra b8fa572c67 LibWeb: Implement formData() method steps for x-www-form-urlencoded
The Response interface of the Fetch API can now parse form urlencoded
bodies when Content-Type is set to 'application/x-www-form-urlencoded'.
2024-07-23 09:02:21 +02:00
Aliaksandr Kalenik 7047fcf761 LibWeb: Separate paint-only property resolution by paintable type
Having resolution of all properties for all paintable types in a single
function was hard to iterate on, so this change separates it into
smaller functions per paintable type.
2024-07-23 09:00:48 +02:00
Lucas CHOLLET aba435a652 LibGfx/JPEGXL: Add support for animated images 2024-07-23 08:59:34 +02:00
Lucas CHOLLET d9a2c62ed4 LibGfx/JPEGXL: Make JPEGXLLoadingContext non [copy,move]able 2024-07-23 08:59:34 +02:00
Tim Ledbetter bd1213d0c5 LibWeb: Return a NodeList from document.getElementsByName()
This aligns our implementation with the specification.
2024-07-23 08:58:22 +02:00
Tim Ledbetter e40352b6b5 LibWeb: Ensure document.getElementsByName("") returns no elements
Previously, if a document had any element with a name attribute that
was  set to the empty string, then `document.getElementsByName("")` and
`element.getElementsByName("")` would return a collection including
those elements.
2024-07-23 08:58:22 +02:00
Tim Ledbetter 0fceede029 LibWeb: Ensure document.getElementsByClassName("") returns no elements
Previously, `document.getElementsByClassName("")` would return a
collection containing all elements in the given document.
2024-07-23 08:58:22 +02:00
Tim Ledbetter faf64bfb41 LibWeb: Move get_elements_by_name implementation to ParentNode
Previously, we had two implementations of the same function in
`Document` and `Element`, which had inadvertantly diverged.
2024-07-23 08:58:22 +02:00
Tim Ledbetter f666d967d6 LibWeb: Ensure document.getElementById("") returns null
Previously, if a document had an element whose id was the empty string,
then `document.getElementById("")` and `element.getElementById("")`
would return that element.
2024-07-23 08:58:22 +02:00
Ali Mohammad Pur 18499c4eac RequestServer: Make the ThreadPool global
Previously we made one thread pool per ipc client, which is excessive
and can eat up all the available fds very fast.
Fixes #760.
2024-07-23 08:56:59 +02:00
Aliaksandr Kalenik 2ead999f2b LibGfx+LibWeb: Remove typeface classes for WOFF fonts
This change removes wrappers inherited from Gfx::Typeface for WOFF and
WOFF2 fonts. The only purpose they served is owning of ttf ByteBuffer
produced by decoding a WOFF/WOFF2 font. Now new FontData class is
responsible for holding ByteBuffer when a font is constructed from
non-externally owned memory.
2024-07-22 15:05:04 +02:00
mobounya 2497f43989 LibWeb: Update update_for_history_step_application
Update 'update_for_history_step_application' to meet some of the specs
introduced in https://github.com/whatwg/html/pull/9856 and in
https://github.com/whatwg/html/pull/9990
2024-07-22 10:39:46 +02:00
Lucas CHOLLET 1039561280 LibGfx: Use libjxl to decode JPEG XL images
It currently doesn't support animated image.

Note that Gfx::Bitmap has no support for get_pixel when the format is
RGBA8888. This is why it has been removed from the tests.
2024-07-22 09:15:16 +02:00
Tim Ledbetter d417b75683 LibWeb/SVG: Ensure SVG transform has an inverse before using it
This avoids a crash that occurred when calling `getBBox()` on an SVG
element that had a transform with no inverse.

Found by Domato.
2024-07-22 09:13:25 +02:00
Tim Ledbetter 4cdafea363 LibWeb: Don't crash when SVG viewbox has a width of 0
Previously, `SVGSVGBox` would have a natural aspect ratio of 0 if it
had a viewbox with zero width. This led to a division by zero, causing
a crash.

Found by Domato.
2024-07-22 09:13:25 +02:00
Tim Ledbetter 604f6040a1 LibWeb: Clamp paintable box maximum scroll offset to 0
Previously calling `PaintableBox::set_scroll_offset()` with a
PaintableBox whose content size was larger than its scrollble overflow
rect would cause a crash.

Found by Domato.
2024-07-22 09:13:25 +02:00
Olekoop 6b88e43b3b LibAudio: Implement PlaybackStream for Android using Oboe
https://github.com/google/oboe

There are many ways to implement audio for Android, however this is
the recommended way to do it.
2024-07-21 16:09:36 -06:00
circl 37f93e4be1 LibWeb: Replace templated retarget function with a regular one
The templating is not necessary anywhere and was effectively just a cast
2024-07-21 16:01:32 -06:00
circl 3adfdd3257 UI: Rename s_serenity_resource_root to s_ladybird_resource_root 2024-07-21 15:59:25 -06:00
Andrew Kaster 68ce5f8290 Ladybird/AppKit: Port TaskManager window to Swift
This is just a direct port of the Objective-C++ code to Swift 6.
A future patch should probably update it to actually use SwiftUI.
2024-07-21 15:55:47 -06:00
Andrew Kaster 4066ce2c7e CMake: Ensure C/C++ compile options only applied when compiling C/C++ 2024-07-21 15:55:47 -06:00
Holger Hans Peter Freyther 02ba51f203 LibWeb/DOM: Avoid repeated calls to Node::navigable
Minor optimization to avoid looking up the navigable during a
layout operation.
2024-07-21 21:53:43 +02:00
Edwin Hoksberg ac6126e263 LibWeb: Support percentage values in SVG line element 2024-07-21 19:56:38 +02:00
Edwin Hoksberg 356bddbdbb LibWeb: Support percentage values in SVG text positioning element 2024-07-21 19:56:38 +02:00
Aliaksandr Kalenik 44e23dce77 LibGfx+LibWeb: Remove everything in LibGfx/Filters
These are no longer needed after switching to use Skia for web page
painting.
2024-07-21 19:30:58 +02:00
Andreas Kling 98f88d49de LibWeb: Make getElementById() always return first match in tree order
We had a const and non-const version of this function, with slightly
different behavior (oops!)

This patch consolidates the implementations and keeps only the correct
behavior in there.

Fixes an issue where comments were not collapsible on Hacker News.
2024-07-21 11:42:53 +01:00
Jamie Mansfield e4e64c15aa LibWeb/HTML: Stub History.scrollRestoration 2024-07-21 10:50:05 +02:00
Jamie Mansfield 9eede09c3c LibWeb/HTML: Stub HTMLImageElement.{x,y} 2024-07-21 10:50:05 +02:00
Jamie Mansfield e1317915f4 LibWeb/SVG: Stub missing SVGLength attributes
setraises is no longer used by the spec, so I've removed that FIXME :^)
2024-07-21 10:50:05 +02:00
Jamie Mansfield 6c7089fc9e LibWeb/SVG: SVGSymbolElement includes SVGFitToViewBox 2024-07-21 10:50:05 +02:00
Aliaksandr Kalenik 821416027d LibWeb: Remove unused code in BorderRadiusCornerClipper
No longer used after DisplayListPlayerCPU is gone.
2024-07-21 10:36:17 +02:00
Aliaksandr Kalenik 48bd39c23c LibWeb/Painting: Remove unused apply_filter_list() function
No longer used after DisplayListPlayerCPU is gone.
2024-07-21 10:36:17 +02:00
Aliaksandr Kalenik 1ad35f4677 LibWeb: Remove unused shadow painting functions
No longer used after DisplayListPlayerCPU is gone.
2024-07-21 10:36:17 +02:00
Aliaksandr Kalenik f3b3b3f5b9 LibWeb: Delete DisplayListPlayerCPU
No longer used after switching to Skia as a default.
2024-07-21 10:36:17 +02:00
Aliaksandr Kalenik 3627329bed Everywhere: Use Skia painter by default
Skia painter is visibly faster than LibGfx painter and has more complete
CSS transforms support. With this change:
- On Linux, it will try to use Vulkan-backend with fallback to
  CPU-backend
- On macOS it will try to use Metal-backend with fallback to
  CPU-backend
- headless-browser always runs with CPU-backend in layout mode
2024-07-21 10:36:17 +02:00
Aliaksandr Kalenik 9851176c25 headless-browser: Disable screenshot tests on macOS
LibGfx's output is consistent across different platforms, which allows
us to have one set of expectations for screenshot tests. This
consistency will not hold for Skia, where features like antialiasing and
gradient color interpolation vary slightly depending on the platform. In
upcoming changes, we are going to switch to using Skia as the default
painter, which leaves us with the following options:

- Have per-platform screenshot test expectations.
- Limit screenshot tests to run only on one platform and maintain a
  single set of expectation files.

For now, I have decided to choose the latter option, using Linux as it
seems to be the most popular platform among developers.
2024-07-21 10:36:17 +02:00
mobounya 9c93630d02 LibWeb: Conform HTTP-network-or-cache to specs
Implement step 8.10 in '4.5. HTTP-network-or-cache fetch' from the
fetch specs.
2024-07-20 14:09:51 -06:00
mobounya 9e223f6dae LibWeb: Add fetch group from the fetch spec
Add fetch group concept from the '2.4. Fetch groups' in
the fetch specs to the environment settings object.
2024-07-20 14:09:51 -06:00
mobounya 8d38a1326e LibWeb: Implement fetch record from the fetch spec
Implement fetch record concept from the '2.4. Fetch groups' in
the fetch specs.
2024-07-20 14:09:51 -06:00
Ángel Carias 69da6a0ce4 LibWeb: Implement Text.wholeText
This getter returns the concatenation of the data of the contiguous
Text nodes of `this` (being this plus its siblings) in tree order.
2024-07-20 18:02:51 +01:00
Andreas Kling 7dacd6be89 LibWeb: Use static_cast<HTMLTemplateElement> right after an is<> check
The double verify_cast here was just barely visible in a profile.
2024-07-20 15:35:30 +02:00
Andreas Kling f9f11dc51d LibWeb: Stop creating transient throwaway JS::Handles in HTML parser
These were being immediately stored in JS::GCPtrs (and dutifully visited
by HTMLParser), so creating temporary handles for them was a complete
waste of time.
2024-07-20 15:35:30 +02:00
Andreas Kling dba6216caa LibWeb: Skip CSS tokenizer filtering when string has no '\r' or '\f'
When loading a canned version of reddit.com, we end up parsing many many
shadow tree style sheets of roughly ~170 KiB text each.

None of them have '\r' or '\f', yet we spend 2-3 ms for each sheet just
looping over and reconstructing the text to see if we need to normalize
any newlines.

This patch makes the common case faster in two ways:

- We use TextCodec::Decoder::to_utf8() instead of process()
  This way, we do a one-shot fast validation and conversion to UTF-8,
  instead of using the generic code-point-at-a-time callback API.

- We scan for '\r' and '\f' before filtering, and if neither is present,
  we simply use the unfiltered string.

With these changes, we now spend 0 ms in the filtering function for the
vast majority of style sheets I've seen so far.
2024-07-20 15:35:30 +02:00
Andreas Kling 7892ee355d LibWeb: Use StringBuilder::append_code_point() over append(Utf32View)
When appending a single Unicode code point, we don't have to go through
the trouble of creating a Utf32View wrapper over it.
2024-07-20 15:35:30 +02:00
Andreas Kling 1a46d8df5f LibTextCodec: Use String::from_utf8() when decoding UTF-8 to UTF-8
This way, we still perform UTF-8 validation, but don't go through the
slow generic code path that rebuilds the decoded string one code point
at a time.

This was a bottleneck when loading a canned copy of reddit.com, which
ended up being ~120 MiB large.

- Time spent decoding UTF-8 before this change: 1192 ms
- Time spent decoding UTF-8 after this change:  154 ms

That's still a long time, but 7.7x faster is nothing to sneeze at! :^)

Note that if the input fails UTF-8 validation, we still fall back to
the slow path and insert replacement characters per the WHATWG Encoding
spec: https://encoding.spec.whatwg.org/#utf-8-decode
2024-07-20 14:29:37 +02:00
sideshowbarker 1a9dabe5ff LibGfx: Handle UTF-16-encoded OpenType font names
This change makes OpenType::Name::string_for_id handle fonts whose names
are UTF-16-encoded (along with handling UTF-8-encoded names).

Otherwise, without this change, the existing code assumes the names are
UTF-8-encoded, fails gracelessly if they’re not, and crashes.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/75
2024-07-20 12:41:02 +01:00
Andreas Kling 3faff34bf6 LibWeb: Make details and summary elements display:block in the UA style
This is the expected behavior per the HTML spec. Fixes an issue where
styling these elements wouldn't have the expected effect unless you also
set the display property.
2024-07-20 13:09:28 +02:00
Diego Frias 4b9649282e LibWasm: Implement the rest of the SIMD conversions 2024-07-20 11:17:29 +02:00
Diego Frias 21c5084d23 LibWasm: Fix v128.any_true instruction 2024-07-20 11:17:29 +02:00
Diego Frias 616048c67e LibWasm: Implement integer conversion and narrowing SIMD instructions 2024-07-20 11:17:29 +02:00
Diego Frias 146646b597 LibWasm: Implement bitmask and float conversion instructions 2024-07-20 11:17:29 +02:00
Edwin Hoksberg 5f154ba372 LibWeb: Implement Element::check_visibility 2024-07-20 09:14:50 +01:00
Timothy Flynn e8f4ae487d LibJS: Pre-allocate the resolved rope string's underlying buffer
For performance, rather than slowly incrementing the capacity of the
rope string's buffer, compute an approximate length for that buffer to
be reserved up front.
2024-07-20 06:45:49 +02:00
Andreas Kling 33207174a9 LibWeb: Allow splitting surrogate pairs in CharacterData.replaceData()
We're expected to handle this situation gracefully, and certainly not
by falling apart like we were.

Found by Domato.
2024-07-20 06:41:25 +02:00
Andreas Kling 416c478876 LibWeb: Don't try to set selection with anchor/focus in different roots
If the anchor and focus nodes are not within the same document, we can't
use them for a selection range.

Found by Domato.
2024-07-20 06:41:25 +02:00
Andreas Kling 4e0edd42b9 LibWeb: Cap HTML dimension values at 17895700 (same as Firefox)
Instead of allowing arbitrarily large values (which could eventually
overflow an i32), let's just cap them at the same limit as Firefox does.

Found by Domato.
2024-07-20 06:41:25 +02:00
Andreas Kling 093f1dd805 LibWeb: Propagate exceptions from setAttribute() in DOMStringMap setter
We were incorrectly assuming that setAttribute() could never fail here,
even when passed an invalid name.

Found by Domato.
2024-07-20 06:41:25 +02:00
Andreas Kling 1c00e5688d LibWeb: Fix StringView OOB access when parsing 3-character legacy color
Found by Domato.
2024-07-20 06:41:25 +02:00
Aliaksandr Kalenik 0c1405ad6d LibWeb: Add missing requests to use antialiasing in Skia painter 2024-07-19 15:52:30 +02:00
Aliaksandr Kalenik 0be57df54d LibWeb: Subtract left inset from size_available_for_margins for abspos
Fixes https://github.com/LadybirdBrowser/ladybird/issues/712
2024-07-19 13:29:20 +01:00
Aliaksandr Kalenik 715f033007 Tests+headless-browser: Move screenshot ref-tests into own directory
This change will make it easier to disable screenshot comparison tests
on a specific platform or have per-platform expectations.

Additionally, it's nice to be able to tell if a ref-test uses a
screenshot as an expectation by looking at the test path.
2024-07-19 13:52:00 +02:00
Edwin Hoksberg 0ae048102c LibWeb: Resolve content-visibility fixme in html details element 2024-07-19 09:04:30 +01:00
Edwin Hoksberg 020b20d817 LibWeb: Support content-visibility css 2024-07-19 09:04:30 +01:00
Tim Ledbetter bd72ff5669 LibWeb: Expose ChildNode methods on the DocumentType IDL interface 2024-07-19 09:22:08 +02:00
Tim Ledbetter 5a578e8f15 LibWeb: Compare node names case insensitively in Node::is_equal_node() 2024-07-19 09:22:08 +02:00
Tim Ledbetter 7ab7be694d LibWeb: Don't consider nodes in different namespaces to be equal
Previously, `Node::is_equal_node()` would return true for nodes in
different namespaces that were otherwise equal.
2024-07-19 09:22:08 +02:00
Holger Hans Peter Freyther 319bb6353e LibWeb: Fix assertion failure on telekom.de
The EntryType has three possible values: Fetching, Failed or
ModuleScript. It is possible that we transition from Fetching to Failed
as in #13.1. Change the assertion to include the failed scenario.

Fixes: https://github.com/LadybirdBrowser/ladybird/issues/661
2024-07-19 09:20:09 +02:00
Daniel Bertalan 31eb0ed938 LibWeb/DOM: Work around GCC 14 warning on always true is<T>()
GCC 14 emits a warning when an always succeeding `dynamic_cast`'s return
value is compared to NULL inside the `AK::is<T>(U)` template when `T` ==
`U`.

While warning on tautological `is` calls seems useful, it's a bit
awkward when it comes from a function template where the cast may fail
in some instantiation. There is a GCC bug open for it:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115664

Work around the warning by performing the algorithm on the base type
(`EventTarget`), with a wrapper that casts it to the more specialized
input type.
2024-07-19 09:18:27 +02:00
Diego Frias ea67bc989f LibWasm: Remove some unnecessary memory checks
Also make `store_to_memory` take a `MemoryArgument` so that we no longer
have to make "synthetic instructions" in some scenarios.
2024-07-19 03:19:04 +02:00
Diego Frias 56ae6b3968 LibWasm: Remove some dead code 2024-07-19 03:19:04 +02:00
Timothy Flynn 368dad54ef LibTextCodec: Use AK facilities to validate and convert UTF-16 to UTF-8
This allows LibTextCodec to make use of simdutf, and also reduces the
number of places with manual UTF-16 implementations.
2024-07-18 19:43:57 +02:00
circl 8357f18e9b LibWeb: Set document.activeElement using the spec algorithm 2024-07-18 07:09:50 -06:00
circl 1aa9282103 LibWeb: Move retarget function to its own file 2024-07-18 07:09:50 -06:00
Ali Mohammad Pur 8cf0f36f7d LibWasm: Replace a hashtable with an RBTree to make instantiation faster
...by about 40%.
2024-07-18 14:54:50 +02:00
Ali Mohammad Pur f1abc36689 LibWasm/WASI: Make the premapped stdio files configurable 2024-07-18 14:54:50 +02:00
Ali Mohammad Pur 16dd8d4d3b LibWasm/WASI+wasm: Make WASI exit() "noreturn" instead of making it exit
This makes it so exit() traps with a known error; an embedder (wasm.cpp)
can simply match this format and handle the request accordingly.
2024-07-18 14:54:50 +02:00
Ali Mohammad Pur e08a7cb94d LibWasm/WASI: Add support for fd_seek() 2024-07-18 14:54:50 +02:00
Ali Mohammad Pur 708abf6bb1 LibWasm/WASI: Add support for fd_fdstat_get() 2024-07-18 14:54:50 +02:00
Ali Mohammad Pur e22408b8b4 LibWasm: Make import errors a bit more descriptive and helpful
Instead of "yeah something went wrong", show what went wrong.
2024-07-18 14:54:50 +02:00
Timothy Flynn fb228a3d85 LibJS: Implement Iterator.prototype.constructor according to spec
The spec allows setting a constructor on non built-in Iterator objects.

This is a normative change in the Iterator Helpers proposal. See:
https://github.com/tc39/proposal-iterator-helpers/commit/30b3501
2024-07-18 14:49:25 +02:00
Timothy Flynn 734e37442d LibJS: Implement Iterator.prototype [ @@toStringTag ] according to spec
The spec allows setting the prototype on non built-in Iterator objects.

This is a normative change in the Iterator Helpers proposal. See:
https://github.com/tc39/proposal-iterator-helpers/commit/30b3501
2024-07-18 14:49:25 +02:00
Aliaksandr Kalenik 1e4720700c LibWeb: Use premultiplied alpha for gradient interpolation in Skia
This change fixes the rest of regressions in
Tests/LibWeb/Ref/css-gradients.html
2024-07-18 14:47:32 +02:00
Tim Ledbetter 055c902a37 LibWeb: Implement Node.isDefaultNamespace()
This method accepts a namespace URI as an argument and returns true if
the given URI is the default namespace on the given node, false
otherwise.
2024-07-18 12:41:01 +03:00
Tim Ledbetter 27d429a85f LibWeb: Implement Node.lookupNamespaceURI()
This method takes a prefix and returns the namespace URI associated
with it on the given node, or null if no namespace is found.
2024-07-18 12:41:01 +03:00
Andrew Kaster d106b6eae2 LibCore: Remove workarounds for system header global name conflicts 2024-07-18 09:43:38 +01:00
Andrew Kaster 8082daaa3f LibAudio+LibCore: Remove workarounds for system header conflicts
This commit could possibly be cherry-picked to serenity
2024-07-18 09:43:38 +01:00
Andrew Kaster 1529f5469c LibGfx+icc: Prefix AK::FixedPoint with AK Namespace 2024-07-18 09:43:38 +01:00
Andrew Kaster 39a41d59c8 RequestServer: Prefix AK::Duration with AK Namespace 2024-07-18 09:43:38 +01:00
Andrew Kaster 28093fecae LibWebView+WebContent: Prefix AK::Duration with AK Namespace 2024-07-18 09:43:38 +01:00
Andrew Kaster b20a1d0fcd LibWeb: Prefix AK::Duration with AK Namespace 2024-07-18 09:43:38 +01:00
Andrew Kaster 2fa9ec20bd LibUnicode: Prefix AK::Duration with AK Namespace 2024-07-18 09:43:38 +01:00
Andrew Kaster f8d1a25254 LibJS: Prefix AK::Duration with AK Namespace 2024-07-18 09:43:38 +01:00
Andrew Kaster c1681931ba LibMedia: Prefix AK::Duration with AK Namespace 2024-07-18 09:43:38 +01:00
Andrew Kaster 28ab1941b9 LibIPC: Prefix AK::Duration with AK Namespace 2024-07-18 09:43:38 +01:00
Andrew Kaster 383c15b22e LibCore: Prefix AK::Duration with AK Namespace 2024-07-18 09:43:38 +01:00
Andrew Kaster 6772d442e5 LibAudio: Prefix AK::Duration with AK Namespace 2024-07-18 09:43:38 +01:00
Aliaksandr Kalenik 7a1f3f7ae3 LibWeb: Change grid item placement to look for area by boundary lines
Areas are disassembled into boundary lines on `build_grid_areas()` step,
so we can always use them to find grid item's position during placement.
This way we support both ways to define area: `grid-template-areas` and
implicitly using `-start` and `-end` boundary line names.
2024-07-18 09:05:37 +02:00
Andreas Kling 166e603c5e ImageDecoder: Pass decoded images as Gfx::Bitmap over IPC
Before this change, we were passing them as Gfx::ShareableBitmap. The
problem is that shareable bitmaps keep their underlying file descriptor
open, so that they can be shared again with someone else.

When a Gfx::Bitmap is decoded from an IPC message, the file descriptor
is closed and recovered immediately.

This fixes an issue where we'd accumulate one file descriptor for every
image decoded. This eventually led to descriptor starvation after enough
images were loaded and still referenced at the same time.
2024-07-18 09:05:10 +02:00
Andreas Kling 9f1a853cc8 LibGfx: Add ability to pass NonnullRefPtr<Gfx::Bitmap> over IPC 2024-07-18 09:05:10 +02:00
Daniel Bertalan c62240aa80 Everywhere: Warn on function definitions without prototypes
If no header includes the prototype of a function, then it cannot be
used from outside the translation unit it was defined in. In that case,
it should be marked as `static`, in order to avoid possible ODR
problems, unnecessary exported symbols, and allow the compiler to better
optimize those.

If this warning triggers in a function defined in a header, `inline`
needs to be added, otherwise if the header is included in more than one
TU, it will fail to link with a duplicate definition error.

The reason this diff got so big is that Lagom-only code wasn't built
with this flag even in Serenity times.
2024-07-17 21:51:29 +02:00
Daniel Bertalan 7fe82a1cda CMake: Add back stricter warnings used in Serenity builds
These used to be enabled in `serenity_compile_options.cmake` for
Serenity builds and were removed in 9b05fb98. This is a slightly more
conservative subset of those, with ones that are enabled by default
omitted.

This should prevent our code quality regressing in the long run.
2024-07-17 21:51:29 +02:00
Jamie Mansfield 0961d68ebc LibWeb: Stub Text.wholeText 2024-07-17 18:19:09 +01:00
Jamie Mansfield 807e63faaf LibWeb: Implement MouseEvent.initMouseEvent 2024-07-17 18:19:09 +01:00
Jamie Mansfield 3845d174e3 LibWeb: Implement KeyboardEvent.initKeyboardEvent 2024-07-17 18:19:09 +01:00
Jamie Mansfield aefab1de38 LibWeb: Short-circuit UIEvent.initMouseEvent if dispatched
This fixes some bugs on wpt.dom/events/Event-init-while-dispatching.html,
although the test still fails due to [GH-23722].

[GH-23722]: https://github.com/SerenityOS/serenity/issues/23722
2024-07-17 18:19:09 +01:00
Jamie Mansfield 87880e9b81 LibWeb/HTML: Remove FIXMEs from HTMLTrackElement constants 2024-07-17 18:19:09 +01:00
Jamie Mansfield 66c3388b16 LibWeb: Implement Performance.toJSON 2024-07-17 18:19:09 +01:00
Jamie Mansfield 116c1f835d LibWeb/DOM: Add FIXMEs for missing functions in Node 2024-07-17 18:19:09 +01:00
Jamie Mansfield 62f74f3b77 LibWeb/DOM: Match order of Node.idl with the spec
This makes it easier to compare with the spec :^)
2024-07-17 18:19:09 +01:00
doctortheemh 0140e5e9cc LibGfx: Decode WebP images with libwebp 2024-07-17 10:04:25 -06:00
Aliaksandr Kalenik be644e5d5d LibWeb: Use blur_radius / 2 as sigma to blur text shadow using Skia
This change is needed to match behavior of default Gfx::Painter.

Fixes Tests/LibWeb/Ref/text-shadow.html
2024-07-17 18:02:11 +02:00
Aliaksandr Kalenik 3270df476d LibWeb: Fix flexible track sizing in GFC
- Change min track sizing function to be "auto" when flex size is
  specified.
- Never check if min track sizing funciton is flexible, because only
  max is allowed to be flexible.
- Address FIXME in automatic_minimum_size to avoid regressions after
  making two fixes mentioned above.
2024-07-17 18:00:18 +02:00
Timothy Flynn c3f8202d0c LibJS: Create exception messages as Strings
The JS::Error types all store their exception messages as a String. So
by using ByteString, we hit the StringView constructor, and end up
allocating the same string twice.
2024-07-17 11:57:06 -04:00
Hendiadyoin1 144e822de2 LibWasm: Use shuffle_or_0 in for vector swizzles and shuffles
Otherwise we'd hit a VERIFY in AK::SIMD::shuffle() when that operand
contains an out-of-range value, the spec tests indicate that a swizzle
with an out-of-range index should return 0.

(cherry picked from commit cd454a1e3d0bc8b3342ed39891c9b27409ecc829)
2024-07-17 09:56:13 -06:00
Aliaksandr Kalenik 3ddacaa705 Ladybird+LibWeb+WebContent: Always use Skia CPU backend in tests mode
Enforce the use of the CPU backend in test mode to ensure that ref-tests
produce consistent results across different computers, as this
consistency cannot be achieved with the GPU backend.
2024-07-17 17:58:53 +03:00
Sam Atkins 9fb44cb057 LibWeb/CSS: Make StringStyleValue hold a FlyString
We already have a FlyString of its value from parsing, and most users
also want a FlyString from it, so let's use that instead of converting
backwards and forwards.

The two users that did want a String are:
- Quotes, which make sense as FlyString instead, so I've converted that.
- Animation names, which should probably be FlyString too, but the code
  currently also allows for other kinds of StyleValue, and I don't want
  to dive into this right now to figure out if that's needed or not.
2024-07-17 15:08:44 +01:00
Sam Atkins d2f04b9f04 LibWeb/CSS: Remove unused StyleProperties::grid_area()
This does not appear to be correct; the `grid-area` property's value is
quite complicated, and not just a string.
2024-07-17 15:08:44 +01:00
simonkrauter b1d7a27468 LibWeb: Rename HTMLInputElement members related to range shadow tree
Choose a better name for private members which were added in
https://github.com/LadybirdBrowser/ladybird/pull/513
2024-07-17 13:11:55 +02:00
Aliaksandr Kalenik 66c88b432f LibWeb: Join text clip paths before application in Skia painter
Each item in clip_paths represents a glyph run, and applying them as a
clip in intersection mode one by one results in an empty clip. Instead,
now all clip paths are joined and applied as a clip together.

This change fixes rendering of "background-clip: text" when an element
has more than one glyph run.

Fixed ref-test: Tests/LibWeb/Ref/css-background-clip-text.html
2024-07-17 14:09:52 +03:00
Braydn dbc2f7ed48 LibJS: Implement CreatePerIterationEnvironment for 'for' statements
Implement for CreatePerIterationEnvironment for 'for' loops per the Ecma
Standard. This ensures each iteration of a 'for' loop has its own
lexical environment so that variables declared in the loop are scoped to
the current iteration.
2024-07-17 11:20:11 +02:00
Jamie Mansfield c8e6a95988 LibWeb/SVG: SVGGradientElement includes SVGURIReference 2024-07-16 21:43:53 +02:00
Jamie Mansfield fbb5bc471d LibWeb/SVG: SVGScriptElement includes SVGURIReference 2024-07-16 21:43:53 +02:00
Jamie Mansfield 796de74956 LibWeb/SVG: SVGAElement includes SVGURIReference 2024-07-16 21:43:53 +02:00
Jamie Mansfield 6ca4c2beb0 LibWeb/SVG: Implement SVGAElement.relList 2024-07-16 21:43:53 +02:00
Jamie Mansfield 7562f89d4e LibWeb/SVG: Implement reflected attributes in SVGAElement
This change implements the download, ping, rel, hreflang, and type
attributes using the [Reflect] annotation in the IDL file.
2024-07-16 21:43:53 +02:00
Jamie Mansfield 5bac8e7730 LibWeb/SVG: Add spec link to SVGAElement 2024-07-16 21:43:53 +02:00
Jamie Mansfield 6f3c5f5ae9 LibWeb/SVG: Implement SVGElement.ownerSVGElement 2024-07-16 21:43:53 +02:00
circl f20010c1d3 LibWeb: Restore event characteristics of MouseEvents and WheelEvents
These were accidentally no longer set after
2c396b5378
2024-07-16 21:10:16 +03:00
Aliaksandr Kalenik 5eeb5eb36e LibWeb: Support SVGRadialGradientPaintStyle in Skia painter
Fixes:
Tests/LibWeb/Ref/svg-gradient-spreadMethod.html
Tests/LibWeb/Ref/svg-radialGradient.html
2024-07-16 19:11:56 +03:00
Aliaksandr Kalenik 4aba38e21f LibWeb: Use repeat tile mode if repeating length specified
...for radial gradient in Skia painter.
2024-07-16 17:40:34 +03:00
Aliaksandr Kalenik fb03f36cfa LibWeb: Add support for repeating linear gradient in Skia painter 2024-07-16 17:40:34 +03:00
Aliaksandr Kalenik dadf82f2a2 LibWeb: Handle gradient repeating as defined in the spec in Skia painter
Couple fixes found by reading the spec:
- Repeating should also happen in negative direction, so the whole
  [0, 1] is covered.
- Leftmost and rightmost stops should be clamped to [0, 1] range if
  needed, because Skia ignores everything outside of this range.
2024-07-16 17:40:34 +03:00
Ali Mohammad Pur 8c8310f0bd LibWasm: Make Absolute/Negate<SignedIntegral> explicitly work mod 2^N
Previously we relied on signed overflow, this commit makes the same
behaviour explicit (avoiding UB in the process).
2024-07-16 15:09:03 +02:00
Colin Reeder 99824eae14 LibWeb: Add support for indexed setter of HTMLOptionsCollection 2024-07-16 10:59:59 +01:00
Andreas Kling 2c918b540d LibWeb+RequestServer: Let RequestServer set HTTP Accept-Encoding header
Ultimately it's RequestServer who knows which kind of encodings it can
handle and decompress, so let's have it set the Accept-Encoding.
2024-07-16 11:01:01 +02:00
Timothy Flynn bfc9dc447f AK+LibWeb: Replace our home-grown base64 encoder/decoders with simdutf
We currently have 2 base64 coders: one in AK, another in LibWeb for a
"forgiving" implementation. ECMA-262 has an upcoming proposal which will
require a third implementation.

Instead, let's use the base64 implementation that is used by Node.js and
recommended by the upcoming proposal. It handles forgiving decoding as
well.

Our users of AK's implementation should be fine with the forgiving
implementation. The AK impl originally had naive forgiving behavior, but
that was removed solely for performance reasons.

Using http://mattmahoney.net/dc/enwik8.zip (100MB unzipped) as a test,
performance of our old home-grown implementations vs. the simdutf
implementation (on Linux x64):

                Encode    Decode
AK base64       0.226s    0.169s
LibWeb base64   N/A       1.244s
simdutf         0.161s    0.047s
2024-07-16 10:27:39 +02:00
BenJilks 3c897e7cf3 LibWeb: Propagate margin and offset when computing a box's baseline
When traversing the layout tree to find an appropriate box child to
derive the baseline from. Only the child's margin and offset was being
applied. Now we sum each offset on the recursive call.
2024-07-15 21:31:51 +02:00
Aliaksandr Kalenik c8e29ad691 LibWeb: Add support for repeating radial gradient in Skia painter
Progress on Tests/Ref/css-gradients.html
2024-07-15 21:31:17 +02:00
Diego Frias 8a0ef17d9a LibWasm: Correctly validate v128_load*_lane instructions 2024-07-15 09:58:04 -06:00
Diego Frias f5326f1747 LibWasm: Implement rest of SIMD load/store instructions
Also implement `v128.any_true`.
2024-07-15 09:58:04 -06:00
simonkrauter 9df8e1f224 LibWeb: Support accent-color for range input and progress element
Fixes #466
2024-07-15 15:51:50 +01:00
Colin Reeder 5c315b532e LibWeb: Add more legacy -webkit- aliases 2024-07-15 15:45:33 +01:00
Aliaksandr Kalenik 247a07b606 LibWeb: Add support for repeating conic gradient in Skia painter 2024-07-15 15:56:34 +03:00
Aliaksandr Kalenik 1ad4cd55b5 LibWeb: Respect conic gradient start angle in Skia painter 2024-07-15 15:56:34 +03:00
Aliaksandr Kalenik 54fdbf78ab LibWeb: Rotate conic gradient in Skia painter to match CSS start angle
-90deg rotation need to be applied, so start conic gradient angle in
Skia matches CSS start angle.
2024-07-15 15:56:34 +03:00
Aliaksandr Kalenik 761fa97fef LibWeb: Add support for conic gradient transition hints in Skia painter 2024-07-15 15:56:34 +03:00
Diego Frias f63a945ba0 LibWeb: Implement the :has() pseudo-class
See https://drafts.csswg.org/selectors-4/#relational.
2024-07-15 11:52:03 +01:00
Aliaksandr Kalenik be1075e673 LibWeb: Support radial gradient with asymmetrical size in Skia painter
Progress on Tests/Ref/css-gradients.html
2024-07-15 13:43:50 +03:00
Aliaksandr Kalenik af9b91e0f7 LibWeb: Mark bitmaps passed to Skia as immutable
All bitmaps passed to Skia during rendering are not supposed to be
mutated.
2024-07-15 12:36:13 +03:00
Diego Frias ff7ca5c48c LibWebView: Trim whitespace when sanitizing file paths
Previously, the presence of surrounding whitespace would give file paths
the `https` schema instead of the `file` schema, making navigation
unsuccessful.
2024-07-14 23:44:36 +01:00
Jamie Mansfield 9ce727d315 LibWeb/Fetch: Use correct header for prefetch requests
See:
 - https://github.com/whatwg/fetch/commit/a5560d2
2024-07-14 12:08:20 +02:00
Jamie Mansfield aee77b975c LibWeb/Fetch: Add missing fetch step for preloaded resources
This is currently no-op and a FIXME exists to implement the "consume a
preloaded resource" AO.
2024-07-14 12:08:20 +02:00
Maciej 9eb568eacb LibWeb: Make innerHTML for XML nodes actually return inner HTML
The spec says to just call the XML serialization algorithm, but it
returns the "outer serialization", and we need the "inner" one. Let's
just concatenate serializations of children; then the result produced is
similar to one from Blink or Gecko.
2024-07-14 11:49:31 +02:00
Maciej cad3b085a8 LibXML: Set XMLNS namespace for xmlns attribute
This is what Blink and Gecko do, and is required for serialization
(innerHTML etc.) of XML elements to work.
2024-07-14 11:49:31 +02:00
Enver Balalic f0a306fe50 LibWasm: Implement most of iNxM SIMD operations
With this we pass an additional ~2100 tests.
We are left with 7106 WASM fails :).

There's still some test cases in the iNxM tests that fail with
this PR, but they are somewhat weird.

Co-authored-by: Diego Frias <styx5242@gmail.com>
2024-07-14 11:35:11 +02:00
simonkrauter 9da3e29818 LibWeb: Make scrollbar thumbs visible on dark background
Previously, the scrollbar thumbs were (almost) invisible, when the page
background color was similar to the scrollbar thumb color (DarkGray).
Now, in addition to the filled rounded rectangle, the scrollbar thumbs
are painted with a 1px solid LightGrey border. On a white or light color
background the border stays invisible.
2024-07-14 08:13:03 +02:00
simonkrauter 04526261c3 LibWeb: Use shorter variant of fill_rect_with_rounded_corners()
Instead of passing `thumb_corner_radius` 4 times, pass it only once.
2024-07-14 08:13:03 +02:00
Jamie Mansfield 1f1276ffb1 LibWeb: Implement HTMLMarqueeElement.trueSpeed 2024-07-13 19:57:51 +02:00
Jamie Mansfield a917f8124c LibWeb: Implement HTMLMarqueeElement.scrollDelay 2024-07-13 19:57:51 +02:00
Jamie Mansfield 2a408ecfbc LibWeb: Implement HTMLMarqueeElement.scrollAmount 2024-07-13 19:57:51 +02:00
Jamie Mansfield 66528a17cb LibWeb: Implement HTMLFrameElement.noResize 2024-07-13 19:57:51 +02:00
Jamie Mansfield e363e89189 LibWeb: Implement HTMLFrameElement.marginWidth 2024-07-13 19:57:51 +02:00
Jamie Mansfield 4edc946aed LibWeb: Implement HTMLFrameElement.marginHeight 2024-07-13 19:57:51 +02:00
Timothy Flynn 2dbd71d54b LibJS: Update specification steps for the Set Methods proposal
It is now Stage 4 and has been merged into the main ECMA-262 spec:
https://github.com/tc39/ecma262/commit/a78d504
2024-07-13 19:57:31 +02:00
Timothy Flynn 55b4ef7915 LibJS: Introduce the CanonicalizeKeyedCollectionKey AO
This is an editorial change in the ECMA-262 spec. See:
https://github.com/tc39/ecma262/commit/30257dd
2024-07-13 19:57:31 +02:00
Jamie Mansfield d4a7cfb68f LibWeb: Stub BroadcastChannel interface
This is enough to get the 1Password login page to load :^)
2024-07-13 19:53:02 +02:00
Diego 4c7ef01b44 LibWasm: Fix sign issues in SIMD cmp ops 2024-07-13 14:38:10 +02:00
Tim Ledbetter 0a0651f34e LibWeb: Implement Node.normalize()
This method puts the given node and all of its sub-tree into a
normalized form. A normalized sub-tree has no empty text nodes and no
adjacent text nodes.
2024-07-13 09:35:54 +02:00
Tim Ledbetter c92222dcae LibWeb: Add styling for disabled button elements 2024-07-13 09:33:16 +02:00
Tim Ledbetter e18501f67f LibWeb: Don't dispatch click events to disabled FormAssociatedElements
Disabled FormAssociatedElements also no longer receive focus when
clicked.
2024-07-13 09:33:16 +02:00
Aliaksandr Kalenik c09b5b8df0 LibGfx+LibWeb: Rename Gfx::WOFF2::Font to Gfx::WOFF2::Typeface
It's a leftover from VectorFont -> Typeface renaming
2024-07-13 09:31:02 +02:00
Aliaksandr Kalenik 1d2e559e13 LibGfx+LibWeb: Rename Gfx::WOFF::Font to Gfx::WOFF::Typeface
It's a leftover from VectorFont -> Typeface renaming
2024-07-13 09:31:02 +02:00
Aliaksandr Kalenik 2f515827c0 Everywhere: Rename Gfx::OpenType::Font to Gfx::OpenType::Typeface
It's a leftover from VectorFont -> Typeface renaming
2024-07-13 09:31:02 +02:00
Aliaksandr Kalenik cac0228d3f LibGfx: Rename m_font to m_typeface in ScaledFont
It's a leftover from VectorFont -> Typeface renaming
2024-07-13 09:31:02 +02:00
Diego Frias 13a8c2a79d LibWasm: Make SIMD float min/max operations binary ops
They previously acted like comparison operators, which was not correct.
2024-07-13 01:27:55 +02:00
Diego 3efb11f5d8 LibWasm: Validate stack correctly in v128_store*_lane instructions
Previously the validator put a `v128` on the stack, which is not what
the spec defines.
2024-07-13 00:04:02 +02:00
BenJilks a8c1bb0461 LibWeb: Draw dashed and dotted lines in Skia painter
Use the `SkDashPathEffect` path effect, to implement dashed and dotted
line styles.
2024-07-12 18:10:46 +03:00
Kenneth Myhra 24bed027b2 LibWeb: Align transform_stream_error_writable_and_unblock_write w/ spec
This aligns AO transform_stream_error_writable_and_unblock_write() with
the spec.

No functional change is introduced by this amendment.
2024-07-12 08:28:35 -04:00
Aliaksandr Kalenik 5c4ca5ac12 LibWeb: Support SVG gradient spread method in Skia painter
Progress on Tests/LibWeb/Ref/svg-gradient-spreadMethod.html
2024-07-12 15:03:44 +03:00
⭐caitp⭐ 2c396b5378 LibWeb: Remove set_event_characteristics()
These methods were overriding properties specified by the EventInit
property bags in the constructor for WheelEvent and MouseEvent.

They appear to be legacy code and no longer relevant, as they would have
been used for ensuring natively dispatched events had the correct
properties --- This is now done in separate create methods, such as
MouseEvent::create_from_platform_event.

This fixes a couple WPT failures (e.g. in
/dom/events/Event-subclasses-constructors.html)
2024-07-12 11:57:33 +03:00
⭐caitp⭐ 932a7d4d81 LibWeb: Pass event_init to base class constructor in FocusEvent
This fixes some WPT failures caused by the "view" parameter not being
initialized from the property bag.
2024-07-11 10:36:04 -06:00
Aliaksandr Kalenik 8a315592cc LibWeb: Use viewport-relative position for radial gradient in Skia
Fixes incorrect radial gradient painting caused by passing
gradient-rect-relative position when Skia expects viewport-relative.
2024-07-11 15:54:33 +02:00
Aliaksandr Kalenik 386e151f96 LibWeb: Add and use to_skia_point() helper 2024-07-11 15:54:33 +02:00
Aliaksandr Kalenik 2c8267babf LibWeb: Add basic conic gradient support in Skia painter
For now it doesn't account for start angle and repeat length but it's
better than not painting conic gradients at all.
2024-07-11 15:54:33 +02:00
simonkrauter 191531b7b1 LibWeb: Use correct default value for <input type=range>
Previously the input element was displayed with value 0, when no value
was set in the HTML. Now it uses `value_sanitization_algorithm()`, which
will calculate the default value.
In `value_sanitization_algorithm()` there was a logical mistake/typo.
The comment from the spec says "unless the maximum is less than the
minimum".
The added layout test would fail without the code changes.
Fixes #520
2024-07-11 11:56:13 +02:00
Kenneth Myhra 907dc84c1e LibWeb: Implement min option for ReadableStreamBYOBReader.read()
When the min option is given the read will only be fulfilled when there
are min or more elements available in the readable byte stream.

When the min option is not given the default value for min is 1.
2024-07-11 11:55:15 +02:00
Andrew Kaster 3850214aac LibGfx: Add workaround for un-parseable OpenType font family names
Co-Authored-By: sideshowbarker <mike@w3.org>
2024-07-10 21:05:47 -06:00
Diego 420a626554 LibWasm: Make memory.grow grow the memory's type
After a `memory.grow`, the type of the memory instance should be
updated so potential memory imports on the boundary are unlinkable.
2024-07-11 01:31:22 +02:00
Diego d07cf26894 LibWasm: Fix loop arity for single-type blocktypes
Single-type blocktypes previously gave loop labels an arity of 1, even
though they're shorthand for `[] -> [T]`.
2024-07-11 00:51:03 +02:00
Diego 625fbc8085 LibWasm: Implement SIMD bitwise operations 2024-07-11 00:50:08 +02:00
sideshowbarker 0a55e36403 LibWeb: Fix handling of find-in-page with pseudo-element content
This change makes find-in-page ignore content that’s been added to the
document using CSS ::after or ::before pseudo-elements. Ignoring such
pseudo-element content for find-in-page matches the behavior in Chrome
and Safari (though not in Firefox).

Otherwise, without this change, find-in-page doesn’t ignore the
pseudo-element content, and we instead crash in
DOM::Range::common_ancestor_container after hitting an assert, due to
the start container and end container for the matched range not having a
common ancestor.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/514
2024-07-10 19:31:57 +01:00
BenJilks bee42160c5 LibWeb: When solving abspos lengths, use min max constrained height
Solving using the unconstrained height, when solving for bottom, would
either leave a gap over overflow its container.
2024-07-10 19:41:12 +02:00
Dennis Camera e007c24ec9 LibJS: Implement extract_pointer_bits for ppc64
On PowerPC 64 pointers can use all 64 bits, however by convention on
Linux user-space addresses use only the lower 43 bits.
I'm not 100% certain that the masking off of the 16 high bits is the
proper solution, but it matches the rest of the LibJS code which assumes
pointers only use the lower 48 bits.

https://www.kernel.org/doc/ols/2001/ppc64.pdf
2024-07-10 11:04:46 -06:00
Aliaksandr Kalenik 2539fd6a5c LibGfx+LibWeb: Support CSS gradient "transition hints" in Skia painter
Skia does not have built-in support for gradient transition hints. So
instead of adding custom gradient painting, now we do the same thing as
other engines and preprocess color stops by replacing transition hints
with a bunch of points lying between adjacent color stops and calculated
using non-linear formula from the spec. As a result we get visually
close enough rendering we would get by applying spec-formula
individually to each point of a gradient.
2024-07-10 20:01:04 +03:00
simonkrauter 7766909415 LibWeb: Harmonize look of range input element
Previously the entire slider track was colored.
Now only the lower part of the slider track (left side of the thumb) is
colored.
Chrome and Firefox do the same.
2024-07-10 10:59:41 -06:00
Colin Reeder 449f81bfbe LibWeb: Add support for -webkit-text-fill-color 2024-07-10 10:25:04 -06:00
simonkrauter b5e80db225 LibWeb: Define width for -webkit-slider-runnable-track
Fixes #512
2024-07-10 10:24:28 -06:00
Dennis Camera 90a2dcfde1 LibWeb: Implement KeyAlgorithms for big-endian 2024-07-10 10:23:26 -06:00
Dennis Camera 81a0aa5725 LibWeb: Implement CryptoAlgorithms for big-endian 2024-07-10 10:23:26 -06:00
Caitlin Potter fac82119df LibWeb: Legacy Platform Objects don't force [[Configurable]]
Per https://github.com/whatwg/webidl/commit/3fb6ab4dbc6a42517c84acf0909,
this step in the spec didn't reflect the reality in mainstream browsers.
This change fixes a failure in WPT/dom/collections/
2024-07-10 10:19:27 -06:00
Colin Reeder d427344f39 LibWeb: Handle inline-start and inline-end as float values
Should resolve #449 for LTR languages at least
2024-07-10 17:41:18 +02:00
Jamie Mansfield 772d64aca2 LibWeb: Add FIXMEs for missing SVGGeometryElement attributes 2024-07-10 10:28:43 +02:00
Jamie Mansfield c9f3a7ddbf LibWeb: Add FIXMEs for missing SVGElement attributes 2024-07-10 10:28:43 +02:00
Jamie Mansfield 9d1ea4c7e0 LibWeb: Implement SVGElement.className 2024-07-10 10:28:43 +02:00
Jamie Mansfield 59f74b909b LibWeb: SVGElement includes GlobalEventHandlers
This fixes many tests on
wpt/html/webappapis/scripting/events/event-handler-all-global-events.html
2024-07-10 10:28:43 +02:00
Jamie Mansfield ffb3a28684 LibWeb: Implement MessageEvent.initMessageEvent
This fixes wpt/html/webappapis/scripting/events/messageevent-constructor.https.html
2024-07-10 10:28:43 +02:00
Andreas Kling 4e7558c88b LibWeb: Don't fire resize event until document actually resizes once
The first time Document learns its viewport size, we now suppress firing
of the resize event.

This fixes an issue on multiple websites that were not expecting resize
events to fire so early in the loading process.
2024-07-10 10:27:31 +02:00
rmg-x 629068c2a7 LibWeb: Ensure normal line-height on HTMLInputElement
Previously, setting CSS `line-height: 0` on an `input` element would
result in no text being displayed.

Other browsers handle this by setting the minimum height to the
"normal" value for single line inputs.
2024-07-10 07:05:52 +02:00
rmg-x b36a78a798 LibWeb: Add method HTMLInputElement::is_single_line() 2024-07-10 07:05:52 +02:00
rmg-x df7f7268db LibWeb: Remove StyleProperties::compute_line_height(Layout::Node)
This method was unused and a FIXME remained for combining it with
another, similar method.
2024-07-10 07:05:52 +02:00
Andrew Kaster 40a2bb32c3 LibWeb: Create separate DedicatedWorkerGlobalScope class
This is how it's supposed to have been from the beginning, we were just
lazy :).
2024-07-10 07:04:53 +02:00
Andrew Kaster f99c7ad85d LibWeb: Add closing flag to WorkerGlobalScope
Also implement close a worker AO.
2024-07-10 07:04:53 +02:00
Andrew Kaster 27ef9ffa8f LibWeb+WebWorker: Add IPC messages to request and communicate shutdown 2024-07-10 07:04:53 +02:00
Andrew Kaster 5d8784318d LibWeb: Initialize HTML::EventLoop with its type 2024-07-10 07:04:53 +02:00
Tim Ledbetter aa4e18fca5 LibWeb: Remove m_src_is_set field from HTMLScriptElement
Now that we pass an `old_value` parameter to `attribute_changed` it is
no longer necessary to store the current attribute state in
`HTMLScriptElement`.
2024-07-10 07:04:08 +02:00
Tim Ledbetter a552bda8d9 LibWeb: Pass the old attribute value to Element::attribute_changed() 2024-07-10 07:04:08 +02:00
Jamie Mansfield 190a419715 LibWeb: Implement EmbedderPolicy struct 2024-07-10 07:03:37 +02:00
Andreas Kling f073f8301c LibJS: Demote some sanity checks in Value constructors to ASSERT 2024-07-10 07:03:20 +02:00
Andreas Kling ef30f191b6 LibJS: Demote VERIFY in GCPtr to ASSERT
These were just here to create a nicer error message for debugging.
A release build will still crash in the exact same place, but now you'll
need to get a backtrace the normal way instead.
2024-07-10 07:03:20 +02:00
Diego e8fd8982f8 LibWasm: Give names to functions exported to JS via ref.func
https://webassembly.github.io/spec/js-api/index.html#name-of-the-webassembly-function
2024-07-10 00:37:18 +02:00
Maciej d890be6e0f LibWeb: Prepare script when src is set the first time
From https://html.spec.whatwg.org/multipage/scripting.html#script-processing-model:
When a script element el that is not parser-inserted experiences one
of the events listed in the following list, the user agent must
immediately prepare the script element el:
- [...]
- The script element is connected and has a src attribute set where
  previously the element had no such attribute.
2024-07-09 20:30:27 +01:00
Diego afd8d90f32 LibWasm: Error when parsed section lengths are invalidated 2024-07-09 14:22:31 +02:00
Diego 5382fbb617 LibWasm: Remove Wasm::ValueType::Kind::Null* variants
As far as I know, they're not in the spec and don't serve any purposes
in the internals of LibWasm.
2024-07-09 14:22:00 +02:00
Andreas Kling 509c10d14d LibJS: Make GetById and GetByValue avoid get_identifier() in common case
We now defer looking up the various identifiers by IdentifierTableIndex
until the last moment. This allows us to avoid the retrieval in common
cases like when a property access is cached.

Knocks a ~12% item off the profile on https://ventrella.com/Clusters/
2024-07-09 14:16:11 +02:00
Andreas Kling ae0cfe4f2d LibJS: Move CommonImplementations.h into Interpreter.cpp
Now that the Interpreter is the only user of these functions, we might
as well keep them in Interpreter.cpp which makes CLion less confused.
2024-07-09 14:16:11 +02:00
Maciej 65d8d205ee LibWeb: Implement HTML DragEvent class
This just defines the class, drag events aren't actually fired yet.
2024-07-09 11:28:32 +01:00
Jamie Mansfield 27f3305b87 Base: Use % for keys in templates
The previous character used, @, conflicted with CSS. % is used by other
templating engines, and doesn't conflict with language features (e.g.
media queries).
2024-07-09 11:21:07 +02:00
doctortheemh 4ef76f3198 LibGfx: Decode AVIF images
Use libavif to decode AVIF images in LibGfx.
2024-07-09 08:15:47 +02:00
simonkrauter 062a266574 LibWeb: Use system colors for input type range and progress as default
Instead of using fixed arbitrary colors for the background of the bar,
AccentColor and Background are now used.
2024-07-08 21:06:42 +01:00
Aliaksandr Kalenik 067bb64eb5 headless-browser: Add CLI argument to enable Skia painter
Useful to check what ref-tests are currently broken with Skia painter.
2024-07-08 19:46:33 +01:00
Diego 31c7e98a4a LibWasm: Fix comparisons between 0.0 and -0.0
According to the spec, -0.0 < 0.0.
2024-07-08 15:12:16 +02:00
Diego c882498d44 LibWasm: Fix some floating-point conversion issues
NaN bit patterns are now (hopefully) preserved. `static_cast` does not
preserve the bit pattern of a given NaN, so ideally we'd use some other
sort of cast and avoid `static_cast` altogether, but that's a large
change for this commit. For now, this fixes the issues found in spec
tests.
2024-07-08 15:12:16 +02:00
Luke Warlow 63a5ff70e5 LibWeb: Implement :modal pseudo class
Adds the :modal pseudo class which matches dialogs opened with
showModal().
2024-07-08 11:34:06 +02:00
Tim Ledbetter 34b9873664 LibWeb: Populate filename in WindowOrWorkerGlobalScope.reportError()
Previously, when `WindowOrWorkerGlobalScope.reportError()` was called
the `filename` property of the dispatched error event was blank. It is
now populated with the full path of the active script.
2024-07-08 11:26:24 +02:00
Tim Ledbetter 572324d47b LibWeb: Invalidate input element style on focus change
The style of input and textarea elements is now invalidated when focus
is changed to a new element. This ensures any `:focus` selectors are
applied correctly.
2024-07-08 08:48:38 +01:00
Andreas Kling 9448c957c1 LibJS: Cache environment index for global declarative bindings
This allows global `let` and `const` variable accesses to be cached
by the GetGlobal instruction, and works even when the access is in a
different translation unit from the declaration.

Knocks a ~10% item off the profile on https://ventrella.com/Clusters/
2024-07-07 20:01:46 +02:00
Natsuki Ikeguchi ccb3a2f7ad LibWeb: Add initial implementation of global.reportError() 2024-07-07 13:53:01 +01:00
Olekoop cb6e438019 LibCore: Don't check for Core::NotificationType::None on Android
In this section on Android it seems to loop itself for some reason
As a quick hack we can just not check for Core::NotificationType::None
2024-07-07 03:43:32 -06:00
Daniel Bertalan 33bfac23ef LibJS: Add missing ValueInlines.h include for Value::to_numeric
When compiling with `-O2 -g1` optimizations (as done in the main
Serenity build), no out-of-line definitions end up emitted for
`Value::to_numeric`, causing files that reference the function but don't
include the definition from `ValueInlines.h` to add an undefined
reference in LibJS.so.

(cherry picked from commit 85b7ce8c2f6daf0db80e801d7fb2503d070765ce)
2024-07-07 11:32:57 +02:00
simonkrauter a676bd97a7 LibWeb: Correct HTMLMeterElement color selection
The logic of the comment "the region between the high boundary and the
maximum value must be treated as the optimum region" is correct.
However, the code below covered only two cases, the optimum case was
missing.
Fixes #473
2024-07-07 08:07:19 +02:00
Alec Murphy 1759b82114 LibWeb: Scroll page and nav history with keyboard
This patch implements basic keyboard functionality for page scrolling
and history traversal.
2024-07-07 08:05:22 +02:00
Jacob Wischnat 7a03ef45c2 LibMedia: Support videos with BT470BG color matrix 2024-07-07 07:39:07 +02:00
rmg-x 7f04ceb4f6 LibWeb: Add response status check when loading fallback favicon
If a favicon image response status was not ok,
we would still attempt to decode the received body data.
2024-07-06 15:51:22 -06:00
rmg-x 8085e3eb26 LibWeb: Add response status check in SharedImageRequest::fetch_image
If an image response status was not ok, we would still pass the received
body data to ImageDecoder which is not correct.
2024-07-06 15:51:22 -06:00
Ali Mohammad Pur e0465b8939 Revert "LibTLS+Everywhere: Switch to using WolfSSL"
This reverts commit 8bb610b97a.
Linking wolfSSL seems to cause more legal trouble than it's worth due to
it being GPLv2, so let's undo this for now.
2024-07-06 15:15:34 -06:00
Keith Cirkel 8d593bcfeb LibWeb: Add customElements.getName 2024-07-06 14:51:43 -06:00
Ali Mohammad Pur 8bb610b97a LibTLS+Everywhere: Switch to using WolfSSL
This commit replaces all TLS connection code with wolfssl.
The certificate parsing code has to remain for now, as wolfssl does not
seem to have any exposed API for that.
2024-07-06 22:15:19 +02:00
Aliaksandr Kalenik 172e080b07 LibCore: Print error code returned by vkCreateInstance()
Good to have at least some information about instance creation failure.
2024-07-06 18:58:22 +01:00
Gingeh e8d32bab58 LibWeb/CSS: Support hwb, oklab and oklch color functions 2024-07-06 05:18:00 -06:00
Gingeh 490a36bab1 LibWeb/CSS: Split parse_rgb_or_hsl_color into separate functions 2024-07-06 05:18:00 -06:00
Jamie Mansfield 65be928d4e LibWeb: Implement HTMLMediaElement.textTracks 2024-07-06 11:41:13 +02:00
Jamie Mansfield ecad28657a LibWeb/HTML: Implement TextTrackList IDL interface 2024-07-06 11:41:13 +02:00
Jamie Mansfield ba8e77df16 LibWeb: Implement TextTrack.id 2024-07-06 11:41:13 +02:00
Jamie Mansfield ab91a616b8 LibWeb: Allow TrackEvent track to be a TextTrack
Fixes two FIXMEs :^)
2024-07-06 11:41:13 +02:00
Aziz Berkay Yesilyurt 13cd653d1c LibWeb/HTML: Update Text Input Styling
So that it is closer to the spec.
https://www.w3.org/TR/css-ui-4/#input-rules
2024-07-06 10:21:35 +02:00
Arthur Hartwig Carlsson 9ed2669fc8 LibWeb: Don't insert out-of-flow elements into block pseudo elements
Like 1132c858e9, out-of-flow elements such
as float elements would get inserted into block level `::before` and
`::after` pseudo-element nodes when they should instead be inserted as a
sibling to the pseudo element. This change fixes that.

This fixes a few layout issues on the swedish tax agency website
(skatteverket.se). :^)
2024-07-06 10:02:29 +02:00
Arthur Hartwig Carlsson 196922ae5b LibWeb: Refactor out-of-flow and in-flow into functions
The concept of out-of-flow and in-flow elements is used in a few places
in the layout code. This change refactors these concepts into functions.
2024-07-06 10:02:29 +02:00
Andreas Kling 9c80326053 LibWeb: Ensure EC on stack when resolving/rejecting image decode promise
Fixes #419
2024-07-06 09:49:51 +02:00
Tim Ledbetter 0a1fc7ee13 LibWeb/CSS: Use serif for font and font-family initial property values
These properties previously used sans-serif for their initial values.
2024-07-06 08:26:57 +01:00
Tim Ledbetter 58589d6250 LibWeb/CSS: Set initial value of color property to canvastext
Previously the non-standard value `-libweb-palette-base-text` was used.
2024-07-06 08:26:57 +01:00
Andrew Kaster bd97442771 Meta: Add vulkan and vulkan-headers to vcpkg dependencies
Also require a specific ICU version to not run into unexpected problems.
2024-07-06 01:44:58 +02:00
circl 91e3ef6dbf LibWeb/ResourceLoader: Report file: errors as "network errors"
This triggers the generated error page which is more informative.
2024-07-05 15:08:13 -06:00
circl e35b055192 LibWeb/ResourceLoader: Call error callback if resource: load fails 2024-07-05 15:08:13 -06:00
circl 4e6eb35520 LibWeb/Fetch: Pass error from ResourceLoader into network_error 2024-07-05 15:08:13 -06:00
circl b83e82c32c LibWeb: Pass network error message to generated error page 2024-07-05 15:08:13 -06:00
Alex Studer cdd91f4b48 Ladybird+LibCore+Meta: Update font paths and names for Android
We also disable fontconfig, because it doesn't have support for Android.
2024-07-05 14:27:25 -06:00
Alex Studer e8b398ca34 LibMedia: Add a stub implementation of FFmpegVideoDecoder for Android
We don't have ffmpeg available on Android, so provide a dummy
FFmpegVideoDecoder and disable linking against ffmpeg for Android.
2024-07-05 14:27:25 -06:00
Salem Yaslem ab82fc8993 LibCore: Support IPv6 for TCP and UDP connection 2024-07-05 14:26:22 -06:00
BenJilks 47aee289d8 LibWeb: Change flex remaining space distribution to include gap
The remaining space is in addition to, not of in place of the
main gap.
2024-07-05 21:31:41 +02:00
Francesco Gazzetta 210e6edd9f LibWeb: Get skia version constraint from vcpkg.json
This way we only have to update it in one place.
2024-07-05 09:56:42 -06:00
Francesco Gazzetta 543b415b7d LibWeb: Allow using system skia
unofficial-skia is a vcpkg-specific package. With this change ladybird
can be built against skia as provided by system package managers such as
guix, mingw, and (soon) nix. All those packages include a .pc file, so
we use pkg-config.
2024-07-05 09:56:42 -06:00
Dennis Camera 14d26397f0 LibWeb: Add user agent CPU string for PowerPC 2024-07-05 09:50:13 -06:00
Thomas Klausner c99674c6ac LibGfx: Fix build on NetBSD
NetBSD provides its own popcount() function.
2024-07-05 09:46:02 -06:00
Daniel Bertalan 947606afcf LibGfx: Do not draw U+FFFD for unknown glyphs
The Replacement Character (U+FFFD) is most commonly used to signal a
text encoding error, i.e. when a stream of bytes couldn't be converted
to a sequence of code points. For glyphs that don't exist in a
particular font, our rendering logic already does the right thing by
drawing empty boxes (`.notdef`); let's not forcibly turn these into
U+FFFD during rendering.
2024-07-05 13:42:07 +02:00
Jamie Mansfield 0a3082ef05 LibWeb: Add missing edge visit for TextTrack in HTMLTrackElement 2024-07-05 09:17:01 +02:00
matjojo b7e505365c LibWeb: Save float-intrusion for marker before list elements layout
... to prevent that left-floating elements inside the list element
push the list marker into the (non-floating) content of the list
element.
2024-07-05 07:31:42 +02:00
Tim Ledbetter 66662496e6 LibWeb: Remove ResourceLoader::emit_signpost()
This was only ever used within SerenityOS. The current implementation
of this method did nothing.
2024-07-05 07:15:44 +02:00
Jamie Mansfield 67e3ac8916 LibWeb/HTML: Stub TextTrack IDL interface 2024-07-05 07:15:04 +02:00
Luke Warlow a9669639ce LibWeb: Implement popover property and attribute
The popover property now reflects the attribute.

It cannot currently use the Reflect IDL concept because the empty string
value is special cased.
2024-07-05 07:14:50 +02:00
Jamie Mansfield 197f57f5d2 Ladybird/Qt: Add actions to set navigator compatibility mode 2024-07-05 07:14:03 +02:00
Jamie Mansfield 1128375dff LibWeb: Support Gecko and WebKit navigator compatibility modes
This will log a debug message when calls are made to the
NavigatorIDMixin that make decisions based on the compatibility mode.
2024-07-05 07:14:03 +02:00