Commit graph

3370 commits

Author SHA1 Message Date
Timothy Flynn 71c29504af AK: Support non-native endianness in Utf16View
Utf16View currently assumes host endianness. Add support for specifying
either big or little endianness (which we mostly just pipe through to
simdutf). This will allow using simdutf facilities with LibTextCodec.
2024-07-18 19:43:57 +02:00
Timothy Flynn 0c14a9417a AK: Replace converting to and from UTF-16 with simdutf
The one behavior difference is that we will now actually fail on invalid
code units with Utf16View::to_utf8(AllowInvalidCodeUnits::No). It was
arguably a bug that this wasn't already the case.
2024-07-18 14:46:25 +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 88044f59c6 AK: Stop exporting AK::FixedPoint into the global namespace
This declaration has conflicts with the macOS SDK, which becomes a
problem when trying to interact with system clang modules.
2024-07-18 09:43:38 +01:00
Andrew Kaster bf600c8e1d AK: Stop exporting AK::Duration into the global namespace
This has conflicts with MacTypes.h from the Apple macOS SDKs, which
becomes a huge problem when trying to interact with system clang modules
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 c1681931ba LibMedia: 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
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
doctortheemh 0140e5e9cc LibGfx: Decode WebP images with libwebp 2024-07-17 10:04:25 -06:00
Nico Weber 83d0452e69 LibGfx/WebPLoader: Use transparent black as animation background color
This matches libwebp (see ZeroFillCanvas() call in
libwebp/src/demux/anim_decode.c:355 and ZeroFillFrameRect() call
in line 435, but in WebPAnimDecoderGetNext()) and makes files
written e.g. by asesprite look correct -- even though the old
behavior is also spec-compliant and arguably makes more sense.
Now nothing looks at the background color stored in the file.

See PR for an example image where it makes a visible difference.

Cherry-picked from serenityos master
276a904d20ffe260b5544a9ace9841d083e0243
2024-07-17 10:04:25 -06: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
sideshowbarker cc6d502e88 Tests: Enable WPT/run.sh to run an arbitrary subset of tests
The change causes Tests/LibWeb/WPT/run.sh to run an arbitrary subset of
tests you give it as arguments. If you don’t specify any arguments, it
has the same behavior as it does without this patch: It just runs an
explicit subset of test names hardcoded into the script.

Otherwise without this change, Tests/LibWeb/WPT/run.sh doesn’t have the
ability to run any tests other than the explicit subset of test names
hardcoded into the script
2024-07-17 09:55:11 -06:00
Jamie Mansfield 6ca4c2beb0 LibWeb/SVG: Implement SVGAElement.relList 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 89531fb115 Tests/LibWeb: Add test for MouseEvent and WheelEvent bubbling 2024-07-16 21:10:16 +03:00
Colin Reeder 99824eae14 LibWeb: Add support for indexed setter of HTMLOptionsCollection 2024-07-16 10:59:59 +01: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
sideshowbarker e797ea816b Tests: Drop --enable-qt-networking arg in WPT/run.sh
--enable-qt-networking doesn't exist on the AppKit chrome
2024-07-15 21:09:29 +01: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
Ali Mohammad Pur 4ef909c308 Tests/LibWasm: Mark two static functions "static"
-Wmissing-declarations would complain about these.
2024-07-15 18:39:24 +02:00
Colin Reeder 5c315b532e LibWeb: Add more legacy -webkit- aliases 2024-07-15 15:45:33 +01: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
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
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
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 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
Diego 906fa04822 LibWasm: Properly check for indeterminate NaNs in SIMD tests
Because `nan:arithmetic` and `nan:canonical` aren't bound to a single
bit pattern, we cannot check against a float-containing SIMD vector
against a single value in the tests. Now, we represent `v128`s as
`TypedArray`s in `testjs` (as opposed to using `BigInt`s), allowing us
to properly check `NaN` bit patterns.
2024-07-12 18:27:47 +02:00
Diego 524e09dda1 LibWasm: Check for correct NaN bit patterns in tests
Some spec-tests check the bit pattern of a returned `NaN` (i.e.
`nan:canonical`, `nan:arithmetic`, or something like `nan:0x200000`).
Previously, we just accepted any `NaN`.
2024-07-12 18:27:47 +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
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
Colin Reeder 449f81bfbe LibWeb: Add support for -webkit-text-fill-color 2024-07-10 10:25:04 -06:00
Dennis Camera 033057683c Everywhere: Don't install code generators and test binaries 2024-07-10 10:13:21 -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 9d1ea4c7e0 LibWeb: Implement SVGElement.className 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
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 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
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
doctortheemh 4ef76f3198 LibGfx: Decode AVIF images
Use libavif to decode AVIF images in LibGfx.
2024-07-09 08:15:47 +02:00
Diego c103001f16 LibWasm: Fix lossy NaN bit pattern conversions in spec-test gen 2024-07-08 15:12:16 +02:00
Diego 6493acf2f4 LibWasm: Preserve sign bit across JS boundary in test-wasm
A `Uint8Array` can now be passed in the Wasm testjs files to be
transmuted into a Wasm value.
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
Natsuki Ikeguchi ccb3a2f7ad LibWeb: Add initial implementation of global.reportError() 2024-07-07 13:53:01 +01:00
simonkrauter cbc4832a53 LibWeb: Extend meter test 2024-07-07 08:07:19 +02: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
Tim Ledbetter 21eefb788b Tests/WPT: Enable Qt neworking when running WPT tests 2024-07-06 14:50:26 -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
Gingeh e1c61d654f LibWeb/CSS: Add tests for color functions 2024-07-06 05:18:00 -06:00
Jamie Mansfield ecad28657a LibWeb/HTML: Implement TextTrackList IDL interface 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 c84ff9f693 Tests: Make rebaseline-libweb-test OS aware
This makes it so that `rebaseline-libweb-test` can be run on *nix or
MacOS as the path to `headless-browser` on MacOS is
`./bin/Ladybird.app/Contents/MacOS/headless-browser` while it is
`./bin/headless-browser` on *nix.
2024-07-05 16:29:00 -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
Caitlin Potter 80cd3712c2 LibWeb: Implement WebIDL constructor flow for derived classes
Following the rules in the algorithm from
https://webidl.spec.whatwg.org/#js-platform-objects, "To Internally
create a new object implementing the interface interface", this change
incorporates the steps to load a prototype from new.target, and write
it to the created instance returned from constructor_impl(). This
mirrors the code for generate_html_constructor(), which incorporates
additional steps needed by Custom Elements.

Bug #334
2024-07-05 21:04:27 +02:00
Dennis Camera b54a1c6284 AK: Implement ShortString for big-endian 2024-07-05 09:49:23 -06:00
Tim Ledbetter 23eba28c22 Everywhere: Remove Serenity specific code from tests
We no longer run our tests on Serenity.
2024-07-05 07:29:51 +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
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
Timothy Flynn 698a95d2de AK: Decode paired UTF-16 surrogates in a JSON string
For example, such use is seen on Twitter.
2024-07-04 14:16:16 +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
Bastiaan van der Plaat bff6c0680a LibWeb/Geometry: Make DOMRect doubles unrestricted 2024-07-01 21:30:52 +01:00
Tim Ledbetter bdaa7f0e8e LibWeb: Implement the HTMLTrackElement.kind attribute
This reflects the HTML `kind` attribute.
2024-06-30 13:08:42 +02:00
Andreas Kling 4db05ecf69 LibWeb: Set the correct prototype for SVGAElement instances 2024-06-28 17:10:52 +02:00
Andreas Kling a84261ee7a Tests/LibWeb: Add test that dumps all global JS constructors 2024-06-28 17:10:52 +02: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 9585da37ad Tests: Skip css-keyframe-fill-forwards.html ref test
This test is currently causing intermittent CI failures.

(cherry picked from commit 24c75922d8476b5096657acb5a1b4c71454ca616)
2024-06-26 18:56:33 -06: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 8331a87f6c LibTimeZone: Rename TestTimeZone to TestTimeZoneDeprecated
This will just allow creating a TestTimeZone in LibUnicode for an ICU-
based implementation.
2024-06-26 10:14:02 +02:00
Ali Mohammad Pur 55e1ab88ad Tests/LibWasm: Don't ignore the result of BigInt::export_data()
Prior to this commit, the test runner was ignoring the result, which
meant that values that fit in less than 128 bits were shifted to remove
the zero words (which is obviously incorrect).
2024-06-25 18:25:53 -06:00
Andreas Kling 7ce350b8c0 Tests: Add a basic test for Declarative Shadow DOM 2024-06-25 19:22:35 +02:00
Zaggy1024 c4c91f02b3 LibMedia: Remove the home-grown VP9 decoder 2024-06-24 12:41:32 -06:00
Zaggy1024 d851945aad Tests/LibMedia: Ensure that frame timestamps increase monotonically 2024-06-24 12:41:32 -06:00
Zaggy1024 bbd8a218a5 AK: Prevent overflow of the min when clamping unsigned values to signed
Also, add some tests for the cases that were broken before.
2024-06-24 12:41:32 -06:00
Zaggy1024 172f4588a7 Tests/AK: Add some quick tests for AK::clamp_to 2024-06-24 12:41:32 -06:00
Zaggy1024 f6a4973578 LibMedia: Give frame timestamps to FFmpeg decoders
H.264 in Matroska can have blocks with unordered timestamps. Without
passing these as the presentation timestamp into the FFmpeg decoder,
the frames will not be returned in chronological order.

VideoFrame will now include a timestamp that is used by the
PlaybackManager, rather than assuming that it is the same timestamp
returned by the demuxer.
2024-06-24 12:41:32 -06:00
Zaggy1024 084cf68dd5 Tests/LibMedia: Add a test for H.264 decoding through FFmpeg 2024-06-24 12:41:32 -06:00
Zaggy1024 48a21d5d6a Tests/LibMedia: Move video decode testing function to a header
This will be useful for other video codecs, but putting all codecs in
one file will be a little messy.
2024-06-24 12:41:32 -06:00
circl 63fa32416d Base: Move test-webm.webm out of /home/anon 2024-06-24 09:45:41 -06:00
Timothy Flynn 3c23ce9007 LibTimeZone: Remove entirely unused time zone methods
Evaluating third-party alternatives to LibTimeZone will be simpler with
unused functionality removed.
2024-06-24 15:04:58 +02:00
Luke Warlow 6014727c20 LibWebView: Allow data URLs in sanitize_url
Allow navigation to data URLs from browser UI.
2024-06-24 06:31:17 -04:00
Timothy Flynn ebdb92eef6 LibUnicode+Everywhere: Merge LibLocale back into LibUnicode
LibLocale was split off from LibUnicode a couple years ago to reduce the
number of applications on SerenityOS that depend on CLDR data. Now that
we use ICU, both LibUnicode and LibLocale are actually linking in this
data. And since vcpkg gives us static libraries, both libraries are over
30MB in size.

This patch reverts the separation and merges LibLocale into LibUnicode
again. We now have just one library that includes the ICU data.

Further, this will let LibUnicode share the locale cache that previously
would only exist in LibLocale.
2024-06-23 19:52:45 +02:00
Andreas Kling 85a4cfc59b LibWeb: Add the bare minimum to render SVGAElement (<a>) 2024-06-23 19:15:24 +02:00
Andreas Kling ae906ca497 LibWeb: Treat width: {min,max,fit}-content as auto if ratio unresolvable
This appears to match other engines.
2024-06-23 19:15:24 +02:00
Andreas Kling db1faef786 LibWeb: Fix overeager fallback to stretch-fit width for some flex items
If a flex item has a preferred aspect ratio and the flex basis is not
definite, we were falling back to using stretch-fit for the main size,
since that appeared to match other browsers.

However, we missed the case where we actually have a definite cross size
through which the preferred aspect ratio can be naturally resolved.
2024-06-23 19:15:24 +02:00
Andreas Kling 9c02ace897 LibWeb: Allow flex-basis: {min,max,fit}-content 2024-06-23 19:15:24 +02:00
Edwin Hoksberg 2b30414c1d LibWeb: Add attribute list that must always be compared without casing 2024-06-22 15:52:04 +02:00
Tim Ledbetter 31d7fa2442 LibWeb: Fire auxclick event on middle click
Previously, no event was fired on middle click. This change also allows
the UI to open a link in a new tab on middle click.
2024-06-22 14:57:36 +02:00
Timothy Flynn aa3a30870b LibUnicode: Replace code point bidirectional classes with ICU 2024-06-22 14:56:39 +02:00
Andreas Kling 63f8feb9a4 LibWeb: Implement RecordingPainter::draw_text() via draw_text_run()
To get away from the ancient (and buggy) text layout code in
Gfx::Painter, we want to remove all the uses of Painter::draw_text().

As a first step towards this, we implement the draw_text() display list
command in terms of the draw_text_run() command by performing the very
simple necessary layout in draw_text() beforehand.
2024-06-21 10:31:13 +02:00
Andreas Kling 8a3dc5ea0a LibGfx: Remove home-grown PNG codec in favor of libpng+apng 2024-06-21 07:31:37 +02:00
Timothy Flynn ab56b8c8dc LibUnicode: Remove the locale-unaware text segmentation implementation 2024-06-20 13:46:54 +02:00
Timothy Flynn 3fe0a27fbd LibLocale: Implement an ICU-based text segmenter
Our current segmenter implementation lives in LibUnicode, and is not
locale-aware. We will need such awareness for ECMA-402, and so LibLocale
will be the new home for text segmentation.

The tests here are ported directly from LibUnicode/TestSegmentation.cpp.
2024-06-20 13:46:54 +02:00
Timothy Flynn 5cf818e305 LibUnicode: Replace case transformations and comparison with ICUs
There are a couple of differences here due to using ICU:

1. Titlecasing behaves slightly differently. We previously transformed
   "123dollars" to "123Dollars", as we would use word segmentation to
   split a string into words, then transform the first cased character
   to titlecase. ICU doesn't go quite that far, and leaves the string
   as "123dollars". While this is a behavior change, the only user of
   this API is the `text-transform: capitalize;` CSS rule, and we now
   match the behavior of other browsers.

2. There isn't an API to compare strings with case insensitivity without
   allocating case-folded strings for both the left- and right-hand-side
   strings. Our implementation was previously allocation-free; however,
   in a benchmark, ICU is still ~1.4x faster.
2024-06-20 10:59:55 +02:00
Zaggy1024 7c10e1a08d LibMedia: Rename LibVideo to LibMedia
This change is in preparation for implementing audio codecs into the
library and using audio as timing for video playback.
2024-06-19 07:51:55 +02:00
Timothy Flynn 8d7216f4e0 LibUnicode: Replace IDNA ASCII conversion with ICU 2024-06-18 21:07:56 +02:00
Timothy Flynn 1feef17bf7 LibUnicode: Remove completely unused code point name & block name data
These were used for e.g. the Character Map on Serenity, but are not used
at all for Ladybird.
2024-06-18 21:07:56 +02:00
Diego 1e19be412f LibWasm: Add missing spec extern and prevent spec extern re-use
Add the missing `print` function to the spectest namespace. Also, spec
externs cannot be re-used because operations that modify "memory", for
example, will carry over into subsequent spec test runs. This can be
remedied in the future by implementing some sort of garbage collector
for allocations in the store.
2024-06-18 16:58:33 +02:00
Andreas Kling b88e0eb50a AK: Remove unused Complex.h 2024-06-18 12:00:14 +02:00
Andreas Kling fe1aec124e AK: Remove unused ArbitrarySizedEnum class 2024-06-18 12:00:14 +02:00
Andreas Kling 1039acca8c LibGfx: Remove JPEG2000 image format support
This format is not supported by other browsers.
2024-06-17 21:57:35 +02:00
Andreas Kling a34a5af939 LibGfx: Remove ILBM image format support
This format is not supported by other browsers.
2024-06-17 21:57:35 +02:00
Andreas Kling b6daddb088 LibGfx: Remove JBIG2 image format support
This format is not supported by other browsers.
2024-06-17 21:57:35 +02:00
Andreas Kling b7f8d7aec5 LibGfx: Remove TGA image format support
This format is not supported by other browsers.
2024-06-17 21:57:35 +02:00
Andreas Kling 681a2ac14e LibGfx: Remove support for the various "portable" image formats
These formats are not supported by other browsers.
2024-06-17 21:57:35 +02:00
Andreas Kling 7141319a7c LibGfx: Remove DDS image format support
This format is not supported by other browsers.
2024-06-17 21:57:35 +02:00
Andreas Kling 4b4254c3d0 LibGfx: Remove QOI image format support
This format is not supported by other browsers.
2024-06-17 21:57:35 +02:00
Andreas Kling 2a888ca626 LibGfx: Remove home-grown JPEG codec in favor of libjpeg-turbo 2024-06-17 17:59:54 +02:00
Matthew Olsson 667e313731 LibWeb: Parse easing values manually
The values aren't that complex, so it doesn't make much sense to have a
dedicated generator for them. Parsing them manually also allows us to
have much more control over the produced values, so as a result of this
change, EasingStyleValue becomes much more ergonomic.
2024-06-16 07:12:46 +02:00
Andreas Kling 4c94202e97 LibWeb: Remove unnecessary FIXME marker for CSSStyleDeclaration.cssFloat 2024-06-14 20:45:37 +02:00
Andreas Kling 19fa630fa7 LibWeb: Make CSSKeyframeRule.parentRule actually point to parent rule 2024-06-14 20:45:37 +02:00
Andreas Kling 7f2c833a39 LibWeb: Implement CSSKeyframesRule.cssRuleList
To make this straightforward, CSSKeyframesRule now uses a CSSRuleList
for internal storage.
2024-06-14 20:45:37 +02:00
Andreas Kling a12d28fd30 LibWeb: Implement CSSStyleDeclaration.parentRule
This readonly attribute returns the containing CSS rule, or null (in the
case of element inline style).
2024-06-14 20:45:37 +02:00
circl dbc94ce92e Tests/LibWeb: Add test to verify correctness of getImageData 2024-06-14 16:54:32 +02:00
Andreas Kling c14369e2e3 Tests: Update rebaseline-libweb-test script with new paths 2024-06-14 16:28:32 +02:00
Aliaksandr Kalenik b2dcdf0096 LibWeb: Use button layout for input elements with button type 2024-06-14 07:58:55 +02:00
Aliaksandr Kalenik 8feaecd5c8 LibWeb: Create BlockContainer layout node for <input type="button">
...and shadow tree with TextNode for "value" attribute is created.
This means InlineFormattingContext is used, and button's text now
respects CSS text-decoration properties and unicode-ranges.
2024-06-14 07:58:55 +02:00
Hexeption 7ac6fd2746 LibWeb: Added HTMLLinkElement.as Tests 2024-06-13 07:58:11 +02:00
Timothy Flynn 273694d8de LibJS+LibLocale: Replace date-time formatting with ICU
This uses ICU for the Intl.DateTimeFormat `format` `formatToParts`,
`formatRange`, and `formatRangeToParts`.

This lets us remove most data from our date-time format generator. All
that remains are time zone data and locale week info, which are relied
upon still for other interfaces. So they will be removed in a future
patch.

Note: All of the changes to the test files in this patch are now aligned
with other browsers. This includes:

* Some very incorrect formatting of Japanese symbols. (Looking at the
  old results now, it's very obvious they were wrong.)
* Old FIXMEs regarding range formatting not including the start/end date
  when only time fields were requested, but the dates differ.
* Day period inconsistencies.
2024-06-13 07:42:09 +02:00
Diego 40fcb00c14 LibWasm: Add missing spec-test imports 2024-06-11 02:43:55 +02:00
Tim Ledbetter 1a4b042664 LibURL: Convert ASCII only URLs to lowercase during parsing
This fixes an issue where entering EXAMPLE.COM into the URL bar in the
browser would fail to load as expected.
2024-06-10 20:34:57 -04:00
Kenneth Myhra e70886595a LibWeb: Implement and wire up TransformStream's cancel callback 2024-06-09 21:27:26 -04:00
Kenneth Myhra fc37bc328e Test/LibWeb: Add test to prove a ReadableStream can be cancelled 2024-06-09 21:27:26 -04:00
Diego 7560b640f3 AK: Add AllowSurrogates to UTF-8 validator
The [UTF-8](https://datatracker.ietf.org/doc/html/rfc3629#page-5)
standard says to reject strings with upper or lower surrogates. However,
in many standards, ECMAScript included, unpaired surrogates (and
therefore UTF-8 surrogates) are allowed in strings. So, this commit
extends the UTF-8 validation API with `AllowSurrogates`, which will
reject upper and lower surrogate characters.
2024-06-09 12:16:32 +02:00
Enver Balalic 64e27cb659 LibWasm: test-wasm: Default initialize u128 parameter bits to 0
This fixes 326 tests.

18802 failed without
18476 failed with.
2024-06-09 12:14:59 +02:00
Timothy Flynn 9724a25daf LibJS+LibLocale: Replace canonical locales and display names with ICU
Note: We keep locale parsing and syntactic validation as-is. ECMA-402
places additional restrictions on locales above what is required by the
Unicode spec. ICU doesn't provide methods that let us easily check those
restrictions, whereas LibLocale does. Other browsers also implement
their own validators here.

This introduces a locale cache to re-use parsed locale data and various
related structures (not doing so has a non-negligible performance impact
on Intl tests).

The existing APIs for canonicalization and display names are pretty
intertwined, so they must both be adapted at once here. The results of
canonicalization are slightly different on some edge cases. But the
changed results are actually now aligned with Chrome and Safari.
2024-06-09 10:47:28 +02:00
Kenneth Myhra 0ec0e92b10 LibWeb: Implement static method ReadableStream.from(asyncIterable) 2024-06-09 10:12:46 +02:00
Jamie Mansfield 0c683af57e LibWeb: Test referrerPolicy attribute on all elements 2024-06-08 08:01:42 +02:00
Jamie Mansfield fdb4e05d7f LibWeb: Use a single test for loading attribute 2024-06-08 08:01:42 +02:00
Jamie Mansfield 1dda129fe1 LibWeb: Test fetchPriority attribute on all elements 2024-06-08 08:01:42 +02:00
Tim Ledbetter 2fed064791 Tests/LibWeb: Wait until document fully loaded before simulating click
This makes the `form-image-submission.html` test pass more reliably.
2024-06-08 07:59:21 +02:00
Andreas Kling 533eea1958 Tests: Skip Text/input/HTML/form-image-submission.html (flaky)
Issue: https://github.com/LadybirdWebBrowser/ladybird/issues/100
2024-06-07 19:39:45 +02:00
Jamie Mansfield 53d7aa53a2 LibWeb: Use Enumerated for HTMLScriptElement.referrerPolicy 2024-06-07 09:54:19 +02:00
Andrew Kaster 0c9dced888 Meta: Remove trivially unused Kernel API headers 2024-06-07 09:44:41 +02:00
Timothy Flynn 8362c073f3 Everywhere: Remove LibSQL, SQLServer, and the sql REPL :^)
It is now entirely unused and replaced by sqlite3.
2024-06-06 11:27:03 -04:00
Daniel Bertalan 376b956214 Tests: Stop invoking UB in AK::NeverDestroyed's tests
Instead of attempting a stack use-after-free by reading an out-of-scope
object's data member, let's keep a flag that checks if the destructor
had been called in the outer scope.

Fixes #64
2024-06-05 17:19:14 -06:00
Andrew Kaster 90af26e309 Meta+CMake: Remove unused CMake functions and features
Goodbye, serenity_components and Jakt.
2024-06-05 12:23:54 -04:00
Andreas Kling 254d040ff4 LibGfx: Move Gfx::Painter::ScalingMode => Gfx::ScalingMode
This will allow users to avoid including Painter.h
2024-06-05 15:37:05 +02:00
Andreas Kling 6a96920dbc LibGfx: Remove Bitmap and Painter "scale" concept
We don't need intrinsic scale factors for Gfx::Bitmap in Ladybird,
as everything flows through the CSS / device pixel ratio mechanism.

This patch also removes various unused functions instead of adapting
them to the change.
2024-06-05 15:37:05 +02:00
Aliaksandr Kalenik 5285e22f2a LibWeb+WebContent: Move scrollbar painting into WebContent
The main intention of this change is to have a consistent look and
behavior across all scrollbars, including elements with
`overflow: scroll` and `overflow: auto`, iframes, and a page.

Before:
- Page's scrollbar is painted by Browser (Qt/AppKit) using the
  corresponding UI framework style,
- Both WebContent and Browser know the scroll position offset.
- WebContent uses did_request_scroll_to() IPC call to send updates.
- Browser uses set_viewport_rect() to send updates.

After:
- Page's scrollbar is painted on WebContent side using the same style as
  currently used for elements with `overflow: scroll` and
  `overflow: auto`. A nice side effects: scrollbars are now painted for
  iframes, and page's scrollbar respects scrollbar-width CSS property.
- Only WebContent knows scroll position offset.
- did_request_scroll_to() is no longer used.
- set_viewport_rect() is changed to set_viewport_size().
2024-06-05 07:03:42 +02:00
Jamie Mansfield 2ffda00347 LibWeb: Implement HTMLImageElement.crossOrigin 2024-06-05 05:42:47 +01:00
Jamie Mansfield d7d60268ec LibWeb: Implement HTMLLinkElement.crossOrigin 2024-06-05 05:42:47 +01:00
Jamie Mansfield 8315ad6759 LibWeb: Implement HTMLImageElement.fetchPriority 2024-06-05 05:42:47 +01:00
Andrew Kaster c6e9f0e7b5 Meta+Documentation: Switch default build dir to Build/Ladybird
Also prefer using the new top-level CMakeLists.txt
2024-06-04 13:44:22 -06:00
Andreas Kling cd84d23afa Base+Tests+Ladybird: Remove bitmap fonts 2024-06-04 18:45:30 +02:00
Andreas Kling 1670eda095 Tests/LibWeb: Remove layout test for Gfx::BitmapFont 2024-06-04 18:45:30 +02:00
Andreas Kling 04a6e2f83d LibWeb: Remove Gfx::BitmapFont
This class supported the binary bitmap font file format in SerenityOS,
and isn't something we need in Ladybird.
2024-06-04 18:45:30 +02:00
Andreas Kling 6321e97b09 AK: Remove various unused things 2024-06-04 09:19:39 +02:00
Andreas Kling e4cd91761d Everywhere: Remove LibMarkdown
This was used to convert markdown into HTML for display in the browser,
but no other browser behaves this way, so let's simplify things by
removing it.

(Yes, we could implement all kinds of "convert to HTML and display" for
every file format out there, but that's far outside the scope of a
browser engine.)
2024-06-04 09:19:39 +02:00
Timothy Flynn 41c9cb032f Test: Skip flakey Text/input/WebAnimations/misc/DocumentTimeline test
Ref https://github.com/LadybirdWebBrowser/ladybird/issues/19
2024-06-03 11:42:18 -06:00
Timothy Flynn bdbe2fdcc5 Everywhere: Replace SERENITY_SOURCE_DIR with LADYBIRD_SOURCE_DIR
In order to have checkouts of both SerenityOS and Ladybird, we need to
use a different environment variable for Ladybird.
2024-06-03 15:57:59 +02:00
Andrew Kaster d057d24d72 Tests: Add log-file option to WPT runner script
Always dropping the log file in /tmp isn't the greatest DX for debugging
failures
2024-06-03 10:55:12 +02:00
Andreas Kling e70d96e4e7 Everywhere: Remove a lot more things we don't need 2024-06-03 10:53:53 +02:00
Andreas Kling 421aa7c475 Everywhere: Remove more unused components 2024-06-03 10:53:53 +02:00
Tim Ledbetter cc435e7a78 Tests: Remove tests for unused components 2024-06-03 10:53:53 +02:00
Matthew Olsson b5c682bc2e LibWeb: Copy the keyframes in KeyframeEffect's copy constructor 2024-06-03 10:53:32 +02:00
Matthew Olsson 37322baf54 LibWeb: Ensure all DocumentTimeline objects have the same time value
The DocumentTimeline constructor used the current millisecond time to
initialize its currentTime, but that means that a newly created timeline
would always have a different time value than other timelines that have
been through the update_animations_and_send_events function.
2024-06-03 10:53:32 +02:00
Nico Weber 857750dfed LibGfx/WebPLoader: Survive calling loop_count() before other accessors
Fixes `animation` asserting when reading a webp input.

(The other order of operations is still covered by TestImageWriter.cpp.)
2024-06-03 07:48:53 +02:00
Jamie Mansfield 295c4ef51a LibWeb/Fetch: Use MimeType in DataURL 2024-06-02 19:55:53 +02:00
Matthew Olsson 0acf89234c LibWeb: Try to fix a flaky animation test
Not sure if this'll fix it fully, as the flake has only ever been
observed on CI.
2024-06-02 16:07:12 +02:00
Matthew Olsson 73aadddbc1 LibWeb: Reject invalid keyframe offset values 2024-06-02 16:07:12 +02:00
Matthew Olsson e13cd914a9 LibWeb: Handle animating the 'all' property 2024-06-02 16:07:12 +02:00
Matthew Olsson 6859826e3d LibWeb: Handle persisting an animation after it has been removed 2024-06-02 16:07:12 +02:00
Matthew Olsson a80af938eb LibWeb: Support subtree option in Animatable.getAnimations() 2024-06-02 16:07:12 +02:00
Matthew Olsson e2cb25e35c LibWeb: Support interpolation of mixed percentage dimension units 2024-06-02 15:12:17 +02:00
Diego d906255cbb LibWasm: Improve table support
Implements `table.get`, `table.set`, `elem.drop`, `table.size`,
and `table.grow`. Also fixes a few issues when generating ref-related
spectests. Also changes the `TableInstance` type to use
`Vector<Reference>` instead of `Vector<Optional<Reference>>`, because
the ability to be null is already encoded in the `Reference` type.
2024-06-01 16:21:03 +02:00
Nico Weber 3ca6dfba48 Tests: Add test for color indexing for single-channel images
The color indexing transform shouldn't make single-channel images
larger (by needlessly writing a palette). If there <= 16 colors
in the single channel, it should make the image smaller.
2024-06-01 14:52:00 +02:00
Timothy Flynn fe3fde2411 AK+LibUnicode: Implement a case-insensitive variant of find_byte_offset
The existing String::find_byte_offset is case-sensitive. This variant
allows performing searches using Unicode-aware case folding.
2024-06-01 07:37:54 +02:00
Nico Weber d8103247d9 Tests: Check that color indexing reduces file size 2024-05-31 22:39:25 +02:00
Nico Weber 533b29dde7 LibGfx/WebPWriter: Add a toggle for disabling individual transforms 2024-05-31 22:39:25 +02:00
Nico Weber 4a327d98a4 Tests: Add a test that triggers the webp color indexing saving path 2024-05-31 22:39:25 +02:00
Tim Ledbetter 4f0d6559f6 WPT: Update test expectations to match current test results 2024-05-30 11:03:56 -06:00
Tim Ledbetter d7ea308664 WPT: Update to latest master
Previously, it was not possible to run `wpt` locally with a python
version >= 3.12.
2024-05-30 11:03:56 -06:00
Matthew Olsson 5740f93ef4 ClangPlugins: Check for strong root fields in GC allocated objects
GC-allocated objects should never have JS::SafeFunction/JS::Handle
fields.

For now the plugin only emits warnings here, as there are many cases
of this occurring in the codebase that aren't trivial to fix. It is also
behind a CMake flag since it is a _very_ loud warning.
2024-05-30 09:29:20 -06:00
Matthew Olsson f860763c77 Tests: Add tests for ClangPlugin's macro validation 2024-05-30 09:29:20 -06:00
Matthew Olsson c739ae3e02 ClangPlugins: Change name of variable used for test compile options
This makes it more clear what it is used for
2024-05-30 09:29:20 -06:00
Matthew Olsson 1965943026 LibWeb: Reject invalid AnimationEffect duration string values 2024-05-29 08:18:24 +02:00
Matthew Olsson 3e221fbb2d IDLGenerators: Handle restricted/unrestricted floating point types 2024-05-29 08:18:24 +02:00
Matthew Olsson 2bd8093449 LibWeb: Detect explicit null timeline given in KeyframeAnimationOptions
We already do this for the timeline argument in the KeyframeEffect
constructor
2024-05-29 08:18:24 +02:00
Tim Ledbetter bb923983fc LibWeb: Implement WorkerGlobalScope.importScripts()
This method allows workers to synchronously import one or more scripts.
2024-05-29 08:17:18 +02:00
MacDue f7bf14605c LibWeb: Remove PaintBorders recording painter command
`Painting::paint_all_borders()` only uses `.draw_line()` for simple
borders and `.fill_path()` for more complex cases. These are both
already supported by the `RecordingPainter` so removing this command
simplifies the painting API.

Two test changes:

css-background-clip-text: Borders are now drawn via the AA painter
(which makes them closer to how they appear in other browsers).

corner-clip-inside-scrollable: Borders removed (does not change test)
due to imperceptible sub-pixel changes.
2024-05-29 08:17:01 +02:00
Nico Weber ab0219bb08 Tests: Remove a FIXME
This mostly works by accident now (see previous commit), but hey,
it works.
2024-05-29 07:10:00 +01:00
Tim Ledbetter d6297ec074 LibWeb: Cast to the correct type in Element::auto_directionality()
Previously, we always cast to a HTMLInputElement when getting the value
of an auto directionality form associated element. This caused
undefined behavior when determining the directionality of an element
that wasn't a HTMLInputElement.
2024-05-28 09:51:07 +02:00
Tim Ledbetter 0b0ad5c9db LibWeb: Calculate width property resolved value correctly
This means that relative width values are now correctly resolved when
calling `getComputedStyle()`.
2024-05-28 08:08:31 +02:00
Tim Ledbetter 7d192ed8c1 LibWeb: Don't crash on clicking a label with an associated text input
Previously, we assumed that all label control paintables were of type
`LabelablePaintable`. This caused a crash when clicking on a label with
a text input control.
2024-05-28 08:07:05 +02:00
Shannon Booth 6466fca20a LibWeb: Implement BaseAudioContext.createGain 2024-05-28 08:06:09 +02:00
Kenneth Myhra dacba5e610 Tests/LibWeb: Initialize 'arrayBuffer' to an UInt8Array
This initializes 'arrayBuffer' to an UInt8Array so that we can
manipulate the contents of 'arrayBuffer'. The test verifies that the
internal buffer is an ArrayBuffer.

Also:
* Correct comparison in test so that we compare arrayBuffer to
  arrayClone, not to itself.
* Remove FIXME, this outputs [object ArrayBuffer] in Firefox and Chrome
  too.
2024-05-27 17:37:27 +02:00
Jamie Mansfield 600daea544 LibWeb: Implement HTMLIFrameElement.loading 2024-05-27 17:34:59 +02:00
Jamie Mansfield 9ee061ea14 LibWeb: Implement HTMLImageElement.loading
Removes some console noise while loading mmu.ac.uk :)
2024-05-27 17:34:59 +02:00
Andreas Kling 802af5ad9d LibWeb: Allow Element.insertAdjacentHTML on the document element
This fixes wpt/domparsing/insert_adjacent_html.html
2024-05-27 17:33:29 +02:00
Andreas Kling e7febd347b LibWeb: Don't advertise the empty string as HTMLCollection property name
This fixes wpt/dom/collections/HTMLCollection-empty-name.html
2024-05-27 17:33:29 +02:00
Aliaksandr Kalenik 663cc753a7 LibWeb: Fix clip box calculation in PaintableWithLines
All painting commands except SetClipRect are shifted by scroll offset
before command list execution. This change removes scroll offset
translation for sample/blit corner commands in
`PaintableWithLines::paint` so it is only applied once in
`CommandList::apply_scroll_offsets()`.
2024-05-26 16:11:53 +01:00
Lucas CHOLLET 09f4032eeb LibGfx/PNG: Read metadata from the eXIf chunk
The test image comes from this WPT test:
http://wpt.live/png/exif-chunk.html
2024-05-26 14:54:43 +01:00
MacDue 18d39deefe Tests/LibWeb: Add ref test for clip-path: polygon(...) 2024-05-26 07:55:50 +02:00
Shannon Booth 17ae65cedc LibWeb: Implement AudioBuffer.copyToChannel 2024-05-26 07:48:37 +02:00
Shannon Booth 67b1f4af55 LibWeb: Implement HTMLFormElement.encoding 2024-05-26 07:47:59 +02:00
Shannon Booth aeb815cc66 LibWeb: Implement HTMLFormElement.enctype 2024-05-26 07:47:59 +02:00
Matthew Olsson a8ef84f8c3 LibWeb: Use LengthPercentage for calc values in Transformation matrix 2024-05-25 22:19:47 +02:00
Aliaksandr Kalenik e2b2b2439c LibWeb: Apply corner clip before scroll offset for PaintableWithLines
Fixes bug when corner clip mask moves along with the scrolled text.
2024-05-25 22:19:40 +02:00
Lucas CHOLLET fb79aa6159 LibGfx/GIF: Correctly write frames with a non-null position 2024-05-25 06:42:15 +01:00
Nico Weber 934516d75b Tests/LibGfx: Don't use a color name as an ARGB32 value
...and use a different color name until a (relatively harmless) bug
writing fully-opaque frames to an animation that also has transparent
frames is fixed. (I've had a local fix for that for a while, but
I'm waiting for #24397 to land.)
2024-05-25 06:36:20 +01:00
Matthew Olsson 15a8baee03 LibWeb: Save time for animationcancel event before transitioning to idle
The if statement in the dispatch implies we are in the idle state, so of
course the active time will always be undefined. If this was cancelled
via a call to cancel(), we can save the time at that point. Otherwise,
just send 0.
2024-05-24 07:25:10 +02:00
Andreas Kling f4636a0cf5 LibWeb: Stop spamming animation events on the wrong event target
This patch fixes two issues:

- Animation events that should go to the target element now do
  (some were previously being dispatched on the animation itself.)
- We update the "previous phase" and "previous iteration" fields of
  animation effects, so that we can actually detect phase changes.
  This means we stop thinking animations always just started,
  something that caused each animation to send 60 animationstart
  events every second (to the wrong target!)
2024-05-23 12:10:06 +02:00
Andrew Kaster bab546472e LibWeb: Mark FontFaceSet as a setlike IDL interface
And implement more of the constructor logic.
2024-05-23 10:57:34 +02:00
Matthew Olsson 6a4938a524 ClangPlugins: Convert all warnings to errors
Now that the lambda capture plugin isn't full of false-positives, we can
make the jump and start halting builds for these errors. It also allows
these plugins to be useful in CI.
2024-05-22 21:55:34 -06:00
Matthew Olsson 573bbd47ee Tests: Update ClangPlugins to use C++23 when running Clang 2024-05-22 21:55:34 -06:00
Matthew Olsson a98ad191c7 Userland: Add ESCAPING annotations to a bunch of places
This isn't comprehensive; just a result of a simple grep search.
2024-05-22 21:55:34 -06:00
Matthew Olsson e0d6afbabe ClangPlugins: Invert the lambda detection escape mechanism
Instead of being opt-out with NOESCAPE, it is now opt-in with ESCAPING.
Opt-out is ideal, but unfortunately this was extremely noisy when
compiling the entire codebase. Escaping functions are rarer than non-
escaping ones, so let's just go with that for now.

This also allows us to gradually add heuristics for detecting missing
ESCAPING annotations and emitting them as errors. It also nicely matches
the spelling that Swift uses (@escaping), which is where this idea
originally came from.
2024-05-22 21:55:34 -06:00
Tim Ledbetter d2b3007248 IDLGenerators: Use spec-compliant algorithm to parse integer values 2024-05-23 04:15:46 +02:00
Lucas CHOLLET c83fc59534 Tests/LibGfx: Also test animated GIFs 2024-05-22 13:29:05 -04:00
Nico Weber b7b51d01c3 LibGfx/AnimationWriter: Survive animations with two identical frames
Creating a completely empty bitmap fails. Just write a 1x1 bitmap
if the bitmap ends up empty for now.
2024-05-22 06:41:47 -04:00
Tim Ledbetter 2a7cf1c588 LibWeb: Implement the width and height attributes where missing
This change adds the `width` and `height` properties to
`HTMLVideoElement` and `HTMLSourceElement`. These properties reflect
their respective content attribute values.
2024-05-21 19:28:43 +02:00
Tim Ledbetter 9f9aa62128 LibWeb: Implement the hspace and vspace attributes
These properties reflect their respective content attributes.
2024-05-21 19:28:43 +02:00
Tim Ledbetter 817bfef3aa Tests/AK: Add tests for integral log2 2024-05-21 09:31:17 +02:00
Tim Ledbetter d0d81e470e AK: Fix off by one error in integral ceil_log2()
Previously, certain values of `ceil_log2(x)` would be 1 smaller than
`ceil(log2(x))`.
2024-05-21 09:31:17 +02:00
Kenneth Myhra e2c4019bfc LibWeb: Close acquired writer in AO readable_stream_pipe_to()
Also adds a test to prove that the WritableStream's close callback is
called.
2024-05-20 16:57:52 -04:00
Tim Ledbetter a6d6729034 LibWeb: Implement the MouseEvent.relatedTarget attribute
This returns the secondary target of a mouse event. For `onmouseenter`
and `onmouseover` events, this is the EventTarget the mouse exited
from. For `onmouseleave` and `onmouseout` events, this is the
EventTarget the mouse entered to.
2024-05-20 08:21:41 +02:00
Ali Mohammad Pur def379ce3f LibCrypto: Move some data around earlier in GHash to make it go faster
This makes galois_multiply() about 10% faster.
2024-05-20 08:03:35 +02:00
Jamie Mansfield 08a3904309 LibWeb/MimeSniff: Implement "minimize a supported MIME type"
See:
- https://github.com/whatwg/mimesniff/commit/227a469
2024-05-19 16:25:50 +02:00
Shannon Booth 3ccbc83168 LibWeb: Add a stubbed slot for DynamicsCompressorNode.reduction
For now, this slot is always 0 - (the default value per spec). But
once we start actually processing audio streams this internal slot
should be changed correspondingly.
2024-05-19 09:26:20 +02:00
Shannon Booth cf615cbd1c LibWeb: Add AudioParams for DynamicsCompressorNode 2024-05-19 09:26:20 +02:00
Shannon Booth ccdf82c9be LibWeb: Implement scrollIntoView with 'center' block position
This fixes a crash on:

https://docs.github.com/en/get-started/learning-about-github/githubs-plans
2024-05-19 07:22:17 +02:00
Shannon Booth dd20156010 LibWeb: Fix division by zero on a zero-height viewport SVG image 2024-05-19 07:19:42 +02:00
Shannon Booth d48316ce15 LibWeb: Fix division by zero on a zero-width viewport SVG image
We were previously crashing by a division by zero due to an aspect ratio
of zero on https://comicbookshop.co.nz/
2024-05-19 07:19:42 +02:00
Lucas CHOLLET a0401b0d86 LibGfx/GIF: Add support for colors
To determine the palette of colors we use the median cut algorithm.
While being a correct implementation, enhancements are obviously
existing on both the median cut algorithm and the encoding side.
2024-05-18 18:30:07 +02:00
Lucas CHOLLET 1ba8a6f80f LibGfx: Add an implementation of the MedianCut algorithm
This is useful to find the best matching color palette from an existing
bitmap. It can be used in PixelPaint but also in encoders of old image
formats that only support indexed colors e.g. GIF.
2024-05-18 18:30:07 +02:00
Tim Ledbetter c36ba450be LibWeb: Generate binding for HTMLObjectElement.contentWindow attribute
This only required adding the appropriate definition to the IDL file,
as `NavigableContainer` already implements the logic that we need.
2024-05-18 18:12:08 +02:00
Tim Ledbetter 2447a25753 LibWeb: Implement the labels attribute for all labelable elements
This returns a `NodeList` of all the labels associated with the given
element.
2024-05-18 18:09:18 +02:00
Tim Ledbetter 3dc86747f0 LibWeb: Implement the HTMLOutputElement.htmlFor attribute
This returns a DOMTokenList that reflects the `for` attribute.
2024-05-18 11:23:20 +02:00
Tim Ledbetter acc1fa3c62 LibWeb: Generate binding for the HTMLObjectElement.form attribute
This only required adding the appropriate definition to the IDL file,
as `FormAssociatedElement` already implements the logic that we need.
2024-05-18 11:04:04 +02:00
Tim Ledbetter 6bf22075ed LibWeb: Implement the HTMLLabelElement.form attribute
This returns the form element associated with the given label element's
control or null if the label has no control.
2024-05-18 11:04:04 +02:00
Tim Ledbetter d0555f3176 LibWeb: Flesh out DOMTokenList::supports() implementation
This change makes `DOMTokenList::supports()` work as expected for
`relList` attributes.
2024-05-16 20:31:23 +02:00
Tim Ledbetter 51fc30a191 LibWeb: Implement the HTMLLinkElement.relList attribute
This returns a DOMTokenList that reflects the `rel` attribute.
2024-05-16 08:06:26 +02:00
Tim Ledbetter fc4e0cf10e LibWeb: Implement the HTMLFormElement.relList attribute
This returns a DOMTokenList that reflects the `rel` attribute.
2024-05-16 08:06:26 +02:00
Tim Ledbetter 0a3e1846f0 LibWeb: Implement the HTMLAreaElement.relList attribute
This returns a DOMTokenList that reflects the `rel` attribute.
2024-05-16 08:06:26 +02:00
Tim Ledbetter b7fd39c2e6 LibWeb: Implement the HTMLAnchorElement.relList attribute
This returns a DOMTokenList that reflects the `rel` attribute.
2024-05-16 08:06:26 +02:00