Commit graph

25846 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
c283b32991 style: Add a low-priority selector list for pseudo-classes that have global rules
This avoids trying to match those global rules for most elements that
can't match them anyways.

Differential Revision: https://phabricator.services.mozilla.com/D147640
2023-10-02 14:37:19 +00:00
Tiaan Louw
1162204bad style: Rename :-moz-modal-dialog to :modal
Differential Revision: https://phabricator.services.mozilla.com/D148751
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
7f81cd4f7c style: While at it use some better names for some bits
Differential Revision: https://phabricator.services.mozilla.com/D148538
2023-10-02 14:37:19 +00:00
Oriol Brufau
6c3f92cb85 Further changes required by Servo 2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
1ce75ff7dd style: Unify Gecko and Servo EventState/ElementState bits
Add a dom/base/rust crate called just "dom" where we can share these.

Most of the changes are automatic:

  s/mozilla::EventStates/mozilla::dom::ElementState/
  s/EventStates/ElementState/
  s/NS_EVENT_STATE_/ElementState::/
  s/NS_DOCUMENT_STATE_/DocumentState::/

And so on. This requires a new cbindgen version to avoid ugly casts for
large shifts.

Differential Revision: https://phabricator.services.mozilla.com/D148537
2023-10-02 14:37:19 +00:00
David Shin
949fd0e172 style: Add parsing for linear easing function and gate it behind pref
Differential Revision: https://phabricator.services.mozilla.com/D146839
2023-10-02 14:37:19 +00:00
David Shin
b31be826c4 style: Hook up linear easing calculation for servo and expose it to C++
Differential Revision: https://phabricator.services.mozilla.com/D146838
2023-10-02 14:37:19 +00:00
David Shin
6326a384a8 style: Rust side plumbing work for linear easing function
Add LinearFunction to TimingFunction. Because the linear function is a
variable list of linear stops, the enum is no longer Copyable.

Differential Revision: https://phabricator.services.mozilla.com/D146837
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
898cafb5a5 style: Use debug_unreachable!() in matches_simple_selector
This shrinks the function by avoiding generating rather noisy panic
code.

Depends on D145486

Differential Revision: https://phabricator.services.mozilla.com/D145487
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
2302d828a5 style: Reorder some variants
This doesn't make a difference, I was hoping it would allow us to remove the
special-casey code we have here:

  https://searchfox.org/mozilla-central/rev/997a56b018662e2940c99bbaf57a6ac9d1aa5422/servo/components/selectors/matching.rs#610-632

But it doesn't. Still I think it doesn't hurt tho, shouldn't change behavior.

Depends on D145485

Differential Revision: https://phabricator.services.mozilla.com/D145486
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
2939bf1a12 style: Simplify a bit hot selector-matching loop
Note that element.clone() is just copying a couple pointers.

Have a single place where we compute the next element and check for linky-ness.
This saves a couple checks (very very minor win in the micro-benchmark I've
been looking at, but consistent).

Depends on D145484

Differential Revision: https://phabricator.services.mozilla.com/D145485
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
a21762fc5b style: Compute hover / active quirk state lazily
This makes the inner function much smaller which improves selector-matching
performance very mildly for the benchmarks I've been looking at. Also, this
should help selector matching on quirks mode by only doing this when we
actually find :hover / :active pseudo-classes.

Differential Revision: https://phabricator.services.mozilla.com/D145484
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
653245c94e style: Avoid some clone()s in selector parsing now that lifetimes are non-lexical
Differential Revision: https://phabricator.services.mozilla.com/D123622
2023-10-02 14:37:19 +00:00
Martin Robinson
921987048c
Implement pinch zoom with a display list (#30446)
In the most recent version of WebRender, the pinch zoom APIs have been
removed. We can recreate this functionality by creating a root display
list with a transform.
2023-10-02 10:24:16 +00:00
Samson
ddc47aa56b
Codegen support multiple interfaces in single webidl file & WebGPU single webidl (#30448)
* Codegen support multiple interfaces in single webidl file

* Merge GPU*.webidl into WebGPU.webidl

* Update gpu files to use WebGPUBinding module file
2023-09-30 12:30:12 +00:00
Samson
ebd41d4101
Use Foo_Binding instead of FooBinding for namespace modules (#30447)
* Update Codegen.py to emit Foo_Binding instead of FooBinding

* s/FooBinding/Foo_Binding/g
2023-09-30 00:52:04 +00:00
Ennui Langeweile
72313d90df
Make the dir attribute's getter follow the spec (#30435)
* Refactor the `dir` attribute's getter and setter

* Run `./mach fmt`

* disregard all the previous commits
i'm a genius!
2023-09-27 12:31:27 +00:00
Ennui Langeweile
80d9a2bb4f
Treat the keygen element as obsolete (#30429)
* Eradicate the `keygen` element

* Run `./mach fmt`

* Fix relevant Servo test

* Fix outdated manifest
2023-09-26 21:37:46 +00:00
Ennui Langeweile
6f0cba0855
Refactor the translatable attribute lightly (#30430) 2023-09-26 05:05:37 +00:00
Fabrice Desré
38c91b836a
Dedupe ron and base64 (#30415) 2023-09-23 11:30:57 +00:00
Samson
aa41fbd8f6
Media query resolution (#30406)
* Add resolution and device-pixel-ratio media query

* Update expectations
2023-09-22 16:18:00 +00:00
Samson
c9b1f35a36
Update mozjs to a version that includes SpiderMonkey ESR 115 (#30379)
* Update mozjs to sm115

* fix module stuff

https://phabricator.services.mozilla.com/D163949

* fix always allow cloning

https://bugzilla.mozilla.org/show_bug.cgi?id=1774866

* Update expectations

toStringTag now works on wasm object due to SM bump
2023-09-20 16:07:38 +00:00
Mukilan Thiyagarajan
c2502120cf
Fix webgl regression after WebRender upgrade (#30390)
Sending WebRender an explicit ResourceUpdate message
after every buffer swap invalidates the tile caches
that depend on the image resource created for the
webgl canvas.

The previous WebRender code that Servo was using
might have worked with WebGL only accidentally since
picture caching was disabled by [default][1] and so the
tiles were not cached between frames.

Fixes #30367

[1]: c385b3c973/third_party/webrender/webrender/src/renderer.rs (L7073)

Signed-off-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2023-09-20 13:21:02 +00:00
Samson
8b30d1a4b2
Update to syn 2 where possible (#30387)
* Update to syn 2 where possible

* Cleanups

* Better no_trace comment

Co-authored-by: Martin Robinson <mrobinson@igalia.com>

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-09-19 15:57:37 +00:00
Martin Robinson
39291715c4
Fix main frame scrolling in quirks mode after WebRender (#30375)
Main frame scrolling after the WebRender upgrade was broken because the
main frame no longer has content size content bounds and quirks mode
leads to a body with zero height.

Fixes #30368.
2023-09-18 13:28:42 +00:00
Martin Robinson
38d9a5eae0
Improve intrinsic sizing and white-space handling around forced line breaks (#30351)
* Take forced line breaks into account for intrinsic size

Fixes #30350.

* Don't linebreak on collapsible whitespace

This whitespace can hang off the end of the line, because it will be
trimmed LineItem layout.

* Update float placement after line breakage

Also don't ever line break for collapsible whitespace.

* Fix a few more test cases and clean up

* Renaming according to review comments
2023-09-15 11:12:59 +00:00
Martin Robinson
abca586e0a
Refactor scrolls on the window object (#29680)
Refactor the scrolling and scrollable area calculation on the window
object, to make it better match the specification. This has some mild
changes to behavior, but in general things work the same as they did
before. This is mainly preparation for properly handling viewport
propagation of the `overflow` property but seems to fix a few issues as
well.

There is one new failure in Layout 2020 regarding `position: sticky`,
but this isn't a big deal because there is no support for `position:
sticky` in Layout 2020 yet.

Co-authored-by: Rakhi Sharma <atbrakhi@igalia.com>
2023-09-15 10:57:54 +00:00
Fabrice Desré
c78533c1a8
Update version of nix, and ron (#30330)
* Bump ron to 0.8.1 to pickup more recent base64

* Remove dependency on nix 0.14

* Update libloading in simpleservo
2023-09-15 02:06:14 +00:00
Samson
d22d97f8c8
Add GPUSupportedFeatures and update GPUSupportedLimits (#30359)
* GPUSupportedFeatures

* New supported limits

* Update expectations
2023-09-14 13:23:12 +00:00
Atbrakhi
c066f6a226
Enable minibrowser by default but also keep the option to disable it (#30338)
* enable minibrowser by default

* review fix

* rename no_minibrowser to no-minibrowser

* review fix
2023-09-13 06:31:19 +00:00
Martin Robinson
8299868bd5
Layout 2020: Rename flow_relative types to Logical... (#30324)
This makes the names of flow relative geometry consistent with what is
used in the style crate and removes them from a module. With this change
it's more obvious what makes these types different from the ones in
`euclid`.
2023-09-12 07:31:30 +00:00
Delan Azabani
1bbd0c1e6e
servoshell: fix lockups while animating (#30322)
* servoshell: fix lockups while animating

* move comment to external_present declaration

* disable needs_recomposite optimisation for now due to breakage

* fix compile error that only happens on ci

* fix more compile errors
2023-09-12 03:30:43 +00:00
Samson
aad2dccc9c
Strict import formatting (grouping and granularity) (#30325)
* strict imports formatting

* Reformat all imports
2023-09-11 19:16:54 +00:00
Samson
59d134133f
Use MozTools 4 and update mozjs (#30326)
* Update mozjs

* moztools4 in bootstrap

* no autoconf

* tidy

* switch to servo-build-deps

* update mozjs for real

* glue mozjs

* fmt

* move to servo/mozjs
2023-09-11 08:23:05 +00:00
Martin Robinson
a9d37cb85a
Upgrade WebRender to e491e1ae637b2eed1e7195855d88357e5eb3ddf9 (#30323)
* Upgrade vendored version of WebRender

* Patch WebRender: upgrade version of gleam

* Restore hit testing implementation

* Fix WebRender warnings

* Adapt Servo to new WebRender

* Update results

* Add a workaround for #30313

This slightly expands text boundaries in order to take into account the
fact that layout isn't measuring glyph boundaries.
2023-09-10 12:38:56 +00:00
Martin Robinson
56976efaa2
Layout 2013: Don't make gradient display items for zero-sized gradients (#30321)
Before WebRender would ignore these, but newer version of WebRender have
issues with them. This change simply prevents legacy layout from
creating display items for these types of gradients. This is already the
behavior of non-legacy layout.
2023-09-09 17:43:09 +00:00
Samson
711dbbd4af
remove extern crate (#30311)
* remove extern crate

* Update components/script_plugins/lib.rs

Co-authored-by: Martin Robinson <mrobinson@igalia.com>

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
2023-09-08 12:11:31 +00:00
Martin Robinson
a0cff6a085
Layout 2013: Don't use WebRender border image outset support (#30315)
The border image outset support in WebRender is going to be removed and
even in versions of WebRender where it still exists, it fails to render
properly.

A border image is a type of border composed of slices of images. The
"outset" of this kind of border is a property in CSS that makes the
border boundaries expand. Previously, the value was passed to WebRender
which would expand the border by this amount and render the images into
the expanded rectangle.

Since this is going to be removed, we handle this property outside of
WebRender. The change is simply to expand the border area by the outset
before calculating the rest of the border values.

This is necessary for the WebRender upgrade.
2023-09-08 06:53:15 +00:00
Martin Robinson
a1b83cac2a
Replace a method call now deprecated in mozjs (#30307) 2023-09-06 23:29:04 +00:00
Samson
e0a6281e73
Impl Setlike and Maplike (#30237)
* MallocSizeOf for Index{Set, Map}

* like as iterable in WebIDL

* Codegen magic for like interfaces

* TestBinding for like

* Test for Setlike and Maplike test bindings

* Some fixes

* Switch to any.js

* nit

* Keep order
2023-09-06 13:08:45 +00:00
Atbrakhi
3df284cf54
Move user input logic into servoshell (#30238)
* cleanup and move user input logix into servoshell

* fix fmt

* moves test from servoshell file

* move command-line args into servoshell

* remove feature media-gstreamer

* fix fmt

* move user input logic code into lib to make it more testable

* remove opts_matches in fn instead get it from main2

* remove pub and fix import

* add licence in new file

* revert passing Matches, instead pass Option String

* review update, also move sanitize fn to parser file

* fmt fix

* review fix: remove extra line
2023-09-06 11:45:56 +00:00
Delan Azabani
c3c6c95a9b
constellation: crash to a new “sad tab” error page (#30290)
* constellation: crash to a new “sad tab” page

* check in resources/crash.html

* use a separate enum variant instead of keying on reason

* fmt + tidy

* rename Resource::Crash to Resource::CrashHTML

* clean up crash page and add details (reason + backtrace)

* avoid repeating crash errors in script::script_thread warn log

* make new LoadData init more idiomatic

* clarify comments and new fields

* fix doc comment style
2023-09-06 09:52:37 +00:00
Martin Robinson
1b6351486c
Replace immeta dependency with imsz (#30294)
`immeta` is no longer maintained and `imsz` seems to have support for
more image formats as well as having no dependencies itself.
2023-09-06 09:20:08 +00:00
Martin Robinson
577baea223
Refactor inline layout nesting (#30289)
This makes the nesting architecture of inline layout a lot simpler. Now
PartialInlineBoxFragment and InlineNestingLevelState are replaced by
two structs:

 - InlineContainerState
 - InlineBoxContainerState

InlineContainerState holds state for the root of the inline formatting
context, while InlineBoxContainerState holds state for inline boxes.
InlineBoxContainerState has an InlineContainerState as the first
element, thus "extends" it.

Now the inline iterators are stack variables directly in the `layout()`
method. They are no longer stored in the state. This avoids the weird
nesting of state and instead relies on a normal vector to hold the
stack of state.

Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
2023-09-05 17:12:15 +00:00
Martin Robinson
ea09c5ba5a
Fix handling of white-space property for wrapping (#30259)
This still fails some tests because on element boundaries we want the
`white-space` property of the first shared ancestor.
2023-09-04 09:38:40 +00:00
Oriol Brufau
a4fdbc30ea
Fix PlacementAmongFloats to avoid missing some bands (#30280)
PlacementAmongFloats would stop iterating when current_bands would be
empty, even if next_band wasn't at infinity.

Then the BFC root or replaced block was placed after all the floats,
even if it could fit next to some of them.

This patch moves the next_band into current_bands so that the loop
keeps considering bands.
2023-09-01 20:18:19 +00:00
Li-Hsuan Hsieh
efa8433548
fix: Enter realm before dispatch activate (#30271)
* ref: https://github.com/servo/servo/issues/30141
2023-09-01 20:16:53 +00:00
Martin Robinson
e9281e2eda
build(deps): bump bitflags from 1.3.2 to 2.3.1 (#30273)
Bumps [bitflags](https://github.com/bitflags/bitflags) from 1.3.2 to 2.3.1.
 - [Release notes](https://github.com/bitflags/bitflags/releases)
 - [Changelog](https://github.com/bitflags/bitflags/blob/main/CHANGELOG.md)
 - [Commits](https://github.com/bitflags/bitflags/compare/1.3.2...2.3.1)
2023-09-01 09:58:48 +00:00
Martin Robinson
96c51ba2e7
Flow inlines around floats (#30243)
This implements the rest of the bulk of float support. Now inline
element flow around floats and floats can be pushed down by inline
elements before them.

Co-authored-by: Oriol Brufau <obrufau@igalia.com>
2023-08-31 10:54:54 +00:00
Martin Robinson
f25ab59406
Properly handle degenerate aspect ratios (#30245)
When a replaced element has a degenerate aspect ratio, it should be
handled as if that element did not have an aspect ratio according to
https://drafts.csswg.org/css-images/#natural-aspect-ratio.
2023-08-30 09:00:18 +00:00