Commit graph

8305 commits

Author SHA1 Message Date
bors-servo
c9480c8e07
Auto merge of #23661 - julientregoat:i-21289, r=jdm
Refactor ImageCache::find_image_or_metadata -> ImageCache::{get_image, track_image}

<!-- Please describe your changes on the following line: -->
Updated the `ImageCache` trait to replace `find_image_or_metadata` with two new functions `track_image` and `get_image`, as well as a new enum (`ImageCacheResult`).

As a result, I was able to refactor the functions that previously called `find_image_or_metadata` pretty cleanly. For a list of these functions, please see the commit information.

---
<!-- 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 #21289  (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because tests already exist for these components. I ran `cargo test` in `net`, `net_traits`, `layout`, and `script` successfully.

<!-- 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. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23661)
<!-- Reviewable:end -->
2020-04-17 15:56:30 -04:00
Julien Tregoat
2742fd2bea Refactor ImageCache::find_image_or_metadata API. 2020-04-17 11:58:18 -04:00
Emilio Cobos Álvarez
848a6203de Some servo build fixes. 2020-04-16 18:29:30 +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
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
daemon1024
a79f97b180 handle detached array in XRView 2020-04-15 10:07:36 +05:30
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
Manish Goregaokar
d146303f1d Dirty canvas when exiting immersive sessions 2020-04-09 22:25:27 -07:00
Manish Goregaokar
58bab8a7e9 Add test for overloading with interface and dict 2020-04-09 12:31:13 -07:00
Manish Goregaokar
c24481ab9c Do not filter out platform objects when doing dictionary conversions
https://heycam.github.io/webidl/#es-overloads

In step 12, the platform object check is for substep 4, but importantly it only matters if `V` implements the matching interface. If not, it should be able to fall back to substep 10 and attempt conversion to a dictionary.
2020-04-08 23:15:57 -07:00
bors-servo
37023b24f2
Auto merge of #26136 - asajeffrey:goodbye-webvr, r=Manishearth
Remove WebVR

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

Removes support for WebVR. WebXR is our future!

---
<!-- 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 do not require tests because how do you test

<!-- 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-08 23:02:50 -04:00
Alan Jeffrey
c611e46381 Remove WebVR 2020-04-08 20:23:41 -05:00
Josh Matthews
c002a29582 Support WebGL2 contexts in XRWebGLLayer. 2020-04-08 12:52:01 -04:00
Josh Matthews
9673091d7a webgl: Only error when beginning transform feedback on programs that have no varying values. 2020-04-08 12:43:11 -04:00
Josh Matthews
66b2b3293d webgl: Fix active uniform block length check. 2020-04-07 16:16:05 -04:00
Istvan
62f00df79d Add initial support for VertexAttribI4*, VertexAttribIPointer
Adds initial support for the WebGL2 `VertexAttribI4i`, `VertexAttribI4iv`, `VertexAttribI4ui`, `VertexAttribI4uiv` and `VertexAttribIPointer` calls.
2020-04-07 15:01:39 -04:00
bors-servo
2002f490ef
Auto merge of #26130 - Manishearth:euclidup, r=nox
Update euclid

r? @nox @jdm
2020-04-07 11:51:38 -04:00
Manish Goregaokar
fccfff11c5 Update euclid 2020-04-07 08:51:08 -07:00
bors-servo
d8781c1054
Auto merge of #26120 - servo:layout-2020-non-opaque-style-data, r=SimonSapin
Remove postorder traversal from layout 2020 during styling
2020-04-07 10:38:16 -04:00
Anthony Ramine
c10e839924 Don't go through the layout thread to retrieve a node's primary style 2020-04-07 14:34:47 +02:00
bors-servo
f3aa7f7144
Auto merge of #26126 - dralley:fix-motionmark, r=jdm
Fix misspelled "get_suported_extensions" function

closes #21122
2020-04-06 20:31:29 -04:00
Anthony Ramine
030a1cf8fb Replace OpaqueStyleAndLayoutData by StyleAndOpaqueLayoutData 2020-04-06 23:06:13 +02:00
Daniel Alley
d0890db479 Fix misspelled "get_suported_extensions" function
closes #21122
2020-04-06 13:50:49 -04:00
Anthony Ramine
e3be136c9b Rename a bunch of style/layout data items
GetLayoutData::get_style_and_layout_data becomes
GetOpaqueStyleAndLayoutData::get_opaque_style_and_layout_data.

GetRawData::get_raw_data becomes GetStyleAndLayoutData::get_style_and_layout_data.

LayoutNode::init_style_and_layout_data becomes
LayoutNode::init_opaque_style_and_layout_data.

LayoutNode::take_style_and_layout_data becomes
LayoutNode::take_opaque_style_and_layout_data.
2020-04-06 12:39:52 +02:00
Tipowol
8a3bf880e9 Add InRealm argument to Callback trait 2020-04-05 19:54:30 +02:00
bors-servo
57fe27a4ef
Auto merge of #26110 - servo:layout-2020-rm-note-dirty-descendant, r=emilio
Kill ServoLayoutElement::note_dirty_descendant
2020-04-04 09:51:19 -04:00
bors-servo
d64f7d427a
Auto merge of #26105 - servo:layout-2020-less-opaque, r=emilio
Make DOM own the style and layout data, in an UnsafeCell
2020-04-04 09:35:34 -04:00
Anthony Ramine
8a0775fc89 Kill ServoLayoutElement::note_dirty_descendant
There is no need to set the dirty descendants flag unsafely from the layout side
for elements with pending restyles, we can do that on the DOM side when draining
the restyles from the Document.
2020-04-04 15:00:04 +02:00
Anthony Ramine
185a402d9c Make DOM own the style and layout data, in an UnsafeCell
The previous Cell was a lie.
2020-04-04 13:10:19 +02:00
teapotd
779552ee7d Form constraints validation 2020-04-02 10:16:46 +02:00
bors-servo
af1ebe79ef
Auto merge of #26083 - servo:layout-2020-more-cleanups, r=jdm
More layout cleanups from the introduction of a lifetime in LayoutDom<T>

What can I say, the follow-up fixes just kept coming to my door one by one, I couldn't just tell them to go away.
2020-04-01 12:05:16 -04:00
Anthony Ramine
4e64a1c682 Add some comments and remove obsolete allow attributes 2020-04-01 11:40:56 +02:00
Anthony Ramine
d9e4f7a0ba Introduce more layout helpers to make selection_for_layout be safe 2020-04-01 11:40:56 +02:00
Anthony Ramine
28e5abe606 Introduce <LayoutDom<Element>>::focus_state 2020-04-01 11:40:56 +02:00