Commit graph

11575 commits

Author SHA1 Message Date
bors-servo
16b0da5004 Auto merge of #14312 - asajeffrey:script-discard-documents, r=cbrewster
Implement discarding Document objects to reclaim space.

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

This PR implements document discarding. Active documents are kept alive strongly, but inactive documents are only kept alive weakly. When a document is GCd, it is marked as discarded, and if it is every reactivated, a reload of the URL is triggered.

Note that this PR is pretty aggressive about discarding, and can any inactive document (other than those being kept alive by other same-origin pipelines). We might want to damp it down a bit.

Also note that this interacts with browser.html in that the reloading triggered by reactivating a document triggers mozbrowser events.

To test this, I added a `-Zdiscard-inactive-documents` debug flag, which discards all inactive documents, even ones which are reachable through other same-origin pipelines.

---
<!-- 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 #14262.
- [X] These changes do not require tests because we should be able to use the existing tests with `-Zdiscard-inactive-documents`.

<!-- 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/14312)
<!-- Reviewable:end -->
2017-01-04 13:58:57 -08:00
bors-servo
2fe914e2fa Auto merge of #14845 - jdm:restyle-ood, r=emilio
Avoid restyling elements that aren't in a document

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #14480
- [X] There are tests for these changes

<!-- 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/14845)
<!-- Reviewable:end -->
2017-01-04 12:19:00 -08:00
bors-servo
6f9ff7b8bf Auto merge of #14738 - Wafflespeanut:keypress, r=jdm
Properly dispatch keypress event

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

This was an attempt to fix #14659. It turned out that the problem wasn't what I thought it was. So, I didn't fix that. On the brighter side, this fixes two related issues.

- Previously, we were unable to launch `keypress` events from `input` and `textarea` elements, because [we'd been cancelling](1327ebd52f/components/script/dom/htmlinputelement.rs (L1120-L1124)) the key events, so that they don't trigger window navigation - #8400). I've introduced an enum to represent an additional state to an event's cancellation.
- [According to the spec](https://w3c.github.io/uievents/#keypress-event-order), `keypress` (if available) should be dispatched immediately after `keydown`, and it should be followed by `input`. Canceling `keypress` should also cancel `input`. But, we'd been dispatching `input` before `keypress`. We now dispatch `input` once the `keypress` event is on the respective elements.

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

<!-- Either: -->
- [x] These changes do not require tests because it's a refactor?

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

r? @jdm or anyone interested

<!-- 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/14738)
<!-- Reviewable:end -->
2017-01-04 10:52:06 -08:00
Josh Matthews
9a264c8173 Only pass nodes to layout for restyling that are actually in the document. 2017-01-04 12:42:12 -05:00
bors-servo
96fd0837d3 Auto merge of #14844 - emilio:to-css-simplification, r=SimonSapin
style: Simplify Debug impl for PropertyDeclaration reusing to_css.

These two functions appear in the data from bug 1328497, and the second part of one is identical to the other.

I think the way to fix this is another one (either using static arrays to get
the interesting data, or making rust generate the equivalent code).

<!-- 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/14844)
<!-- Reviewable:end -->
2017-01-04 09:37:48 -08:00
Emilio Cobos Álvarez
c8ea840106
style: Simplify Debug impl for PropertyDeclaration reusing to_css.
These two functions appear in the data from bug 1328497.

I think the way to fix this is another one (either using static arrays to get
the interesting data, or making rust generate the equivalent code).
2017-01-04 18:24:04 +01:00
Alan Jeffrey
c14c431d0a Default --max-session-history is now 16. 2017-01-04 17:02:03 +00:00
Alan Jeffrey
1a201fc702 Pass test-tidy. 2017-01-04 15:23:37 +00:00
Alan Jeffrey
ef50a64598 Updated comment. 2017-01-04 15:22:46 +00:00
Josh Matthews
318a047ee5 Interact with the originating document for stylesheet loads, rather than the element's current document. 2017-01-04 09:55:45 -05:00
Alan Jeffrey
67bf23016e Added warnings for idempotent freeze/thaw. 2017-01-04 13:56:14 +00:00
Alan Jeffrey
78c87ea8d7 Implement discarding Document objects to reclaim space. 2017-01-04 11:29:31 +00:00
bors-servo
1e927ca88b Auto merge of #14835 - bholley:external_atomic_refcell, r=Manishearth
Switch to crates.io for atomic_refcell

r? @Manishearth

See #14828 for backstory.

<!-- 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/14835)
<!-- Reviewable:end -->
2017-01-03 19:20:59 -08:00
Bobby Holley
b9d99390ad Switch to crates.io for atomic_refcell. 2017-01-03 18:14:27 -08:00
bors-servo
61f6454b9c Auto merge of #14827 - Manishearth:spec-doc, r=emilio
Add spec links to all CSS properties

<!-- 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/14827)
<!-- Reviewable:end -->
2017-01-03 14:28:29 -08:00
Manish Goregaokar
94412ab6b0 Fix image-orientation line-wrap 2017-01-03 14:28:11 -08:00
Manish Goregaokar
1094c68a55 Add spec link for text-emphasis 2017-01-03 14:03:43 -08:00
Manish Goregaokar
d873bb8fa4 Add spec links for border shorthands 2017-01-03 14:03:42 -08:00
Manish Goregaokar
c89368dcc5 Add spec links for opacity 2017-01-03 14:03:40 -08:00
Manish Goregaokar
ca6ada8b83 Make spec links mandatory 2017-01-03 14:03:39 -08:00
Manish Goregaokar
9a2945bd3a Add spec links for xul properties 2017-01-03 14:03:38 -08:00
Manish Goregaokar
0c6829aea1 Add spec links for ui properties 2017-01-03 14:03:37 -08:00
Manish Goregaokar
450a5d1ae0 Add spec links for text properties 2017-01-03 14:03:35 -08:00
Manish Goregaokar
24f4388b5b Add spec links for table properties 2017-01-03 14:03:34 -08:00
Manish Goregaokar
7238cfb349 Add spec links for svg properties 2017-01-03 14:03:33 -08:00
Manish Goregaokar
baaddf651d Add spec links for pointing properties 2017-01-03 14:03:32 -08:00
Manish Goregaokar
6cf15de868 Add spec links for padding properties 2017-01-03 14:03:30 -08:00
Manish Goregaokar
e7464b5fd5 Add spec links for outline properties 2017-01-03 14:03:28 -08:00
Manish Goregaokar
fdd6a409fb Add spec links for mask properties 2017-01-03 14:03:26 -08:00
Manish Goregaokar
3128694bff Add spec links for margin properties, support spec links on four_sides_shorthand 2017-01-03 14:03:25 -08:00
Manish Goregaokar
6138b6aa75 Add spec links for list properties 2017-01-03 14:03:23 -08:00
Manish Goregaokar
26a9b450a2 Add spec links for inherited_text properties 2017-01-03 14:03:20 -08:00
Manish Goregaokar
096dca9171 Add spec links for inherited_table properties 2017-01-03 14:03:18 -08:00
Manish Goregaokar
ff4893e17e Add spec links for inherited_svg properties 2017-01-03 14:03:17 -08:00
Manish Goregaokar
71026c5ddb Add spec links for inherited_box properties 2017-01-03 14:03:16 -08:00
Manish Goregaokar
82835c8b1b Add spec links for font properties 2017-01-03 14:03:14 -08:00
Manish Goregaokar
b56762246f Add spec links for effects properties 2017-01-03 14:03:13 -08:00
Manish Goregaokar
be8f9ad9d7 Add spec links for counter properties 2017-01-03 14:03:12 -08:00
Manish Goregaokar
dedebc5cb5 Add spec links for column properties 2017-01-03 14:03:11 -08:00
Manish Goregaokar
6a88723409 Support logical values for float/clear 2017-01-03 14:03:10 -08:00
bors-servo
57b2c2609e Auto merge of #14828 - bholley:faster_atomic_refcell, r=Manishearth
Reimplement AtomicRefCell with pure atomics

While reviewing @bzbarsky's patches in [1], I started typing out some lore about how mutable AtomicRefCell borrows are actually cheaper than immutable ones, so we should prefer them where possible. But then I decided that this was a really dumb state of affairs and that we should just fix AtomicRefCell instead, and implement a proper AtomicRef{,Mut}::map while we were at it. So here we are.

This PR adds a from-scratch implementation of AtomicRefCell that aims to be 100% sound, even in unrealistic overflow scenarios. We should probably get this on crates.io eventually, but I want to land it landed in-tree first.

With this implementation, each operation (borrow or release) is one atomic instruction, and all borrow/release pairs (mutable or immutable) take 12 ns on my machine, which is what I'd expect. This is a 50% improvement over the previous implementation in the immutable case.

There may be some places where we could get away with Ordering::Release instead of Ordering::AcqRel, but it didn't seem worth it to try to reason it out.

r? @Manishearth

CC @emilio @SimonSapin @heycam @upsuper

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1298588

<!-- 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/14828)
<!-- Reviewable:end -->
2017-01-03 12:24:45 -08:00
Bobby Holley
c26b4bed60 Reimplement AtomicRefCell as a fork of RefCell. 2017-01-03 12:23:06 -08:00
Manish Goregaokar
0b515c2bc9 Add spec links for box properties 2017-01-03 10:27:49 -08:00
Manish Goregaokar
a9c0162000 Add spec links for border properties 2017-01-03 10:24:00 -08:00
Manish Goregaokar
cd2f9734e9 Add spec links for background properties 2017-01-03 10:23:56 -08:00
Manish Goregaokar
d63af611f2 Add spec links for position properties 2017-01-03 10:23:04 -08:00
Manish Goregaokar
29c2db4457 Add spec argument to property helpers 2017-01-03 10:23:02 -08:00
bors-servo
68ecb04847 Auto merge of #14831 - servo:rustfmt-traits, r=nox
Rustfmt script_traits and net_traits.

CC #8553.

<!-- 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/14831)
<!-- Reviewable:end -->
2017-01-03 08:11:09 -08:00
bors-servo
672f099c95 Auto merge of #14830 - heycam:bindings-update-15, r=emilio
stylo: update bindings

Bindings update for https://treeherder.mozilla.org/#/jobs?repo=stylo&revision=8ebbde564daf4f7019d874e4b888bd670c81e6cc.

r? @emilio

<!-- 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/14830)
<!-- Reviewable:end -->
2017-01-03 06:08:30 -08:00
Ms2ger
b46846e2a0 Rustfmt net_traits. 2017-01-03 15:06:41 +01:00