Commit graph

3808 commits

Author SHA1 Message Date
Sam Atkins
a9a25d4eca Tests: Add a test for @supports
This is derived from our old demo page.

Notably, we currently do claim to support `::-webkit-foo` selectors,
which is a bug. According to the spec [1], we have to parse those as
valid, but `@supports` should still fail for them [2], which is a bit
confusing.

[1] https://www.w3.org/TR/selectors-4/#compat
[2] https://drafts.csswg.org/css-conditional-4/#support-definition-ext
2024-11-07 15:11:24 +01:00
Tim Ledbetter
29f419d637 Tests: Import an xht test from WPT 2024-11-07 12:02:31 +00:00
Pavel Shliak
1389ae02be LibGfx: Fix 24bit BMPs being transparent and send them as RGBx to Skia 2024-11-07 12:27:00 +01:00
Andreas Kling
81e75530d9 LibWeb: Make :nth-* selectors match children of non-elements
Some checks failed
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Build Dev Container Image / build (push) Has been cancelled
This was covered by WPT, which caught us not allowing :nth-child(1)
to match the root HTML element, and other similar issues.
2024-11-06 21:42:53 +01:00
Andreas Kling
eeba30f988 LibWeb: Allow :link and :any-link to match SVG <a> elements 2024-11-06 21:42:53 +01:00
Andreas Kling
92d9907f8f LibWeb: Add style invalidation for :target, :focus, :active and :link 2024-11-06 21:42:53 +01:00
Andreas Kling
1045000c28 LibWeb: Style invalidation for DOM node removal needs to happen earlier
We can't invalidate after the removal has taken effect, since that means
invalidation won't be able to find potentially affected siblings and
ancestors by traversing from the invalidation target.
2024-11-06 21:42:53 +01:00
Andreas Kling
adfc69bc67 LibWeb: Add style invalidation for :defined selector 2024-11-06 21:42:53 +01:00
Andreas Kling
6c945fc353 Tests: Import more CSS selector tests from WPT 2024-11-06 21:42:53 +01:00
Andreas Kling
9dff6bca1f Tests: Import more style invalidation tests from WPT
These will help us work on style invalidation with more confidence.
2024-11-06 21:42:53 +01:00
Sam Atkins
8f21513902 Tests: Re-import tests that used ahem.css
This causes 36 new subtests to pass locally. :^)

Unfortunately at least one of these is flaky when it's able to load the
font file, apparently because we don't wait for the font and its
stylesheet to actually load before the tests run.
2024-11-06 20:03:38 +01:00
Sam Atkins
a8b3d363cc Tests: Annotate reasons for skipping LibWeb tests
Eventually we want to stop skipping these, so it's helpful to know why
they were skipped in the first place. :^)

I've grouped them together by reason, so the order has changed a little.

For some of these the reason isn't clear.
2024-11-06 20:03:38 +01:00
Gingeh
f88f41cf1e LibWeb: Reject invalid processing instructions 2024-11-06 18:48:50 +01:00
Piotr
06154b87dd LibWeb: Support for "content-language" http-equiv state
Implemented support for setting the pragma-set default language in the
`<meta/>` tag with an `http-equiv` attribute `content-language`.
2024-11-06 10:56:57 +01:00
Hermes Junior
5dabd468ed LibWeb: Fix out-of-bound crash when there's more table cells than cols
Added a getter to ensure we are within a valid range.
This behavior is accepted by other browsers,
and crashed on some pages.
2024-11-06 09:36:33 +00:00
Gingeh
cd5d8f4d95 LibWeb: Handle steps(x, start) like steps(x, jump-start) 2024-11-06 09:27:53 +00:00
Pavel Shliak
672590c360 Tests: Remove duplicated test for FloatingPointParsing 2024-11-06 09:22:44 +00:00
Pavel Shliak
5fe1d38955 Tests: Remove duplicated test for UnicodeCharacterTypes 2024-11-06 09:22:44 +00:00
Pavel Shliak
cf5521ec68 Tests: Remove duplicated test for StringView 2024-11-06 09:22:44 +00:00
Gingeh
453e034801 LibXML: Read code points when parsing names 2024-11-06 10:07:52 +01:00
Aliaksandr Kalenik
42b31820a6 LibWeb: Use UTF-16 code units length in CharacterData::replace_data()
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Range API uses UTF-16 code units to represent offsets, so replace_data()
needs to use it instead of bytes count while calculating new offsets.

Fixes incorrectly thrown exception when non-latin string is passed into
replace_data().
2024-11-06 05:46:30 +00:00
Sam Atkins
f5d67cefc1 Tests: Import a couple of CSS nesting tests from WPT
This is partly to check that importing ref tests works, and that I
didn't break the text-test import.
2024-11-05 17:58:16 +00:00
Shannon Booth
9598ed1d17 LibWeb: Hook up the HostInitializeShadowRealm callback
This is enough for a basic shadow realm to work :^)

There is more that we still need to implement here such as module
loading and fixing up the global object, but this is enough to get some
basic usage working.
2024-11-05 10:43:08 -07:00
Shannon Booth
c69a9812c8 LibWeb: Introduce the 'ShadowRealmGlobalScope' interface
This object represents the global object for a shadow realm. The IDL
generator will need to be adjusted to the '[Global]' extended attribute
and no '[Exposed]' field (the change in the test is not correct, as I
understand it), but this should be enough to get us started on
shadow realms.
2024-11-05 10:43:08 -07:00
Aliaksandr Kalenik
75e26af117 Tests/LibWeb: Import css grid alignment tests from WPT 2024-11-05 17:44:08 +01:00
Aliaksandr Kalenik
3833049fc8 Meta+Tests: Substitute Ahem font path in import-wpt-test.py 2024-11-05 17:44:08 +01:00
Sam Atkins
b7efb61fbe Tests/LibWeb: Restructure Ref and Screenshot test dirs to match others
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Now each test type has the same directories:
- input
- expected
- data

Also, tests can be in subdirectories within ./input.
2024-11-05 14:02:07 +00:00
Sam Atkins
08253d6aee Tests/LibWeb: Move assets used by multiple test types into Assets/
Having to go through multiple levels of .. is not ideal, but less odd
than reaching into another test type's data files.
2024-11-05 14:02:07 +00:00
Gingeh
a4b38dda56 LibWeb: Use substrings instead of pointers when parsing unicode ranges
Fixes a segfault when parsing a wildcard-only unicode range
2024-11-05 14:01:45 +00:00
Andreas Kling
ceedfb34d2 LibWeb: Look at both namespace & tag name in HTML parser stack checks
We were neglecting to check the namespace when looking for a specific
type of element on the stack of open elements in many cases.

This caused us to confuse HTML and SVG elements.
2024-11-05 12:29:27 +01:00
Andreas Kling
49b88fc095 LibWeb: Don't compare against HTML-uppercased tag names in HTML parser
Element::tag_name() returns an uppercased string for HTML elements,
which is usually not what's expected by the parser algorithms that look
at tag names.
2024-11-05 12:29:27 +01:00
Gingeh
d1b967bca5 LibWeb: Consider every row when calculating table width 2024-11-05 10:58:11 +00:00
Gingeh
c67ecf37f7 LibWeb: Implement linear easing according to latest spec 2024-11-05 10:41:29 +00:00
Kostya Farber
373c80db68 LibWeb: Start implementing letter spacing
Letter spacing is applied during text shaping and `shape_text` is used
in places other `InlineLevelIterator` so way may have more work to do,
however this is a good start :^).
2024-11-05 10:40:22 +00:00
Pavel Shliak
38bb8ce0de LibWeb: Modify table formatting according to spec
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run
Makes Sub, Super, TextBottom, TextTop vertical aligns equal to Baseline
2024-11-04 14:54:32 +00:00
Sam Atkins
ebbef87243 Tests: Skip flakey css/cubic-bezier-infinite-slope-crash.html test
This has been consistently timing-out on CI.
2024-11-04 12:50:44 +00:00
Piotr
e2613090ed LibWeb: Handle empty string in lang attribute
If the attribute value is the empty string `(lang="")`, the language
is set to unknown. `lang` attribute higher up in the document tree
will no longer be applied to the content of that element.
2024-11-04 12:06:32 +00:00
Quentin Ligier
e099a452b1 LibWeb: Add tests for the CSS4 color functions 2024-11-04 10:48:10 +00:00
Tim Ledbetter
56441fe3e6 LibWeb: Don't crash when input with no associated text node loses focus 2024-11-04 10:08:34 +00:00
Timothy Flynn
50a31f9728 LibWeb: Abort early processing frame/iframe attrs for null navigables
We guarded one step against a null navigable, but the very next step
also needs to be protected. Let's just abort early instead. This was
caught by the following imported WPT test:

html/dom/elements/the-innertext-and-outertext-properties/innertext-setter.html

This test adds a <frame> element and immediately removes it, but the
task to process the src attribute is already queued. Note that <iframe>
would have the same issue, but this test does not include them.
2024-11-04 09:54:32 +00:00
Timothy Flynn
16def85153 LibWeb: Implement HTMLFrameElement as a NavigableContainer
NavigableContainer is our home grown concept which already contains the
AOs needed for frame and iframe elements. This patch simply aligns our
HTMLFrameElement implementation with this class.

A couple of notes:

1. The <script> in the <head> element is intentional. The <frameset>
   element effectively takes the place of the <body> element, and we
   cannot add a <script> to a <frameset> element.

2. We don't render <frameset> or <frame> at all. Rendering is defined
   in the following spec:
   https://html.spec.whatwg.org/multipage/rendering.html#frames-and-framesets

3. If you load the test page in your browser, you won't see anything,
   regardless of (2). Our test infra adds a <pre> element to the "body"
   element (which is the <frameset> element here). Such children will
   never be rendered. In the future, we could come up with something
   better for our test infra to do, but this isn't important anyways
   for this test - we can still grab the <pre> element's innerText.
2024-11-04 09:54:32 +00:00
Timothy Flynn
cfcb29bdfd AK+LibUnicode: Add a method to trim non-ASCII whitespace from a String
Required by WebDriver.
2024-11-03 20:42:46 -05:00
Andreas Kling
969ee0f3e0 LibJS: Make DataView::byte_offset() return u32
This fixes structured serialization of DataView. It was expected
to be uniform with TypedArray, which returns u32 for byte_offset().

This was covered by a number of WPT infrastructure tests, which this
commit also imports.
2024-11-04 00:22:40 +01:00
Aliaksandr Kalenik
d13011bfbc Tests/LibWeb: Import WPT tests for CSS grid properties parsing
Increase test coverage for our grid implementation.
2024-11-03 22:02:29 +01:00
rmg-x
0db171c36e LibWeb/Crypto: Fix sizes being passed into generate_aes_key()
Previously, callers were passing the size in bytes, but the method
expected bits. This caused a crash in LibCrypto when verifying the key
size later on.

Also make the naming of local variables and parameters a little more
clear between the different AES algorithms :^)
2024-11-03 21:55:43 +01:00
Andreas Kling
64747c0397 LibWeb: Make HTML parser "current node" APIs return nullable pointer
It's actually possible for there to be no adjusted current node, when
the stack of open elements is empty. This was covered by one of the WPT
parsing tests.
2024-11-03 20:32:32 +01:00
Andreas Kling
0a47d8cb08 LibWeb: Handle more MathML/HTML integration points in the parser 2024-11-03 20:32:32 +01:00
Andreas Kling
ae39c54e51 LibWeb: Fix SVG tag adjustment for feSpotLight, feTile, feTurbulence 2024-11-03 20:32:32 +01:00
Andreas Kling
88a4a86ece Tests: Import many HTML parsing tests from WPT
I had to skip a lot of these due to assertion failures that we need to
investigate before unskipping.
2024-11-03 17:51:44 +01:00
Gingeh
c2cd191864 LibWeb: Use machine epsilon when approximating cubic bezier 2024-11-03 17:35:20 +01:00