Commit graph

123 commits

Author SHA1 Message Date
Matt Brubeck
37dd2a654d Don't use image metadata for layout when rendering to a file
PR #9208 added the ability to perform layout before an `<img>` resource is
fully loaded. However, when we are rendering to an image file for testing
purposes, we need to block until the image content is fully loaded (until
issue #9441 is fixed).

Fixes #9550.
2016-02-25 13:47:27 -08:00
Emilio Cobos Álvarez
dd503dfacb Refactor style to be completely backend-independent
This commit refactors the style crate to be completely independent of
the actual implementation and pseudo-elements supported.

This also adds a gecko backend which introduces parsing for the
anonymous box pseudo-elements[1], although there's still no way of
querying them.

https://mxr.mozilla.org/mozilla-central/source/layout/style/nsCSSAnonBoxList.h
2016-02-13 16:05:14 +01:00
bors-servo
87aaa5ffe0 Auto merge of #9523 - ruud-v-a:hasher, r=Wafflespeanut
Upgrade to new Hasher API

This fixes #9494.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9523)
<!-- Reviewable:end -->
2016-02-05 07:32:13 +05:30
bors-servo
2a6707ce58 Auto merge of #9532 - nox:dedup-heapsize, r=Manishearth
Say farewell to in-tree HeapSizeOf

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9532)
<!-- Reviewable:end -->
2016-02-05 03:40:36 +05:30
Anthony Ramine
cb5cd8d881 Say farewell to in-tree HeapSizeOf 2016-02-04 22:03:32 +01:00
Bobby Holley
a77a5ecb16 Implement StandaloneStyleContext::new. 2016-02-03 18:39:16 -08:00
Ruud van Asseldonk
95be0b9a25 Upgrade to new Hasher API 2016-02-03 20:06:39 +01:00
jmr0
167ffa7a95 adding image metadata notification capabilities to image cache 2016-01-29 20:54:49 -05:00
Kishor Bhat
4c5eeb1f58 Remove unused imports in layout 2016-01-17 13:17:23 +05:30
Ms2ger
74f6c9b74f Update to rustc 1.7.0-nightly (b4707ebca 2015-12-27) 2016-01-14 14:56:18 -06:00
rohan.prinja
1f02c4ebbb task -> thread 2016-01-10 17:58:13 +09:00
Bobby Holley
bf1a7d243f Remove the dependency of parallel DOM traversal and style calculation on LayoutContext. 2016-01-06 18:24:18 -08:00
Bobby Holley
a05d7f1dfd Hoist style-related context bits into style/.
We do a few things-here:
* Hoist non-layout-dependent fields in SharedLayoutData and LocalLayoutData into style/.
* Hoist parts of css/matching.rs into style/.
* Hoist parts of layout/animation.rs into style/animation.rs.
* Remove the duplicated-but-slightly-different definition of OpaqueNode.
2015-12-29 12:07:07 -08:00
Brandon Fairchild
637afecec9 Move LayerKind and ScrollPolicy enums to gfx_traits
This also moves LayerId and LayerProperties to gfx_traits.

Fixes #8836.
2015-12-20 20:43:31 -05:00
GauriGNaik
fc81276c8e Add pipeline information to CSS error reporting. 2015-12-14 11:18:30 -05:00
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