Commit graph

396 commits

Author SHA1 Message Date
Connor Brewster
17bd80a7b1 Implement history state 2018-04-16 10:21:15 -05:00
Anthony Weston
7f7fc91758 Pass new method in CollectServoSizes for accurate DOM heap use reporting 2018-03-27 20:35:39 -04:00
Emilio Cobos Álvarez
21df4014db
constellation: Make setting up the WebGL state fallible.
This fixes a regression caused by the glutin update.

We now are creating EGL contexts in Linux Wayland, instead of X context, so the
GLContextFactory assumption of one GL back-end per platform is broken.

This just works around it, for now, but in general I think not relying on
available WebGL state is a good thing, and we do that already for WebVR anyway.
2018-03-09 23:27:29 +01:00
bors-servo
ac162e8f72
Auto merge of #20012 - alexfjw:avoid_Window-GetComputedStyle_when_checking_for_display-none, r=emilio
Avoid `Window::GetComputedStyle` when checking for `display: none`

<!-- Please describe your changes on the following line: -->
Refactored Window::GetComputedStyle to use Element::Style.

Not sure which tests are relevant, but I've ran the dom, fetch & 2dcontext wpt tests. They don't seem to give errors.

---
<!-- 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 #19885.

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

<!-- 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/20012)
<!-- Reviewable:end -->
2018-02-27 04:52:05 -05:00
Alex Fong
8d09398230 Avoid Window::GetComputedStyle when checking for display: none 2018-02-26 19:07:04 +08:00
Paul Rouget
da349ee8a9 remove mozbrowser code 2018-02-13 09:40:06 +01:00
Paul Rouget
e7c754fb64 remove forcetouch support 2018-02-11 08:02:39 +01:00
Nupur Baghel
d02422408e Updated content_type of Document and XMLDocument from DOCString to Mime 2018-02-09 09:32:56 +05:30
Fernando Jiménez Moreno
983084470f Print url of recorded PWM 2017-12-07 20:58:31 +01:00
Manish Goregaokar
3900f5e616
Use FetchCanceller for document loads 2017-11-22 14:06:27 -08:00
ddh
2ef28d05b5 added navigation start for interactive metrics 2017-11-14 15:21:35 +00:00
ddh
0a09ee5cd8 changed f64 to u64 for navigation start timing until it had to be float 2017-11-01 20:45:22 +00:00
Bastien Orivel
29b4eec141 Bump bitflags to 1.0 in every servo crate 2017-10-30 23:36:06 +01:00
ddh
52b63def44 added pipelines to all task sources
changed task sources to accept pipeline ids
2017-10-25 14:25:58 +01:00
ddh
2ffbe53989 added time to interactive metrics, refactored metrics to use traits
changed task macro to take pipeline info
2017-10-24 21:02:56 +01:00
bors-servo
2b03a9974c Auto merge of #18968 - mbrubeck:try, r=emilio
Use try syntax for Option where appropriate

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes do not require tests because they are refactoring only

<!-- 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/18968)
<!-- Reviewable:end -->
2017-10-21 03:31:21 -05:00
Josh Matthews
c075372739 Do not trace Rust values when thread is shutting down. 2017-10-20 13:50:40 -04:00
Matt Brubeck
2d45e9d2da Use try syntax for Option where appropriate 2017-10-20 08:25:35 -07:00
bors-servo
fe16c1d5c3 Auto merge of #18809 - Eijebong:bitflags, r=nox
Update bitflags to 1.0 in every servo crate

It still needs dependencies update to remove all the other bitflags
versions.

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes do not require tests because it's a dependency update

<!-- 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/18809)
<!-- Reviewable:end -->
2017-10-19 10:35:08 -05:00
bors-servo
07e9794306 Auto merge of #18944 - servo:jemallocator2, r=nox
Stop relying on linking details of std’s default allocator

We’ve been bitten before by symbol names changing: https://github.com/servo/heapsize/pull/46, and upstream is planning to stop using jemalloc by default: https://github.com/rust-lang/rust/issues/33082#issuecomment-309781465

So use the (relatively) new `#[global_allocator]` attribute to explicitly select the system allocator on Windows and jemalloc (now in an external crate) on other platforms. This choice matches current defaults.

<!-- 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/18944)
<!-- Reviewable:end -->
2017-10-19 09:15:17 -05:00
Bastien Orivel
e8e2d0a4b2 Update bitflags to 1.0 in every servo crate
It still needs dependencies update to remove all the other bitflags
versions.
2017-10-19 15:01:17 +02:00
Simon Sapin
959ce482dd Stop relying on linking details of std’s default allocator
We’ve been bitten before by symbol names changing:
https://github.com/servo/heapsize/pull/46
and upstream is planning to stop using jemalloc by default:
https://github.com/rust-lang/rust/issues/33082#issuecomment-309781465

So use the (relatively) new `#[global_allocator]` attribute
to explicitly select the system allocator on Windows
and jemalloc (now in an external crate) on other platforms.
This choice matches current defaults.
2017-10-19 09:52:50 +02:00
bors-servo
4cf2ce66fc Auto merge of #18933 - mrobinson:wr-text-index, r=jdm
Use WebRender to compute text index on click events

This is the second half of switching over to WebRender for hit testing.
Now that WebRender gives us the location of the hit tested point in the
display item, we can use that to calculate text index.

<!-- 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
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they shouldn't change behavior.

<!-- 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/18933)
<!-- Reviewable:end -->
2017-10-19 02:36:32 -05:00
Nicholas Nethercote
4506f0d30c Replace all uses of the heapsize crate with malloc_size_of.
Servo currently uses `heapsize`, but Stylo/Gecko use `malloc_size_of`.
`malloc_size_of` is better -- it handles various cases that `heapsize` does not
-- so this patch changes Servo to use `malloc_size_of`.

This patch makes the following changes to the `malloc_size_of` crate.

- Adds `MallocSizeOf` trait implementations for numerous types, some built-in
  (e.g. `VecDeque`), some external and Servo-only (e.g. `string_cache`).

- Makes `enclosing_size_of_op` optional, because vanilla jemalloc doesn't
  support that operation.

- For `HashSet`/`HashMap`, falls back to a computed estimate when
  `enclosing_size_of_op` isn't available.

- Adds an extern "C" `malloc_size_of` function that does the actual heap
  measurement; this is based on the same functions from the `heapsize` crate.

This patch makes the following changes elsewhere.

- Converts all the uses of `heapsize` to instead use `malloc_size_of`.

- Disables the "heapsize"/"heap_size" feature for the external crates that
  provide it.

- Removes the `HeapSizeOf` implementation from `hashglobe`.

- Adds `ignore` annotations to a few `Rc`/`Arc`, because `malloc_size_of`
  doesn't derive those types, unlike `heapsize`.
2017-10-18 22:20:37 +11:00
Martin Robinson
770b348091 Use WebRender to compute text index on click events
This is the second half of switching over to WebRender for hit testing.
Now that WebRender gives us the location of the hit tested point in the
display item, we can use that to calculate text index.
2017-10-18 09:15:55 +02:00
bors-servo
ca08271345 Auto merge of #18704 - mrobinson:wr-hit-testing, r=jdm,glennw,mbrubeck
Switch to using WebRender hit testing

This trades quite a bit of complicated code in Servo for few more
messages and a significant performance improvement. In particular,
WebRender can search the entire display list at once instead of
ping-ponging down the pipeline tree. This allows us to send mouse
events to the correct pipeline immediately.

<!-- 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
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they should not change behavior.

<!-- 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/18704)
<!-- Reviewable:end -->
2017-10-17 17:09:25 -05:00
Martin Robinson
b5d51dd263 Switch to using WebRender hit testing
This trades quite a bit of complicated code in Servo for few more
messages and a significant performance improvement. In particular,
WebRender can search the entire display list at once instead of
ping-ponging down the pipeline tree. This allows us to send mouse
events to the correct pipeline immediately.
2017-10-17 23:33:13 +02:00
Matt Brubeck
efc3683cc7 Fix commonmark Markdown warnings in docs, part 1
Fixes warnings from rust-lang/rust#44229 when `--enable-commonmark` is
passed to rustdoc.

This is mostly a global find-and-replace for bare URIs on lines by
themselves in doc comments.
2017-10-17 11:24:57 -07:00
Imanol Fernandez
8ae0739bab Implement DOM to texture 2017-10-16 20:56:53 +02:00
Simon Sapin
aa15dc269f Remove use of unstable box syntax.
http://www.robohornet.org gives a score of 101.36 on master,
and 102.68 with this PR. The latter is slightly better,
but probably within noise level.
So it looks like this PR does not affect DOM performance.

This is expected since `Box::new` is defined as:

```rust
impl<T> Box<T> {
    #[inline(always)]
    pub fn new(x: T) -> Box<T> {
        box x
    }
}
```

With inlining, it should compile to the same as box syntax.
2017-10-16 17:16:20 +02:00
Martin Robinson
0380431157 Combine ReflowGoal and ReflowQueryType
This simplifies the logic in the layout_thread and makes it clearer
which types of reflows generate display lists and cause display updates.
2017-09-30 16:06:48 +02:00
Anthony Ramine
378babfd4c Move STACK_ROOTS to dom::bindings::root 2017-09-27 14:16:05 +02:00
Anthony Ramine
8d566fbc3c Move script_runtime::StackRootTLS to root::ThreadLocalStackRoots 2017-09-27 13:58:59 +02:00
Anthony Ramine
f87c2a8d76 Rename Root<T> to DomRoot<T>
In a later PR, DomRoot<T> will become a type alias of Root<Dom<T>>,
where Root<T> will be able to handle all the things that need to be
rooted that have a stable traceable address that doesn't move for the
whole lifetime of the root. Stay tuned.
2017-09-26 09:49:10 +02:00
Anthony Ramine
577370746e Rename DOMRefCell<T> to DomRefCell<T>
I don't want to do such a gratuitous rename, but with all the other types
now having "Dom" as part of their name, and especially with "DomOnceCell",
I feel like the other cell type that we already have should also follow
the convention. That argument loses weight though when we realise there
is still DOMString and other things.
2017-09-26 09:49:08 +02:00
Anthony Ramine
c52fd0a780 Rename MutNullableJS<T> to MutNullableDom<T> 2017-09-26 09:49:02 +02:00
Anthony Ramine
7be32fb237 Rename JS<T> to Dom<T> 2017-09-26 09:48:55 +02:00
Anthony Ramine
0e3c54c191 Rename dom::bindings::js to dom::bindings::root 2017-09-26 02:19:05 +02:00
Alan Jeffrey
fbfb9a80b4 Remove sources of panic when laying out an iframe without a nested browsing context. 2017-09-22 09:04:18 -05:00
Anthony Ramine
52527d6f9d Rename Task to TaskBox 2017-09-20 10:07:29 +02:00
Anthony Ramine
46628fba05 Move Task to its own module 2017-09-18 02:47:04 +02:00
Anthony Ramine
8e78f18d2d Introduce MainThreadScriptMsg::DispatchJobQueue
This removes the last remaining use of Task::run_with_script_thread
2017-09-17 10:46:00 +02:00
Anthony Ramine
1d52df0562 Remove uses of AsyncJobHandler from script_thread 2017-09-17 10:27:02 +02:00
Anthony Ramine
f58207b851 Introduce MainThreadScriptMsg::RegisterPaintWorklet
This avoids the need for a generic task to send messages to the layout thread
through the main script thread.
2017-09-17 10:19:59 +02:00
Anthony Ramine
56117d3185 Rename Runnable to Task
The changes are:
 * `*Runnable` -> `*Task`;
 * `RunnableMsg` -> `Task`;
 * `RunnableWrapper` -> `TaskCanceller`;
 * `MainThreadRunnable` -> `MainThreadTask`;
 * `wrap_runnable` -> `wrap_task`;
 * `get_runnable_wrapper` -> `task_canceller`;
 * `handler` -> `run`;
 * `main_thread_handler` -> `run_with_script_thread`.
2017-09-16 15:43:26 +02:00
Anthony Ramine
52a6f63608 Introduce MainThreadScriptMsg::MainThreadRunnable
This will allow us to separate the types for tasks that must run on the main
script thread and regular tasks.
2017-09-16 15:10:07 +02:00
Anthony Ramine
7ca52152a6 Put the name of runnables in Debug for CommonScriptMsg 2017-09-16 03:47:17 +02:00
Anthony Ramine
7481ce177f Store a Rc<MicrotaskQueue> directly on Window 2017-09-13 14:27:45 +02:00
Anthony Ramine
7f9f95b7ce Store microtask queues in Rc<T> 2017-09-13 14:27:42 +02:00
Anthony Ramine
fe29037e89 Avoid a clone in ScriptThread::new 2017-09-13 14:27:40 +02:00