Commit graph

332 commits

Author SHA1 Message Date
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
Patrick Walton
65e3db1c0d layout: Add a REPOSITION restyle damage type.
Separating out `REPOSITION` from `REPAINT` allows us to compute
stacking-context-relative positions without rebuilding the display list.
This saves a lot of time when responding to script-to-layout queries.
2016-09-26 14:20:30 -07:00
UK992
93a103ba73 Reorder use statements 2016-09-09 04:55:19 +02:00
Ms2ger
871c207c44 Pass SharedLayoutContext to Flow::compute_absolute_position. 2016-08-24 10:12:38 +02:00
Alexandrov Sergey
49b50e45a3 do not merge inline fragments if there is space in between 2016-08-11 10:11:11 +03:00
Alexandrov Sergey
0b68fb3cb5 reset border_padding between, account for border_padding in border_box and reset *_FRAGMENT_OF_ELEMENT flag for splitted fragments 2016-08-08 19:51:57 +03: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
Ms2ger
9f13278b77 Move arc_ptr_eq to style. 2016-07-11 12:13:12 +02:00
Emilio Cobos Álvarez
383ba964ab
layout: text: Don't consider the REQUIRES_LINE_BREAK_AFTERWARD_IF_WRAPPING_ON_NEWLINES if the fragment can wrap text.
This was making us fall in a loop where the start split was empty, but we didn't
ignore it because the current fragment had this flag, but then we treated it
differently depending on the white_space property.

Not totally sure this is the proper fix, but it makes sense to me. In case it
is:

Fixes #12369.
2016-07-10 15:34:57 -07: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
6f4b8f2505 Store SharedStyleContext in AbsoluteAssignBSizesTraversal. 2016-06-22 14:09:54 +02:00
Matt Brubeck
25a19343b3 Remove REPAINT damage in Fragment::build_display_list
Previously, the code that called this function was responsible for this.
Some code paths neglected to do it.  This moves the damage removal to one
central location.
2016-06-20 13:39:36 -07:00
Ms2ger
0d0b268138 Move LayoutNode and related traits to script_layout_interface. 2016-06-20 19:07:54 +02:00
Ms2ger
5c03dd8eb1 Introduce a script_layout_interface crate and move RestyleDamage to it. 2016-06-20 19:02:36 +02:00
Darin Minamoto
4a4be1d7e5 Image with height defined in % resizes properly 2016-06-15 16:39:22 -07: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
Cullen Rhodes
40acd24e8f Report use statements that use {} with only one entry 2016-05-27 10:18:44 +01:00
Ulf Nilsson
0f983cd11f Make text-align: justify incremental layout safe 2016-05-10 15:46:22 +02:00
Matt Brubeck
887f0e6454 Remove redundant code in whitespace stripping
LineBreaker calls Fragment::strip_trailing_whitespace_if_necessary and then
recalculates the fragment's inline size.  But this isn't necessary because
strip_trailing_whitespace_if_necessary already recalculates the size.
2016-05-05 16:46:31 -07:00
Patrick Walton
b7c9674044 layout: Consider vertical alignment of fragments during line breaking.
This makes the line breaker determine the final block positions of each
line rather than doing it in a separate pass afterward. Not only does
this simplify the code, it makes `vertical-align` and float placement
interact properly.
2016-05-04 13:20:21 -07:00
Patrick Walton
04f05349b1 layout: Check flow descendants of inline block fragments to find their
baselines when aligning inline fragments per CSS 2.1 § 10.8.1.
2016-05-04 13:20:21 -07:00
Patrick Walton
8823f87276 layout: Don't pretend inline fragment sizes are zero when placing them
between floats.
2016-05-04 13:19:52 -07:00
Matt Brubeck
1e23d90631 Upgrade to bitflags 0.6.0 and selectors 0.5.6
Types generated by `bitflags!` are now private by default.  This PR marks them
`pub` where necessary.
2016-04-30 10:14:03 -07:00
bors-servo
0a1efe4578 Auto merge of #10320 - malayaleecoder:master, r=KiChjang
Rename imm_child_iter() and child_iter().

Fixes #10286

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10320)
<!-- Reviewable:end -->
2016-04-09 03:54:40 +05:30
malayaleecoder
d4dcaf3167 Rename imm_child_iter() and child_iter(). Fixes #10286 2016-04-09 01:18:00 +05:30
Matt Brubeck
cac06e579c Remove unused argument to adjust_clipping_region_for_children 2016-04-07 16:22:51 -07:00
bors-servo
256b865055 Auto merge of #10407 - mauricioc:issue10403, r=bholley
Move some CSS properties to match Gecko's representation

Fixes #10403. Animation had an extra transition-delay property, which was also moved to Box. Let me know if I should squash the commits.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10407)
<!-- Reviewable:end -->
2016-04-07 03:18:15 +05:30
Michael Howell
2b75ef09f7 Whitespace stripping should not result in a dangling, open border. 2016-04-05 11:39:49 -07:00
Mauricio Collares
347cf0580c Move CSS text-overflow property from InheritedText to Text 2016-04-05 00:21:39 -03:00
Emilio Cobos Álvarez
4460712a8f layout: Propagate selected_style to InlineFragmentNodeInfo 2016-03-30 14:28:13 +02: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
bors-servo
639fdd6b12 Auto merge of #10210 - perlun:rename-computedvalues-to-servocomputedvalues, r=SimonSapin
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.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10210)
<!-- Reviewable:end -->
2016-03-29 18:25:40 +05:30
Matt Brubeck
99885b1950 Restore stripped whitespace before reflowing text fragments
Fixes #10200.
2016-03-28 14:04:35 -07: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
bors-servo
bed91b3334 Auto merge of #10176 - mbrubeck:selection-range, r=pcwalton
Highlight selected text in input fields

Fixes #9993.  This does not yet allow stylesheets to set the selection colors; instead it uses a hard-coded orange background and white foreground.

r? @pcwalton

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10176)
<!-- Reviewable:end -->
2016-03-26 08:16:20 +05:30
Matt Brubeck
08caf7412f Convert ScannedTextFragment fields into bitflags 2016-03-24 18:33:27 -07:00
Matt Brubeck
6171000875 Highlight selected text in input fields
Fixes #9993.  This does not yet allow stylesheets to set the selection colors;
instead it uses a hard-coded orange background and white foreground.
2016-03-24 18:33:26 -07:00
Bobby Holley
c2daea2c9c Parameterize the rest of the style system on TNode. 2016-03-24 11:50:57 -07:00
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
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
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
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
Jonathan Schuster
205336bf2e Move util::range into its own crate 2016-02-25 21:06:10 -05:00
bors-servo
83be388f59 Auto merge of #9668 - glennw:inline-accuracy, r=pcwalton
Ensure when calculating font metrics that the total line height matches requested line height.

This fixes rounding accuracy issues that could result in layout producing results off by a small number of Au.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9668)
<!-- Reviewable:end -->
2016-02-18 17:48:15 +05:30
Anthony Ramine
db8d502f41 Move util::logical_geometry to style 2016-02-18 10:17:13 +01:00
Glenn Watson
286130b051 Ensure when calculating font metrics that the total line height matches requested line height.
This fixes rounding accuracy issues that could result in layout producing results off by a small number of Au.
2016-02-18 14:16:13 +10:00