Commit graph

1427 commits

Author SHA1 Message Date
Patrick Walton
5ea8c34276 layout: Move overflow calculation to be a separate, sequential,
bottom-up pass.

Right now, the only reason that overflow calculation works is that we
rely on script inducing extra reflows that are sent for display. This
was preventing #10021 from landing.

This change regresses layout performance by about 1% in my tests.

Fixes #7797 properly.
2016-03-18 22:11:51 -07:00
David Bonet
57df260f9d Removed overflow references on AssignBSizesAndStoreOverflow code 2016-03-17 21:14:50 +01:00
Anthony Ramine
46c505e47b Bump serde to 0.7 2016-03-17 13:52:39 +01:00
Anthony Ramine
f7af675861 Update log to 0.3.5 2016-03-16 23:36:04 -07:00
Patrick Walton
28a71c4820 Make border radii clip their contents.
Needed for browser.html rounded corners.
2016-03-14 18:32:55 -07:00
Bobby Holley
539f839958 Remove lifetimes from LayoutNode and friends. 2016-03-14 14:31:57 -07:00
Bobby Holley
7c4dcaa677 Inline ObjectElement::get_type_and_data into the consumers.
The usage here doesn't quite work without the lifetimes.
2016-03-14 14:31:57 -07:00
Bobby Holley
b1878bd925 Remove lifetimes from T{Node,Element,Document}. 2016-03-14 14:31:57 -07:00
bors-servo
d330ecdafc Auto merge of #9964 - mbrubeck:incremental-damage, r=pcwalton
Compute damage even when incremental layout is disabled

This fixes traversals that use the damage flags to decide which nodes to process, such as `resolve_generated_content`, which was broken in non-incremental mode. r? @pcwalton

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9964)
<!-- Reviewable:end -->
2016-03-12 05:00:17 +05:30
bors-servo
71b1122e97 Auto merge of #9969 - mbrubeck:quotes-036, r=pcwalton
Don't re-resolve already-resolved generated content

This fixes #7846, a failure in the "quotes-036.htm" test. Servo lays out this test correctly in its initial layout, but then messes it up in any relayout (whether it's an incremental or full layout).

The problem is that the ResolveGeneratedContent traversal is not safe to run more than once on the same flow. It mutates some GeneratedContent fragments into ScannedText fragments, but leaves others unmodified (in particular, those that generate empty content). The next time layout runs, these remaining GeneratedContent fragments are processed *again* but with an incorrect correct quote nesting level (because some of the surrounding GeneratedContent fragments are gone).

This patch ensures that each GeneratedContent fragment is resolved only once.

r? @pcwalton

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9969)
<!-- Reviewable:end -->
2016-03-12 02:42:10 +05:30
bors-servo
7ff7932a8c Auto merge of #9824 - danlrobertson:element1, r=asajeffrey
Add the scrollWidth and scrollHeight extensions to the element interface

Add the `scrollWidth` and `scrollHeight` extensions to the element interface. My goal was to create a method that encompassed getting `scrollWidth`, `scrollHeight`, `scrollTop`, and `scrollLeft`.

I also noted that `clientHeight` and `clientWidth` to not handle the root element and the body element correctly.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9824)
<!-- Reviewable:end -->
2016-03-12 00:19:24 +05:30
Daniel Robertson
16d2778ece Add scrollWidth/Height to element interface
Add the scrollWidth and scrollHeight extensions to the element
interface.
2016-03-11 18:22:16 +00:00
Matt Brubeck
ae5cfc31e3 Compute damage even when incremental layout is disabled
This fixes traversals that use the damage flags to decide which nodes to
process, such as `resolve_generated_content`, which was broken in
non-incremental mode.
2016-03-11 09:52:22 -08:00
bors-servo
059edc3287 Auto merge of #9961 - mbrubeck:split-line-work-list, r=pcwalton
Fix work list order after split_line_at_last_known_good_position

This fixes a bug in line splitting caused by the following actions when `LineBreaker::split_line_at_last_known_good_position` is called:

1. Push some number of previous fragments onto the front of the work list.
2. Push the current fragment back onto the front work list.

This resulted in the work list being out of order.  The correct order is action 2 followed by action 1.  Fixes #9830. r? @pcwalton

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9961)
<!-- Reviewable:end -->
2016-03-11 23:19:43 +05:30
Matt Brubeck
1e7d60e7b7 Fix work list order after split_line_at_last_known_good_position
This fixes a bug in line splitting caused by the following actions when
`LineBreaker::split_line_at_last_known_good_position` is called:

1. Push some number of previous fragments onto the front of the work list.
2. Push the current fragment back onto the front work list.

This resulted in the work list being out of order.  The correct order is
action 2 followed by action 1.  Fixes #9830.
2016-03-11 09:18:22 -08:00
Matt Brubeck
5104d8244f Don't re-resolve already-resolved generated content
This fixes #7846, a failure in the "quotes-036.htm" test. Servo lays out this
test correctly in its initial layout, but then messes it up in any relayout
(whether it's an incremental or full layout).

The problem is that the ResolveGeneratedContent traversal is not safe to run
more than once on the same flow. It mutates some GeneratedContent fragments
into ScannedText fragments, but leaves others unmodified (in particular,
those that generate empty content). The next time layout runs, these remaining
GeneratedContent fragments are processed *again* but with an incorrect correct
quote nesting level (because some of the surrounding GeneratedContent
fragments are gone).

This patch ensures that each GeneratedContent fragment is resolved only once.
2016-03-11 09:11:37 -08:00
bors-servo
40083a7aa8 Auto merge of #9962 - mrobinson:display-list-simplification, r=pcwalton
Simplify the display list slightly

Now that WebRender uses an Iframe display item, we do not need the Noop
item for the non-WebRender path. We can simply reuse the Iframe display
item. Also remove the layer_id member from the LayeredItem struct, as
it is unused.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9962)
<!-- Reviewable:end -->
2016-03-11 11:22:29 +05:30
Martin Robinson
474033c39f Simplify the display list slightly
Now that WebRender uses an Iframe display item, we do not need the Noop
item for the non-WebRender path. We can simply reuse the Iframe display
item. Also remove the layer_id member from the LayeredItem struct, as
it is unused.
2016-03-10 14:33:22 -08:00
Anthony Ramine
b66d190166 Bump url to 0.5.7 2016-03-09 20:15:16 +01:00
Anthony Ramine
10e19e06a7 Bump string_cache to 0.2.11 2016-03-09 20:15:15 +01:00
Anthony Ramine
f89c321141 Bump euclid to 0.6.4 2016-03-09 20:15:11 +01:00
Anthony Ramine
200e2286fd Bump cssparser to 0.5.4 2016-03-09 20:14:38 +01:00
Anthony Ramine
5720c76816 Bump app_units to 0.2.3 2016-03-09 20:14:35 +01:00
Suvish Varghese Thoovamalayil
de68820e76 Remove unused cell_extras feature gates. Fixes #9912 2016-03-08 16:56:13 +05:30
Simon Sapin
142610265e Add the -servo-overflow-clip-box property. 2016-03-04 19:47:20 +01:00
bors-servo
1c63bf9822 Auto merge of #9861 - pcwalton:superflat, r=glennw
Flatten the WebRender API to allow us to use shared memory to transfer display lists.

Improves performance significantly.

Requires servo/webrender_traits#15 and servo/webrender#222.

r? @glennw

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9861)
<!-- Reviewable:end -->
2016-03-04 06:45:45 +05:30
bors-servo
aba500a698 Auto merge of #9858 - glennw:anim-smoothness, r=pcwalton
Fix animation smoothness when using requestAnimationFrame.

Previously, the flow for ticking animations was:

Compositor -> Constellation -> Layout -> Script

However, this means that the compositor <-> layout messages can thrash, meaning layout thread is very rarely idle.

This means that the script thread (which joins on the layout thread during reflow) was unable to execute and run rAF callbacks.

With this change, the flow is now:

Compositor -> Constellation -> Script (when rAF is active).
Compositor -> Constellation -> Layout (when transitions / animations are active and no rAF is present).

This makes rAF based animation *much* smoother.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9858)
<!-- Reviewable:end -->
2016-03-04 05:50:50 +05:30
Patrick Walton
5e17325e54 Flatten the WebRender API to allow us to use shared memory to transfer
display lists.

Improves performance significantly.

Requires servo/webrender_traits#15 and servo/webrender#222.
2016-03-03 14:44:48 -08:00
bors-servo
37bcc161fe Auto merge of #9832 - metajack:suppress-reflows, r=mbrubeck
Suppress reflows before RefreshTick or FirstLoad

This fixes a bug where partially loaded content is displayed to the user
before it should be, usually before stylesheets have loaded. This commit
supresses reflows until either FirstLoad or RefreshTick, whichever comes
first.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9832)
<!-- Reviewable:end -->
2016-03-04 04:00:30 +05:30
Jack Moffitt
2507bfb2cf Suppress reflows before RefreshTick or FirstLoad
This fixes a bug where partially loaded content is displayed to the user
before it should be, usually before stylesheets have loaded. This commit
supresses reflows until either FirstLoad or RefreshTick, whichever comes
first.

Unfortunately, hit_test and mouse_over did not do reflows if they were
necessary, and so by suppressing the initial spurious reflows, these
methods started to panic without a display list to query. This patch
also transforms these into queries similar to the other existing
queries.
2016-03-03 15:17:46 -07:00
Glenn Watson
92061132f3 Fix animation smoothness when using requestAnimationFrame.
Previously, the flow for ticking animations was:

Compositor -> Constellation -> Layout -> Script

However, this means that the compositor <-> layout messages can thrash, meaning layout thread is very rarely idle.

This means that the script thread (which joins on the layout thread during reflow) was unable to execute and run rAF callbacks.

With this change, the flow is now:

Compositor -> Constellation -> Script (when rAF is active).
Compositor -> Constellation -> Layout (when transitions / animations are active and no rAF is present).

This makes rAF based animation *much* smoother.
2016-03-04 07:26:00 +10:00
bors-servo
55fc48e4c4 Auto merge of #9843 - pcwalton:optimize-flat-display-lists, r=mrobinson
Optimize flat display lists

Flat display lists were a 2x regression on the spheres demo. This patch series fixes that.

See the individual commits for more details.

r? @mrobinson

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9843)
<!-- Reviewable:end -->
2016-03-04 02:49:04 +05:30
Patrick Walton
117e92aefd layout: Minor whitespace cleanup. 2016-03-03 13:09:57 -08:00
Patrick Walton
d3d2dd05f2 layout: Switch display list building from bottom-up to top-down.
This eliminates a lot of allocations and O(n^2) behavior.
2016-03-03 13:09:56 -08:00
Patrick Walton
f4b95dd00b layout: Remove the validate_display_list_geometry debugging tool.
I don't think anyone was using it, and it's incompatible with taking
display lists out of flows.
2016-03-03 13:09:55 -08:00
Patrick Walton
72a52e23e0 layout: Don't call establishes_stacking_context() so much.
That function is expensive because it has to check a lot.
2016-03-03 13:09:54 -08:00
Patrick Walton
940bff1f9c gfx: Stop cloning clipping regions so much.
Clipping regions can contain vectors and so can be expensive to copy.
2016-03-03 13:09:50 -08:00
Patrick Walton
983576ebaa gfx: Avoid copying stacking contexts around so much during stacking
context creation.
2016-03-03 13:09:49 -08: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
Corey Farwell
75353e19a7 Indicate components should not be published to crates.io.
http://doc.crates.io/manifest.html#the-publish--field-optional
2016-03-03 15:04:44 -05:00
bors-servo
056a7cf1a2 Auto merge of #9715 - ecoal95:mousemove, r=mbrubeck
script: Fix MouseOver handling

Now we only query for the topmost node, and apply the hover state to all
of the parent elements.

This fixes things like #9705, where the hover state was applied only to
the children.

This also makes us more conformant with other browsers in the case of
taking in account margins and paddings.

For example, prior to this PR, when your mouse was over the inner
element, in the bottom part, `hover` styles didn't apply to the parent.

```html
<style>
div {
  padding: 10px;
  margin: 10px;
  height: 15px;
  background: blue;
}

div:hover {
  background: red;
}
</style>

<div>
  <div></div>
</div>
```

Fixes #9705

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9715)
<!-- Reviewable:end -->
2016-03-03 22:55:35 +05:30
Emilio Cobos Álvarez
48dee6413d script/layout: Refactor mouse_over since it now basically uses hit_test 2016-03-02 20:14:15 +01:00
Glenn Watson
ff831bb478 Fix unexpected overflow with overflow: hidden set.
Fixes #9719.
2016-03-03 05:02:37 +10:00
Emilio Cobos Álvarez
b1f0581637 script: Fix MouseOver handling
Now we only query for the topmost node, and apply the hover state to all
of the parent elements.

This fixes things like #9705, where the hover state was applied only to
the children.

This also makes us more conformant with other browsers in the case of
taking in account margins and paddings.

For example, prior to this PR, when your mouse was over the inner
element, in the bottom part, `hover` styles didn't apply to the parent.

```html
<style>
div {
  padding: 10px;
  margin: 10px;
  height: 15px;
  background: blue;
}

div:hover {
  background: red;
}
</style>

<div>
  <div></div>
</div>
```

Fixes #9705
2016-03-02 20:01:41 +01:00
Ms2ger
0a9b62d7c7 Remove a stray println in table layout.
It was introduced in 4dc9d8b1c5.
2016-03-02 10:57:06 +01:00
bors-servo
62814f7cb4 Auto merge of #9756 - mrobinson:flat-display-lists-webrender, r=pcwalton
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.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9756)
<!-- Reviewable:end -->
2016-03-02 06:21:08 +05:30
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
Matt Brubeck
6c684a5ac7 Fix border collapsing at the end of a table-row-group
This fixes the border-end calculation for table rows whose borders are
collapsed with rows in different rowgroups.  The border collapsing code now
uses an iterator that yields all the rows as a flat sequence, regardless of
how they are grouped in rowgroups.  It gets rid of
`TableRowGroupFlow::preliminary_collapsed_borders` which was never correct.
(It was read but never written.)

This may fix #8120 but I'm not 100% certain. (I haven't managed to reproduce
the intermittent failure locally, and my reduced test case still fails but in
a different way.)
2016-03-01 09:02:35 -08:00
Matt Brubeck
4dc9d8b1c5 Fix confusing push_or_mutate API
This fixes a bug when recalculating border collapsing for an existing table
now. The bug was caused by using `push_or_mutate` which has no effect if there
is already a value at the specified index.

The fix switches incorrect `push_or_mutate` calls to use `push_or_set`
instead. It also renames `push_or_mutate` to `get_mut_or_push` which I think
is a less-confusing name for this method.
2016-02-29 15:18:19 -08:00
bors-servo
4300ba2211 Auto merge of #9717 - schuster:move-range, r=frewsxcv
Move util::range into its own crate

Fixes #9695

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9717)
<!-- Reviewable:end -->
2016-02-26 07:41:57 +05:30