Commit graph

657 commits

Author SHA1 Message Date
Anthony Ramine
036f123c4e Implement concept of dirty root 2020-05-19 16:26:36 +02:00
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
Simon Sapin
1f6efbf9e9 Correctly paint the CSS canvas’ background
https://drafts.csswg.org/css-backgrounds/#special-backgrounds

Fixes https://github.com/servo/servo/issues/25559
Closes https://github.com/servo/servo/pull/26121, as it is an alternative.
2020-05-15 13:37:09 +02:00
Bastien Orivel
1b2464b4b6 Add a fast path in Element::SetInnerHTML when the value is small and trivial text
Inspired from gecko which has a similar fast path. This makes innerHTML
more than 10 times faster for this case.

Fixes #25892
2020-05-04 18:11:49 +02: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
Anthony Ramine
030a1cf8fb Replace OpaqueStyleAndLayoutData by StyleAndOpaqueLayoutData 2020-04-06 23:06:13 +02: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
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
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
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
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
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
206157dd74 Make LayoutNodeHelpers methods take self 2020-03-29 19:34:22 +02:00
Anthony Ramine
dba6a635e5 Give a lifetime parameter to LayoutDom 2020-03-28 15:37:57 +01:00
YUAN LYU
3ea6d87bcc
Add trait DomObjectWrap to provide WRAP function 2020-03-20 22:16:56 -04:00
bors-servo
145c89a2d4
Auto merge of #25499 - NeverHappened:implement-form-dirname, r=jdm
Implement dirname support for form element

Added support for dirname in input on form submit
Added Dir getter / setter for HTMLElement
NOT YET Added get directionality according to https://html.spec.whatwg.org/multipage/dom.html#the-directionality

- [X] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #25379 (GitHub issue number if applicable)
2020-02-24 21:18:10 -05:00
Dmitry Kolupaev
35d340daba Simplify code for directionality 2020-02-25 01:18:21 +03:00
Dmitry Kolupaev
edb940e613 Remove recursiveness from directionality search 2020-02-25 01:18:21 +03:00
Dmitry Kolupaev
7e2107b1a5 Simplify node#parent_directionality 2020-02-25 01:18:20 +03:00
Dmitry Kolupaev
7d6d1c09cb Rearrange directionality algorithm functions 2020-02-25 01:18:20 +03:00
Josh Matthews
1449bac0e1 Avoid accessing node global during Node's destructor. 2020-02-24 16:27:40 -05:00
bors-servo
f020536215
Auto merge of #25548 - pshaughn:docnamedgetter, r=jdm
Add SupportedPropertyNames to Document (also fix iframe getting)

Existing test of named-getting an iframe now succeeds. I added a new test for Object.getOwnPropertyNames(document) based on my understanding of the spec; that test could use a second opinion.

UPDATE: This was trying to do too many things in one PR as originally submitted. It is now using #25572 as a base, and I suggest reviewing that PR before this one to avoid duplicating review effort.

---
<!-- 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 #7273 for all implemented named getters, fix #25146, and fix the iframe case only of #25145.

<!-- Either: -->
- [X] There are tests for these changes

<!-- 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-02-13 20:11:20 -05:00
Patrick Shaughnessy
e48eac6879 Doc named getter improvements 2020-02-13 15:37:03 -05:00
Patrick Shaughnessy
01aba1fcc4 Event dispatch rewritten to resemble spec more often, activate on clicks better 2020-02-12 15:57:37 -05:00
Patrick Shaughnessy
4ea0a7061b Remove outdated comment about #4105 2020-02-05 15:43:03 -05:00
Kunal Mohan
02c1612cb0
Add accountable-refcell as optional build time feature 2020-01-08 09:44:41 +05:30
bors-servo
e185423fc7
Auto merge of #25310 - pshaughn:attr_node, r=Manishearth
Attr is a Node, with consequences for many Node methods

<!-- Please describe your changes on the following line: -->
Attr is now a Node, as current WHATWG specs require. I think I did some unidiomatic things to make compareDocumentPosition work and it could use a look by someone more familiar with how to write concise Rust code. I also think the new cases in compareDocumentPosition lack tests; it is possible to compare the position of two attributes, or of an attribute and an element, and I don't think any tests are exercising that functionality.

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

<!-- Either: -->
- [ ] There are tests for these changes (existing cases of Node methods are well-tested, and there is a WPT test specifically for whether Attr is Node, but I'm not sure about new Node method cases)

<!-- 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-01-07 18:13:40 -05:00
Patrick Shaughnessy
a322c6079b Now passing output tests as well as anyone 2020-01-06 15:28:55 -05:00
Patrick Shaughnessy
67e9fc8c0a Attr is a Node, with consequences for many Node methods 2019-12-23 19:10:16 -05:00
Patrick Shaughnessy
0231a0a712 adding .isConnected DOM attribute 2019-12-11 10:08:05 -05:00
Thomas Delacour
d0c64d347d
ISSUE-23995: lazily generate unique_id for node 2019-09-24 09:25:09 -04:00
George Roman
d7b9fede99 Return ErrorStatus from webdriver_handlers 2019-08-18 15:30:55 +03:00
Simon Sapin
c38c964f1b Upgrade to rustc 1.38.0-nightly (dddb7fca0 2019-07-30) 2019-07-31 13:34:01 +02:00
marmeladema
35dc5320ab Wrap(Global)Method now takes a SafeJSContext instead of a JSContext
as first argument.
2019-07-24 08:18:21 +01:00
Emilio Cobos Álvarez
3d57c22e9c Update euclid.
There are a few canvas2d-related dependencies that haven't updated, but they
only use euclid internally so that's not blocking landing the rest of the
changes.

Given the size of this patch, I think it's useful to get this landed as-is.
2019-07-23 23:09:55 +02:00
Fernando Jiménez Moreno
a3d0d95b61 Moar detach shadow improvements 2019-07-22 17:40:17 +02:00
Fernando Jiménez Moreno
1f3c879a85 Detach shadow clean up 2019-07-22 17:40:16 +02:00
gatowololo
3df8d6891e Split getter for mutation_observers() into two methods.
registered_mutation_observers() returns immutable references and does
not init mutation observers.

registered_mutation_observers_mut() lazily initializes raredata if it
does not exist.

Updated code that uses this methods to call appropriate method when
mutation is not necessary.
2019-06-06 11:30:37 -07:00
Fernando Jiménez Moreno
37e88e77cd Set self as containing_shadow_root for shadow roots 2019-04-29 12:15:16 +02:00
Fernando Jiménez Moreno
68bee1c771 Final nits; fix custom elements rare data usage; s/owner_s_r/containing_s_r
Clarify special case for containing_shadow_root and add it to layout
accessor
2019-04-29 12:02:04 +02:00
Fernando Jiménez Moreno
9b2eb77530 Do not lazy initialize RareData on its getters 2019-04-26 12:00:26 +02:00
Fernando Jiménez Moreno
9d52feffbb Rename shadow_root_from_node to containing_shadow_root 2019-04-26 12:00:26 +02:00