Commit graph

45901 commits

Author SHA1 Message Date
sagudev
886e88d4ea Add webgpu cts vendoring mechanism 2023-06-01 10:35:52 +02:00
bors-servo
fd7698c3ea
Auto merge of #29805 - jdm:dom-protos, r=mrobinson
Support extending DOM classes in JS

Adds support for determining the correct prototype as part of a `new` call for non-HTML constructors. Support for HTML constructors [was added](https://github.com/servo/servo/blob/master/components/script/dom/bindings/htmlconstructor.rs#L116) as part of the custom element work, but that wasn't enough for extending other DOM objects like `EventTarget`.

This work is based on Gecko's code in https://searchfox.org/mozilla-central/rev/2d678a843ceab81e43f7ffb83212197dc10e944a/dom/bindings/BindingUtils.cpp#3667, and is split into two parts:
1) the actualy new implementation (demonstrating that extending `EventTarget` works as expected)
2) plumbing the new prototype through all of the rest of the DOM object construction code.

This ends up being more complex than the way it's done in Gecko because they have lazy DOM reflectors, so their native DOM objects can be constructed without any knowledge of a JS prototype. Servo's reflectors are eager, however, so we need to propagate prototype information into individual constructors. As a result, this was a tedious set of changes to make.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #29770
- [x] There are tests for these changes
2023-06-01 05:06:09 +02:00
Josh Matthews
cc07e27864 Rename reflect_dom_object2. 2023-05-31 23:03:32 -04:00
bors-servo
7399a3a686
Auto merge of #29816 - Loirooriol:sync, r=mrobinson
Backport several style changes from Gecko (3)

<!-- Please describe your changes on the following line: -->
This continues https://github.com/servo/servo/pull/29772.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
2023-05-31 20:44:42 +02:00
bors-servo
6fa314de2a
Auto merge of #29813 - stshine:overflow-bfc, r=mrobinson
layout_2020: Check blocks for whether they will establish a formatting context

<!-- Please describe your changes on the following line: -->
According to spec
https://drafts.csswg.org/css-overflow-3/#overflow-control, If the computed value of overflow on a block box is neither visible nor clip nor a combination thereof, it establishes an independent formatting context for its contents.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [x] There are tests for these changes OR

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
2023-05-31 18:24:38 +02:00
Pu Xingyu
08067674f4 Update test expectations 2023-05-31 23:31:17 +08:00
Pu Xingyu
5c71219819 layout_2020: Check blocks for whether they will establish a formatting context 2023-05-31 23:28:28 +08:00
Pu Xingyu
b8a037fc1f layout_2020: Add 'establishes_block_formatting_context' method to 'ComputedValuesExt'
This method checks whether the style of a normal block would establish
a block formatting context.
2023-05-31 21:51:52 +08:00
Pu Xingyu
fb91a5c0f5 style: Enable 'column-span' for layout 2020 2023-05-31 19:25:01 +08:00
bors-servo
e48cfb2ebe
Auto merge of #29817 - atouchet:sha, r=jdm
De-dupe sha-1

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #___ (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
2023-05-31 01:24:01 +02:00
Oriol Brufau
d669ab9a75 Update test expectations 2023-05-31 00:58:52 +02:00
Oriol Brufau
2c8f330318 Avoid complaints from ./mach test-tidy 2023-05-31 00:50:37 +02:00
Oriol Brufau
7cfbaf37f7 Further changes required by Servo 2023-05-31 00:50:36 +02:00
Emilio Cobos Álvarez
fdbb4d01e6 style: Merge branches in some ComputedValues functions
This should mitigate the code size impact. Also make get_resolved_value
non-generic to avoid monomorphizing it multiple times.

Differential Revision: https://phabricator.services.mozilla.com/D130354
2023-05-31 00:50:36 +02:00
Emilio Cobos Álvarez
b9d2ae624b style: Remove other Widget* colors
These are only used for frameset painting and the non-e10s <select>
dropdown focus codepath. We have other more appropriate standard
colors for this.

Differential Revision: https://phabricator.services.mozilla.com/D129992
2023-05-31 00:50:36 +02:00
Emilio Cobos Álvarez
4ed53833ea style: Remove TextForeground/Background system colors
Same thing, there's nor reason these should be different from other
CSS-exposed colors.

Differential Revision: https://phabricator.services.mozilla.com/D129991
2023-05-31 00:50:36 +02:00
Emilio Cobos Álvarez
2fd66ea588 style: Remove WindowBackground/Foreground system colors
There's no reason for these to be different to the CSS-exposed
Window/WindowText.

Differential Revision: https://phabricator.services.mozilla.com/D129990
2023-05-31 00:50:36 +02:00
Emilio Cobos Álvarez
b1ef020aa2 style: Serialize text-decoration using Servo
The code introduced in the preceding patch deals with currentColor correctly,
so we should be able to do this now.

This uncovers a bug in the existing serialization code when a non-auto
text-decoration-thickness was used, caught by
css/css-text-decor/parsing/text-decoration-computed.html.

Differential Revision: https://phabricator.services.mozilla.com/D130018
2023-05-31 00:50:35 +02:00
Oriol Brufau
b3e40479f8 Further changes required by Servo 2023-05-31 00:50:35 +02:00
Emilio Cobos Álvarez
b702426c99 style: Generalize resolved style code to deal with all shorthands
This removes the various assumptions that the animation code does.

Code size might be a concern, we can optimize if it is a problem,
but let's do the obvious thing for now.

Differential Revision: https://phabricator.services.mozilla.com/D130017
2023-05-31 00:50:35 +02:00
Emilio Cobos Álvarez
04776cd116 style: Treat empty root margin as zero as per spec
Differential Revision: https://phabricator.services.mozilla.com/D130131
2023-05-31 00:50:35 +02:00
Emilio Cobos Álvarez
285c645b78 style: Make autofill background configurable via system color prefs
And remove the autofill.background pref for 95 (or 96, depending on
when this lands) assuming nothing terrible causes us to turn it off on
94.

Differential Revision: https://phabricator.services.mozilla.com/D129988
2023-05-31 00:50:35 +02:00
Oriol Brufau
5f46c027ea Further changes required by Servo 2023-05-31 00:50:35 +02:00
Emilio Cobos Álvarez
f70b0e7108 style: Make Canvas/CanvasText and Link colors color-scheme-aware
For that, add `.dark` version of the browser.display* prefs that control
the light version of these colors.

The default for background/foreground colors are taken from the
GenericDarkColors used in LookAndFeel.

The defaults for links are based on this discussion:

  https://github.com/whatwg/html/issues/5426#issuecomment-904021675

(So they effectively match Chrome).

Whether the dark colors should be exposed in about:preferences (like the
light colors are) is TBD.

With this patch, we pass all the tests in:

  /html/semantics/document-metadata/the-meta-element/color-scheme/

Use the colors to paint the default canvas background and the default
colors.

There are three "regressions", though they are really progressions: we
now render the reference as the test expects (before we rendered a light
canvas background even for the reference).

Apart of these iframe tests (which we should look into, I filed
https://bugzilla.mozilla.org/show_bug.cgi?id=1738380), there are three
remaining test failures.

Two of them are due to `color: initial` not changing based on the
color-scheme. Safari also fails these tests, and the thing they're
really testing is whether system colors are preserved at computed-value
time:

  https://github.com/w3c/csswg-drafts/issues/3847

Regarding that change, I'm not so sure the trade-offs there are worth
it, as that not only complicates interpolation (we wouldn't be able to
use system colors in color-mix among others, see
https://github.com/w3c/csswg-drafts/issues/5780) plus it changes
inheritance behavior in sorta unexpected ways, see:

  https://github.com/w3c/csswg-drafts/issues/6773

Which I just filed because apparently no browser implements this
correctly. So for now will punt on those (keep matching Safari).

There's an svg-as-image test:

  https://searchfox.org/mozilla-central/rev/f8576fec48d866c5f988baaf1fa8d2f8cce2a82f/testing/web-platform/tests/css/css-color-adjust/rendering/dark-color-scheme/svg-as-image.html

Which isn't using the feature at all and I'm not sure why is it supposed
to pass (why prefers-color-scheme: dark is supposed to match that SVG
image). This test fails in all browsers apparently:

  https://wpt.fyi/results/css/css-color-adjust/rendering/dark-color-scheme/svg-as-image.html?label=master&label=experimental&aligned

I sent https://github.com/web-platform-tests/wpt/pull/31407 to remove
it and hopefully get it reviewed by some Chromium folks.

Differential Revision: https://phabricator.services.mozilla.com/D129746
2023-05-31 00:50:34 +02:00
Emilio Cobos Álvarez
c3322938f2 style: Move Canvas/Link color computation to C++-land
This doesn't change behavior but will allow us to deduplicate some
logic given we compute the effective color-scheme in C++.

Differential Revision: https://phabricator.services.mozilla.com/D129744
2023-05-31 00:50:34 +02:00
Emilio Cobos Álvarez
6c16c019fc style: Implement <meta name=color-scheme>
There are still tests failing because
https://bugzilla.mozilla.org/show_bug.cgi?id=1736034 hasn't been synced
yet.

Once that lands, they will still fail because we don't change
Canvas/CanvasText based on color-scheme, but that I'm attaching
patches for after this one.

Differential Revision: https://phabricator.services.mozilla.com/D129743
2023-05-31 00:50:34 +02:00
Oriol Brufau
3a23598080 Further changes required by Servo 2023-05-31 00:50:34 +02:00
Mats Palmgren
9c6bf6d23b style: Fix broken 'list-style' serialization
Differential Revision: https://phabricator.services.mozilla.com/D129847
2023-05-31 00:50:34 +02:00
Oriol Brufau
40b7d87bbb Further changes required by Servo 2023-05-31 00:50:34 +02:00
Emilio Cobos Álvarez
1b04838278 style: Use GTK menu radius on native context menus and panels
Differential Revision: https://phabricator.services.mozilla.com/D129439
2023-05-31 00:50:33 +02:00
Emilio Cobos Álvarez
9868cd52ba style: Allow parsing layer statements inside nested rules
This fixes https://wpt.live/css/css-cascade/layer-media-query.html once
it syncs.

Differential Revision: https://phabricator.services.mozilla.com/D129424
2023-05-31 00:50:33 +02:00
Oriol Brufau
2d8866d6c8 Further changes required by Servo 2023-05-31 00:50:33 +02:00
Emilio Cobos Álvarez
1b2ef21c8c style: Update layer ordering to follow the spec
The bitfield approach worked when the layer order was in pre-order, but
the spec was changed to make it work like post-order and I don't think
there's a way to keep it working like that, so keep the layer order in a
separate data structure that we look up when going from Rule to
ApplicableDeclarationBlock.

This is just a vector index operation so hopefully shouldn't be too bad.

This patch intentionally regresses @keyframe handling to some extent,
since we need a bit more complicated approach and it seemed worth
implementing in a separate patch.

Depends on D129380

Differential Revision: https://phabricator.services.mozilla.com/D129381
2023-05-31 00:50:33 +02:00
Emilio Cobos Álvarez
5f2a29659f style: Store a LayerOrder in ApplicableDeclarationBlock
This shouldn't change behavior jut yet.

Differential Revision: https://phabricator.services.mozilla.com/D129380
2023-05-31 00:50:33 +02:00
Emilio Cobos Álvarez
77078dd660 style: Make browser.tabs.drawInTitlebar a tri-state
To more properly support Linux having a different default at runtime.

Expose the resolved value in appinfo for convenience, and use it in the
front-end as needed.

Differential Revision: https://phabricator.services.mozilla.com/D129004
2023-05-31 00:50:33 +02:00
stransky
578ecdba79 style: [Linux] Export titlebar radius as int from LookAndFeel
Titlebar radius is exported as integer from Gtk so there's no need to use floats here.

Differential Revision: https://phabricator.services.mozilla.com/D128993
2023-05-31 00:50:32 +02:00
Emilio Cobos Álvarez
c3c3dacb97 style: Don't use nsContentUtils::sNamespaceManager in servo
Differential Revision: https://phabricator.services.mozilla.com/D129030
2023-05-31 00:50:32 +02:00
Mike Hommey
00d2cec626 style: Remove unused import_rule::PendingSheet
Differential Revision: https://phabricator.services.mozilla.com/D128823
2023-05-31 00:50:32 +02:00
Emilio Cobos Álvarez
efb5a8cfe5 style: Fix rebase mistake
MANUAL PUSH: Bustage fix CLOSED TREE
2023-05-31 00:50:32 +02:00
Emilio Cobos Álvarez
0be968fb4c style: Remove -moz-gtk-csd-transparent-background
We always use alpha visual for WebRender, and appearance: none is
unnecessary (root element has no intrinsic appearance).

Differential Revision: https://phabricator.services.mozilla.com/D128682
2023-05-31 00:50:32 +02:00
Oriol Brufau
c204f3a96d Further changes required by Servo 2023-05-31 00:50:31 +02:00
Emilio Cobos Álvarez
07e5ea6966 style: Expose titlebar radius as a chrome-only CSS environment variable
Mostly plumbing.

Differential Revision: https://phabricator.services.mozilla.com/D128680
2023-05-31 00:50:31 +02:00
Oriol Brufau
5c861b90c5 Further changes required by Servo 2023-05-31 00:50:31 +02:00
Emilio Cobos Álvarez
e74b41cafe style: Add support for chrome-only environment variables
This bit is taken straight from D73454 (I reviewed it but I guess
another pair of eyes is ok, it's really straight-forward).

Co-authored-by: Nicklas Boman <smurfd@gmail.com>

Differential Revision: https://phabricator.services.mozilla.com/D128679
2023-05-31 00:50:31 +02:00
Emilio Cobos Álvarez
685b2cd29a style: Remove -moz-toolbar-prefers-color-scheme
By making prefers-color-scheme return the ColorSchemeForChrome(), which
accounts for the Firefox theme.

Differential Revision: https://phabricator.services.mozilla.com/D128611
2023-05-31 00:50:31 +02:00
Emilio Cobos Álvarez
8c6af822b0 style: Make anonymous scrollbar caching work on mac by default, and unify scrollbars.css across platforms
We make it work on macOS by setting pointer-events: none + opacity: 0 rather
than visibility: hidden, and tweaking the caching setup to be Android-like.

Now that the scrollbars sheet is the same across platforms, move it to where
the rest of the UA sheets are. This way we guarantee that the RDM vs. Android
difference is less (just the ifdef at the top of the sheet).

Depends on D128084

Differential Revision: https://phabricator.services.mozilla.com/D128085
2023-05-31 00:50:30 +02:00
Emilio Cobos Álvarez
750c9ee814 style: Clean up GTK titlebar colors
Apparently ActiveCaption/CaptionText/InactiveCaption/InactiveCaptionText
are supposed to be used for titlebars, so implement them properly and
remove the GTK-specific colors.

Differential Revision: https://phabricator.services.mozilla.com/D128028
2023-05-31 00:50:30 +02:00
Boris Chiou
f00818b8ec style: Tweak the serialization of rotate property
The serialization of rotate should be updated to match the current spec.

1. If a rotation about the z axis (that is, in 2D) is specified, the property
   must serialize as just an <angle>.

2. If any other rotation is specified, the property must serialize with an axis
   specified. If the axis is parallel with the x or y axes, it must serialize
   as the appropriate keyword.

Also, we need to handle the zero length vector separately because it is
parallel to every other vector but different from x axis, y axis, or z axis.

Differential Revision: https://phabricator.services.mozilla.com/D127747
2023-05-31 00:50:30 +02:00
Emilio Cobos Álvarez
6899931303 style: Make inert not modify the computed style
Differential Revision: https://phabricator.services.mozilla.com/D127422
2023-05-31 00:50:30 +02:00
Emilio Cobos Álvarez
b3deee4cc8 style: Remove support for -moz-system-color() as chrome code no longer uses it (in favor of color-scheme)
Differential Revision: https://phabricator.services.mozilla.com/D127802
2023-05-31 00:50:30 +02:00