Commit graph

294 commits

Author SHA1 Message Date
Corey Farwell
5c408d2be9 rust-geom API changes
https://github.com/servo/rust-geom/pull/81
2015-06-13 12:28:21 -07: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
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
Simon Sapin
ef8edd4e87 Upgrade to rustc 551a74dddd84cf01440ee84148ebd18bc68bd7c8. 2015-05-05 10:07:34 -04:00
bors-servo
1e150140bd Auto merge of #5480 - SimonSapin:multicol, r=pcwalton
This add some properties to the style system and a new flow type, but the larger issues of dealing with fragmentation in the flow tree is still an open question.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5480)
<!-- Reviewable:end -->
2015-04-28 19:48:45 -05: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
bors-servo
0a4db7ae0f Auto merge of #5889 - pcwalton:remove-absolute-static-i-offset, r=glennw
They haven't been used for hypothetical box calculation in quite some
time.

r? @glennw

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5889)
<!-- Reviewable:end -->
2015-04-28 18:30:38 -05:00
Patrick Walton
132658856f layout: Remove absolute_static_i_offset and fixed_static_i_offset.
They haven't been used for hypothetical box calculation in quite some
time.
2015-04-28 15:39:44 -07:00
Ms2ger
903305416a Implement Clone for Copy types. 2015-04-28 23:31:10 +02:00
Patrick Walton
48299a53cb layout: Implement most of border-collapse per CSS 2.1 § 17.6.2.
Known issues:

* Collapsed borders do not correctly affect the border-box of the table
  itself.

* The content widths of all cells in a column and the content height of
  all cells in a row is the same in this patch, but not in Gecko and
  WebKit.

* Corners are not painted well. The spec does not say what to do here.

* Column spans are not handled well. The spec does not say what to do
  here either.
2015-04-27 17:12:07 +02:00
Ms2ger
4d41f1c991 Stop using the deprecated range function. 2015-04-22 20:26:40 +02:00
Patrick Walton
acd08c67c6 layout: Use the same code path for computing static positions of regular
flows and static positions of hypothetical boxes.

Before this change, Servo used one code path that computed the position
of flows with `position: static` or `position: relative` and another
separate code path that computed the position of flows with `position:
absolute` or `position: fixed`. The latter code attempted to duplicate
the former code to determine the static position of hypothetical boxes,
but this was both fragile and incorrect in the case of hypothetical
boxes nested inside floats. In fact, it's impossible to determine the
static position of an absolute flow relative to its containing block at
inline-size assignment time, because that static position could depend
on a float that cannot be placed until block-size assignment!

This patch changes block layout to use the same code path for static
positioning of regular flows and static positioning of absolute flows
where applicable. This both simplifies the code and improves its
efficiency, since it allows the `hypothetical_position` field and
`static_block_offsets` data structure to be removed. Moreover, it
improves correctness in the above case (which the new reftest checks).
This allows the sidebar in Facebook Timeline to be positioned properly.
2015-04-14 13:00:10 -07:00
Ms2ger
31c6a3977f Use usize in flow.rs. 2015-04-02 14:55:43 +02:00
Ms2ger
588143149c Use u32 for ImmutableFlowUtils::dump_with_level. 2015-04-02 14:55:25 +02:00
Patrick Walton
4011291bf2 layout: Stop rebuilding all inline-block flows unconditionally, and
bubble intrinsic inline sizes as necessary when doing incremental
reflow.
2015-04-01 10:52:15 -07:00
Ms2ger
da1e3a3f11 Use usize for debug ids. 2015-03-28 22:37:41 +01:00
Ms2ger
37c271a260 Use usize and u32 for LayerId. 2015-03-28 15:36:36 +01:00
Manish Goregaokar
3479d3fa7f Replace unsafe_blocks by unsafe_code. 2015-03-21 10:27:32 +01:00
Ms2ger
1604515fd9 Fix various build warnings. 2015-03-20 17:57:49 +01:00
Jack Moffitt
237150fa49 Fix memory leak in flow tree by adding weak refs.
Cycles were being created in the flow tree since absolutely positioned
descendants had pointers to their containing blocks. This adds
WeakFlowRef (based on Weak<T>) and makes these backpointers weak
references. This also harmonizes our custom Arc<T>, FlowRef, to be
consistent with the upstream implementation.

Fixes #4915.
2015-03-16 12:53:16 -06:00
Patrick Walton
f9cdd05d58 layout: Implement ordered lists, CSS counters, and quotes per CSS 2.1
§ 12.3-12.5.

Only simple alphabetic and numeric counter styles are supported. (This
is most of them though.)

Although this PR adds a sequential pass to layout, I verified that on
pages that contain a reasonable number of ordered lists (Reddit
`/r/rust`), the time spent in generated content resolution is dwarfed by
the time spent in the parallelizable parts of layout. So I don't expect
this to negatively affect our parallelism expect perhaps in pathological
cases.
2015-03-09 17:13:45 -07:00
Matt Brubeck
cabbbcc978 Keep track of the containing block writing mode.
This is necessary for correctly converting `relative_containing_block_size`
to physical coordinates.
2015-03-09 14:22:36 -07:00
Matt Brubeck
8221bfc3ef Layout fixes for RTL child flows in LTR parents
...and vice-versa.  This is not a complete fix for all mixed-direction layout
cases, but it fixes enough problems to make some simple test cases pass, like
tha attached reftest.

There are FIXME comments for many of the remaining issues.  In particular,
this does not yet handle RTL layout of fixed/absolute elements.
2015-03-09 14:21:26 -07:00
Dan Fox
559ff68b31 Get rid of servo_util 2015-03-05 17:42:05 +00:00
Glenn Watson
86baef2cc0 Remove compositor layers when iframes are removed from doc or display:none. 2015-03-04 07:51:46 +10:00
bors-servo
d26345f868 auto merge of #4994 : pcwalton/servo/layout-tinting, r=pcwalton
r? @metajack
2015-02-20 23:06:48 -07:00
Patrick Walton
40a3b41758 layout: Add an option to visualize parallel layout 2015-02-20 19:11:35 -08:00
Adenilson Cavalcanti
8a1e81a9ae Actually print the contents of Flow Tree into console.
When executing servo with proper flags (i.e. --debug dump-flow-tree),
it should print the flow tree. We had the code, but it was commented.
2015-02-20 16:52:18 -08:00
Ms2ger
aaed4a54c7 Use rustc-serialize rather than the built-in deprecated serialize. 2015-02-17 13:24:15 +01:00
Ms2ger
2b0eb98c1d Fix some warnings in layout. 2015-02-12 18:58:38 +01:00
Simon Sapin
d5dd1d658e Upgrade to rustc ba2f13ef0 2015-02-04 2015-02-11 14:48:34 -08: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
Josh Matthews
95fc29fa0d Update rustc to 00b112c45a604fa6f4b59af2a40c9deeadfdb7c6/rustc-1.0.0-dev. 2015-01-28 10:16:49 +10:00
Ms2ger
faefb27f3e Use std::sync::atomic::Ordering explicitly. 2015-01-22 14:49:25 +01:00
Matt Brubeck
97a8b617fb Remove unused Flow method 2015-01-12 09:58:53 -08:00
Ms2ger
16c7060bc8 Update rustc to revision 2cfb5acb5a2751c759627377e602bac4f88f2d19. 2015-01-08 09:58:46 -05:00
Patrick Walton
bf540d590a layout: Explicitly thread border box dimensions and relative offsets
through display list building.

The old `flow_origin` concept was ill-defined (sometimes the border box
plus the flow origin, sometimes including horizontal margins and
sometimes not, sometimes including relative position and sometimes not),
leading to brittleness and test failures. This commit reworks the logic
to always pass border box origins in during display list building.
2015-01-04 17:43:05 -08:00
Patrick Walton
5ea2c6dcfd layout: Paint stacking contexts' overflow areas properly.
This was making `box-shadow` not show up in many cases, in particular,
but the effects were not limited to that.
2015-01-04 17:41:59 -08:00
Patrick Walton
cc7cacfd5f gfx: Clip the background properly when border-radius is used.
Improves Reddit, GitHub, etc.
2014-12-22 14:48:55 -08:00
Patrick Walton
dea8375613 gfx: Refactor the border drawing code and split out fragment display
list building into multiple functions.

This should have no functional changes; it's just code cleanup.
2014-12-22 14:48:55 -08:00
Simon Sapin
7be30dee8e Fix some writing mode mismatch assertions errors.
The rendering is still wrong beause of #2795, but at least we get a rendering.

(This test change is just for readability, it should be equivalent to before.)
2014-12-18 17:15:51 +00:00
Simon Sapin
084a63df45 Remove usage of the deprecated std::num::Zero trait. 2014-12-18 11:16:47 +00:00
Patrick Walton
5675274c44 layout: Implement empty-cells per CSS 2.1 § 17.6.1.1. 2014-12-17 21:25:12 -08:00
Ms2ger
466faac2a5 Update rustc to revision 3dcd2157403163789aaf21a9ab3c4d30a7c6494d. 2014-12-17 15:19:45 -05:00
Ms2ger
eafa8b48fc Fix bogus transmute. 2014-12-16 15:15:00 +01:00
Patrick Walton
3029fbab92 layout: Implement basic lists and the CSS1 list properties.
The exact rendering is ill-spec'd. Some things are ugly (especially the
width and height of list style images) but they are infrequently used
and I believe this implementation matches the spec. Numeric lists are
not supported yet, since they will require a separate layout pass.

The implementation is a subclass of `BlockFlow`, on advice from Robert
O'Callahan.
2014-12-15 16:25:06 -08:00
Patrick Walton
071d320728 layout: Refactor inline layout a bit. 2014-12-12 14:55:24 -08:00