Commit graph

9463 commits

Author SHA1 Message Date
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
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
b895ccbec4
Auto merge of #26086 - jdm:mozjs-jitspew, r=Manishearth
Support SpiderMonkey jitspew.

This enables developers to diagnose JIT performance issues on desktop and on device by following the steps at https://github.com/servo/servo/wiki/Diagnosing-SpiderMonkey-JIT-issues.
2020-04-01 23:38:13 -04: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
Josh Matthews
689b32c6e4 Support SpiderMonkey jitspew. 2020-04-01 11:32:53 -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
Anthony Ramine
295f120425 Make LayoutShadowRootHelpers::get_style_data_for_layout return a &CascadeData
That return type is Sync, which thus means that the method can be safe.
2020-04-01 11:40:55 +02:00
Anthony Ramine
ebd2892158 Make synthesize_presentational_hints_for_legacy_attributes be safe 2020-04-01 11:40:55 +02:00
Anthony Ramine
0c0027ecfd Make LayoutDocumentHelpers::style_shared_lock be safe
StyleSharedRwLock is Sync.
2020-04-01 11:40:55 +02:00
Anthony Ramine
4636507fa1 Move unsafe code out of <LayoutDom<HTMLTextAreaElement>>::value_for_layout 2020-04-01 11:40:55 +02:00
Anthony Ramine
f8af8176de Introduce a bunch of LayoutDom<HTMLInputElement> private helpers
Those help contain the unsafety in most of the actual helpers used by layout.
2020-04-01 11:40:55 +02:00
Anthony Ramine
1cd3d6bd4c Introduce <LayoutDom<HTMLImageElement>>::current_request
This safe helper contains the only source of unsafety from the actual image
layout helpers methods, making them completely safe.
2020-04-01 11:40:55 +02:00
Anthony Ramine
fc07a5147c Make LayoutNodeHelpers::composed_parent_node_ref be safe
For clarity, I introduce <LayoutDom<Element>>::parent_node_ref to contain
the remaining unsafety bits out of composed_parent_node_ref which is more
complex than just a field access.
2020-04-01 11:40:34 +02:00
bors-servo
2c0bbcf2aa
Auto merge of #26077 - jdm:xr-canvas-dirty, r=asajeffrey
webgl: Don't dirty canvas element while in immersive mode.

There are various WebGL APIs that are supposed to trigger a frame composite at the end of the event loop when they're used. We enforce this via dirtying the canvas element and ensuring that reflow occurs for normal content. This is redundant when we're using immersive mode and incurs extra work by the layout thread and compositor that inhibits the immersive rendering performance.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix (part of) #26019
- [x] These changes do not require tests because we do not have infrastructure to test immersive mode on CI.
2020-03-31 22:23:32 -04:00
Josh Matthews
ab75808b8c webgl: Don't dirty canvas element while in immersive mode. 2020-03-31 17:17:51 -04:00
Josh Matthews
6ab7a50b31 Cache the result of retrieving an element's client rectangle from layout. 2020-03-31 17:15:44 -04:00
Anthony Ramine
f712b0bcf8 Make LayoutShadowRootHelpers::get_host_for_layout be safe 2020-03-31 22:30:42 +02:00
Anthony Ramine
68d5cfffd5 Make a bunch of LayoutNodeHelpers be safe 2020-03-31 22:30:34 +02:00
Anthony Ramine
f014da9565 Introduce LayoutDom::is
Just like Castable::is.
2020-03-31 22:06:40 +02:00
Anthony Ramine
9c8540af5c Make layout methods accessing rare data be safe
They don't do anything fancy so there is no additional unsafety calling them
compared to using LayoutDom in the first place, the usual story of all
those changes.
2020-03-31 22:04:35 +02:00
Anthony Ramine
414d477b54 Don't generate rare_data_for_layout methods anymore
It is only used twice.
2020-03-31 21:54:02 +02:00
Anthony Ramine
dd750c6f86 Introduce LayoutDom::to_layout_slice
It generalises <LayoutDom<Element>>::attrs.
2020-03-31 21:39:45 +02:00
Anthony Ramine
72c0771299 Make a bunch of LayoutDocumentHelpers be safe
The other methods are actually unsafe.
2020-03-31 21:39:45 +02:00
Anthony Ramine
e561911066 Make LayoutCanvasRenderingContext2DHelpers::get_canvas_id be safe 2020-03-31 21:23:55 +02:00
Anthony Ramine
fbc3e430ab Make a bunch or trivial LayoutElementHelpers safe 2020-03-31 20:37:57 +02:00
Anthony Ramine
a913c6650d Reduce scope of unsafe block in LayoutHTMLCanvasElementHelpers::data 2020-03-31 19:06:25 +02:00
Anthony Ramine
5ff931d171 Introduce <LayoutDom<Element>>::attrs()
This safe method is the basic block to access element attributes from layout.
We reuse it in the other attr-related layout methods to remove a pretty big
source of rampant unsafe code between script and layout.
2020-03-31 18:46:49 +02:00
Anthony Ramine
0bda174823 Merge RawLayoutElementHelpers into LayoutElementHelpers 2020-03-31 18:30:42 +02:00
Anthony Ramine
3b504148d5 Move around some code in the element
The intent is to merge the two layout helper traits together
so I'm moving them around to make later diffs more readable.
2020-03-31 18:02:02 +02:00
bors-servo
3aa15e3fa3
Auto merge of #26070 - servo:layout-2020-more-cleanups, r=SimonSapin
Make LayoutNodeHelpers::text_content return a cow

What does it mean? It means that layout can process `Text` nodes' contents by just borrowing them, potentially saving us from a lot of unnecessary tempoorary allocations, which is nice.
2020-03-31 10:51:18 -04:00
CYBAI
018b23d43b Use mozjs exposed function to generate SourceText 2020-03-31 22:29:53 +09:00
Anthony Ramine
fb1ff3f097 Remove an obsolete comment 2020-03-31 15:23:06 +02:00
Anthony Ramine
6fe294fa5b Make LayoutNodeHelpers::text_content return a cow 2020-03-31 15:02:13 +02:00
Anthony Ramine
409bd3d989 Make LayoutCharacterDataHelpers::data_for_layout be safe 2020-03-31 14:57:44 +02:00
Anthony Ramine
00c5ec202c Make LayoutHTMLTextAreaElementHelpers::value_for_layout safe 2020-03-31 14:35:37 +02:00
Anthony Ramine
e1e913d33c Make LayoutHTMLInputElementHelpers::value_for_layout return a cow 2020-03-31 14:30:18 +02:00
Anthony Ramine
3e875ce3eb Introduce AttrHelpersForLayout::namespace 2020-03-31 14:06:22 +02:00
Anthony Ramine
47c9f19121 Don't clone the result of AttrHelpersForLayout::local_name
There is no need to do that. Embrace returning borrows from the DOM, it good.
2020-03-31 14:02:14 +02:00
Anthony Ramine
4db84bede8 Rename AttrHelpersForLayout methods 2020-03-31 13:58:50 +02:00
Anthony Ramine
4c16729a01 Make AttrHelpersForLayout methods be safe
The unsafety isn't there, it's in the creation of the LayoutDom<T> values.
2020-03-31 13:54:52 +02:00
bors-servo
f9e7c6b9dc
Auto merge of #26054 - shnmorimoto:fix_tojson_unconditionally_serializes, r=jdm
Fix tojson unconditionally serializes

<!-- 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 #25281

<!-- 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-03-31 02:33:53 -04:00
bors-servo
42463c4c44
Auto merge of #26062 - jdm:jsup, r=Manishearth
Update mozjs.

Fix #26040. Incorporate upstream patches to improve JIT codegen on arm64.
2020-03-30 23:51:47 -04:00
Shinichi Morimoto
74995a5287 fixed CGCollectJSONAttributesMethod 2020-03-31 09:37:07 +09:00
bors-servo
77b02393fb
Auto merge of #26009 - SasiDharKM:master, r=jdm
Implementation for ImageBitmap

<!-- Please describe your changes on the following line: -->
Created the boilerplate code for the image bitmap implementation.

---
<!-- 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 #20650

<!-- 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-03-30 19:26:39 -04:00
Josh Matthews
33ddf3eef3 Update mozjs. 2020-03-30 17:45:28 -04:00
santoshpavan
8c405546a2 Implement ImageBitmap interface
Implementation of ImageBitmap

ImageBitMap webidl file added

Implementation of ImageBitmap

mentioned the correct origin link

basic new and new_inherited

updated the mod.rs file to include imagebitmap

imagebitmap implemented

changed according to Serialization

implemented serializable

get methods for width and height

basic imagebitmap

added missing crates

added Vec and missing crates

Syntax fixes

Reformatting and minor error fixes

Implementation of  ImageBitmap

tidy-test runs

Took out extra parameters in reflect_dom_object call

added comments with specification links for webidl functions

changing the code based on review comments

adding resolved changes form the pull request

Changes based on pr review

Changes based on pr review

ran test-tidy and fmt

removed the duplicate crate

removed unnecessary crates

Kept only the relevant crate import

Updated test expectations, exposed interface list, and manifest
2020-03-30 15:52:15 -04:00
bors-servo
c8479c8b90
Auto merge of #26036 - gterzian:add_ipc_router_shutdown, r=Manishearth
Add ipc router shutdown

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

Explicitly shutting down IPC router as part of shutdown, for contexts see https://github.com/servo/servo/pull/25685#pullrequestreview-364604068

Note that the call to `shutdown` is idempotent, so it shouldn't matter whether the call in the constellation and the script-thread are actually on the same `ROUTER` in single-process mode...

---
<!-- 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. -->
2020-03-30 14:09:46 -04:00