Commit graph

133 commits

Author SHA1 Message Date
rohan.prinja
1f02c4ebbb task -> thread 2016-01-10 17:58:13 +09:00
Bobby Holley
3b33174163 Review nits: Narrowly scoping unsafety, and expanding comment. 2016-01-07 11:17:31 -08:00
Bobby Holley
f9a02f0aba Hoist the style parts of traversal.rs into style/. 2016-01-06 18:50:16 -08: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
ebc5eb1b98 Make parallel DOM traversal and style calculation operate on TNode instead of LayoutNode. 2016-01-06 17:58:53 -08:00
Bobby Holley
513a75d86a Hoist the rest of css/matching.rs into style/. 2016-01-04 09:41:31 -08:00
Bobby Holley
94b0789a5f Remove the dependency of css/matching.rs on SharedLayoutContext. 2016-01-04 09:38:04 -08:00
Bobby Holley
08f2a24552 Remove the dependency of css/matching.rs on concrete RestyleDamage.
We can make this easier by inlining helper method implementations in the traits themselves,
which makes the code more compact as a nice side-effect.
2016-01-04 09:38:04 -08:00
Bobby Holley
27987c3bb4 Introduce a concept of restyle damage to the style system.
We can't hoist RestyleDamage itself, because it's very layout-dependent. But this
should be enough to let us hoist the things we need.
2016-01-04 09:38:04 -08:00
Bobby Holley
947134949a Refactor parallel dom traversal to be agnostic to the processing steps themselves. 2016-01-04 09:38:04 -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
Bobby Holley
47059d2d26 Separate style+layout and layout-specific wrapper functionality.
This patch does a number of things, unfortunately all at once:
* Hoists a large subset of the layout wrapper functionality into the style system.
* Merges TElementAttributes into the newly-created TElement.
* Reorganizes LayoutData by style vs layout, and removes LayoutDataShared.
* Simplifies the API for borrowing style/layout data.

There's still more to do to make the style system usable standalone, but
this is a good start.
2015-12-29 11:50:03 -08:00
Bobby Holley
cf33f00018 Generalize the rest of layout to operate on generic Layout*.
There wasn't a good way to split this up, unfortunately.

With this change, the only remaining usage of the Servo-specific structures is
in layout_task, where the root node is received from the script task. \o/
2015-11-28 18:01:02 -08:00
Bobby Holley
afa3834f3b Rename ThreadSafeLayoutFoo to ServoThreadSafeLayoutFoo and TThreadSafeLayoutFoo to ThreadSafeLayoutFoo. 2015-11-21 11:26:49 -08:00
Bobby Holley
a85ae24c51 Hoist exported ThreadSafeLayoutFoo functionality into traits. 2015-11-21 11:25:20 -08:00
bors-servo
8b6bfb615a Auto merge of #8628 - mrobinson:damage-bits, r=pcwalton
Clean up restyle damage after it no longer applies

BUBBLE_ISIZES and REPAINT can become "stuck" on in the default Servo
configuration once they are activated. This is solved by removing these
damage bits after they no longer apply. There isn't a good way to test
this, other than noting that it doesn't break any existing CSS tests.
This will become more important in the future as the REPAINT bit is used
to implement display list patching.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8628)
<!-- Reviewable:end -->
2015-11-21 04:44:28 +05:30
Martin Robinson
90e2f7bfbf Clean up restyle damage after it no longer applies
BUBBLE_ISIZES and REPAINT can become "stuck" on in the default Servo
configuration once they are activated. This is solved by removing these
damage bits after they no longer apply. There isn't a good way to test
this, other than noting that it doesn't break any existing CSS tests.
This will become more important in the future as the REPAINT bit is used
to implement display list patching.
2015-11-20 11:57:58 -08:00
Bobby Holley
2f6e94943a Rename Layout*Trait to Layout*.
The next step will be to remote the Servo-specificity of the layout code we want
to share by making it operate generically on Layout*.
2015-11-18 17:24:36 -08:00
Bobby Holley
9dd45b9f2a Prefix concrete types with 'Servo'. 2015-11-18 17:23:46 -08:00
Bobby Holley
54f2700ba6 Hoist exported wrapper functionality into a family of traits.
All the existing code still uses the concrete implementations, so this
shouldn't impact the generated code at all.
2015-11-18 17:23:29 -08:00
Ms2ger
647232a495 Wrap SharedLayoutContext::stylist in a wrapper to make it Sync. 2015-11-07 11:23:49 +01:00
Glenn Watson
695b7491fe Change overflow calculation to be calculated after compute_absolute_position.
Also include absolutely positioned elements in the overflow rect calculation.

Fixes #7797.
2015-11-03 20:10:06 +10:00
Ms2ger
9f91984415 Use the passed-in reflow root rather than the one stored in the SharedLayoutContext. 2015-10-26 17:51:26 +01:00
Bobby Holley
228eff7272 Remove HAS_DIRTY_SIBLINGS.
This isn't doing anything right now, and we're not even setting it properly
in dirty_impl the |dirty_subtree(self)| was causing us to hit the skip case
for step 3.
2015-10-21 09:56:07 -07:00
Ms2ger
2bfca9cace Remove the boolean shareable flag in RecalcStyleForNode::process. 2015-10-19 15:01:31 +02:00
Ms2ger
843629b29f Remove the unused boolean in StyleSharingResult::CannotShare. 2015-10-19 15:01:30 +02:00
Ms2ger
f3faaa6b01 Define share_style_if_possible on LayoutElement. 2015-10-19 15:01:29 +02:00
Ms2ger
604601f1f4 Return the result from match_element rather than using an outparam. 2015-10-19 15:01:27 +02:00
Ms2ger
5c7dc4c633 Define match_node on LayoutElement as match_element. 2015-10-19 15:01:26 +02:00
Matt Brubeck
52eda16cca Remove unused PostorderDomTraversal::should_prune 2015-10-01 10:01:07 -07:00
Eli Friedman
f0da2a3701 Delete dead code.
(#[cfg(debug)] is false in every normal servo configuration, and the
code in question doesn't compile.)
2015-09-26 00:23:03 -07: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
475d358b21 layout: Fix tidy failures. 2015-09-01 08:37:41 -07:00
Patrick Walton
b66f17a445 layout: Make overflow calculation take relative percentages into
account.

This necessitated changing overflow to be calculated by the parent flow
if relatively positioned children are present. That is because the
overflow regions cannot be calculated without knowing relative offsets,
which themselves cannot be calculated without knowing the parent size
(because of percentages). To accomplish this without sacrificing
parallelism in the non-relative case, this patch splits overflow into
"early" and "late" computation. Late overflow computation cannot be
parallelized across children, while early overflow computation can.

Makes the "Apple Music" text show up over the full-bleed promotional
background on apple.com.
2015-08-31 16:50:56 -07:00
Johann Tuffe
ec07178b6f sort all uses 2015-08-20 20:47:12 +08:00
Ms2ger
3984e39011 Replace the StyledNode trait with inherent methods. 2015-07-27 19:57:33 +02:00
Simon Sapin
055a1c5cee Update rust-selectors
Update for https://github.com/servo/rust-selectors/pull/37
2015-07-23 18:53:57 +02:00
Ms2ger
4b08cea663 Scope the allowed unsafe code in traversal.rs. 2015-07-17 11:41:06 +02:00
Ms2ger
3e2c44114c Move the traversal traits into the traversal module. 2015-07-17 11:40:40 +02:00
Michael Wu
1a014beb08 Remove LayoutChan from LayoutDataWrapper 2015-07-04 03:54:40 -04:00
Simon Sapin
9e1a674b16 Update rust-selectors 2015-06-26 12:35:08 -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
Corey Farwell
8e3f4bba85 Reduce max line length from 150 to 120 characters
Part of https://github.com/servo/servo/issues/6041
2015-05-24 00:01:49 -04: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
Patrick Walton
72f031e2a1 layout: Support inline incremental reflow, and stop reconstructing all
flows when mousing over the document.

This exposes more "jumpiness" on sites like Hacker News, but the bug
that causes it was pre-existing.
2015-05-19 11:08:27 -07:00
Patrick Walton
b026a8ecf6 layout: Store overflow for flows impacted by floats.
Makes qz.com visible.

In order to work around a compiler bug involving Sized, this patch moves
`store_overflow` to be a virtual method.
2015-05-11 12:59:55 -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
Ms2ger
903305416a Implement Clone for Copy types. 2015-04-28 23:31:10 +02:00
Ms2ger
a65c80231a Stop using u/i suffixes in layout. 2015-04-02 15:14:09 +02:00