Commit graph

25732 commits

Author SHA1 Message Date
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
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
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
Aliaksandr Kalenik
e713de115c LibWeb+LibCore: Use Vulkan backend for Skia on Linux
Skia now uses GPU-accelerated painting on Linux if Vulkan is available.
Most of the performance gain is currently negated by reading the GPU
backend back into RAM to pass it to the Browser process. In the future,
this could be improved by sharing GPU-allocated memory across the
Browser and WebContent processes.
2024-07-05 07:13:13 +02:00
Aliaksandr Kalenik
70db2bff92 LibWeb: Do not create Metal context when Skia painter is not enabled 2024-07-05 07:13:13 +02:00
rmg-x
ae983a2ef7 LibWeb: Add log_filtered_request() method in ResourceLoader
This will reduce log noise when visiting sites
that have a lot of filtered content.

Previously, red error text would be displayed in
the logs for each filtered URL.
2024-07-04 21:45:30 +01:00
Diego
fce8ed1563 LibWasm: Validate potentially empty else branch in if instruction 2024-07-04 21:47:07 +02:00
Braydn
24adb1c452 LibWeb: Add Web Worker Origin Inheritance
Fetch requests from web workers fail CORS checks because the origin is
not inherited from the outside settings. Ensure web worker origin is
correctly inherited from outside settings
2024-07-04 11:43:25 -06:00
Dennis Camera
176e3ba16a LibCrypto: Use ARM C Language Extensions (ACLE) for CRC32 intrinsics
The __builtin_arm_* intrinsics don't exist on all ARMv8 systems.
Use the standardized ACLE intrinsics, instead.
2024-07-04 16:53:13 +02:00
Jamie Mansfield
61e616c974 LibWeb: Implement Navigator.doNotTrack 2024-07-04 16:42:34 +02:00
Jamie Mansfield
fb20326979 LibWeb: Support sending DNT header with requests 2024-07-04 16:42:34 +02:00
Aliaksandr Kalenik
830b287c46 Everywhere: Remove GPU painter and AccelGfx
GPU painter that uses AccelGfx is slower and way less complete compared
to both default Gfx::Painter and Skia painter. It does not make much
sense to keep it, considering Skia painter already uses Metal backend on
macOS by default and there is an option to enable GPU-accelerated
backend on linux.
2024-07-04 14:47:02 +02:00
Bastiaan van der Plaat
c81a640f3e LibWeb/CSS: Serialize transform scale percentage values as numbers 2024-07-04 14:41:35 +02:00
Tim Ledbetter
34741d09c6 LibWeb: Update Range::set_base_and_extent() to the latest spec text
This allows it to work with content inside shadow roots.
2024-07-04 14:38:56 +02:00
Tim Ledbetter
e5d1261640 LibWeb: Don't update selection if start and end node roots differ
This allows selection to work within shadow roots and prevents the
selection being cleared if the mouse moves outside of the current
document or shadow root.
2024-07-04 14:38:56 +02:00
circl
ceb9c3b797 LibWeb+UI: Add tooltip overriding and use it for <video> tags
This call is used to inform the chrome that it should display a tooltip
now and avoid any hovering timers. This is used by <video> tags to
display the volume percentage when it is changed.
2024-07-04 14:15:51 +02:00
circl
0f7623dd83 LibWeb+UI/Qt: Display 'title' tooltips only when the mouse stops moving
Now instead of sending the position in which the user entered the
tooltip area, send just the text, and let the chrome figure out how to
display it.

In the case of Qt, wait for 600 milliseconds of no mouse movement, then
display it under the mouse cursor.
2024-07-04 14:15:51 +02:00
Luke Warlow
6623177265 LibWeb: Implement support for scrollbar-gutter
This property is now correctly parsed.

Ladybird always uses overlay scrollbars so this property does nothing.
2024-07-04 13:22:40 +02:00
Tim Ledbetter
e76ad9492e LibWeb: Elide boundary checks when constructing find in page ranges
Previously, unnecessary boundary checks were being done when
constructing the range objects used to represent find in page matches.
These checks are no longer performed leading to a significant speedup
when performing find in page queries on pages containing a lot of text.
2024-07-03 15:35:14 +02:00
Tim Ledbetter
156c1083e9 LibWeb: Cache text blocks used by find in page
The first step of the find in page algorithm is to walk the layout tree
of each document on the page and construct a list of strings against
which to search for matches.

Previously, this was being done for each new query, even when the
page content hadn't been updated. The output of this process is now
cached in the viewport node of the associated document. This ensures
that this process is no longer repeated unnceessarily.
2024-07-03 15:35:14 +02:00
Victor Tran
31698281b6 LibWeb: Stop deadlocking on unit tests
Unit tests on macOS deadlock because the WebContent process is waiting
for the next opportunity to render before a screenshot is taken. For
some reason unknown to myself, this opportunity never arrives. In
order to not deadlock, screenshot requests are now also processed
separately from rendering.
2024-07-03 15:01:03 +02:00
Samuel Eisenhandler
7de669dc07 LibWebView: Append remaining source after consuming all tokens
Since "Character" tokens do not have an "end position", viewing source
drops the source contents following the final non-"Character" token.

By handling the EOF token and breaking out of the loop, we avoid this
issue.
2024-07-03 08:59:53 -04:00
Aliaksandr Kalenik
72b4d44d07 LibWeb: Reschedule HTML event loop processing if navigable needs repaint
This is an attempt to fix the hanging CI on macOS caused by some
screenshot requests being stuck unprocessed. With this change, we at
least make sure that the HTML event loop processing, which triggers
repainting, will happen as long as there are navigables that need to be
repainted.
2024-07-02 20:33:45 +02:00
doctortheemh
5f06594bbd LibCore: Include full definition for LocalSocket
clang 19 (git) complains that LocalSocket is an incomplete type
and errors out. Including the full definition fixes the build.
2024-07-02 10:27:45 +02:00
Bastiaan van der Plaat
bff6c0680a LibWeb/Geometry: Make DOMRect doubles unrestricted 2024-07-01 21:30:52 +01:00
Andrew Kaster
55c1b5d1f4 LibWeb: Use double as the argument for AnimationFrameCallbacks
This avoids an unecessary lossy conversion for the current time from
double to i32. And avoids an UBSAN failure on macOS that's dependent
on the current uptime.
2024-07-01 14:29:45 -06:00
Aliaksandr Kalenik
bce7b24cfb LibWeb: Fix painting of paths with storke-width=0 in Skia painter
From SkPaint.h:
"Sets the thickness of the pen used by the paint to outline the shape.
A stroke-width of zero is treated as "hairline" width. Hairlines are
always exactly one pixel wide in device space (their thickness does not
change as the canvas is scaled)."

While we expect stroke-width=0 to simply not be painted.
2024-07-01 18:17:08 +02:00
Aliaksandr Kalenik
877adcc021 LibWeb: Use CornerRadii struct in FillRectWithRoundedCorners command
This makes it consistent with other commands.
2024-07-01 18:17:08 +02:00
Aliaksandr Kalenik
eba33b964e LibWeb: Remove unneeded Web namespace usage in TraversableNavigable.cpp 2024-07-01 18:17:08 +02:00
Aliaksandr Kalenik
3f97f73316 LibWeb: Add m_ prefix to surface member in SkiaSurface 2024-07-01 18:17:08 +02:00
Aliaksandr Kalenik
330d5996ed LibWeb: Fix Skia painter to close paths more correctly
Start point was incorrectly passed into `close_subpath_if_needed()` as
end point, which led to all subpaths being closed.
2024-07-01 18:17:08 +02:00
Andrew Kaster
29b4f21c7b WebContent: Add shutdown_server IPC call to request process exit
This ensures that removing the last view from a WebContentClient will
close its associated process, assuming the WebContent process is not
hung. A more drastic measure will be needed to trigger forcefully
killing the process when it doesn't respond to this request.
2024-07-01 18:10:56 +02:00
Andrew Kaster
4cc3d598f9 LibWebView+LibCore: Manage process lifecycle using a SIGCHLD handler
This large commit also refactors LibWebView's process handling to use
a top-level Application class that uses a new WebView::Process class to
encapsulate the IPC-centric nature of each helper process.
2024-07-01 18:10:56 +02:00
Andrew Kaster
3dea602d92 LibProtocol: Don't crash when RequestServer exits 2024-07-01 18:10:56 +02:00
Ali Mohammad Pur
a4eb46fcca LibWasm/WASI: Don't convert enums and u8s into i64
Doing so results in incorrect values being created, ultimately leading
to traps or errors.

(cherry picked from commit f6c3b333334f7bb5314a844804cb259cf277005e)
2024-07-01 00:05:21 +02:00
Aliaksandr Kalenik
7181c3f2ea Everywhere: Limit layout text fragments to use one font for all glyphs
The ChunkIterator now limits a chunk to using only one font (before, it
was possible to have a chunk with >1 font, when `unicode-range` CSS
property is used).

This change allows us to reduce some complexity in the text shaping and
painting code and makes us compatible with the APIs in Skia and
HarfBuzz.
2024-06-30 19:23:24 +02:00
Aliaksandr Kalenik
d5926a3231 LibGfx+LibWeb: Rename Gfx::VectorFont to Gfx::Typeface
Typeface is a more widely used name for the data represented by
class previously named VectorFont.

Now:
- Typeface represents decoded font that is not ready for rendering
- ScaledFont represents the combination of typeface and size for
  rendering
2024-06-30 13:09:23 +02:00
Aliaksandr Kalenik
e2726ce8e4 LibGfx+LibWeb: Remove Gfx::Typeface
...and use VectorFont directly in FontDatabase.
2024-06-30 13:09:23 +02:00
Tim Ledbetter
bdaa7f0e8e LibWeb: Implement the HTMLTrackElement.kind attribute
This reflects the HTML `kind` attribute.
2024-06-30 13:08:42 +02:00
Aliaksandr Kalenik
4cdc5d2ce9 LibWeb: Add text shadows support in Skia painter 2024-06-28 20:53:39 +02:00
Aliaksandr Kalenik
b27cf1be49 LibWeb: Remove fragment_baseline from PaintTextShadow
Translate text_rect instead, so the struct doesn't have to carry
additional member.
2024-06-28 20:53:39 +02:00
Aliaksandr Kalenik
ebc282207b LibWeb: Save unscaled glyph run in PaintTextShadow command
Implements the same optimization we already have for DrawGlyphRun by
saving unscaled glyph run and scale factor in a painting command, which
allows to avoid copying of glyphs vector to apply scaling during
recording.
2024-06-28 20:53:39 +02:00
Timothy Flynn
6369737676 LibWeb: Ensure SkiaSurface is fully defined before it is allocated
LLVM 18 on macOS correctly errs when we try to allocate an incomplete
SkiaSurface object.
2024-06-28 12:59:10 -04:00
Andreas Kling
cf0912c700 LibIPC: Remove unused AK::Formatter for IPC::Connection 2024-06-28 17:11:24 +02:00
Andreas Kling
4fe21e6d87 LibIPC: Move stuff from Connection.h to .cpp and reduce #include count 2024-06-28 17:11:24 +02:00
Andreas Kling
6d9c4d852d LibIPC: Move more of Connection::try_parse_messages() to ConnectionBase
By moving this up to ConnectionBase, we have less custom code for each
templated subclass, and it gets a little easier to edit the code since
you don't have to rebuild as much when making changes.
2024-06-28 17:11:24 +02:00
Andreas Kling
f4d40c292b LibIPC: Remove no-longer-used DeferredInvoker abstraction 2024-06-28 17:11:24 +02:00
Andreas Kling
4db05ecf69 LibWeb: Set the correct prototype for SVGAElement instances 2024-06-28 17:10:52 +02:00
Aliaksandr Kalenik
79acb998e1 LibCore+LibWeb: Use Metal backend for Skia painter on macOS
If Metal context and IOSurface are available, Skia painter will use
Ganesh GPU backend on macOS, which is noticeably faster than the default
CPU backend.

Painting pipeline:
1. (WebContent) Allocate IOSurface for backing store
2. (WebContent) Allocate MTLTexture that wraps IOSurface
3. (WebContent) Paint into MTLTexture using Skia
4. (Browser) Wrap IOSurface into Gfx::Painter and use
   QPainter/CoreGraphics to blit backing store into viewport.

Things we should improve in the future:
1. Upload textures for images in advance instead of doing that before
   every repaint.
2. Teach AppKit client to read directly from IOSurface instead of
   copying.
2024-06-28 14:25:34 +02:00
Aliaksandr Kalenik
c62cc915df Everywhere: Pass backing store into Navigable::paint()
...instead of Gfx::Bitmap, which makes it possible to access and
directly paint into IOSurface on macOS.
2024-06-28 14:25:34 +02:00
Ali Mohammad Pur
3214f2c5bf LibCore: Handle destroyed owner when unregistering timers and notifiers
Cherry-picked from 9f4f319277
2024-06-27 14:32:48 -06:00
Tim Ledbetter
c4d5ae28ea LibWeb: Implement a minimal version of Window.find()
This is a non-standard API that other browsers implement, which
highlights matching text in the current window.

This is just a thin wrapper around our find in page functionality, the
main motivation for adding this API is that it allows us to write tests
for our find in page implementation.
2024-06-27 10:09:39 +02:00
Tim Ledbetter
cda31615da LibWeb: Add WrapAround option to find in page
This allows `Page::find_in_page()` to optionally not return a result if
the start or end of the document has been reached.
2024-06-27 10:09:39 +02:00
Tim Ledbetter
fee7b4147c LibWeb: Ensure layout is up to date before performing find in page query 2024-06-27 10:09:39 +02:00
Andrew Kaster
343a3a0d7e Ladybird+LibIPC: Move clearing FD_CLOEXEC helper logic to IPC::File 2024-06-26 16:09:33 -06:00
Andrew Kaster
54f66c574c LibWebView: Allow querying and iterating all extant WebContentClients
This is mostly useful when some application-level logic needs to
iterate over all child processes. A more robust Process abstraction
would make this easier.
2024-06-26 16:09:33 -06:00
circl
1f3285eb04 LibWeb: Restrict fetching file: and resource: URLs to internal pages
They are now blocked on pages which:
- Don't have an opaque origin (should be only user-initiated or about:)
- Aren't other file: pages
- Aren't other resource: pages
2024-06-26 12:15:33 -06:00
circl
d14888f31a LibWeb: Consider resource: URLs to be trustworthy and non-opaque
This makes icons once again load in the directory listings
2024-06-26 12:15:33 -06:00
Daniel La Rocque
cb629e18bb LibJS: Improve deep equals algorithm in tests
The `deepEquals` algorithm used for testing was naive, and incorrectly
evaluated equality of objects in some cases. The new algorithm considers
that the second object could have more keys than the first, and compares
the prototypes of the objects.
2024-06-26 12:13:08 -06:00
Tim Ledbetter
e9e195418e LibWeb: Fire a change event on mouseup of number input buttons
This matches the behavior of other browsers.
2024-06-26 10:15:07 +02:00
Tim Ledbetter
b4b947c607 LibWeb: Update number input on mousedown of number input buttons
This matches the behavior of other browsers. Previously, a click event
was used, so the value was only updated when the mouse was released.
2024-06-26 10:15:07 +02:00
Tim Ledbetter
2a980816e7 LibWeb: Fire input event on user interaction with input element buttons
An input event is now fired when the step up or step down button of an
input element of type number is clicked.

This ensures that any associated <output> element is updated when these
buttons are clicked.
2024-06-26 10:15:07 +02:00
Tim Ledbetter
a3d12e569c LibWeb: Deduplicate the firing of input events in HTMLInputElement
Input elements without a defined user-interaction behavior need to fire
an input event when the user changes the element's value in some way.
This change moves the code to do this into its own function and adds
some spec text to explain what is being done.
2024-06-26 10:15:07 +02:00
Timothy Flynn
bd73dd316d LibTimeZone: Remove LibTimeZone and TZDB data
All users have been ported to the ICU implementation.
2024-06-26 10:14:02 +02:00
Timothy Flynn
672a555f98 LibCore+LibJS+LibUnicode: Port retrieving time zone offsets to ICU
The changes to tests are due to LibTimeZone incorrectly interpreting
time stamps in the TZDB. The TZDB will list zone transitions in either
UTC or the zone's local time (which is then subject to DST offsets).
LibTimeZone did not handle the latter at all.

For example:

The following rule is in effect until November 18, 6PM UTC.

    America/Chicago -5:50:36 - LMT 1883 Nov 18 18:00u

The following rule is in effect until March 1, 2AM in Chicago time. But
at that time, a DST transition occurs, so the local time is actually
3AM.

    America/Chicago -6:00 Chicago C%sT 1936 Mar 1 2:00
2024-06-26 10:14:02 +02:00
Timothy Flynn
1b2d47e6bb LibJS+LibUnicode: Port retrieving available regional time zones to ICU 2024-06-26 10:14:02 +02:00
Timothy Flynn
4fc0fba646 LibCore+LibJS+LibUnicode: Port retrieving available time zones to ICU
This required updating some LibJS spec steps to their latest versions,
as the data expected by the old steps does not quite match the APIs that
are available with the ICU. The new spec steps are much more aligned.
2024-06-26 10:14:02 +02:00
Timothy Flynn
d3e809bcd4 LibJS+LibUnicode: Port retrieving the system time zone to ICU 2024-06-26 10:14:02 +02:00
Timothy Flynn
89aa9a3af0 LibJS: Update Intl AO spec numbers
Otherwise, upcoming AO implementations will conflict with these.
2024-06-26 10:14:02 +02:00
Timothy Flynn
c379b35798 LibUnicode: Move helper to convert StringEnumeration to a list to ICU.h
This will be needed outside of UnicodeKeywords.cpp.
2024-06-26 10:14:02 +02:00
Luke Warlow
a65f1ecc37 LibWeb: Implement stub for ElementInternals
This implements a stub ElementInternals object which implements the
shadowRoot getter only.

Also implement attachInternals function.
2024-06-26 06:30:40 +02:00
Luke Warlow
ce8d3d17c4 LibWeb: Implement unsafe HTML parsing methods
Both Element's and ShadowRoot's setHTMLUnsafe, and Document's static
parseHTMLUnsafe methods are implemented.
2024-06-26 06:13:29 +02:00
Ali Mohammad Pur
920f470735 LibCore: Fix some thread-related memory/object leaks 2024-06-26 05:47:16 +02:00
Luke Warlow
9171c35183 LibWeb: Refactor DOM parsing APIs
Multiple APIs have moved from the DOM Parsing and Serialization spec to
HTML.

Updates spec URLs and comments.

Delete InnerHTML file:
- Make parse_fragment a member of Element, matching serialize_fragment
on Node.
- Move inner_html_setter inline into Element and ShadowRoot as per the
spec.

Add FIXME to Range.idl for Trusted Types createContextualFragment
2024-06-26 05:41:00 +02:00
Andrew Kaster
a587eafbf4 CMake: Consistently use imported targets for third party dependencies 2024-06-25 17:15:42 -04:00
Tim Ledbetter
0879489084 LibMedia: Hide Matroska debug message behind a flag 2024-06-25 19:25:34 +02:00
Andreas Kling
fb9f3f10f3 LibWeb: Add Element.getHTML() and ShadowRoot.getHTML() 2024-06-25 19:22:35 +02:00
Andreas Kling
0c47b3ff97 LibWeb: Update innerHTML & co IDL definition to match spec
This stuff has moved from a mixin defined by the DOM Parsing spec, over
to the HTML spec, where they are now defined as partial interfaces for
Element and ShadowRoot.

There's also some new functionality that we don't implement yet, so
patch marks them as FIXME properties.
2024-06-25 19:22:35 +02:00
Andreas Kling
f4bdf56212 LibWeb: Rename Element::shadow_root_internal() to shadow_root()
And let the old shadow_root(), which was only supposed to be used by
bindings, be called shadow_root_for_bindings() instead.

This makes it much easier to read DOM code, and we don't have to worry
about when to use shadow_root_internal() or why.
2024-06-25 19:22:35 +02:00
Andreas Kling
c7d9c1c0b2 LibWeb: Update DOM cloning algorithm for declarative shadow DOM 2024-06-25 19:22:35 +02:00
Andreas Kling
a0e1112209 LibWeb: Add HTMLTemplateElement IDL attrs for declarative shadow DOM 2024-06-25 19:22:35 +02:00
Andreas Kling
8e68215d33 LibWeb: Add ShadowRoot.clonable and ShadowRoot.serializable 2024-06-25 19:22:35 +02:00
Andreas Kling
e62db9c118 LibWeb: Update HTML fragment serialization for declarative shadow DOM 2024-06-25 19:22:35 +02:00
Andreas Kling
9eb4b91168 LibWeb: Parse declarative shadow DOM template elements
We now honor the shadowrootmode attribute on template elements while
parsing, and instantiate a shadow tree as required by the spec.
2024-06-25 19:22:35 +02:00
Andreas Kling
043ad0eb76 LibWeb: Refactor Element.attachShadow() after spec changes
The bulk of this function is moved to a new "attach a shadow root"
helper, designed to be used both from here and the HTML parser.
2024-06-25 19:22:35 +02:00
Andreas Kling
f3070118b1 LibWeb: Add "allow declarative shadow roots" flag to Document 2024-06-25 19:22:35 +02:00
simonkrauter
e9001da8d6 LibWeb: Initial support for dashed lines in Canvas
Implement setLineDash() and getLineDash() in CanvasPathDrawingStyles,
which write/read from the CanvasState object.
This doesn't implement the actual drawing of a dashed line, but at least
sites using the Chart.js library no longer fail with an exception.
Unfortunately the Painter classes don't support dashed/dotted lines
based on segments yet.
2024-06-25 09:47:17 +02:00
Zaggy1024
c4c91f02b3 LibMedia: Remove the home-grown VP9 decoder 2024-06-24 12:41:32 -06:00