Commit graph

8894 commits

Author SHA1 Message Date
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
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
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
69004e43dd
Auto merge of #26025 - szeged:webgl_draw_range_elements, r=jdm
Add support for DrawRangeElements in WebGL2

Adds initial support for the WebGL2 `DrawRangeElements` call.

<!-- Please describe your changes on the following line: -->
I have started working on this function, but not sure how could I check for the Uniform Block Backing (https://www.khronos.org/registry/webgl/specs/latest/2.0/#ACTIVE_UNIFORM_BLOCK_BACKING).
I am looking for some advice.

---
<!-- 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] There are tests for these changes

cc @mmatyas @zakorgy @jdm
<!-- 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 13:59:05 -04:00
Istvan
bfa43fbeba Add support for DrawRangeElements in WebGL2
Adds initial support for the WebGL2 `DrawRangeElements` call.
2020-03-30 13:55:01 +02:00
Anthony Ramine
02fb5a68e6 Remove a bunch of _forever suffixes in Attr methods
They don't return &'static references anymore.
2020-03-30 13:09:03 +02:00
Anthony Ramine
ba5bcec7e4 Make LayoutDom<'dom, T> be a mere reference wrapper 2020-03-30 13:09:02 +02:00
Anthony Ramine
ea9e62bdca Fix LayoutDom::unsafe_get
The raw pointer can be used to extend the lifetime of the inner T
to beyond 'dom.
2020-03-30 13:07:36 +02:00
Anthony Ramine
4279fe5933 Fix LayoutElementHelpers::get_classes_for_layout
It should not return a 'static reference
2020-03-30 13:07:27 +02:00
Anthony Ramine
05c71dff88 Fix AttrHelpersForLayout
We should never be returning 'static stuff from attrs, that's a big lie.
2020-03-30 13:07:27 +02:00
Anthony Ramine
4a17950331 Make LayoutShadowRootHelpers methods take self 2020-03-30 13:07:27 +02:00
Anthony Ramine
86296b84ff Clean up LayoutShadowRootHelpers::get_style_data_for_layout
Parameter E is unused and the result should be bound by 'dom.
2020-03-30 13:07:25 +02:00
Anthony Ramine
206157dd74 Make LayoutNodeHelpers methods take self 2020-03-29 19:34:22 +02:00
Shinichi Morimoto
d8c1dc60e8 fixed is_satisfied condition 2020-03-30 02:32:46 +09:00
Shinichi Morimoto
fa8afbb1b0 remove unnecessary condition 2020-03-30 02:32:17 +09:00
Anthony Ramine
467913acdb Make LayoutElementHelpers methods take self 2020-03-29 19:31:54 +02:00
Anthony Ramine
9b2debe678 Give a lifetime parameter to LayoutDocumentHelpers 2020-03-29 19:29:02 +02:00
Anthony Ramine
f0c98bfa5c Give a lifetime parameter to LayoutCharacterDataHelpers 2020-03-29 19:25:46 +02:00
Anthony Ramine
d87444cb1f Make LayoutCanvasWebGLRenderingContextHelpers methods take self 2020-03-29 17:52:34 +02:00
Anthony Ramine
301acdc309 Make LayoutSVGSVGElementHelpers methods take self 2020-03-29 17:25:00 +02:00
Anthony Ramine
56793f24da Make HTMLTableSectionElementLayoutHelpers methods take self 2020-03-29 17:23:52 +02:00
Anthony Ramine
5d3274c181 Make HTMLTableRowElementLayoutHelpers methods take self 2020-03-29 17:23:31 +02:00
Anthony Ramine
83045c7e68 Make HTMLTableElementLayoutHelpers methods take self 2020-03-29 17:22:47 +02:00
Anthony Ramine
09600301c5 Make HTMLTableCellElementLayoutHelpers methods take self 2020-03-29 17:22:11 +02:00
Anthony Ramine
f794feb6f4 Make LayoutHTMLMediaElementHelpers methods take self 2020-03-29 17:21:38 +02:00
Anthony Ramine
e590251e5f Make LayoutHTMLImageElementHelpers methods take self 2020-03-29 17:20:40 +02:00
Anthony Ramine
1504f35031 Make HTMLIFrameElementLayoutMethods methods take self 2020-03-29 17:19:59 +02:00
Anthony Ramine
668ef35612 Make HTMLHRLayoutHelpers methods take self 2020-03-29 17:19:32 +02:00
Anthony Ramine
fea4a2e629 Make HTMLFontElementLayoutHelpers methods take self 2020-03-29 17:18:59 +02:00
Anthony Ramine
56ef9b5170 Make LayoutHTMLCanvasElementHelpers methods take self 2020-03-29 17:18:31 +02:00
Anthony Ramine
e7cfd0c409 Make HTMLBodyElementLayoutHelpers methods take self 2020-03-29 17:17:00 +02:00
Anthony Ramine
9d337ea013 Make LayoutCanvasRenderingContext2DHelpers methods take self 2020-03-29 16:08:53 +02:00
bors-servo
15d8c6058b
Auto merge of #26048 - nox:layout-2020-transparent-data, r=jdm
Give a lifetime parameter to LayoutDom
2020-03-28 13:37:31 -04:00
Anthony Ramine
dba6a635e5 Give a lifetime parameter to LayoutDom 2020-03-28 15:37:57 +01:00
Anthony Ramine
60ca98b753 Pass pending restyles instead of draining them from layout 2020-03-28 15:37:56 +01:00