Commit graph

184 commits

Author SHA1 Message Date
Eli Friedman
69ca066802 Fully implement the "align descendants" rule for div.
This adds -servo-left and -servo-right to complement -servo-center.

This intentionally doesn't try to address issue #7301.
2015-10-02 12:53:20 -07:00
Matt Brubeck
441cc479a3 Use the correct container size in compute_overflow
Fixes #7768 - positioning of RTL stacking contexts.
2015-09-28 11:57:40 -07: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
Martin Robinson
1e6f797268 Ensure unique LayerIds for pseudo-elements
Currently pseudo-elements, like the fragments created for ::before and
::after, with layers will have the same LayerId as the body of their
owning fragments. Instead all LayerIds should be unique.

Fixes #2010.
2015-09-17 06:42:29 -07:00
bors-servo
9e914ca0db Auto merge of #7588 - notriddle:master, r=pcwalton
Actually store the overflow for inline-block elements.

Fixes #7571

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7588)
<!-- Reviewable:end -->
2015-09-17 00:53:04 -06:00
bors-servo
c3f9e1813a Auto merge of #7550 - pcwalton:block-formatting-context-overflow, r=mbrubeck
layout: Defend the block formatting context speculation against going wrong in the presence of blocks that overflow in the inline direction.

Makes the Google search result links appear.

Closes #7298.

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7550)
<!-- Reviewable:end -->
2015-09-11 10:03:39 -06:00
Michael Howell
029af81570 Actually store the overflow for inline-block elements.
Fixes #7571
2015-09-09 12:24:28 -07:00
Martin Robinson
184238c348 Layerize StackingContexts that are on top of layers
StackingContexts that should be painted on top of StackingContexts that
are already layerized should automatically get their own layer. This
will ensure proper painting order.
2015-09-09 09:13:14 -07:00
Mathieu Rheaume
bd07426735 Remove unnecessary mut on variables declared in components/layout/block.rs 2015-09-07 20:58:20 -04:00
Patrick Walton
683290e109 layout: Use a special path that treats margin: auto as zero for inline-block
inline size computation.

Places the search icon in the right place on the Google SERPs.
2015-09-04 20:42:57 -07:00
Patrick Walton
ded4a5793e layout: Defend the block formatting context speculation against going wrong in
the presence of blocks that overflow in the inline direction.

Makes the Google search result links appear.

Closes #7298.
2015-09-04 17:00:15 -07:00
Patrick Walton
2276d642fd layout: Stop double-counting position: relative offsets for stacking
contexts.

Fixes the location of the gear menu on the Google SERPs.
2015-09-04 09:28:18 -07:00
Manish Goregaokar
8e2c37a542 Fix match_refs and let_returns in layout, address review changes 2015-09-04 18:30:46 +05:30
Manish Goregaokar
54c036cd66 Elide most 'a lifetimes 2015-09-04 08:55:51 +05:30
bors-servo
a547ae6826 Auto merge of #7496 - servo:calc_, r=SimonSapin
Implement CSS3 Calc

This is #7185 with one commit added to make it build merged with master, which got support for the `ch` unit in the meantime.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7496)
<!-- Reviewable:end -->
2015-09-02 02:33:18 -06:00
bors-servo
dcaf66397a Auto merge of #7313 - pcwalton:position-relative-percentage-overflow, r=mbrubeck
layout: Make overflow calculation take relative percentages into account.

This necessitated changing overflow to be calculated by the parent flow
if relatively positioned children are present. That is because the
overflow regions cannot be calculated without knowing relative offsets,
which themselves cannot be calculated without knowing the parent size
(because of percentages). To accomplish this without sacrificing
parallelism in the non-relative case, this patch splits overflow into
"early" and "late" computation. Late overflow computation cannot be
parallelized across children, while early overflow computation can.

Makes the "Apple Music" text show up over the full-bleed promotional
background on apple.com.

r? @SimonSapin -- would appreciate a look over the iframe test case that was changed.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7313)
<!-- Reviewable:end -->
2015-09-01 12:33:07 -06:00
Simon Sapin
80d471d5cf Merge branch 'master' into calc 2015-09-01 18:39:16 +02:00
erneyja
17663315dd make test-tidy check that = have space after them 2015-09-01 07:18:19 -04:00
Patrick Walton
b66f17a445 layout: Make overflow calculation take relative percentages into
account.

This necessitated changing overflow to be calculated by the parent flow
if relatively positioned children are present. That is because the
overflow regions cannot be calculated without knowing relative offsets,
which themselves cannot be calculated without knowing the parent size
(because of percentages). To accomplish this without sacrificing
parallelism in the non-relative case, this patch splits overflow into
"early" and "late" computation. Late overflow computation cannot be
parallelized across children, while early overflow computation can.

Makes the "Apple Music" text show up over the full-bleed promotional
background on apple.com.
2015-08-31 16:50:56 -07:00
David Zbarsky
cdae523cd4 Address review comments 2015-08-26 14:43:10 -07:00
David Zbarsky
cb4d878169 Implement Calc for LengthOrPercentageOrAuto 2015-08-26 14:14:45 -07:00
David Zbarsky
9556141e57 Implement Calc for LengthOrPercentage 2015-08-26 14:14:43 -07:00
Patrick Walton
ec1c90df41 layout: Centralize the logic that determines whether fragments get
layers in the fragment, so that it can be activated when we're forcing
the creation of extra layers due to positioned descendants that
themselves have layers.

The newly failing tests were tests that accidentally passed due to
incorrect stacking order.

Closes #7281.
2015-08-22 12:41:33 -07:00
Johann Tuffe
ec07178b6f sort all uses 2015-08-20 20:47:12 +08:00
bors-servo
30a1339ed1 Auto merge of #7274 - pcwalton:table-minimum-width, r=mbrubeck
layout: Make table cells' minimum inline sizes override explicitly specified widths if the latter are too small.

Improves ebay.com.

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7274)
<!-- Reviewable:end -->
2015-08-19 03:20:37 -06:00
Patrick Walton
9d41841964 layout: Make table cells' minimum inline sizes override explicitly
specified widths if the latter are too small.

Improves ebay.com.
2015-08-18 14:38:49 -07:00
bors-servo
19d466b062 Auto merge of #7256 - pcwalton:block-formatting-contexts-max-width, r=mbrubeck
layout: Use the value of the `max-width` property when speculating what the inline sizes of block formatting contexts are likely to be.

Usually, Web developers set this property on block formatting contexts
in order to avoid running into floats, and we can use this as a
speculation hint.

Fixes the width of the search box on the Google SERPs.

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7256)
<!-- Reviewable:end -->
2015-08-18 13:38:05 -06:00
Corey Farwell
6aaada64dc flow::Flow should follow *_mut naming conventions
Fixes #7148
2015-08-18 09:12:01 -04:00
Patrick Walton
69e5bd2e3d layout: Use the value of the max-width property when speculating what
the inline sizes of block formatting contexts are likely to be.

Usually, Web developers set this property on block formatting contexts
in order to avoid running into floats, and we can use this as a
speculation hint.

Fixes the width of the search box on the Google SERPs.
2015-08-17 17:01:20 -07:00
Patrick Walton
a30379975a layout: Improve our handling of inline absolute containing blocks.
Several issues are addressed in this commit:

* Inline flows now bubble up their absolute descendants instead of
  making the inline flow the containing block for them. (In the future,
  we will need to make the inline flow *sometimes* be the containing
  block for them, but for now it improves sites to unconditionally
  bubble up.)

* Fragments now look at their inline fragment context to determine
  whether they are positioned.

* Inline flows now push the stacking-relative position of the absolute
  containing block down to their inline-block fragments.

* Inline absolute hypothetical fragments can be containing blocks.

* Fixes the logic in
  `containing_block_range_for_flow_surrounding_fragment_at_index`. The
  condition to determine whether fragments are positioned was inverted!

* `Descendants`/`AbsDescendants` has been refactored in order to become
  more friendly to inline absolute containing blocks in the future.

Improves the inline position of the green drop-down arrow in the Google
SERPs. (The block position is still wrong.)
2015-08-17 12:43:12 -07:00
Glenn Watson
04581660b3 Add fix for compositor repainting tiles on scroll layers that have stale clipping results.
Needed for #6643. Fixes #7153.
2015-08-13 13:53:03 +10:00
Patrick Walton
df4acbac04 layout: Implement basic overflow: scroll functionality.
Known issues:

* Display list optimization can sometimes optimize out elements that
  should be shown. This affects the Enyo demo.

* The `overflow: scroll` container doesn't clip the inner layer properly
  when borders, border radius, etc. are present.

* `overflow-x: scroll` and `overflow-y: scroll` don't work individually;
  elements are scrolled all at once.

* Scrolling only works on absolutely-positioned elements.
2015-08-10 21:27:04 -07:00
Glenn Watson
e83091d918 Fix explicit height edge case with absolute / relative nested divs.
Needed for #6643.
2015-08-11 11:25:26 +10: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
Patrick Walton
95c9d3cefe layout: Take negative margins of floats into account when placing them.
Removes extraneous inline space on GitHub pull requests.
2015-08-05 11:15:32 -07:00
Patrick Walton
3d9cc784d0 layout: If the container of a block formatting context has margins in
the inline direction, subtract those from the inline size of preceding
floats.

Makes the content area on http://reddit.com/r/rust visible.
2015-08-03 19:22:50 -07:00
bors-servo
d66c59a152 Auto merge of #6784 - glennw:offset-ext, r=pcwalton
Implement offsetParent/Top/Left/Width/Height.



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6784)
<!-- Reviewable:end -->
2015-08-03 18:39:43 -06:00
Glenn Watson
9e5687e3e7 Implement offsetParent/Top/Left/Width/Height. 2015-08-03 11:55:38 +10:00
Glenn Watson
b9fea3deb3 Fix percentage height calculation, absolute containing block height calculations.
It's not possible to correctly determine during the css cascade whether the container height
is explicitly specified. Additionally, the spec https://drafts.csswg.org/css2/visudet.html#the-height-property
says this should affect the *used* height, rather than the computed height.

This significantly improves the layout in #6643.
2015-08-03 10:47:56 +10:00
David Zbarsky
e484d6b5e3 Implement getComputedStyle 2015-07-29 20:17:50 -04:00
Ms2ger
3984e39011 Replace the StyledNode trait with inherent methods. 2015-07-27 19:57:33 +02:00
Glenn Watson
39ddbbb0e1 Implement enough of 3d transforms spec to run the CSS FPS demo. 2015-06-23 14:10:44 +10:00
ecoal95
8cbfb3482c Use euclid from crates.io 2015-06-19 00:04:24 +02:00
Corey Farwell
5c408d2be9 rust-geom API changes
https://github.com/servo/rust-geom/pull/81
2015-06-13 12:28:21 -07:00
Simon Sapin
595c726f51 Revert "Add support for 'padding-box' value for 'box-sizing' property (fixes #6032)"
This reverts commit 945adabd48.

The CSS Working Group resolved to drop this value from the spec:
http://log.csswg.org/irc.w3.org/css/2015-05-20/#e555680

The group was unable to come up with even a theoretical use case.
Gecko only implemented this value for completeness.
Other browsers vendors have clearly expressed they have no interest
in implementing this.
2015-06-02 15:31:59 +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
d5ca1a18dc layout: Support percentage widths in inline-blocks.
Improves Twitter.
2015-05-19 13:35:02 -07:00
Matt Brubeck
0048b4f2ab Positioning fixes for RTL floats 2015-05-18 17:25:06 -07:00
Matt Brubeck
ec5c333347 Use the correct writing mode for Floats fields
Fixes #6113 (assertion failures caused by floats in mixed-direction pages).
2015-05-18 17:24:43 -07:00