Commit graph

58 commits

Author SHA1 Message Date
GauriGNaik
996e9e06b2 Defined new trait ParseErrorReporter and added error_reporter member to ParserContext 2015-11-25 18:28:30 -05:00
Patrick Walton
e881f0feeb Write animated values into the ComputedValues structures when
animations complete or are interrupted.

This adds a new pair of reader-writer locks. I measured the performance
of style recalculation on Wikipedia and the overhead of the locks was
not measurable.

Closes #7816.
2015-11-24 19:50:52 -06:00
Ms2ger
5462afaa8f Remove the unsafe Sync implementation for SharedLayoutContext. 2015-11-07 11:23:50 +01:00
Ms2ger
647232a495 Wrap SharedLayoutContext::stylist in a wrapper to make it Sync. 2015-11-07 11:23:49 +01:00
Ms2ger
e9b77628ce Wrap SharedLayoutContext::canvas_layers_sender in a Mutex. 2015-11-07 11:23:48 +01:00
Ms2ger
8fc75704c9 Wrap SharedLayoutContext::new_animations_sender in a Mutex. 2015-11-07 11:23:47 +01:00
Ms2ger
552a03fde6 Wrap SharedLayoutContext::font_cache_task in a Mutex. 2015-11-07 11:23:44 +01:00
Ms2ger
32bb4044fd Remove unused SharedLayoutContext::constellation_chan. 2015-11-07 11:23:42 +01:00
Ms2ger
bcd541c02c Wrap SharedLayoutContext::image_cache_sender in a Mutex. 2015-11-07 11:23:41 +01:00
Ms2ger
1c11bd09df Remove unused SharedLayoutContext::layout_chan. 2015-11-07 11:23:39 +01:00
Patrick Walton
3ae5f04bd1 layout: Store viewport and screen size separately.
Fixes a bug whereby all nodes would get unconditionally reflowed on
every layout event if the page set a viewport.
2015-11-03 13:12:45 -08:00
Ms2ger
c693e13a2c Remove the reflow root from SharedLayoutContext. 2015-10-26 17:51:28 +01:00
Glenn Watson
339a3f869b Split Au type into separate crate, with minimal dependencies. 2015-10-01 07:16:11 +10:00
Ravi Shankar
889eec364b sorted the extern crate, mod & use declarations 2015-09-24 02:12:45 +05:30
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
Patrick Walton
757e2cf4e5 layout: Reformat some long lines and fix some whitespace issues. 2015-09-17 13:31:17 +02:00
Mathieu Rheaume
7320433cca Remove 'get_*' on getters as per RFC 0344 on various components 2015-09-12 20:14:01 -04:00
Johann Tuffe
ec07178b6f sort all uses 2015-08-20 20:47:12 +08:00
Josh Matthews
8bb853f643 Fix existing syntactics nits. 2015-08-16 10:30:43 -04:00
Patrick Walton
11822f3eb1 layout: Remove the now-useless dirty field from the layout context.
At this point the only thing it does is to try to avoid adding display
items that are outside the root scrollable area, which is both wrong
(since it's incompatible with having scrollable areas outside the root)
and is useless (because we have displayports now).
2015-08-10 21:27:03 -07:00
Patrick Walton
7349b6ac28 layout: Tie transitions to the DOM node and finish them instantly when
new styles are set.

Tying transitions to the DOM node avoids quadratic complexity when
updating them.

Finishing transitions instantly when styles are updated makes our
behavior more correct.
2015-08-01 23:01:43 -07:00
Patrick Walton
82b53d83ff script: Make the ImageCacheTask use IPC.
This necessitated getting rid of the boxed trait object that was being
be passed between the script task and the image cache task.
2015-07-26 23:07:44 -07:00
Patrick Walton
bb99b2f3c8 script: Make most of 2D canvas and WebGL run over IPC.
To actually make the multiprocess communication work, we'll need to
reroute the task creation to the pipeline or the compositor. But this
works as a first step.
2015-07-25 00:50:12 -07:00
Glenn Watson
4f28c93f40 Restore exit after load command line flag.
Also updates glutin with a crash fix that was exposed by this patch.
2015-07-20 11:19:13 +10:00
Ms2ger
270f0aafed Reduce the scope of the allowed unsafe code in context.rs.
Since I made unsafe code opt-in in layout, the unsafe code in this module has
been reduced to a single unsafe impl, so there is no reason to allow it in
the entire module.
2015-07-08 11:28:59 +02:00
Ms2ger
028484526d Require that WorkQueue's QueueData is Sync rather than Send. 2015-07-07 11:11:46 +02:00
Ms2ger
24730f1078 Borrow the QueueData for WorkQueue::run.
This allows us to get rid of the raw pointers and unsafe dereferencing in
the parallel layout implementation.
2015-07-04 08:55:48 +02:00
ecoal95
8cbfb3482c Use euclid from crates.io 2015-06-19 00:04:24 +02:00
Nicholas Nethercote
48a0725c01 Measure LocalLayoutContexts in LayoutTask and LayoutWorkers.
The FreeType instances in layout workers are reasonably large and worth
measuring. The one in LayoutTask is smaller but it's easy to measure at the
same time. Sample output:
```
|    8.33 MiB -- pages
|       8.33 MiB -- url(file:///home/njn/moz/servo/../servo-static-suite/wikipedia/Guardians%20of%20the%20Galaxy%20(film)%20-%20Wikipedia,%20the%20free%20encyclopedia.html)
|          1.32 MiB -- layout-worker-0-local-context
|          1.31 MiB -- layout-worker-1-local-context
|          1.24 MiB -- layout-worker-3-local-context
|          1.17 MiB -- layout-worker-4-local-context
|          1.08 MiB -- layout-worker-2-local-context
|          1.06 MiB -- layout-worker-5-local-context
|          0.78 MiB -- paint-task
|             0.78 MiB -- buffer-map
|          0.38 MiB -- layout-task
|             0.30 MiB -- display-list
|             0.07 MiB -- local-context
```
This required adding a mechanism to WorkQueue to measure worker TLSes.
2015-06-10 21:06:59 -07:00
Corey Farwell
4f47b41fa7 Remove fnv & smallvec crate reexports from util
The util component specified fnv and smallvec as dependencies and publicly
reexported both of them. Several other components utilized these reexports,
presumably because fnv and smallvec used to live in the tree so reexporting
made the transition easier.

These indirect dependencies through the util component are unnecessary.

This commit removes the fnv & smallvec crate reexports in the util component.
It exchange, it adds fnv & smallvec as dependencies to non-util components
wherever needed. Finally, it removes the fnv dependency from util as it is not
utilized anywhere in the util component.
2015-06-10 07:14:55 -07:00
Nicholas Nethercote
9b4d39d6d1 Make LOCAL_CONTEXT_KEY safe and non-leaky.
`LOCAL_CONTEXT_KEY` is currently a `Cell<*mut LocalLayoutContext>`. The use
of the raw pointer means that the `LocalLayoutContext` is not dropped when
the thread dies; this leaks FreeType instances and probably other
things. There are also some unsafe getter functions in `LayoutContext`
(`font_context`, `applicable_declarations_cache` and
`style_sharing_candidate_cache`) that @eddyb says involve undefined
behaviour.

This changeset changes `LOCAL_CONTEXT_KEY` to
`RefCell<Option<Rc<LocalLayoutContext>>>`. This fixes the leak and also
results in safe getters.

(Fixes #6282.)
2015-06-04 20:57:34 -07:00
Simon Sapin
18f69f2c87 Fix a rustup warning. std::box::into_raw is now safe. 2015-06-02 15:31:52 +02:00
bors-servo
77099b25d5 Auto merge of #5586 - pcwalton:no-broken-background-image-redux, r=glennw
r? @jdm

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5586)
<!-- Reviewable:end -->
2015-05-20 16:43:31 -05:00
Patrick Walton
7e7675c1dc net: Don't load the placeholder image for background images, only for
image fragments.

This also changes the way the placeholder is handled in the image cache
task to decode it up front instead of each time an image fails to load,
both because it was more convenient to implement that way and because
it saves CPU cycles to do so.

This matches the behavior of Gecko and WebKit. It improves the look of
our cached copy of Wikipedia.
2015-05-20 12:00:33 -07:00
ecoal95
3350522306 Layerize canvas
Note that this keeps using readback right now, `NativeSurface` painting
will be implemented soon.

Also see https://github.com/servo/servo/issues/6142
2015-05-20 19:10:50 +02:00
Patrick Walton
6a197719b3 compositing: Implement display ports and avoid creating display lists
for items outside it.

This improves Servo's performance on large pages.
2015-05-19 16:53:51 -07:00
Glenn Watson
a5a5214783 Various fixes to getClientBoundingRect()
* Fix queries involving stacking contexts
 * The code was double accumulating stacking context origins.
* Handle queries of inline elements.
 * The node addresses being compared were incorrect (CharacterData vs. Span)
* Handle ScriptQuery reflows correctly.
 * The layout task was skipping the compute absolute positions traversal, so failed before window.onload.
2015-05-01 12:40:37 +10:00
Glenn Watson
d8aef7208e Refactored image cache task - details below.
* Simpler image cache API for clients to use.
 * Significantly fewer threads.
   * One thread for image cache task (multiplexes commands, decoder threads and async resource requests).
   * 4 threads for decoder worker tasks.
 * Removed ReflowEvent hacks in script and layout tasks.
   * Image elements pass a Trusted<T> to image cache, which is used to dirty nodes via script task. Previous use of Untrusted addresses was unsafe.
   * Image requests such as background-image on layout / paint threads trigger repaint only rather than full reflow.
 * Add reflow batching for when multiple images load quickly.
   * Reduces the number of paints loading wikipedia from ~95 to ~35.
 * Reasonably simple to add proper prefetch support in a follow up PR.
 * Async loaded images always construct Image fragments now, instead of generic.
   * Image fragments support the image not being present.
 * Simpler implementation of synchronous image loading for reftests.
 * Removed image holder.
 * image.onload support.
 * image NaturalWidth and NaturalHeight support.
 * Updated WPT expectations.
2015-04-23 09:40:24 +10:00
Gilles Leblanc
ba36a108c1 Split out shared networking code into net_traits crate
Fixes #4476
2015-04-03 13:38:10 -04:00
Patrick Walton
66dd8c8a6c layout: Implement CSS transitions per CSS-TRANSITIONS § 2.
Transition events are not yet supported, and the only animatable
properties are `top`, `right`, `bottom`, and `left`. However, all other
features of transitions are supported. There are no automated tests at
present because I'm not sure how best to test it, but three manual tests
are included.
2015-03-31 08:46:11 -07:00
Ms2ger
9904216d76 Use u32 for generation numbers. 2015-03-28 22:46:16 +01:00
Manish Goregaokar
3479d3fa7f Replace unsafe_blocks by unsafe_code. 2015-03-21 10:27:32 +01:00
James Gilbertson
fafc357308 Fix broken viewport percentage length units after a viewport resize.
When a viewport is resized, the computed values for a style containing viewport percentage length units become stale. However, there's no way for those styles to be invalidated after a resize. As a solution, this commit invalidates the computed values cache after a resize has occurred, which is probably over-kill.

A better solution would probably be to track under what conditions computed values remain valid, and invalidate them as indicated.
2015-03-08 13:06:27 -06:00
Dan Fox
559ff68b31 Get rid of servo_util 2015-03-05 17:42:05 +00:00
Ms2ger
1059115865 Use boxed::into_raw in create_or_get_local_context. 2015-02-12 22:58:08 +01:00
Ms2ger
a09a912178 Import net as net rather than servo_net. 2015-02-10 12:55:24 +01:00
Ms2ger
b2fcc2397e Import msg as msg rather than servo_msg. 2015-02-10 11:40:36 +01:00
Ms2ger
7c6b03abfe Opt-in rather than opt-out to unsafe blocks in layout. 2015-02-08 20:03:27 +01:00
Simon Sapin
d13d36f57f End the libstyle 'pub use' madness. 2015-01-30 15:08:29 +01:00
Ms2ger
1b3e368bcd Don't shadow lifetimes in layout. 2015-01-28 14:44:32 +01:00