These were missing. It also lists why some of these steps are actually
present in the `StylesheetLoader` instead.
Testing: WPT
Part of #22715
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
Moves the drop logic for `GPUBindGroupLayout` to an inner struct
`DroppableGPUBindGroupLayout`.
Testing: No tests added
Fixes: Partially #26488
Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
When the network decoder's `finish()` returns decoded content in
`parse_sync`, it was being added to the parsing input but not captured
for devtools. This ensures the content is also captured for the devtools
Sources panel.
Testing: We have tests for this in devtools_tests.py. They were failing
before this change. I ran locally and it passed now. With this all
DevTools tests are passing!
Signed-off-by: atbrakhi <atbrakhi@igalia.com>
Add all the missing error messages for `hkdf_operation.rs` and
`cshake_operation.rs` (one message only). Tried to follow the style of
existing messages and used an existing message for the HKDF-expand
operation. Related to #40756.
Testing: No tests added.
Signed-off-by: César Pedraza <cpedraza@unal.edu.co>
This change makes it so that tranforms (including CSS transform and
scrolling) are properly accounted for when calculating glyph indices.
Containing block sizes are moved to `BaseFragment`. This should reduce
the size of the StackingContextTree a little.
Testing: A Servo-specific WPT-style test is added for this change.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
These changes introduce a new OriginSnapshot type, which is an immutable
version of MutableOrigin (ie. an origin that includes an optional domain
modifier). This is now propagated as part of LoadData's origin, allowing
us to perform the same-origin-domain check for javascript: URLs as
needed.
Testing: Newly-passing tests.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Some platforms send empty composition events (winit on Linux, for
example). These should be ignored appropriately as they can cause
unecessary rendering updates even when the content of the text area does
not change.
Testing: This is mainly an optimization, so no tests are added. It does
prevent
some misbehavior, but that is a secondary effect fixed by #41978.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Moves the drop implementation for `GPUBindGroup` to a separate
`DroppableGPUBindGroup` struct.
Testing: No tests added
Fixes: partially #26488
Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
This constructors takes more arguments than it needs to. The three
arguments removed are almost always the default values. The exception is
in the unit tests. In this change those calls are modified to use
`set_max_length` like is done in the actual script code.
Testing: This is just a simplification of the code, so should be covered
by existing tests.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
We should not move the text cursor or change the text selection when
non-primary (such as the right) mouse buttons are pressed. Doing so
interferes with the common operations:
1. Select text
2. Open context menu
3. Copy text
This change fixes that.
Testing: New WPT-style tests are added.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This change brings Servo closer to the specification by removing the
unspecified sanitization flags used during parsing of input elements.
Instead we implement the lines of the specification that say to reset
resettable elements after parsing them. This forces a re-sanitization of
the default value (from the `value` attribute), clearing up the
confusion in parser comments.
In addition, specification text is added in the element creation code.
Testing: This just brings our code closer to the specification, so it is
covered by existing tests.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Updates the implementation of HTMLIFrameElement::GetContentDocument to
match the latest specification text.
Testing: Since each script thread only contains documents that are
same-origin-domain, I don't think it's possible to construct a testcase
with an observable difference here.
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Retrieving the origin from the document's URL means the wrong origin can
be returned for documents like about:blank or about:srcdoc.
Testing: Newly-passing test involving a srcdoc and blob.
---------
Signed-off-by: Josh Matthews <josh@joshmatthews.net>
Adding error messages across
`script/dom/subtlecrypto/ecdh_operation.rs`.
Testing: No tests as this is just adding error messages
Fixes: (part of) #40756
---------
Signed-off-by: PaulTreitel <paul.treitel@gmail.com>
This change adds support for updating the selection when double and
triple clicking in text fields. Double clicking selects the most
relevant word while triple clicking selects the entire line.
Testing: This change adds unit tests for `Rope` as well as a
Servo-specific WPT style test. These behaviors are platform
dependent.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This change moves all single versus multiline input handling to script.
It didn't really belong in `Rope`. In addition, it ensures that all
insertions into single line text boxes are sanitized by replacing
linebreaks with spaces.
Testing: As pasting is hard to test with a WPT-style test, this changes
includes new unit tests.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Listen for `setBreakpoint` on `debugger.js` and add the relevant WebIDLs
and Servo counterparts to trigger this event and notify SpiderMonkey.
Implement `find_source` for `SourceManager` and `find_offset` for
`SourceActor`.
Testing: Manual testing and `./mach test-devtools` (note, the latter
seems to have some failing tests, we are investigating this, but this
patch doesn't add any new failure).
Fixes: Part of #36027
---------
Signed-off-by: eri <eri@igalia.com>
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
Part of the navigate algorithm, it now performs the
fragment navigation after the history_behavior is
determined. It also updates the scrolling algorithm
to reflect what the specification expects.
With these changes, the test from the issue now
correctly scrolls to `Target`, but it doesn't update
the `scrollY` value for `window` and hence still
fails the test.
Part of #41807
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
We previously introduced new infrastructure for sharing code in
`aes_common.rs` among AES algorithms.
This patch makes AES-KW algorithm adapt the new infrastructure, by
moving the relevant code away from `aes_operation.rs` to its own
`aes_kw_operation.rs`, and calling AES common steps in the new
`aes_common.rs`.
Since all AES algorithms have been moved away from `aes_operation.rs`,
the file `aes_operation.rs` is also removed. The key handle variants
`Handle::Aes128`, `Handle::Aes192` and `Handle::Aes256` used by the old
AES infrastructure is also removed.
Testing: Refactoring. Existing tests suffice.
Fixes: Part of #41763
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
We currently only support 128-bit tags for AES-GCM authenticated
decryption. This patch expands support to 96-bit, 104-bit, 112-bit, and
120-bit tags.
The specification recommends supporting 32-bit and 64-bit tags as well.
However, the `aes-gcm` crate currently does not support them. We may
need to look for a workaround or wait for updates from the upstream
project.
Testing: Pass some WPT tests that were expected to fail.
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Fix caching before the console is opened and stop sending messages
prematurely.
Fix line numbers not showing in console messages because of a missing
`rename_all`.
Remove `getCachedMessages` in favour of sending a list of messages as a
reply to the `watchResources` for `console-message`/`error-message` in
the watcher.
Remove `startListeners` and `stopListeners`. These are legacy methods of
watching properties before the watcher actor. It is preferred to enable
properties in `supported_resources` in the watcher than to use these
messages.
Remove `clearMessagesCache`, only `clearMessagesCacheAsync` seems to be
used now. Add a reply to `clearMessagesCacheAsync`.
Simplify a bit the structs for console messages and prefer serde's
annotations to manual serialization. Merge `handle_console_message` and
`handle_page_error`, and improve the usability of `ConsoleResource`.
Fix some fields in console messages. We are missing `source_id` for now.
This will be easier to add after better support for source actors. We
are also missing stack traces.
| Before | After |
| --- | --- |
| 
| 
|
Testing: Manual testing
Fixes: #26666
---------
Signed-off-by: eri <eri@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
Moves the adapter dropping logic from the `GPUAdapter` struct to a new
`DroppableGPUAdapter` struct.
Testing: No tests added.
Fixes: Partially #26488
Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
This change updates and implements the old `query_text_index` layout
query to properly look for the glyph index of a point within a node's
`Fragment`s. This should work properly with the shadow DOM of both
`<input>` and `<textarea>` elements. In particular, multiple lines are
supported.
Caveats:
- `<input>` and `<textarea>` that are transformed are currently not
supported. This will happen in a followup.
- For multi-line inputs, we should be finding the text offset of the
nearest line that is within the block range of the click. This will
happen in a followup.
Testing: This change adds two Servo-specific WPT-style tests. These are
Servo-specific because the behavior of clicking in text fields isn't
fully specified.
Fixes: #35432Fixes: #10083
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Josh Matthews <josh@joshmatthews.net>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
Add all the missing error messages in `ed25519_operation.rs`. Followed
the other implementations of `importKey`, `exportKey` and others to try
and follow the same style. Related to #40756.
Testing: No tests added, did some manual tests
---------
Signed-off-by: César Pedraza <cpedraza@unal.edu.co>
We previously introduced new infrastructure for sharing code in
`aes_common.rs` among AES algorithms.
Similar to #41856 on AES-CTR and #41883 on AES-CBC, this patch makes
AES-GCM algorithm adapt the new infrastructure, by moving the relevant
code away from `aes_operation.rs` to its own `aes_gcm_operation.rs`, and
calling AES common steps in the new `aes_common.rs`.
The patch also re-wrote the encrypt and decrypt operations of AES-GCM to
properly handle different tag lengths. This helps extend our support on
more tag lengths later, in order pass more WPT tests.
Testing: Refactoring. Existing tests suffice.
Fixes: Part of #41763
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
We previously introduced new infrastructure for sharing code in
`aes_common.rs` among AES algorithms.
Similar to #41856 on AES-CTR, this patch makes AES-CBC algorithm adapt
the new infrastructure, by moving the relevant code away from
`aes_operation.rs` to its own `aes_cbc_operation.rs`, and calling AES
common steps in the new `aes_common.rs`. The patch also does some
refactoring on the encrypt and decrypt operations to get closer to
specification.
Testing: Refactoring. Existing tests suffice.
Fixes: Part of #41763
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Servo `Range` type probably predates the `Range` type in the standard
library. The fact that there are two `Range` types in Servo is often
very confusing. The internal type is only used for byte indices in glyph
runs. This change removes the internal generic `Range` in favor of a
small wrapper around a native Rust `Range`.
It's likely that there are more improvements that could be done here,
such as reusing `Utf8CodePointIndex`, but this code is going to change a
lot soon and these ranges might soon be replaced with actual glyph
ranges. We are going to be looking to remove `TextByteRange` entirely.
This is just an intermediate step.
Testing: This should not change behavior and is thus covered by existing
tests.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Switch most of the uses of IpcChannel to GenericChannel.
Currently there is still one major usage of IpcChannel in the
frame_sender. This will be a more complicated change,
hence, should have extra scrutinee.
Requires https://github.com/servo/servo/pull/41771
Testing: Like all GenericChannels, this is mostly type changes
---------
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
The existing implementation in `Location::navigate` differs
a lot from the existing spec. Therefore, let's incrementally
make it closer match the spec by implementing the first
step for `SetHref`.
Testing: WPT
Part of #41807
---------
Signed-off-by: Tim van der Lippe <tvanderlippe@gmail.com>
#41762 introduced new infrastructure for sharing code in `aes_common.rs`
among AES algorithms.
This patch makes AES-CTR algorithm adopt the new infrastructure, by
moving the relevant code away from `aes_operation.rs` to its own
`aes_ctr_operation.rs`, with refactoring for adaptation.
Testing: Refactoring. Existing tests suffice.
Fixes: Part of #41763
---------
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Methods were unused and removed from the HTML spec.
Testing: Verified with ./mach build and ./mach test-unit. Without errors
or warnings.
Fixes: #41835
Signed-off-by: TimurBora <timurborisov5561@gmail.com>
Bluetooth component is now switched away from IpcChannel to
GenericChannel.
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Testing: Mostly type changes so a compilation should be the testing.
---------
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This change improves the counting of clicks for mouse button events by
ensuring that `detail` property of those events includes the click
count. This `detail` differs from that of `dblclick` events where the
`detail` is always 2. In addition, it ensures that the click count can
increase for mouse buttons that do not cause `click` and `dblclick`
events (such as the right mouse button).
Testing: This change adds two Servo-specific WPT-style tests. While this
behavior is specified a bit, the details are implementation specific.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Follow-up to #41823.
Now that we always execute JS with callback, we can safely remove the
obsolete sync script handler.
- Rename `ExecuteAsyncScript` to `ExecuteScriptWithCallback`
- Remove `ExecuteScript` related logic.
- Rewrite async callback wrapper to simplify things.
Testing: I expect no change in behaviour. See if WPT tests agree with
it.
---------
Signed-off-by: Euclid Ye <yezhizhenjiakang@gmail.com>
Fix a panic when calling `determine_auto_margins` for nodes without
`.style()`. Now it returns an empty `AutoMargins` (all options set to
`None`), which matches the behaviour in Firefox:
```json
"autoMargins": {}
"autoMargins": {"top": "auto", "bottom": "auto", "left": "auto", "right": "auto"}
```
Refactor `GetLayoutReply` and `ComputedNodeLayout` to take advantage of
serde's flatten feature, making the serialization much cleaner.
Testing: Manual testing with the example provided in the issue.
Fixes: #41743
---------
Signed-off-by: eri <eri@igalia.com>
Reviewable per commit. First commit adds `&mut JSContext` to
`call_default_constructor`. Second commit adds `&mut JSContext` to
Interface, which in unfortunately required many changes (a lot of
passing `&mut JSContext` down).
Testing: Just a refactor, but should be covered by WPT
Part of #40600
---------
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This changes routed_promise to use the GenericCallback functionality.
This mostly effected WebGPU but also Clipboard and Memory Reporting.
We also added a GenericCallback::new_blocking() functionality which
produces a callback and a channel
which then can be blocked on. This was used a couple of times in the
code.
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Testing: This should not change functionality.
---------
Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
Start adding AES-OCB support to WebCrypto API.
This patch implements the import key operations of AES-OCB, with the
`aes` crate.
Specification:
https://wicg.github.io/webcrypto-modern-algos/#aes-ocb-operations-import-key
Testing:
- Pass some WPT tests that were expected to fail.
- Some new FAIL expectations are added. They were skipped by WPT when
the import key operation of AES-OCB had not been implemented, and
requires other not-yet-implemented operations to pass.
Fixes: Part of #41762
Signed-off-by: Kingsley Yung <kingsley@kkoyung.dev>
Add a callback on `WebFontDocumentContext` to create resource timing
entries, this callback is then used to call `submit_timing`, using a
shim listener, as this function requires a listener.
Testing: Using `./mach test-wpt
tests/wpt/tests/preload/preload-resource-match.https.html`
Fixes: #41660
---------
Signed-off-by: lumi <lumi@suwi.moe>
This change makes it so that all form controls are implemented with
shadow DOM, completely removing the legacy text content and selection
code paths for form controls. The motivation for this change is:
- to allow properly hit testing against the text nodes of `<textarea>`
and other widgets. This is important for implementing mouse-based
selection on the page.
- to simplify the way that form controls are implemented in general and
to prepare the way for proper implementations of the user interface of
other controls.
Testing: This should not change observable behavior at the moment,so
should be covered by existing WPT tests.
---------
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>