Commit graph

26922 commits

Author SHA1 Message Date
Josh Matthews
72e6a1f007
Remove media element state changes triggered by network responses (#32643)
* Do not change media element ready state when network response is complete.

* Do not fire multiple error events for the same media content.

* Inform media backend when media response is complete.

* Continue delaying the load event when a complete media response is received.

* Only mark a media response as complete when the response is the active one.

* Update expectations for imagebitmap tests using video element.

* Update fetch ORB video test expectations.

* Update media CSS selector test expectation for non-implemented feature.

* Update expectations for media element tests that now work.

* Updat expected result for failing reftest.

* Update expected failure for test that loads an audio file in a video element.

* Update media test expectation for unimplemented track feature.

* Do not process media element ready state changes that are unchanged.

* Reset media element ready state to Current when playback finishes.

* Set media element ready state to Enough when appropriate player event is received.

* Update test expectations.
2024-07-09 06:48:44 +00:00
石蕊 (Pi-Cla)
f29dd64a7b
Fix more clippy (#32740) 2024-07-09 04:47:43 +00:00
Martin Robinson
77e9e3deba
fonts: Add support for generic font families and font size configuration (#32673)
This adds support for generic font families in Servo and allows for
configuration of them as well as their default font sizes. One
interesting fix here is that now monospace default to 13px, like it does
in other browsers.

In addition to that, this exposes a new interface in Stylo which allows
setting a default style. This is quite useful for fonts, but also for
other kinds of default style settings -- like text zoom.

Fixes #8371.
Fixes #14773.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-07-08 17:17:48 +00:00
cybai (Haku)
956b7f62e0
Avoid unnecessary clones for URLs (#32694) 2024-07-08 16:11:55 +00:00
atbrakhi
d9b99723f5
Remove unused ToWebRender implementation (#32729) 2024-07-08 16:10:34 +00:00
Jonathan Schwender
8cd1e22f8d
android/ohos: fonts: Ignore ascii case when searching for font family (#32725)
The input for this function commonly comes from a `LowercaseString`,
while our actual font family name has cases.
Since font family lookup should be case-neutral, we do a compare
ignoring the ascii case.
I'm not too familiar with the CSS standard so I'm not 100% sure
if this is sufficient, or if we need to use a different method
to compare strings for arbitrary non-ascii font names.

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
2024-07-08 13:53:41 +00:00
Martin Robinson
89944bd330
layout: Improve layout of table captions (#32695)
- Instead of treating captions as a `BlockFormattingContext`, treat it as
  a `NonReplacedFormattingContext`, which allows reusing flow layout for
  captions -- fixing some issues with sizing.
- Pass in the proper size of the containing block when laying out,
  fixing margin calculation.
- Follow the unspecified rules about how various size properties on
  captions affect their size.
- Improve linebreaking around atomics, which is tested by
  caption-related tests. This fixes intrinsic size calculation regarding
  soft wrap opportunities around atomic and also makes the code making
  these actual soft wrap opportunities a bit better.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-07-08 12:58:38 +00:00
eri
2888193cfe
DevTools: Replace camel case variable names (#32726)
* refactor: rename to snake case

* refactor: more renaming

* chore: format

* chore: clean
2024-07-08 11:18:35 +00:00
Ngo Iok Ui (Wu Yu Wei)
6cb95827a3
Set compositor's cursor_pos properly (#32718) 2024-07-08 07:41:27 +00:00
Keith Cirkel
db4cba4d6d
Add customElements.getName (#32715)
* Add customElements.getName

* rebaseline
2024-07-07 15:22:57 +00:00
Bumsoo Kim
141a594e23
Replace null-byte terminated string literals with C-string literals (#32716)
* simple conversion from byte string to c-string

Signed-off-by: Bum Kim <bumcrystlbum@gmail.com>

* convert byte strings to c-strings to c_char ptr

Signed-off-by: Bum Kim <bumcrystlbum@gmail.com>

---------

Signed-off-by: Bum Kim <bumcrystlbum@gmail.com>
2024-07-06 20:14:15 +00:00
Samson
59d0f1fe1a
script: Impl cloning of JSPrincipals (#32706)
* Impl cloning of JSPrincipals

* bincode as workspace dependency

* Update mozjs and cc
2024-07-06 10:25:38 +00:00
Martin Robinson
7eac599aa1
fonts: Stop using Stylesheet::effective_font_face_rules (#32699)
This function doesn't exist in upstream Stylo and is fairly unecessary.
Removing it will help reduce the difference between downstream Stylo and
upstream Stylo.
2024-07-04 21:53:14 +00:00
Martin Robinson
0f2139be27
layout_2013: Remove code preventing writing mode assertion failures (#32698)
It's actually kind of useful that this code crashes, as it points out a
problem. Additionally, we aren't going to be maintaining Layout 2013 any
longer so it is very unlikely that these bugs will ever be fixed. This
allows us to reduce our diff with upstream Stylo.

Closes #30577.
2024-07-04 21:08:02 +00:00
Martin Robinson
4b63043c6a
clippy: Fix warnings in shared and config, fonts, layout, and layout_2020 components (#32674) 2024-07-04 14:18:58 +00:00
Samson
99c1f886b8
webgpu: Update wgpu and revamp RenderPass (#32665)
* Update wgpu and revamp RenderPass

* Set good expectations

* Set one bad expectation

* send_render_command

* small fixups

* docs

* doc

* Put RenderPass inside PassState

* Use Pass enum for ComputePass too

* fix docs
2024-07-04 12:16:42 +00:00
Martin Robinson
26624a109f
clippy: Fix a bunch of warnings in script (#32680)
This is just a portion of the errors that are remaining to be fixed.
2024-07-04 11:40:23 +00:00
newmoneybigbucks
aae66cc33c
Updated all kill_*_id functions defined in indentityhub.rs to free_*_id naming format for issue 32685 (#32688)
Signed-off-by: newmoneybigbucks <newmoneybigbucks@protonmail.com>
2024-07-04 09:03:13 +00:00
派卡 (pi-cla)
650af7db92
webgpu: Remove mutex around Identities (#32682) 2024-07-03 18:39:45 +00:00
Martin Robinson
959ffad99a
layout: Add support for table captions (#32657)
This adds initial support for table captions. To do this, the idea of
the table wrapper becomes a bit more concrete. Even so, the wrapper is
still reponsible for allocating space for the grid's border and padding,
as those properties are specified on the wrapper and not grid in CSS.

In order to account for this weirdness of HTML/CSS captions and grid are
now laid out and placed with a negative offset in the table wrapper
content rect.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2024-07-03 18:24:19 +00:00
Martin Robinson
4e79ac5701
layout: Allow rendering LineItems independent of inline box (#32666)
Refactor inline layout to allow rendering line items in the second stage
to be rendered in any order, independent of their parent inline box.
This will allow line items to be reordered, effectively allowing the
splitting of inline boxes, for the purposes of BiDi and any other inline
reordering feature.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
2024-07-03 15:15:31 +00:00
atbrakhi
4357751f28
use au in TextFragment (#32653) 2024-07-03 07:27:08 +00:00
atbrakhi
044ab3eeab
fix clippy warning (#32667) 2024-07-02 14:59:46 +00:00
Samson
c0105de82b
webgpu: Implement ShaderCompilationInfo (#32642)
* ShaderCompilationInfo

* expectations

* Handle CompilationInfo promise in GPUShaderModule

* Fix my english
2024-07-02 13:39:06 +00:00
Jonathan Schwender
9455169813
Add OpenHarmony support to servoshell (#32594)
* Generate EGL bindings for ohos

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* Adjust servoshell `bin` error message for android/ohos

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* ohos: disable WebGL

offscreen buffers are not implemented yet on ohos.

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* Add OpenHarmony support to servoshell

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* Share ResourceReaderInstance

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* Share android/ohos HostTrait

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* Share servo glue

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>

* Pass Init options from ArkTS to Servo

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* f rebase ResourceReaderMethods

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* fixup! Share ResourceReaderInstance

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* Fix typo

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* Update Cargo.lock

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* ohos: Move WebGL check to webgl thread

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* Remove commented code

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

* Remove commented and duplicate / unused code

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>

---------

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
Signed-off-by: Jonathan Schwender <schwenderjonathan@gmail.com>
2024-06-28 12:51:50 +00:00
Martin Robinson
adc0fc984d
layout: Make geom.rs logical geoemetry types more ergonomic (#32633)
Make using the logical geometry types more ergonomic by having them all
implement `Copy` (at most 4 64-bit numbers), similar to what `euclid`
does. In addition add an implementation of `Neg` for `LogicalVec` and
`LogicalSides` as it will be used in upcoming table implementation code.
2024-06-28 08:20:50 +00:00
Samson
e9cf4d4971
webgpu: Update wgpu and revamp computepass (#32575)
* Do not wait on drop, but rather wake poller thread

* Update wgpu and render stuff

* Set some good expectations

* Update wgpu again

* handle IPC error as warning

* More good expectations

* Some more expectations

CTS does not match the spec: https://github.com/gpuweb/cts/issues/3806

* This expectations are due to other changes in servo

also happening on main

* Explain error_command_encoders and remove RefCell around it

* fixup

* store validness of passes

* More good expectations

* More docs

* this assert is wrong

* This is even more right per CTS/spec

Only Command encoder state errors are allowed here, but wgpu does not exposes them.

* More good expectations

* One bad expectation

* Fix my english
2024-06-28 04:49:35 +00:00
atbrakhi
fced0b4940
use au in AtomicLineItem (#32630) 2024-06-27 11:12:32 +00:00
Martin Robinson
da2de4fc68
html: Parse a comma-separated list of faces in the <font> tag (#32622)
This change parses a comma-separated list of faces in the `<font>` tag
and also moves the parsing code from `stylo` to Servo. This means that
the servo-specific code can be removed from stylo decreasing the
differences between Gecko and Servo's version of `stylo`.
2024-06-26 18:28:35 +00:00
Martin Robinson
e16291f14e
layout: Enable parallel layout for tables (#32477)
This simply wraps row and column-based layout of table sells in a
`par_iter()` unconditionally enabling parallel layout for tables. In the
future we can choose to adjust the conditions under which layout is done
in parallel.
2024-06-26 16:33:48 +00:00
Oriol Brufau
f055964792
Switch replaced layout to app units (#32625) 2024-06-26 16:19:24 +00:00
Mukilan Thiyagarajan
a730469b70
script: Implement the FontFaceSet DOM API (#32576)
Add a skeleton implementation of FontFaceSet interface with support
for resolving the `document.fonts.ready` Promise when the loading of
web fonts is completed.

This change exposes new failures in the web platform tests.

These were ERROR before the change because `document.fonts.ready` caused
a `ReferenceError` causing the tests to be aborted and they now FAIL:
- /css/CSS2/linebox/vertical-align-top-bottom-001.html
- /css/css-flexbox/flex-one-sets-flex-basis-to-zero-px.html
- /css/css-fonts/generic-family-keywords-001.html
- /css/css-fonts/math-script-level-and-math-style/math-script-level-004.tentative.html
- /css/css-fonts/math-script-level-and-math-style/math-script-level-002.tentative.html
- /css/css-text/text-autospace/text-autospace-ligature-001.html
- /css/css-values/calc-size/calc-size-width.tentative.html

These were TIMEOUT before the change because `document.fonts.ready` was
a ReferenceError and the tests were asynchronous (reftest-wait). These now
FAIL because the assertions are now executed after fonts are loaded:
- /css/css-fonts/matching/fixed-stretch-style-over-weight.html
- /css/css-fonts/matching/range-descriptor-reversed.html
- /css/css-fonts/matching/stretch-distance-over-weight-distance.html
- /css/css-fonts/matching/style-ranges-over-weight-direction.html
- /css/css-fonts/variations/variable-box-font.html
- /css/css-fonts/variations/variable-gpos-m2b.html
- /css/css-fonts/variations/variable-gsub.html
- /css/css-fonts/variations/variable-opsz-size-adjust.html
- /css/css-position/sticky/position-sticky-change-top.html
- /css/css-position/sticky/position-sticky-fixed-ancestor.html
- /css/css-position/sticky/position-sticky-flexbox.html
- /css/css-position/sticky/position-sticky-grid.html
- /css/css-position/sticky/position-sticky-inline.html
- /css/css-position/sticky/position-sticky-rendering.html
- /css/css-position/sticky/position-sticky-stacking-context.html
- /css/css-position/sticky/position-sticky-table-td-left.html
- /css/css-position/sticky/position-sticky-table-td-right.html
- /css/css-position/sticky/position-sticky-table-tfoot-bottom.html
- /css/css-position/sticky/position-sticky-table-th-right.html
- /css/css-position/sticky/position-sticky-table-thead-top.html
- /css/css-position/sticky/position-sticky-table-tr-bottom.html
- /css/css-position/sticky/position-sticky-table-tr-top.html
- /css/css-position/sticky/position-sticky-writing-modes.html
- /css/css-pseudo/marker-intrinsic-contribution-001.html
- /css/css-text/hyphens/hyphens-character.html

These tests now PASS due to this patch:
* FAIL -> PASS
  - /html/canvas/element/text/2d.text.draw.fill.maxWidth.fontface.html
  - /html/canvas/element/text/2d.text.measure.width.empty.html
* TIMEOUT -> PASS
  - /css/css-fonts/variations/font-descriptor-range-reversed.html
  - /css/css-fonts/variations/variable-opsz.html
  - /css/css-position/sticky/position-sticky-table-th-left.html
* ERROR -> PASS
  - /css/css-fonts/generic-family-keywords-002.html
  - /css/css-fonts/generic-family-keywords-003.html
* These two tests only PASS in Layout 2020:
  - /css/CSS2/positioning/inline-static-position-001.html
  - /css/cssom-view/getBoundingClientRect-empty-inline.html

These two tests have subtests that PASS intermittenttly:
- /fetch/metadata/generated/css-font-face.sub.tentative.html
- /css/css-fonts/generic-family-keywords-001.html

These tests are new TIMEOUTS that used to FAIL because
`documents.fonts.ready` was undefined:
- /resource-timing/TAO-match.html
- /resource-timing/content-type.html
- /resource-timing/nextHopProtocol-is-tao-protected.https.html

The failure in `/resize-observer/change-layout-in-error.html` could be
due to an issue in the ResizeObserver implementation that is now exposed
with this change, but this needs more investigation.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2024-06-26 09:44:47 +00:00
Martin Robinson
7ea894774f
Add a directory listing feature for file URLs (#32580)
Signed-off-by: Bobulous <Bobulous@users.noreply.github.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Bobulous <Bobulous@users.noreply.github.com>
2024-06-26 08:02:50 +00:00
Oriol Brufau
7b6aa64aca
Clean up some unused dependencies (#32600) 2024-06-25 13:02:59 +00:00
Oriol Brufau
a972e5c200
Switch flex layout to app units (#32599) 2024-06-25 07:05:16 +00:00
ItsSunnyMonster
42e090a1eb
clippy: fix some warnings in desktop and some components (#32583)
* clippy: fix some warnings in ports/servoshell/desktop

Signed-off-by: ItsSunnyMonster <100400733+ItsSunnyMonster@users.noreply.github.com>

* style: fix formatting

Signed-off-by: ItsSunnyMonster <100400733+ItsSunnyMonster@users.noreply.github.com>

* clippy: fix warnings in bluetooth, devtools and servo components

Signed-off-by: ItsSunnyMonster <100400733+ItsSunnyMonster@users.noreply.github.com>

* clippy: remove comments

Signed-off-by: ItsSunnyMonster <100400733+ItsSunnyMonster@users.noreply.github.com>

---------

Signed-off-by: ItsSunnyMonster <100400733+ItsSunnyMonster@users.noreply.github.com>
2024-06-25 07:04:23 +00:00
Oriol Brufau
b1fdfb88bb
Upgrade stylo to 2024-05-31 (#32474)
* Upgrade stylo to 2024-05-31

* Fixup for https://phabricator.services.mozilla.com/D211731

* Fixup for https://phabricator.services.mozilla.com/D207779

* Fixup for https://phabricator.services.mozilla.com/D207781

* Update test expectations
2024-06-24 20:03:50 +00:00
eri
5eb8813448
DevTools: Implement watcher actor (#32509)
* feat: base for watcher

* feat: some more watcher tests

* feat: implement getWatcher

* refactor: clean up getWatcher

* feat: implement watchTargets

* feat: implement watchResources

* feat: very messy watchTargets fix

* refactor: clean browsing context

* feat: target configuration

* refactor: start cleanup

* refactor: more doc coments

* refactor: clean browsing context
2024-06-21 16:06:55 +00:00
atbrakhi
26c585a0c5
use app unit in box_fragement (#32349) 2024-06-21 14:54:21 +00:00
Martin Robinson
66edef8065
layout: Simplify Contents a little (#32487)
Instead of duplicating some of `NonReplacedContents` in `Contents`,
divide it into either replaced and non-replaced content, since this is
how the layout system processes `Contents` always. In addition, stop
using `TryInto` to match replaced or non-replaced contents, as it is
quite confusing to handle an `Err` as a success case.
2024-06-21 10:13:31 +00:00
Martin Robinson
44064b1439
layout: Add very basic support for showing text in input boxes (#32365)
This only paints text in input fields. Selection and cursor are still
not painted.

In addition to adding this feature, the change also updates the
user-agent.css with the latest from the HTML specification. Extra
padding and extraneous settings (such as a bogus line-height and
min-height) are also removed from servo.css. This leads to some new
passes.

There are some new passes, this introduces failures as inserting text
reveals issues that were hidden before. Notably:

- failures in `/html/editing/editing-0/spelling-and-grammar-checking/`:
  We do not support spell-checking.
- Most of the rest of the new failures are missing features of input
  boxes that are also missing in legacy layout.
2024-06-20 10:13:50 +00:00
Mukilan Thiyagarajan
ee2acaeacf
config: fix panic in PrefValue to [f64; 4] conversion (#32571)
The `Iterator::all` method consumes the input iterator `f` so when
we reuse `f` in `f.flatten().collect()` it yields an empty Vector
in the case where all the elements are successfully converted using
try_into(). This causes out of bounds access when indexing into
the resulting Vector to extract the individual components.

Fixes #32570.

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-06-20 08:47:13 +00:00
Jonathan Schwender
7957d11b5d
ohos: Add fallback font for serif (#32555)
The fallback behavior seems to have changed recently.
Now we need to explicitly add a fallback for `serif`
otherwise no font is selected.

Signed-off-by: Jonathan Schwender <jonathan.schwender@huawei.com>
2024-06-20 06:51:38 +00:00
Samson
bf99cf7f30
Proper GPUDevice cleanup (#32520)
* Make device cleanup right

* Use weakref for GPUDevice in globalscope

* No need to destroy device on drop

* DeviceReason early return

* make remove_gpu_device to be the only way to remove device
2024-06-20 05:56:59 +00:00
Martin Robinson
cd2ab36759
Rename gfx to fonts (#32556)
This crate only takes care of fonts now as graphics related things are
split into other crates. In addition, this exposes data structures at
the top of the crate, hiding the implementation details and making it
simpler to import them.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-06-19 20:26:19 +00:00
Martin Robinson
e74075255b
layout: Flatten inline box storage in InlineFormattingContexts (#32539)
This accomplishes two things:

1. Makes it easier to iterate through all inline formatting context
   items.
2. Will make it possible to easily move back and forth through the tree
   of inline boxes, in order to enable reordering and splitting inline
   boxes on lines -- necessary for BiDi.

Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
2024-06-19 08:51:10 +00:00
Martin Robinson
70982dfa5a
layout: Allocate inline box start space on segment (#32486)
Instead of allocating the inline padding and border space on the line,
allocate it on the segment -- which where the inline box start goes.

Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
2024-06-18 16:19:00 +00:00
Ngo Iok Ui (Wu Yu Wei)
63889b732f
fix: codegen on callback (#32537)
* Fix codegen on callback

* Add test callbacks to testbinding.rs
2024-06-18 16:00:14 +00:00
Martin Robinson
fef1337da0
fonts: Clean up WebRender web fonts when they are no longer used (#32545)
This is the first part of cleaning up unused WebRender resources.
Currently this only cleans up web font resources, but a more
full-featured implementation in the future could also clean up unused
system fonts.

Fixes #32345.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2024-06-18 14:02:27 +00:00
webbeef
bd15a4fbd8
servoshell: Reset link status when loading a new document (#32518)
* Reset link status when loading a new document

* Reset hover link when navigating back or forward
2024-06-18 11:10:14 +00:00