Commit graph

44 commits

Author SHA1 Message Date
Anthony Ramine
518c0660c6 Make Node::style_and_layout_data be a DomRefCell<T>
That way we can use borrow_mut_for_layout and borrow_mut.
2020-05-19 15:51:55 +02:00
Anthony Ramine
4c61baee30 Make OpaqueLayoutAndStyleData just a bit less opaque
It now stores a NonNull<dyn Any>.
2020-04-04 13:08:51 +02:00
Anthony Ramine
785a344e32 Update rand to 0.7 (fixes #24448) 2019-10-23 15:34:48 +02:00
Thomas Delacour
d0c64d347d
ISSUE-23995: lazily generate unique_id for node 2019-09-24 09:25:09 -04:00
Fernando Jiménez Moreno
6bf1ca20a2 Make Node and Element rare_data an Option 2019-04-26 12:00:25 +02:00
Fernando Jiménez Moreno
1427c43620 Update size of tests after *RareData changes 2019-04-26 11:42:37 +02:00
Fernando Jiménez Moreno
067acdfd27 Update size of tests with shadow root size 2019-04-26 11:31:16 +02:00
Simon Sapin
51d6b6350e Upgrade to rustc 1.36.0-nightly (e305df184 2019-04-24)
This includes a `size_of` regression for a few DOM types,
due to https://github.com/rust-lang/rust/pull/58623 which replaces the
implementation of `HashMap` in the standard library to Hashbrown.

Although `size_of<HashMap>` grows, it’s not obvious how total memory usage
is going to be impacted: Hashbrown only has one `u8` instead of one `usize`
of overhead per hash table bucket for storing (part of) a hash,
and so might allocate less memory itself.

Hashbrown also typically has better run time performance:
https://github.com/rust-lang/hashbrown#performance

Still, I’ve filed https://github.com/rust-lang/hashbrown/issues/69
about potentially reducing the `size_of<HashMap>` regression.
2019-04-25 13:52:09 +02:00
Jan Andre Ikenmeyer
f1f409ffb6
Update MPL license to https (part 5) 2018-11-27 19:09:17 +01:00
Connor Brewster
9f51c7df21 Track custom element state 2017-08-09 14:36:22 -06:00
bors-servo
7b134440fc Auto merge of #17614 - cbrewster:custom_element_reactions, r=jdm
Implement custom element reactions

<!-- Please describe your changes on the following line: -->
Initial work for implementing custom element reactions: https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element-reactions

---
<!-- 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 #17433 (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. -->

<!-- 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/17614)
<!-- Reviewable:end -->
2017-07-17 22:58:53 -07:00
Connor Brewster
4665991503 Support custom element callback reactions 2017-07-17 22:23:45 -06:00
Emilio Cobos Álvarez
bf9369b29d
script: Move the layout_wrapper outside of script.
This allows us to have ensure_data() and clear_data() functions on the TElement
trait, instead of hacking around it adding methods in random traits.

This also allows us to do some further cleanup, which I'd rather do in a
followup.
2017-07-15 16:41:12 +02:00
Connor Brewster
37e8b89377 Allow element prefix to be set
Implements step 6.1.10 of
https://dom.spec.whatwg.org/#concept-create-element
2017-06-23 21:10:01 -06:00
Connor Brewster
2f36d3544f Support is option when creating elements 2017-06-23 21:09:55 -06:00
Bobby Holley
eee07be227 Introduce NonZeroPtrMut and use it in servo_arc.
MozReview-Commit-ID: AAmeyjfyXeU
2017-06-06 21:38:51 -07:00
Sumit
3ca89204ff Mutation Observer API 2017-05-15 18:15:38 -04:00
Christian Poveda
62821a6915 Solving merge conficts related to the html5ever_atoms -> html5ever change 2017-05-03 12:57:49 -05:00
Christian Poveda
875e422fe6 Changed all prefixes from DOMString to the atomic Prefix from html5ever 2017-05-03 10:17:42 -05:00
Bobby Holley
fd1c814e78 Bump the DOM element sizes.
This will go back down soonish when NonZero stablizes and we can use it in
StyleArc, which I expect will be long before the memory overhead here matters.
2017-05-02 17:59:53 -07:00
Emilio Cobos Álvarez
ab6277a91d
script: Update expected size of elements now we have bigger state flags. 2017-03-29 15:44:47 +02:00
Simon Sapin
31678b426c Update to rustc 1.17.0-nightly (8c72b7651 2017-03-11)
This fixes the DOM node size regression introduced by a previous Rust update:
https://github.com/servo/servo/issues/15704
2017-03-11 11:46:41 +01:00
Simon Sapin
64885c4213 Update to rustc 1.17.0-nightly (413a975e3 2017-02-23)
Fix #15704
2017-02-24 01:49:29 +01:00
Bobby Holley
9e860df9df Bug 1336646 - Apply selector flags during traversal. r=emilio 2017-02-08 19:21:05 -08:00
Bobby Holley
940cda1d15 Remove generation, remove filter pop, and add size tests. 2016-12-22 11:09:55 -08:00
Ms2ger
86d59212fe Introduce a script::test module to expose the APIs needed for unit tests. 2016-12-22 15:58:53 +01:00
Simon Sapin
acc38aa8c2 Use Arc<PropertyDeclarationBlock> everwhere it’s appropriate. 2016-08-31 02:34:07 +02:00
Anthony Ramine
c66380d83c Update Rust to 1.13.0-nightly (198713106 2016-08-26) 2016-08-28 13:45:03 +02:00
Mitchell Hentges
1ca4a3e32f Compute tag_name a maximum of once per document owner 2016-08-03 20:05:22 -07:00
Ms2ger
0c506cf1df Remove the wrapper::ServoThreadSafeLayoutNode re-export. 2016-06-20 19:08:09 +02:00
Matt Brubeck
33b9aa49db Update path in script_tests::size_of error messages 2016-03-29 08:41:12 -07:00
Matt Brubeck
973918967f Dirty elements whose selectors are affected by sibling changes
This fixes incremental layout of nodes that match pseudo-class selectors such
as :first-child, :nth-child, :last-child, :first-of-type, etc.

* Fixes #8191
* Fixes #9063
* Fixes #9303
* Fixes #9448

This code is based on the following flags from Gecko:
https://hg.mozilla.org/mozilla-central/file/e1cf617a1f28/dom/base/nsINode.h#l134
2016-02-23 17:31:38 -08:00
Anthony Ramine
9932a5cf82 Abstract out Node::unique_id in its own structure
An UnsafeCell is use to lazily create the Uuid.
2016-02-04 14:22:53 +01:00
Bobby Holley
47059d2d26 Separate style+layout and layout-specific wrapper functionality.
This patch does a number of things, unfortunately all at once:
* Hoists a large subset of the layout wrapper functionality into the style system.
* Merges TElementAttributes into the newly-created TElement.
* Reorganizes LayoutData by style vs layout, and removes LayoutDataShared.
* Simplifies the API for borrowing style/layout data.

There's still more to do to make the style system usable standalone, but
this is a good start.
2015-12-29 11:50:03 -08:00
Anthony Ramine
3c76835615 Properly propagate changes when range or trees are mutated 2015-12-25 23:35:57 +01:00
Aleksandr Likhanov
4bf21ab15e reduce node.unique_id size
fix sizeof unittest
update Cargo.lock
2015-11-19 00:48:20 +05:00
Alan Jeffrey
64a50bcf56 Added versioning to DOM nodes.
There is now an inclusive_descendants_version field of each node, which
increases each time the node, or any of its descendants, is dirtied.
This can be used for cache invalidation, by caching a version number
and comparting the current version number against the cached version number.
2015-11-06 17:23:16 -06:00
Bobby Holley
69255ed169 Bump the expected sizes for Element.
After rebasing, this suddenly became a problem again, even though there's no actual size increase here
(we're shrinking NodeFlags by 1 byte, and adding 1 byte of EventState). Moving the NodeFlags to the end
of Node and the EventState bits to the beginning of Element doesn't seem to helper either.

This is probably a padding issue that's worth investigating at some point, but given the level
of churn in this code it doesn't seem worth it to fuss to much over this right now.
2015-10-16 17:56:33 -07:00
bors-servo
d1269294e6 Auto merge of #7611 - nox:cache-element-id, r=frewsxcv
Cache the `id` attribute on Element

Thanks to @asabil for the original work, I only rebased it.

Fixes #6359 and #7040.


<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7611)
<!-- Reviewable:end -->
2015-09-20 09:23:20 -06:00
Brandon Fairchild
de3547e401 Fix reported test-tidy errors for unmerged import blocks
This merges import blocks that were reported by tidy as unmerged.
2015-09-19 12:50:14 -04:00
Ali Sabil
ea655ada10 Cache the id attribute on Element 2015-09-13 23:55:40 +02:00
Michael Wu
941f7dc04b Move EventTargetTypeId/NodeTypeId to DOMClass 2015-09-12 01:09:46 +02:00
Michael Wu
1a014beb08 Remove LayoutChan from LayoutDataWrapper 2015-07-04 03:54:40 -04:00
Simon Sapin
dc431c9bdb Move script crate unit tests into the unit_tests crate. 2015-04-08 01:07:53 +02:00
Renamed from components/script/tests.rs (Browse further)