Commit graph

3868 commits

Author SHA1 Message Date
Shannon Booth
45537efcef LibWeb: Enable callbacks for ByteStreamTeeBYOBReadRequest::on_chunk
Fixes a crash running the imported WPT test.
2024-11-09 08:10:57 -05:00
Shannon Booth
d31014d135 LibWeb: Reorder step to get chunk size after checking for aborted stream
This fixes a crash seen on:

http://wpt.live/streams/writable-streams/aborting.any.html

I believe this is a spec bug, which has been reported to the Streams
spec.
2024-11-09 08:09:54 -05:00
sideshowbarker
3594cdf948 LibWeb: Fix accessible-name computation for “tooltip” & empty-alt cases
This change fixes accessible-name computation for:

- an element that has empty text content but that also has a title
  attribute (“tooltip”) with a non-empty value
- an img element whose alt attribute is the empty string but that also
  has a “title” attribute with a non-empty value

Otherwise, without this change, the accessible name unexpectedly isn’t
computed correctly for those cases.
2024-11-09 08:08:05 -05:00
Timothy Flynn
52c828be2b LibWeb: Disable slow imported CSS animation tests 2024-11-08 15:02:30 -05:00
stelar7
54b5822e0b LibWeb: Add IDBVersionChangeEvent 2024-11-08 11:10:15 -07:00
stelar7
60ae5e75f8 LibWeb: Implement the IDBDatabase interface 2024-11-08 11:10:15 -07:00
Sam Atkins
1cc83db0c9 Tests: Disable an animation test that's flaky on CI 2024-11-08 10:12:42 -07:00
Andreas Kling
87dd8714c5 Tests: Import WPT tests from css/css-backgrounds/animation
These give us some basic coverage of backgrounds, borders and animation
mechanisms.
2024-11-07 22:50:33 +01:00
Sam Atkins
b0e79ce549 Tests: Import all WPT css/css-nesting tests
A few are skipped for now:
- A few ref tests fail
- Crash tests are not supported by our runner and time out
- top-level-is-scope.html crashes and needs further investigation
2024-11-07 15:11:24 +01:00
Sam Atkins
0b23dddb4b LibWeb/CSS: Clear child CSS rules' caches too
If a rule gets its caches cleared because it's moved in the OM, then its
child rules' caches are likely invalid and need clearing too.

Assuming that caches only point "upwards", this will correctly clear
them all. For the time being that will be true.
2024-11-07 15:11:24 +01:00
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
BenJilks
80e7e6dd7d LibWeb: Layout inline elements respective of writing-mode
Use the `writing-mode` property to determine what values should be used
for computing each element's rect on the screen. If it is a vertical
mode, swap the inline and block, lengths and offsets.

This only lays out whole inline formatting contexts vertically, and does
not currently support mixing the two orientations in a single context.
2024-11-03 17:01:54 +01:00
BenJilks
c3f3e93b7e LibWeb: Add writing-mode CSS property, and its values
Introduce the `writing-mode` property, as specified in
https://drafts.csswg.org/css-writing-modes/#block-flow
2024-11-03 17:01:54 +01:00
Aliaksandr Kalenik
2bd43e3603 LibWeb: Remove save() call in DisplayListPlayerSkia::add_mask()
This save() call did not have matching restore(). For mask application
it's display list builder responsibility to emit save() and restore()
so mask is applied only to relevant portion.

Progress on https://www.jetbrains.com/
2024-11-03 11:25:01 +01:00
Timothy Flynn
13b7355ec1 LibWeb: Move some classes from the DOM namespace to the HTML namespace
The following classes are in the HTML spec and thus belong in the HTML
namespace:

* BeforeUnloadEvent
* HTMLFormControlsCollection
* RadioNodeList
2024-11-02 11:16:45 -04:00
Gingeh
c4e8eeb9a3 LibWeb: Don't crash on transformed clip-paths
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
We can remove this check and FIXME because we already support them
2024-11-02 04:30:14 +00:00
sideshowbarker
437879f849 LibWeb: Correctly descend element nodes when computing accessible name
This change implements the “is a descendant of a native host language
text alternative element” condition in the “F: Name From Content” step
at https://w3c.github.io/accname/#step2F in the “Accessible Name and
Description Computation” spec — to ensure that all descendant nodes get
included as expected in computations for accessible names for elements.

Otherwise, without this change, Ladybird unexpectedly skips descendant
element nodes when computing accessible names — which can result in the
wrong accessible name being returned.
2024-11-01 18:13:41 -04:00
Shannon Booth
472b56b47c LibWeb: Propagate exception if serializing inner node fails
Fixing a crash for the given test.
2024-11-01 14:02:14 -04:00
Shannon Booth
4dd912e686 LibWeb: Rebaseline XHTML test case
At some point we must have broken the ability of running XHTML test
cases, so the whitespace expectation changes have not been rebaselined
for this test case.
2024-11-01 14:02:14 -04:00
Andrew Kaster
36feebb1e7 LibWeb: Add Wasm Web-API streaming compilation and instantiation
This requires fixing up the "parameter is a promise" handling in
the IDL generator.
2024-11-01 10:42:24 -07:00
Andrew Kaster
ba6dcd7521 LibWeb: Refactor WebAssembly API to use spec-defined promise AOs 2024-11-01 10:42:24 -07:00
Jelle Raaijmakers
3504370281 LibWeb: Add stubbed Media Source Extensions API
Just the boilerplate :^)
2024-11-01 13:23:45 -04:00
Shannon Booth
1dc1bebd2a LibWeb: Push a temporary execution context for setTimeout
This fixes a crash seen running stream tests.
2024-11-01 13:12:01 -04:00
Aliaksandr Kalenik
4a1e109678 LibWeb: Fix ability to modify selection outside of inputs using keyboard
Fixes regression introduced in a8077f79cc
2024-11-01 13:11:10 -04:00
Shannon Booth
f20822e293 LibWeb: Handle language attributes without a '-'
Where we would previously index out of bounds.
2024-11-01 16:09:12 +01:00
Aliaksandr Kalenik
e915143593 LibWeb: Fix selectionchange event dispatch on text control elements
With a8077f79cc Selection object is no
longer aware of selection state inside text controls (<textarea> and
<input>), so this change makes them responsible for dispatching
`selectionchange` if their selection state was changed.
2024-11-01 15:06:09 +01:00
Grubre
8703ca0c7d LibWeb: Use String::to_fullwidth() when applying text-transform
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
Before, we just returned the input string. Now the property is applied
using the `String::to_fullwidth()` function.

fixes:
https://wpt.fyi/results/css/css-text/text-transform/text-transform-fullwidth-001.xht
2024-11-01 07:48:17 -04:00
Grubre
5a6a7b7e5e LibWeb: Pass locale to to_lowercase() from apply_text_transform
Previously we passed `{}` which resulted in incorrect text when using
some languages like `lt`.

Fixes:
http://wpt.fyi/results/css/css-text/text-transform/text-transform-upperlower-039.html
2024-11-01 07:48:17 -04:00
Grubre
1b25fb5d40 LibWeb: Pass locale to to_uppercase() from apply_text_transform
Previously we passed the default argument which is `{}`. This resulted
in incorrect uppercasing for some languages like `tr`.

Fixes:
http://wpt.live/css/css-text/text-transform/text-transform-tailoring-002.html
2024-11-01 07:48:17 -04:00
Jelle Raaijmakers
c7773d0312 Meta: Update my email address everywhere 2024-11-01 12:14:53 +01:00
Jonne Ransijn
2457118024 AK: Add template specializations for Optional<{,Fly}String>
Slice the size of `Optional<{,Fly}String>` in half by introducing
`UINTPTR_MAX` as an invalid bit pattern for these values.
2024-10-31 23:26:22 +01:00
Timothy Flynn
6708251968 LibWeb: Disable css/transition-basics.html test
This is flaky in CI.
2024-10-31 13:23:26 -04:00
Timothy Flynn
d188aaf288 LibWeb: Protect animation frame callbacks from GC while they execute
Stealing the callbacks from the AnimationFrameCallbackDriver made them
no longer safe from GC. Continue to store them on the class until we
have finished their execution.
2024-10-31 15:37:47 +01:00
stelar7
f6991a2955 LibWeb: Bring performance.now() closer to spec 2024-10-31 14:10:13 +01:00
Sergei Azarkin
2199fde5a9 LibWeb: Support shorthands when setting style attribute
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
Better support for CSS shorthands when setting the style attribute. This
improves some tests in WPT /css/css-align/default-alignment/*shorthand.
When setting the style attribute in JS via element.style = '..' or the
setAttribute method, shorthand properties were not expanded to longhand
properties.
2024-10-31 12:23:03 +00:00
Gingeh
3467076dbc LibWeb+LibGfx: Keep path properties when cloning and implement fill-rule 2024-10-31 10:30:24 +00:00
Gingeh
a7e83c38ee LibWeb: Implement missing basic shapes 2024-10-31 10:30:24 +00:00
Jelle Raaijmakers
76e638b4ca LibWeb: Use right interface for custom SVG and MathML elements
The DOM spec gets overridden by both the SVG2 and MathML core specs in
that unknown elements should not inherit DOM::Element, but
SVG::SVGElement and MathML::MathMLElement respectively.
2024-10-31 09:58:59 +00:00
Jelle Raaijmakers
84fe8d675b LibWeb: Implement HTMLOrSVGElement.nonce
There are two FIXMEs remaining that depend on a functional
PolicyContainer, which we ignore for now and always behave like a CSP is
set.
2024-10-31 10:46:21 +01:00
Gingeh
4ecf56cadf LibWeb: Allow calculated values in css filters 2024-10-31 08:19:46 +01:00
Tim Ledbetter
21a32e4b6d LibWeb: Don't crash when parsing large floating point number values
Previously, attempting to parse a floating point number with an integer
part larger than `(2 ^ 31) - 1` would cause the browser to crash. We now
avoid this by converting the integer part of the number to a `double`
rather than an `i32`.
2024-10-31 08:05:25 +01:00
justus2510
144907f5bd LibGfx: Apply Exif orientation for PNG images
Fixes wpt/png/exif-chunk.html.

At some point there should probably be some mechanism to handle this
outside of the individual decoder plugins. The TIFF decoder seems to
have its own version of this, and as far as I can tell, the JPEG decoder
doesn't handle this at all, even though that's probably the most common
use case for Exif orientations. :^)
2024-10-31 02:18:08 +00:00
sideshowbarker
120bc52f23 Tests: Import WPT accname/name/comp_embedded_control.html test
This change imports the WPT accname/name/comp_embedded_control.html
test, along with related resources files it depends on.

Note that in the wai-aria/scripts/aria-utils.js file, this changes the
get_computed_label call to use our window.internals.getComputedLabel.
2024-10-31 01:16:47 +00:00
Jelle Raaijmakers
a0ee86db04 LibWeb: Prevent painting grid items twice as a stacking context
We paint grid item nodes as a stacking context when they have no
`z-index` style set. However, a grid item could already have a stacking
context established - for example, when the `filter` style is applied.
This causes these nodes to be drawn twice.

Skip painting grid item nodes if a stacking context is already present.
2024-10-31 00:59:32 +01:00
Sam Atkins
760943d584 LibWeb/CSS: Correct matching of calc() against <number-percentage>
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
This seems to have vanished from the spec, but in any case, we still
need it. Without this change we erroneously thought that calculations
that match <percentage> did not match <number-percentage>.
2024-10-30 20:58:16 +01:00
Shannon Booth
797b0d0f43 LibJS+LibWeb: Remove remaining use and reference to SafeFunction 2024-10-30 20:55:45 +01:00
Aliaksandr Kalenik
a8077f79cc LibWeb: Separate text control input events handling from contenteditable
This input event handling change is intended to address the following
design issues:
- Having `DOM::Position` is unnecessary complexity when `Selection`
  exists because caret position could be described by the selection
  object with a collapsed state. Before this change, we had to
  synchronize those whenever one of them was modified, and there were
  already bugs caused by that, i.e., caret position was not changed when
  selection offset was modified from the JS side.
- Selection API exposes selection offset within `<textarea>` and
  `<input>`, which is not supposed to happen. These objects should
  manage their selection state by themselves and have selection offset
  even when they are not displayed.
- `EventHandler` looks only at `DOM::Text` owned by `DOM::Position`
  while doing text manipulations. It works fine for `<input>` and
  `<textarea>`, but `contenteditable` needs to consider all text
  descendant text nodes; i.e., if the cursor is moved outside of
  `DOM::Text`, we need to look for an adjacent text node to move the
  cursor there.

With this change, `EventHandler` no longer does direct manipulations on
caret position or text content, but instead delegates them to the active
`InputEventsTarget`, which could be either
`FormAssociatedTextControlElement` (for `<input>` and `<textarea>`) or
`EditingHostManager` (for `contenteditable`). The `Selection` object is
used to manage both selection and caret position for `contenteditable`,
and text control elements manage their own selection state that is not
exposed by Selection API.

This change improves text editing on Discord, as now we don't have to
refocus the `contenteditable` element after character input. The problem
was that selection manipulations from the JS side were not propagated
to `DOM::Position`.

I expect this change to make future correctness improvements for
`contenteditable` (and `designMode`) easier, as now it's decoupled from
`<input>` and `<textarea>` and separated from `EventHandler`, which is
quite a busy file.
2024-10-30 19:29:56 +01:00
Andreas Kling
33507578e0 Tests: Skip css/css-flexbox/abspos/position-absolute-001.html for now
This test is too slow for our GCC CI :^(
2024-10-30 18:45:14 +01:00
Sam Atkins
51fc87bc1b LibWeb/CSS: Return 0 from CSSRule.type for non-spec types
We use the CSSRule::Type enum for identifying the type of a CSSRule, but
the spec requires that only some of these types are exposed via the
`type` attribute. For the rest, we're required to return 0, so let's do
so. :^)
2024-10-30 17:30:58 +01:00
Florian Cramer
df7cac539e LibXML: Set the doctype when parsing via Parser::parse_with_listener
This fixes at least one WPT test under /domparsing
2024-10-30 14:53:36 +01:00
Gingeh
bd25d0b1b4 LibWeb: Parse drop-shadow filter with missing or starting color
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
2024-10-30 12:41:02 +01:00