Commit graph

23769 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
280402b2a1 style: Fix C++ side of <length-percentage> values.
Differential Revision: https://phabricator.services.mozilla.com/D63398
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
7e8dbd0896 style: Make CalcNode the specified representation of <length> and <length-percentage> values.
This is the meat of the patch. There are a couple improvements done in a couple
later patches which should hopefully be straight-forward.

Differential Revision: https://phabricator.services.mozilla.com/D63397
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
426edbd991 style: Move the guts of calc nodes into a generic enum.
We'll have different leaf nodes as we progress in the value computation stage.

Differential Revision: https://phabricator.services.mozilla.com/D63396
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
869553357d style: Implement ToCss for CalcNode.
We'll use `CalcNode` as the specified value representation for <length> and
<length-percentage> values, so they'll have to implement ToCss.

There's one minor issue (two calls to to_css() instead of to_css_impl() which
are addressed later in the series).

Differential Revision: https://phabricator.services.mozilla.com/D63395
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
c52bae1923 style: Remove an invalid assert.
This assert was wrong. The assert may fire if we resurrect the node from a
different thread and insert a kid fast enough.

We allow resurrecting nodes (bumping the nodes from zero to one) to avoid
allocation churn.

In particular, while the thread dropping the node gets to read the children (so
after the fetch_sub from the refcount, but before the read() of the children),
another thread could plausibly bumped the refcount back, and added a children.

This is a very big edge case of course, but I'm kinda sad I hadn't realized
before.

Differential Revision: https://phabricator.services.mozilla.com/D63286
2020-04-16 16:35:07 +02:00
Jonathan Kew
471e491a89 style: Add support for the 'all' value of text-decoration-skip-ink.
Differential Revision: https://phabricator.services.mozilla.com/D61184
2020-04-16 16:35:07 +02:00
Tim Nguyen
61712d1a03 style: Implement parsing for CSS conic-gradient syntax.
Differential Revision: https://phabricator.services.mozilla.com/D62148
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
31187b0180 style: Remove layout.css.webkit-appearance.enabled.
I don't think we want to keep the ugly widget hacks forever. Let me know if
you'd rather keep the property behind a pref but I don't think there's a point
in doing that.

Differential Revision: https://phabricator.services.mozilla.com/D62649
2020-04-16 16:35:07 +02:00
Cameron McCormack
47db01f793 style: Change initial value of image-orientation to from-image.
Differential Revision: https://phabricator.services.mozilla.com/D62826
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
f25e0b77e9 style: Minor gradient parsing cleanup.
I suggested the compat_mode bit in D62923 but it was somehow only applied to one
of the branches.

Also rustfmt the code for consistency, and add a local alias.

Differential Revision: https://phabricator.services.mozilla.com/D63015
2020-04-16 16:35:07 +02:00
Tim Nguyen
25b265a10f style: Refactor GenericGradient for conic-gradient support.
Differential Revision: https://phabricator.services.mozilla.com/D62923
2020-04-16 16:35:07 +02:00
Tim Nguyen
fc88e908d5 style: Re-introduce display: -moz-stack; as <legacy-stack>.
Differential Revision: https://phabricator.services.mozilla.com/D62758
2020-04-16 16:35:07 +02:00
Martin McNickle
28d8565f38 style: Use the cbindgen output for GridAutoFlow directly in gecko.
Depends on D62787

Differential Revision: https://phabricator.services.mozilla.com/D62910
2020-04-16 16:35:07 +02:00
Martin McNickle
cf20c627b5 style: Replace existing GridAutoFlow struct with a bitflags! backed one.
Differential Revision: https://phabricator.services.mozilla.com/D62787
2020-04-16 16:35:07 +02:00
Tim Nguyen
0e3c122890 style: Make GradientItem and ColorStop support angular color stops.
Differential Revision: https://phabricator.services.mozilla.com/D62544
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
5cedc45858 style: Make font-family serialization algorithm a bit more conservative.
So as to avoid serializing as identifiers font-families with spaces as part of
the identifier. This avoids serializing confusing escaped sequences if the
beginning of the stuff after the space happens to not be a valid ident start.

This is an slightly more restrictive version of the existing logic, which
happens to also match other browsers in my testing.

Differential Revision: https://phabricator.services.mozilla.com/D62376
2020-04-16 16:35:07 +02:00
Boris Chiou
ef2d934dac style: Drop fallback attribute from animate and distance.
Still keep the discriminant checks to avoid generating terrible code.

Differential Revision: https://phabricator.services.mozilla.com/D62329
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
239302b1ed style: Split clip-path and shape-outside values.
We don't actually share _that_ much code across them. This makes callers clearer
and code less confusing, IMHO.

This also has the benefit of not autocompleting path from devtools for
shape-outside.

Differential Revision: https://phabricator.services.mozilla.com/D62373
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
ab03688994 style: Use cbindgen for shape-outside and clip-path.
Differential Revision: https://phabricator.services.mozilla.com/D62372
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
558cc59288 style: Use cbindgen instead of nsStyleImage.
The trickier part is that we represent -moz-image-rect as a Rect() type instead
of image with non-null clip-rect. So we need to add a bit of code to
distinguish "image request types" from other types of images.

But it's not too annoying, and we need to do the same for fancier images like
image-set and such whenever we implement it, so seems nice to get rid of
most explicit usages of nsStyleImage::GetType().

Differential Revision: https://phabricator.services.mozilla.com/D62164
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
4dadcf71a5 style: Some preparation to start using cbindgen for shape-outside and clip-path.
Tweak the ShapeSourceRepresentation so that it doesn't store Option<>s.

Some renames so that GeometryBox doesn't conflict with the Gecko type, and some
other usual bits / re-exports to deal with cbindgen and generics.

Also, drive-by derive parsing of GeometryBox as it's trivial.

Doing this unfortunately is not possible without removing nsStyleImage first, so
let's do that before.

This makes us serialize in the shortest form for shape-outside, but that's what
we should do anyway.

(aside: the shapes code is a bit too generic, maybe we should unify
ClippingShape and FloatAreaShape...)

Differential Revision: https://phabricator.services.mozilla.com/D62163
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
08175a494e style: Remove some include dependencies in nsStyleConsts.h.
We include it everywhere because it's included from gfxTypes.h.

This should avoid including all the generated bindings _everywhere_.

Differential Revision: https://phabricator.services.mozilla.com/D62174
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
149cb5f5f1 style: Merge ImageLayer and Image.
ImageLayer is almost the only usage of Image, so keeping them in the same enum
makes the resulting C++ struct smaller, and makes it map more cleanly to
nsStyleImage.

Differential Revision: https://phabricator.services.mozilla.com/D62161
2020-04-16 16:35:07 +02:00
bors-servo
a4fbad2533
Auto merge of #26190 - servo:unstable, r=nox
Remove use of soon-to-be-deprecated unstable feature

https://github.com/rust-lang/rust/issues/47336#issuecomment-586589016
2020-04-16 03:05:05 -04:00
bors-servo
f8db6666e0
Auto merge of #26191 - jdm:webgl2-origin-trial, r=Manishearth
Automatically enable WebGL 2 for specific domains.

Our WebGL 2 implementation has progressed to the point where some but not all content works well. One particular example of non-working content is Babylon.js; if the WebGL2RenderingContext interface is present, it automatically tries to use it and causes panics in Servo. However, there are demos like http://www.servoexperiments.com/webxr-particles/ that work fine today and would be great to feature on our HoloLens homepage.

This change adds what is effectively an origin trial, where we can identify content that works well, ensure it's running in a list of blessed hosts, and reap the benefits.
2020-04-15 20:25:43 -04:00
bors-servo
324e2d2b42
Auto merge of #26185 - daemon1024:handle-null-proj, r=Manishearth
handle detached array in XRView

<!-- Please describe your changes on the following line: -->
Recompute XRView.projectionmatrix when the buffer is detached
---
<!-- 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
- [x] These changes fix #26153 (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. -->
2020-04-15 18:43:16 -04:00
Josh Matthews
e2845a6939 Automatically enable WebGL 2 for specific domains. 2020-04-15 17:26:42 -04:00
bors-servo
7d1f968d52
Auto merge of #26166 - utsavoza:ugo/issue-23436/08-04-2020, r=jdm
Remove DomRefCell wrapper for CanvasState

<!-- 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: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #23436
- [x] There are tests for these changes

The PR removes the DomRefCell wrapper for CanvasState from `CanvasRenderingContext2D` and `OffscreenCanvasRenderingContext2D`. The reason for keeping member wrappers in CanvasState instead of overall CanvasState wrapper itself is because I believe that removing member wrappers would make it rather difficult to refactor the internal CanvasState methods in order to cover certain edge cases.

[For example](https://github.com/servo/servo/issues/23436#issuecomment-611089157): Drawing a canvas inside of itself would require getting and providing certain parameters for source canvas such as `canvas_id` and `is_origin_clean` that are currently accessed through source canvas context. Also, we might run into similar issue when creating patterns using canvas.

<!-- 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. -->
2020-04-15 16:41:31 -04:00
bors-servo
f6f2b493f6
Auto merge of #26143 - jdm:transform-feedback, r=nox
Fix webgl transform feedback

This allows https://www.joshmatthews.net/webxr-particles/ to run in Servo. This change corresponds with the following spec text:
```
GL_INVALID_OPERATION is generated by glBeginTransformFeedback if no binding points would be used, either because no program object is active of because the active program object has specified no varying variables to record.
```

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #26137
- [x] There are tests for these changes
2020-04-15 13:51:59 -04:00
Simon Sapin
6175a68c10 Replace a transmute with .to_ne_bytes() + constructor 2020-04-15 17:54:04 +02:00
Simon Sapin
7f975c3d5d Remove use of some other unstable features 2020-04-15 15:17:52 +02:00
Simon Sapin
7861b0be79 Remove use of soon-to-be-deprecated unstable feature
https://github.com/rust-lang/rust/issues/47336#issuecomment-586589016
2020-04-15 15:10:11 +02:00
Simon Sapin
fbfe86fffe Remove unused #![feature(…)] attributes 2020-04-15 15:01:46 +02:00
bors-servo
ce9f22a5e4
Auto merge of #26183 - tamird:patch-1, r=gterzian
Use hash_map::Entry to save a map lookup

A bit of golf noticed via https://medium.com/programming-servo/programming-servo-workers-at-your-service-db71e5943511.

r? @gterzian
2020-04-15 01:00:47 -04:00
daemon1024
a79f97b180 handle detached array in XRView 2020-04-15 10:07:36 +05:30
bors-servo
23deec8c39
Auto merge of #26147 - jdm:linewidth, r=nox
Avoid GL errors with LineWidth commands

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #26139
2020-04-14 18:54:00 -04:00
Tamir Duberstein
fac1e654d2
Use hash_map::Entry to save a map lookup 2020-04-14 18:17:46 -04:00
bors-servo
54c7024ce0
Auto merge of #26181 - mrobinson:animations-refactor, r=emilio
style: Refactor some animations code

This change modifies the names of some methods to make it clearer what
they are doing. It also adds some clarifying comments to explain some
confusing behavior.

<!-- 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: -->
- [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: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they do not change behavior.

<!-- 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. -->
2020-04-14 09:49:42 -04:00
Martin Robinson
304b283811 style: Refactor some animations code
This change modifies the names of some methods to make it clearer what
they are doing. It also adds some clarifying comments to explain some
confusing behavior.
2020-04-14 13:40:43 +02:00
bors-servo
33a74a4f4e
Auto merge of #26164 - Manishearth:dirty-endsession, r=jdm
Dirty canvas when exiting immersive sessions

Fixes https://github.com/servo/servo/issues/26162, fixes servo/webxr#155

We basically end up in a situation where the main thread is asleep. It's unclear to me why it doesn't wake up after attempts to interact with the screen, but we stopped dirtying the canvas during the immersive session (https://github.com/servo/servo/pull/26077) so the main thread wasn't awake initially.

This is probably not the cleanest fix -- we really should not be ending up in situations where the main thread is perma-asleep -- however, we should be dirtying the canvas after exiting immersive mode _anyway_ since the contents need to be shown to the user, so this fix is still valid, even if it's not fixing the root cause.
2020-04-13 20:02:48 -04:00
Manish Goregaokar
453be48c94 Dirty layers when changing visibility state 2020-04-13 15:12:41 -07:00
Alan Jeffrey
fda8da0e9d Added first-cut implementation of XR layers 2020-04-13 13:57:58 -05:00
bors-servo
8cc619cfdb
Auto merge of #26111 - CYBAI:fix-origin-trustworthy, r=jdm
Update checking origin trustworthy align to spec

While reading the [spec of ` Is origin potentially trustworthy? `](https://w3c.github.io/webappsec-secure-contexts/#is-origin-trustworthy), I found our second step is wrong; then, I found Josh said we didn't check it with `https` because we didn't support https in tests yet (https://github.com/servo/servo/pull/13574#discussion_r89346191).

IIRC, we've supported https wpt tests now so it might be fine to change it to align with spec.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] 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. -->
2020-04-13 01:45:57 -04:00
CYBAI
99a8ea26a1 Update checking origin trustworthy align to spec 2020-04-13 10:23:00 +09:00
bors-servo
3abbfdf278
Auto merge of #26170 - Manishearth:enum-convertible, r=asajeffrey
Add FromJSValConvertible for enums

Fixes https://github.com/servo/servo/issues/26169

This adds FromJSValConvertible implementations for webidl enums, which allows them to be used within `sequence<>`, etc.

This also uses these implementations when converting arguments.
2020-04-12 11:47:43 -04:00
Manish Goregaokar
242b7f8fdc Use FromJSValConvertible impls when converting arguments 2020-04-11 00:15:43 -07:00
Manish Goregaokar
10a13ffa20 Implement FromJSValConvertible on enums 2020-04-11 00:15:43 -07:00
Utsav Oza
bd8fbee12c Resolve mach build warnings 2020-04-10 23:02:31 +05:30
Utsav Oza
d98ade2a68 Remove DomRefCell wrapper for canvas_state from CanvasRenderingContext2D 2020-04-10 23:02:30 +05:30
Utsav Oza
4a730d1cd2 Remove DomRefCell wrapper for canvas_state from OffscreenCanvasRenderingContext2D 2020-04-10 23:02:30 +05:30