Commit graph

405 commits

Author SHA1 Message Date
bors-servo
47387a5c44 Auto merge of #11752 - mbrubeck:cleanup, r=pcwalton
Minor code cleanup in layout

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/11752)
<!-- Reviewable:end -->
2016-06-21 17:51:26 -05: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
7414edab05 Move DISPLAY_PORT_SIZE_FACTOR to block.rs. 2016-06-20 21:23:43 +02:00
Ms2ger
5c03dd8eb1 Introduce a script_layout_interface crate and move RestyleDamage to it. 2016-06-20 19:02:36 +02:00
Ms2ger
2383cb2eee Remove unused argument to place_float_if_applicable. 2016-06-20 12:37:56 +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
Per Lundberg
2f7ed1d73e Removed unused imports
This fixes #11185.
2016-05-15 22:24:26 +03:00
Patrick Walton
b6bed345f5 layout: Take margins in the inline direction into account when
guessing the inline-size of block formatting contexts.

Fixes the layout on reddit.com.

Partially addresses #10571.
2016-05-10 17:11:28 -07:00
bors-servo
8bc4785bed Auto merge of #10999 - heycam:move-width-height, r=SimonSapin
Move width and height from Box to Position.

This helps with style struct alignment between Servo and Gecko.

<!-- 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/10999)
<!-- Reviewable:end -->
2016-05-04 19:52:25 -07:00
Patrick Walton
4ae6a68e35 layout: Fix non-vertical-align-correct wording in a comment. 2016-05-04 13:20:23 -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
Cameron McCormack
550d780e17 Move width and height from Box to Position.
This helps with style struct alignment between Servo and Gecko.
2016-05-04 11:06:42 +10:00
Ben Striegel
08987c6f5a Fix unused mut warning 2016-05-02 21:02:20 -04:00
bors-servo
8db0367301 Auto merge of #10944 - mbrubeck:bitflags-0.6, r=frewsxcv
Upgrade a bunch of dependencies

<!-- 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/10944)
<!-- Reviewable:end -->
2016-04-30 15:21:22 -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
Samuel Harrington
4691dc0c6e Remove dead code from block.rs 2016-04-29 20:13:42 -07:00
Patrick Walton
6b6587a73b layout: Translate floats flowing out of blocks to compensate for inline
direction margins.

Improves Reddit /r/rust.
2016-04-28 10:25:49 -07:00
Patrick Walton
f69931552b layout: Disallow margins from collapsing through block formatting
contexts per CSS 2.1 § 8.3.1.

Closes #10449.
2016-04-14 17:24:26 -07:00
Patrick Walton
a3fd226341 layout: Disallow margins from collapsing through blocks with clearance
per CSS 2.1 § 8.3.1.

Fixes the test failure in #10458.
2016-04-14 17:24:24 -07:00
Patrick Walton
e32455f7b8 layout: Disallow margins from collapsing through blocks that have
floated children per CSS 2.1 § 8.3.1.

Fixes the test failure in #10458.
2016-04-14 11:22:40 -07:00
Michael Howell
3c2210c5fc Propogate transformed clipping regions to nested flows.
Fixes #10559
2016-04-13 11:50:50 -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
Patrick Walton
1e884ddc69 layout: Allow non-absolutely-positioned elements with overflow: scroll
set to be scrolled.

This makes them establish stacking contexts, which is a CSS 2.1 spec
violation. However, we were already violating the spec here for
absolutely-positioned elements with `overflow: scroll`. It will probably
be easier to fix this spec violation once we either switch entirely to
WebRender or we have multiple layers per stacking context.

Closes #2742.
2016-04-06 17:58:47 -07:00
Mauricio Collares
aae8919da4 Move some CSS properties from Box to Position 2016-04-05 00:21:49 -03:00
bors-servo
77444d00be Auto merge of #10279 - notriddle:issue_10258, r=mbrubeck
Fix #10258

Respect border-box when computing the relative sizes of children.

<!-- 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/10279)
<!-- Reviewable:end -->
2016-03-30 12:48:40 +05:30
Michael Howell
61c7ee917e Compute content box for children with box-sizing: border-box correctly.
Fixes #10258
2016-03-29 14:37:54 -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
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
faineance
418842faf9 use self.0 instead of destructing single item tuple structs 2016-03-27 11:50:08 +01: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
Patrick Walton
b29719e36b layout: Rewrite the block formatting context/float inline-size
speculation code.

The old code tried to do the speculation as a single bottom-up pass
after intrinsic inline-size calculation, which was unable to handle
cases like this:

    <div>
        <div style="float: left">Foo</div>
    </div>
    <div>
        <div style="overflow: hidden">Bar</div>
    </div>

No single bottom-up pass could possibly handle this case, because the
inline-size of the float flowing out of the "Foo" block could never make
it down to the "Bar" block, where it is needed for speculation.

On the pages I tried, this regresses layout performance by 1%-2%.

I first noticed this breaking some pages, like the Google SERPs, several
months ago.
2016-03-25 18:39:16 -07:00
Bobby Holley
c2daea2c9c Parameterize the rest of the style system on TNode. 2016-03-24 11:50:57 -07: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
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
bors-servo
d1ff330ba8 Auto merge of #9438 - pcwalton:root-margins, r=mbrubeck
Expand the block size of the root flow's margin box to the viewport size instead of expanding the block size of its border box.

Closes #9308.

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9438)
<!-- Reviewable:end -->
2016-01-30 03:55:24 +05:30
Patrick Walton
777c46fd3f Expand the block size of the root flow's margin box to the viewport size
instead of expanding the block size of its border box.

Closes #9308.
2016-01-28 11:12:37 -08:00
Simon Sapin
47d918ca35 Document new return value of BlockFlow::assign_block_size_block_base 2016-01-28 09:43:14 +01:00
Simon Sapin
5498b54347 Add Multicolumn support block fragmentation. 2016-01-28 09:43:14 +01:00
Simon Sapin
48270b58bf Move part of BlockFlow::assign_inline_sizes to separate function. 2016-01-28 09:43:14 +01:00
Kishor Bhat
4c5eeb1f58 Remove unused imports in layout 2016-01-17 13:17:23 +05:30
rohan.prinja
1f02c4ebbb task -> thread 2016-01-10 17:58:13 +09:00