Commit Graph

4276 Commits

Author SHA1 Message Date
Tom
0bbf7a1b54 LibWeb: Refactor should_skip_anonymous_text_runs
This same function was being copied in the {Flex,Grid}FormattingContext,
so unify them in the parent FormattingContext.
2022-12-28 15:04:58 +01:00
Liav A
445b5e1e94 Userland: Remove i686 support 2022-12-28 11:53:41 +01:00
Tom
9d5049230c LibWeb: Clamp {row,column} spans if outside of grid
A bug was found where grid items were being drawn outside of the grid if
the item had a large span and the grid was defined as having gaps
between the rows/columns.

This was caused by an erroneous calculation of the
{row,column}_{start,span} properties.
2022-12-26 16:02:48 +01:00
Timothy Flynn
ba86011fab LibWeb: Add missing return statement in an element scrolling error case 2022-12-26 09:56:22 -05:00
Timothy Flynn
9b483625e6 LibIPC+Everywhere: Change IPC decoders to construct values in-place
Currently, the generated IPC decoders will default-construct the type to
be decoded, then pass that value by reference to the concrete decoder.
This, of course, requires that the type is default-constructible. This
was an issue for decoding Variants, which had to require the first type
in the Variant list is Empty, to ensure it is default constructible.

Further, this made it possible for values to become uninitialized in
user-defined decoders.

This patch makes the decoder interface such that the concrete decoders
themselves contruct the decoded type upon return from the decoder. To do
so, the default decoders in IPC::Decoder had to be moved to the IPC
namespace scope, as these decoders are now specializations instead of
overloaded methods (C++ requires specializations to be in a namespace
scope).
2022-12-26 09:36:16 +01:00
Baitinq
419dea0996 WebDriver: Implement stub for .../element/{element id}/click
This patch adds a stub implementation for the POST
/session/{session id}/element/{element id}/click endpoint.
2022-12-25 17:24:52 +01:00
Baitinq
6a72a4df96 LibWeb: Propagate errors in Element::scroll_into_view()
This patch will allow us to handle scrolling errors in the WebDriver
implementation :)
2022-12-25 17:24:52 +01:00
Jelle Raaijmakers
ae82b14e59 LibGL+LibWeb: Remove WebGL-specific API from GLContext
The OpenGL API has ways to retrieve these values, so let's make sure to
implement them. :^)
2022-12-25 15:48:59 +01:00
MacDue
2b1342b120 LibWeb: Remove done gradient painting TODO
This code is already generalised to every gradient in existence.
2022-12-25 15:35:31 +01:00
MacDue
f2fe3245cf LibWeb: Speed up gradient painting quite a lot
Previously gradient painting was dominated by the clipping checks in
Painter::set_pixel(). This commit changes gradient painting to use the
new Painter::fill_pixels() function (which does all these checks outside
the hot loop).

With this change gradient painting drops from 96% of the profile to 51%
when scrolling around on gradients.html. A nice 45% reduction :^)
2022-12-25 15:35:31 +01:00
Luke Wilde
7e701f6256 LibWeb: Keep unhandledrejection event promises alive when task is queued
This is fixed by making the "about to be notified rejected promises
list" use JS::Handle instead of JS::NonnullGCPtr. This UAF happens
because notify_about_rejected_promises makes a local copy of this list,
empties the member variable list and then moves the local copy into a
JS::SafeFunction lambda. JS::SafeFunction can only see GC pointers that
are in its storage, not external storage.

Example exploit (requires fixed microtask timing by removing the dummy
execution context):
```html
<script>
Promise.reject(new Error);

// Exit the script block, causing a microtask checkpoint and thus
// queuing of a task to fire the unhandled rejection event for the
// above promise.
// During the time after being queued but before being ran, these
// promises are not kept alive. This is because JS::SafeFunction cannot
// see into a Vector, meaning it can't visit the stored NonnullGCPtrs.
</script>

<script defer>
// Cause a garbage collection, destroying the above promise.
const b = [];
for (var i = 0; i < 200000; i++)
    b.push({});

// Some time after this script block, the queued unhandled rejection
// event task will fire, with the event object containing the dead
// promise.
window.onunhandledrejection = (event) => {
    let value = event.promise;
    console.log(value);
}
</script>
```
2022-12-25 15:32:51 +01:00
Andreas Kling
32e35a02f9 LibWeb: Apply CSS text-transform during layout
Previously we were doing this at the painting stage, which meant that
layout potentially used the wrong glyphs when measuring text.

This would lead to incorrect layout metrics and was visible on the
HTML5Test score display, for example. :^)
2022-12-24 12:27:46 +01:00
Andreas Kling
f982400063 LibGfx: Rename TTF/TrueType to OpenType
OpenType is the backwards-compatible successor to TrueType, and the
format we're actually parsing in LibGfx. So let's call it that.
2022-12-21 08:44:22 +01:00
MacDue
a9ea0ee9af LibWeb: Fix passing size/position to paint_radial_gradient()
This was wrong twice making it right... But let's fix that.

The center was being passed as a DevicePixelPoint, but was in fact in
CSS pixels, the size was passed as a Gfx::FloatSize but was in
CSS pixels again. Then we were scaling from device pixels to CSS pixels
when painting which does not need to be done if everything is passed
which the correct scale factors already applied.
2022-12-20 11:03:18 +01:00
Jelle Raaijmakers
25f2e4981c AK: Stop using DeprecatedString in Base64 encoding 2022-12-20 10:34:19 +01:00
MacDue
88e50869f1 LibWeb: Fix crash when serializing nodes for DOM inspector
Noticed this trying to inspect GitHub, you'd get a segfault due to the
parent node being null here.
2022-12-19 11:37:56 -05:00
Keir Davis
f639445456 LibWeb: Fully Implement get_an_elements_noopener
This removes two fix me in HTMLHyperlinkElementUtils
2022-12-19 07:57:44 -05:00
Matt Purnell
0bda06c9c5 LibWeb: Don't const_cast layout_box() when calling const functions
layout_box() already has a non-const overload, so we don't need to
const_cast them anymore. This gets rid of 2 FIXMEs. :^)
2022-12-18 12:56:33 +01:00
Quentin Ligier
588994bb00 LibWeb: Improve variable name in HTMLTableElement
The variables 'child_to_append_after' are used to specify the child
before which new elements will be inserted, its name is misleading.
These variables are always passed as 'child' to pre_insert.
2022-12-17 18:35:32 +01:00
Alexander Narsudinov
45525d4f85 LibWeb: Add NamedNodeMap::setNamedItemNS() method
This patch adds implementation of the missing `setNamedItemNS()` method.
2022-12-17 18:27:57 +01:00
Alexander Narsudinov
530d5adc62 LibWeb: Add NamedNodeMap::removeNamedItemNS() method
This patch adds implementation of the missing `removeNamedItemNS()`
method.
2022-12-17 18:27:57 +01:00
Alexander Narsudinov
7679d38c5f LibWeb: Fix incorrect behaviour in NamedNodeMap::removeNamedItem()
According to the spec we should return removed attribute, but the old
implementation returned nullptr instead.

Now we return the element's removed attribute.
2022-12-17 18:27:57 +01:00
Alexander Narsudinov
f2d7690702 LibWeb: Add NamedNodeMap::getNamedItemNS()
This patch allows us to use method getNamedItemNS() of NamedNodeMap API.
2022-12-17 18:27:57 +01:00
Alexander Narsudinov
ce6cf5bab8 LibWeb: Make method NamedNodeMap::set_attribute() closer to the spec
This patch eliminates 1 FIXME that I've got during fixme roulette! :^)
2022-12-17 18:27:57 +01:00
Alexander Narsudinov
1a0fbe1e85 LibWeb: Add internal get_attribute_ns() methods of NamedNodeMap
This patch adds methods for querying element by namespace and
local name.

These methods are defined by the spec for internal
usage, but weren't implemented in LibWeb yet.
2022-12-17 18:27:57 +01:00
Linus Groh
111a38c464 LibJS: Convert new_object_environment() to NonnullGCPtr 2022-12-16 09:59:56 +01:00
Andreas Kling
c355e9692d LibWeb: Add spec links to IDL APIs in HTMLTableElement 2022-12-16 09:58:03 +01:00
Andreas Kling
2ded895107 LibWeb: Allow setting HTMLTableElement.tFoot to null value
This annihilates 2 FIXMEs :^)
2022-12-16 09:58:03 +01:00
Andreas Kling
346737701d LibWeb: Allow setting HTMLTableElement.tHead to null value
This deals with 2 FIXMEs :^)
2022-12-16 09:58:03 +01:00
Andreas Kling
2d791cf90f LibWeb: Allow setting HTMLTableElement.caption to null value
This takes care of 2 FIXMEs :^)
2022-12-16 09:58:03 +01:00
Andreas Kling
6e127f62d7 LibWeb: Add spec link and comment to HTMLTableElement::caption() 2022-12-16 09:58:03 +01:00
Aliaksandr Kalenik
992b4489ad LibWeb: Fix bug in BFC that independent FC assigned to wrong variable
Bug was introduced in 210bf8adf0c431be05659140fd6de3a2cc5b7d99
It makes new variable for independent_formatting_context instead
of using earlier declared one which means that
parent_context_did_dimension_child_root_box will never be called.
2022-12-16 09:57:37 +01:00
Linus Groh
6ae79a84df LibJS: Convert Object::construct() to NonnullGCPtr 2022-12-15 06:56:37 -05:00
Linus Groh
22089436ed LibJS: Convert Heap::allocate{,_without_realm}() to NonnullGCPtr 2022-12-15 06:56:37 -05:00
Linus Groh
2a66fc6cae LibJS: Add make_handle({Nonnull,}GCPtr<T>) overloads 2022-12-15 06:56:37 -05:00
Kyle Lanmon
0991464de6 LibWeb: Implement input range type sanitation algorithm 2022-12-15 09:43:41 +00:00
Kyle Lanmon
c5b953e51b LibWeb: Implement input local date and time type sanitation algorithm 2022-12-15 09:43:41 +00:00
Kyle Lanmon
a3c4af7a19 LibWeb: Implement input time type sanitation algorithm 2022-12-15 09:43:41 +00:00
Kyle Lanmon
d249a69150 LibWeb: Implement input week type sanitation algorithm 2022-12-15 09:43:41 +00:00
Kyle Lanmon
8197b7a063 LibWeb: Implement input month type sanitation algorithm 2022-12-15 09:43:41 +00:00
Kyle Lanmon
edb3a0aa0a LibWeb: Implement input date type sanitation algorithm 2022-12-15 09:43:41 +00:00
Kyle Lanmon
dfbc5553f2 LibWeb: Implement input email type sanitation algorithm 2022-12-15 09:43:41 +00:00
Kyle Lanmon
6fa34a4ee3 LibWeb: Implement input color type sanitation algorithm 2022-12-15 09:43:41 +00:00
Max Stevens
3aeb7a41c0 LibWeb: Implement more values of flexbox align-content
Implement the values 'space-between' and 'space-around'
of the 'align-content' flexbox property.

The following WPT tests now pass:
- http://wpt.live/css/css-flexbox/align-content-004.htm
- http://wpt.live/css/css-flexbox/align-content-005.htm
2022-12-15 09:27:32 +01:00
Sam Atkins
ab49dbf137 LibWeb: Convert Paintable coordinates to new pixel units
This fixes a few sizing issues too. The page size is now correct in most
cases! \o/

We get to remove some of the `to_type<>()` shenanigans, though it
reappears in some other places.
2022-12-14 16:47:57 +00:00
Sam Atkins
57a69f15ff LibWeb: Remove declarations for LineBoxFragment methods that don't exist 2022-12-14 16:47:57 +00:00
Sam Atkins
1a68a4292d LibWeb: Convert text and text-decoration painting to new pixel units
This does not touch the actual font selection, so the text itself is
still small for now.
2022-12-14 16:47:57 +00:00
Sam Atkins
a72302342a LibWeb: Convert marker painting to new pixel units 2022-12-14 16:47:57 +00:00
Sam Atkins
fb43a71981 LibWeb: Convert shadow painting to new pixel units 2022-12-14 16:47:57 +00:00
Sam Atkins
9d1f30b533 LibWeb: Convert gradient painting to new pixel units
Co-authored-by: MacDue <macdue@dueutil.tech>
2022-12-14 16:47:57 +00:00