Commit graph

35737 commits

Author SHA1 Message Date
Shannon Booth
1096b64936 LibWeb: Put setting object's promise's in WindowOrWorkerGlobalScope
This aligns with an update to the HTML specification which instead
stores these promises on the global object instead of the settings
object.

It also makes progress towards implementing the ShadowRealm proposal
as these promises are not present in the 'synthetic' realm for that
proposal.
2024-10-23 11:29:53 -06:00
Shannon Booth
d1fc76bffd LibJS: Allow host to create ShadowRealm global object
This implements the proposed update to the ShadowRealm proposal for
integrating the ShadowRealm specification into the web platform.
2024-10-23 11:29:53 -06:00
Shannon Booth
0ec8af5b70 LibJS: Initialize ShadowRealm internal slots through setters
This allows us to align our implementation in the same order as the
specification.

No functional change with the current implementation of this AO.

However, this change is required in order to correctly implement a
proposed update of the shadow realm proposal for integration with
the HTML spec host bindings in order to give the ShadowRealm
object the correct 'intrinsic' realm.

This is due to that proposed change adding a step which manipulates the
currently executing Javascript execution context, making the ordering
important.
2024-10-23 11:29:53 -06:00
Daniel La Rocque
db6ec2792a LibWeb: Assert navigationParams' request and response are not null 2024-10-23 11:23:21 -06:00
Daniel La Rocque
219cb04865 LibWeb: Check if navigationParams is NullWithError
When we check whether navigationParams is null, we should check if it is
`NullWithError`, since `NullWithError` is equivalent to `Empty`, but is
used for error messages.
2024-10-23 11:23:21 -06:00
Jelle Raaijmakers
1f9295ca2e LibWeb: Remove unused members from ReplacedBox
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-23 11:05:39 +02:00
Timothy Flynn
b75a4d25b7 WebContent: Further validate cookie attributes set from WebDriver
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
Implement a few missing steps in the Add Cookie endpoint.
2024-10-23 09:05:33 +02:00
Timothy Flynn
8988e7ef8d LibWeb+LibWebView: Move the cookie domain matching algorithm to LibWeb
This will be needed outside of LibWebView.
2024-10-23 09:05:33 +02:00
Timothy Flynn
527218da19 LibWeb: Implement the document.cookie setter/getter according to spec
This ensures we cannot set or get cookies on non-HTTP(S) origins. Since
this would prevent our ability to test cookies during LibWeb tests, this
also adds an internals API to allow cookie access on file:// URLs.
2024-10-23 09:05:33 +02:00
Alex Ungurianu
1dd3865de9 LibWeb: Usefully dump CSS property rules
Sample dump:
```
CSSPropertyRule:
  name: --valid
  syntax: <color> | none
  inherits: false
  initial-value: red
```
2024-10-23 06:55:37 +01:00
Alex Ungurianu
a4c72f50c0 LibWeb: Parse @property CSS directives
This is not a complete parse, as it doesn't validate or take into
account the parsed syntax.
Enough to get us a few more WPT tests though :)
2024-10-23 06:55:37 +01:00
Alex Ungurianu
50d64b0fb7 LibWeb: Add and implement CSSPropertyRule IDL and bindings 2024-10-23 06:55:37 +01:00
Aliaksandr Kalenik
648fac7215 LibWeb: Fix "input" events being dispatched twice when cancelled
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-22 19:41:07 -04:00
Kostya Farber
2534e7aeff LibWeb: Strip tabs before text shaping
Handling tabs during text shaping caused issues because we tried to
index 'input_glyph_info' whilst iterating until 'glyph_count' and these
can be different sizes.

The difference is due to when one or more characters get
merged into the same glyph when calling 'input_glyph_info' (see
https://lazka.github.io/pgi-docs/HarfBuzz-0.0/classes/glyph_info_t.html).

We don't want to render tabs as they come up as tofu characters so
instead let's strip them out of the text chunk before starting text
shaping.
2024-10-22 21:42:54 +02:00
Jelle Raaijmakers
77850b3540 LibWeb/EventHandler: Ignore repeated keyup events
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
Platforms such as X11 will typically send repeated keyRelease/keyup
events as a result of auto-repeating:

  * KeyPress (initial)
  * KeyRelease (repeat)
  * KeyPress (repeat)
  * KeyRelease (repeat)
  * ad infinitum

Make our EventHandler more spec-compliant by ignoring all repeated keyup
events. This fixes long-pressing the arrow keys on
https://playbiolab.com/.
2024-10-22 11:20:35 -04:00
Jelle Raaijmakers
9309cc9df3 UI+LibWeb+WebContent: Implement KeyEvent repeat property
When a platform key press or release event is repeated, we now pass
along a `repeat` flag to indicate that auto-repeating is happening. This
flag eventually ends up in `KeyboardEvent.repeat`.
2024-10-22 11:20:35 -04:00
Jelle Raaijmakers
cf315d54ec UI+LibWeb: Remove unused includes 2024-10-22 11:20:35 -04:00
Kostya Farber
537cbf55c3 LibWeb: Add letter-spacing css property to Node 2024-10-22 15:32:34 +01:00
ronak69
6c3ecf6a34 LibWeb/CSS: Tweak in CSSRGB::to_color() to avoid floating point errors
Example of the difference:

    50 * 2.55      --> 127.4999 --> round towards +∞ --> 127
    50 * 255 / 100 --> 127.5000 --> round towards +∞ --> 128

Now, 9 failing WPT tests in /css/css-color/ pass.
2024-10-22 14:18:17 +01:00
Aliaksandr Kalenik
3e8b2454fb LibWeb: Stub InputEvent.getTargetRanges()
We need this, because https://www.slatejs.org/ that is used by Discord
checks this function to decide whether a browser has "beforeinput" event
support.
2024-10-22 08:44:51 -04:00
Aliaksandr Kalenik
63f502ab0a LibWeb: Implement dispatching of "beforeinput" event 2024-10-22 08:44:51 -04:00
Aliaksandr Kalenik
0de61b0f65 LibWeb: Implement dispatching of "input" event 2024-10-22 08:44:51 -04:00
Aliaksandr Kalenik
d88e6bee5d LibWeb: Put cursor in last text node when contenteditable is focused
With this change we match behavior of other engines a bit more closer.
2024-10-22 08:44:51 -04:00
Kostya Farber
da42c19cb6 LibWeb: Apply the word-spacing css property to Node
This will let us start to begin applying this during
text shaping.
2024-10-22 13:36:26 +01:00
Jelle Raaijmakers
e4533e5595 LibWeb: Do not floor SVG offset in SVGPathPaintable
Resolves a FIXME and improves the visuals of https://tweakers.net :^)
2024-10-22 07:37:59 -04:00
Timothy Flynn
c96c5e45ff LibWeb: Implement KeyboardEvent.charCode according to spec
It should be 0 for keydown/keyup events.
2024-10-22 12:48:58 +02:00
Timothy Flynn
1bbe8309d4 LibUnicode: Add a helper to determine if a code point is printable 2024-10-22 12:48:58 +02:00
Timothy Flynn
b24a7079f1 LibWeb+WebDriver: Add a flag to default WebDriver to headless mode
We previously only supported enabling headless mode on a per-session
basis via the capabilities record. We don't have the ability to mutate
this record from WPT, so this adds a flag to set the default mode.
2024-10-22 04:24:31 +01:00
samu698
d08d305399 LibWeb: Fixed IDL for HTMLInputElement
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
Use Enumerated for the form{Enctype, Method} attributes
2024-10-21 15:41:00 -06:00
samu698
ab04f6d422 LibWeb: Fixed IDL for HTMLButtonElement
Use Enumerated for the form{Enctype, Method} attributes
2024-10-21 15:41:00 -06:00
samu698
6892482755 LibWeb: Use correct IDL for HTTPFormElement's method attribute
Removed the custom getter and updated the idl so that the attribute
is Reflected and Enumerated.
2024-10-21 15:41:00 -06:00
Timothy Flynn
ebe89a3207 WebContent: Parse the type hint in WebDriver's New Window endpoint
Although we aren't using this hint (we always create tabs), we do need
to validate the payload.
2024-10-21 13:15:11 -04:00
Tim Ledbetter
74983e6966 WebDriver: Don't return from new_window() until WebDriver is connected
Previously, tests would intermittently fail because the current session
wasn't yet aware of a newly created window handle.

Co-authored-by: Timothy Flynn <trflynn89@pm.me>
2024-10-21 18:02:21 +01:00
Andreas Kling
72f4253911 LibWeb: Scale up "inspected node" hint text to match screen DPI
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 fixes an issue where the text would look very small on macOS.
2024-10-21 15:57:28 +02:00
Aliaksandr Kalenik
629a3ac61e LibWeb: Add missing check if scrollable overflow defined for paintable
With 6a549f6270 we need to check if
optional scrollable overflow exists for paintable box, because it's not
computed for inline nodes.

Fixes crashing after navigating into direct messages screen on Discord.
2024-10-21 15:57:19 +02:00
Jelle Raaijmakers
27928cd28c LibWeb: Add PointerEvent.getCoalescedEvents() and .getPredictedEvents()
Fixes at least 4 WPT subtests in /pointerevents.
2024-10-21 07:37:59 -04:00
Jelle Raaijmakers
effa21a69f LibWeb: Add PointerEvent.persistentDeviceId
Fixes at least 2 WPT subtests in /pointerevents.
2024-10-21 07:37:59 -04:00
Andreas Kling
325ff4ac27 Revert "LibGfx: Use actual vector size as indicated by HarfBuzz"
This reverts commit 14f5f51147.
2024-10-21 12:09:11 +02:00
Andreas Kling
fdfbfcab37 Revert "LibWeb: Unbreak harfbuzz text layout"
This reverts commit a8d0712c28.
2024-10-21 12:09:02 +02:00
Vincent Sgherzi
9ce139a3f0 LibWeb: Fix boolean logic mistake in XMLSerializer for empty public ID
Fixes 5 subtests on http://wpt.live/domparsing/xml-serialization.xhtml
2024-10-21 10:53:02 +02:00
Andreas Kling
a8d0712c28 LibWeb: Unbreak harfbuzz text layout
The reason we were keeping track of the pre-shaping buffer was to know
where we had tab characters in the input. This is a very strange way of
doing that, but since it broke the web, let's patch it up quickly.

Follow-up to #1870 which broke text layout on many web pages.
2024-10-21 10:30:12 +02:00
Ben Wiederhake
14f5f51147 LibGfx: Use actual vector size as indicated by HarfBuzz
This fixes a browser crash as experienced on Wikipedia when encountering
the &ne; entity. As a side-effect, this also affects some tab-align and
-wrap tests.
2024-10-21 10:15:39 +02:00
Jim Broadbent
97ca6036fa LibWeb/XHR: Progess event handle empty length
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-20 22:22:59 +02:00
samu698
50f642613d LibWeb/HTML: Implement inner text set according to spec
Replaced the ad-hoc implementation with a spec compliant one.
This change fixes 36 WPT tests.
2024-10-20 22:15:04 +02:00
Andreas Kling
58c523ae46 LibWeb: Honor appearance: none when creating input element layout node
Per css-ui-4, setting `appearance: none` is supposed to suppress the
creation of a native-looking widget for stuff like checkboxes, radio
buttons, etc.

This patch implements this behavior by simply falling back to creating
a layout node based on the CSS `display` property in such cases.

This fixes an issue on the hey.com imbox page where we were rendering
checkboxes on top of sender profile photos.
2024-10-20 21:58:58 +02:00
stasoid
6b73a2d8a4 LibCore: Port File to Windows
Co-authored-by: Cameron Youell <cameronyouell@gmail.com>
2024-10-20 10:18:03 -06:00
stasoid
f6430035e7 LibCore/System: Add initial Windows support
Co-authored-by: Cameron Youell <cameronyouell@gmail.com>
2024-10-20 10:18:03 -06:00
Timothy Flynn
6cba55893e WebContent: Return the handle of the newly opened window from New Window
We were returning the handle of the already opened window, rather than
the handle of the window we just opened.
2024-10-20 16:41:11 +01:00
Timothy Flynn
981aaba96c LibWeb: Break the Window open steps into two methods for internal use
Some callers (namely WebDriver) will need access to the navigable opened
by these steps. But if the noopener parameter is set, the returned proxy
will always be null.

This splits some of the Window open steps into an internal method that
returns the chosen navigable.
2024-10-20 16:41:11 +01:00
Bastian Müller
748e3c2e6c LibWeb/XHR: Pass API URL character encoding
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-20 07:58:22 -04:00