Commit graph

95 commits

Author SHA1 Message Date
Xidorn Quan
ab0e5c9d99 Switch column-count to use predefined integer type 2017-03-17 23:08:05 +11:00
Emilio Cobos Álvarez
95ccfa748e
Bug 1303229: Get the proper viewport size for stylo. r=heycam
At least until we support scrollbars properly, this size is going to be the
correct one. I've left a TODO to grab the proper one once we support it.

This allows to trivially test viewport units for now.

MozReview-Commit-ID: JdaZ6WlZ2C6
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-03-11 11:54:12 +01:00
Pu Xingyu
336aa795b4 Remove cached thread local context from LayoutContext
Remove cached thread local context from LayoutContext, use LayoutContext for
assign_inline_sizes(), and simplify the parallel flow traversal code.
2017-02-08 08:47:54 +08:00
Martin Robinson
29876d2703 Rework the way scroll roots are collected
Collect scroll roots during the collect_stacking_context phase instead
of during display list construction. This will be useful in order to
collect containing block scroll roots as well as to give scroll roots
sequential ids in the future. This change also pulls stacking context
children out of the StackingContext struct itself, which should reduce
very slightly the memory used by the finished display list. This also
simplifies the DisplayListBuilder because it no longer has to maintain
a stack of ScrollRootIds and StackingContextIds and can instead just
rely on the program stack.
2017-01-10 13:33:08 +01:00
Bobby Holley
648ce1e44e Make the DomTraversalContext own the SharedStyleContext and share it immutably across the traversal.
This allows us to get rid of a bunch of lifetimes and simplify a lot of code. It
also lets us get rid of that nasty lifetime transmute, which is awesome.

The situation with thread-local contexts is still suboptimal, but we fix that in
subsequent patches.
2016-12-16 10:57:27 -08:00
Nick Price
64a95f6410 Update layout component and helper to use LengthOrNormal 2016-12-11 08:50:06 -05:00
J. Cliff Dyer
5821ff77db Convert column-width to use Either
Fixes #14350
2016-12-01 15:17:51 +05:30
Michael Howell
5f320bd2ca Make FlowRef a newtype
This creates a sharp distinction between `Arc<Flow>`s, which may be
owned by anyone, and `FlowRef`s, which may only be owned by the
traversal code. By checking the reference count, we ensure that a `Flow`
cannot be pointed to by `Arc`s and `FlowRef`s simultaneously.

This is not a complete fix for #6503, though it is a necessary start
(enforcing the no-aliasing rule of `FlowRef::deref_mut` will require far
more work).

Fixes #14014
2016-11-04 13:36:04 -07:00
Martin Robinson
71d285af80 Use a new id type for tracking scrolling areas
This is a step in disassociating scrolling areas from stacking
contexts. Now scroll areas are defined by unique ids, which means that
in the future stacking context will be able to contain more than one.
2016-10-30 21:10:04 +01:00
Patrick Walton
be252371ea layout: Refactor Flow::from_fragment-style constructors to be
consistent.
2016-10-26 14:04:08 -07:00
Martin Robinson
066775915c Simplify stacking context collection
Simplify the way that stacking contexts are collected. Instead of
passing the StackingContextId down the tree, pass the parent
StackingContext itself. This will allow future patches to get more
information about the parent stacking context (such as location).

Also remove the return value of collect_stacking_contexts, which was
unused.
2016-09-27 10:48:44 +02:00
Ms2ger
871c207c44 Pass SharedLayoutContext to Flow::compute_absolute_position. 2016-08-24 10:12:38 +02:00
Martin Robinson
6259df5e2d Update to euclid 0.8 2016-08-12 03:12:06 +02:00
Simon Sapin
6d0e48f6cc Remove some type aliases that are now just re-exports. 2016-07-20 08:42:47 +02:00
Simon Sapin
789807b7b0 Remove the ComputedValue traits and style_struct_traits 2016-07-20 08:42:40 +02:00
Anthony Ramine
51ff916e09 Move util::print_tree to gfx_traits 2016-07-04 15:47:06 +02:00
Ms2ger
ea45e76840 Pass SharedStyleContext to assign_inline_sizes. 2016-06-22 14:50:04 +02:00
Ms2ger
ea15f69404 Pass SharedStyleContext to compute_inline_sizes. 2016-06-22 14:31:05 +02:00
Ms2ger
21b8d2bd91 Pass SharedStyleContext to propagate_assigned_inline_size_to_children. 2016-06-22 14:28:14 +02:00
Patrick Walton
a86f77e36d script: Keep the DOM-side viewport up to date when scrolling happens in
WebRender.

This happens asynchronously, just as it does in non-WebRender mode.

This functionality is a prerequisite for doing proper display-list-based
hit testing in WebRender, since it moves the scroll offsets into Servo
(and, specifically, into the script thread, enabling iframe event
forwarding) instead of keeping them private to WebRender.

Requires servo/webrender_traits#55 and servo/webrender#277.

Partially addresses #11108.
2016-05-31 14:12:51 -07:00
Per Lundberg
4cb4cc93e4 Renamed TComputedValues to ComputedValues
This is a followup to #10210, and a continuation of #10185.
2016-03-29 23:30:13 +03:00
Per Lundberg
c2ad084713 ComputedValues is now ServoComputedValues
This is the first part of #10185. More to follow. I have built this locally with both servo and geckolib without errors; let's see if it succeeds on all platforms as well.
2016-03-27 10:55:43 +03:00
Bobby Holley
c2daea2c9c Parameterize the rest of the style system on TNode. 2016-03-24 11:50:57 -07:00
Patrick Walton
4233e0f163 gfx: Box stacking contexts to minimize memmove traffic.
`memmove` was showing up high in the profile when concatenating and
shorting display lists. This change drastically reduces the `memmove`
cost in exchange for some minor additional allocation cost.
2016-03-03 13:09:48 -08:00
Martin Robinson
e7019f2721 Flatten display list structure
Instead of producing a tree of stacking contexts, display list
generation now produces a flat list of display items and a tree of
stacking contexts. This will eventually allow display list construction
to produce and modify WebRender vertex buffers directly, removing the
overhead of display list conversion.  This change also moves
layerization of the display list to the paint thread, since it isn't
currently useful for WebRender.

To accomplish this, display list generation now takes three passes of
the flow tree:

        1. Calculation of absolute positions.
        2. Collection of a tree of stacking contexts.
        3. Creation of a list of display items.

After collection of display items, they are sorted based upon the index
of their parent stacking contexts and their position in CSS 2.1
Appendeix E stacking order.

This is a big change, but it actually simplifies display list generation.
2016-03-01 14:50:07 -08:00
Anthony Ramine
db8d502f41 Move util::logical_geometry to style 2016-02-18 10:17:13 +01:00
Patrick Walton
7c5b2d6cb3 layout: Separate out overflow-for-scrolling from overflow-for-paint.
Closes #9484.
2016-02-03 16:06:24 -08:00
Simon Sapin
5498b54347 Add Multicolumn support block fragmentation. 2016-01-28 09:43:14 +01:00
Simon Sapin
359b984348 Multicol: compute the width of columns based on column-width and column-count. 2016-01-28 09:43:14 +01:00
Simon Sapin
9abbd1b5d1 Sequentialize assign_block_size for flows that can be fragmented.
Fragmentation will be intertwined with block size calculation.
2016-01-28 09:42:17 +01:00
Martin Robinson
8dd664a438 Improve readability of flow tree dump
Use the PrintTree utility to improve the readability of flow tree
dumps. Blocks and fragments are now split over two dump levels, because
otherwise they are impenetrable. Also start printing the restyle damage of
fragments.
2015-11-23 15:17:32 -08: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
Manish Goregaokar
54c036cd66 Elide most 'a lifetimes 2015-09-04 08:55:51 +05:30
Johann Tuffe
ec07178b6f sort all uses 2015-08-20 20:47:12 +08:00
Corey Farwell
6aaada64dc flow::Flow should follow *_mut naming conventions
Fixes #7148
2015-08-18 09:12:01 -04:00
Patrick Walton
ed4172b2c6 layout: Make sure anonymous table flows are statically positioned.
The failing `float-applies-to-*` CSS 2.1 tests never really should have
been passing in the first place; they depend on floats inside
fixed-layout tables working properly, which they don't.

Closes #6078.
Closes #6709.
Closes #6858.
2015-08-06 18:49:07 -07:00
Glenn Watson
9e5687e3e7 Implement offsetParent/Top/Left/Width/Height. 2015-08-03 11:55:38 +10:00
Glenn Watson
7dbffeed20 Fix panic when html element has display: table. 2015-07-31 16:40:06 +10:00
ecoal95
8cbfb3482c Use euclid from crates.io 2015-06-19 00:04:24 +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
Patrick Walton
1f0b5889da layout: Allow inline elements to be containing blocks for
absolutely-positioned elements.

This also implements a little bit of the infrastructure needed to
support for fragmentation via support for multiple positioned fragments
in one flow.

Improves Google.
2015-05-13 12:00:53 -07:00
Simon Sapin
544a02a250 Refactor flow construction to make float less of a special case. 2015-04-29 02:47:46 +02:00
Simon Sapin
cc4749373a Add MulticolFlow and use it for multicol elements.
It currently "inherits" from BlockFlow and does not override anything.
2015-04-29 02:29:33 +02:00