Commit graph

256 commits

Author SHA1 Message Date
bors-servo
e46499a5df Auto merge of #7498 - pcwalton:inline-absolute-containing-blocks, r=mbrubeck
layout: Implement partial support for inline absolute containing blocks.

Improves the position of the down arrows on google.com 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/7498)
<!-- Reviewable:end -->
2015-09-01 16:36:58 -06:00
Patrick Walton
676f7014e8 layout: Implement partial support for inline absolute containing blocks.
Improves the position of the down arrows on google.com SERPs.
2015-09-01 12:18:19 -07: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
67db4fbc2e Remove stray changes 2015-08-26 14:15:01 -07:00
David Zbarsky
9556141e57 Implement Calc for LengthOrPercentage 2015-08-26 14:14:43 -07:00
Simon Sapin
21d69314d4 Don’t mark flow_ref::deref_mut as unsafe.
See discussion in https://github.com/servo/servo/pull/7237
2015-08-21 21:16:25 +02:00
Simon Sapin
2d22aa8e7e Replace the unsound impl DerefMut for FlowRef with an unsafe function.
See #6503.
2015-08-20 16:24:26 +02:00
Johann Tuffe
ec07178b6f sort all uses 2015-08-20 20:47:12 +08:00
Corey Farwell
6aaada64dc flow::Flow should follow *_mut naming conventions
Fixes #7148
2015-08-18 09:12:01 -04:00
João Oliveira
067a22a868 Replace uses of for foo in bar.iter(),
and `for foo in bar.iter_mut(), and for foo in bar.into_iter()
(continuation of #7197)
2015-08-18 01:46:11 +01:00
bors-servo
d654841288 Auto merge of #7177 - pcwalton:intervening-inline-block, r=mbrubeck
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.)

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7177)
<!-- Reviewable:end -->
2015-08-17 13:56:53 -06: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
Josh Matthews
8bb853f643 Fix existing syntactics nits. 2015-08-16 10:30:43 -04:00
João Oliveira
0038580abf Replace uses of for foo in bar.iter() and for foo in bar.iter_mut()
closes #7197
2015-08-15 02:27:39 +01:00
Patrick Walton
ae378a8c3e layout: Rewrite whitespace stripping.
This patch makes Servo unconditionally strip whitespace before text run
scanning (assuming that the `white-space` property allows it). Whitespace
stripping during reflow is now only used for handling whitespace at the ends of
lines; reflow now never attempts to handle ignorable whitespace.

Many CSS tests pass now. There are some new failures, however.

The following reference tests now fail due to a pre-existing bug whereby
whitespace is used to calculate the position of inline hypothetical boxes for
elements with `display: inline; position: absolute`:

* `absolute-replaced-height-036.htm`
* `vertical-align-sub-001.htm`
* `vertical-align-super-001.htm`

The following reference tests fail due to a pre-existing bug whereby we don't
handle `font-size: 0` properly in inline reflow:

* `font-size-zero-1.htm`
* `font-size-zero-2.htm`

The following reference test fails due to the fact that it relied on our
incorrect insertion of whitespace to make room for the black background:

* `inline-formatting-context-007.htm`
2015-08-11 11:42:20 -07: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
Patrick Walton
11fdb503df layout: Introduce infrastructure for tracking, backing up, and splitting
at the last known good split point, and use it for `white-space:
nowrap`.

Fixes overflowing tables on Wikipedia.

This infrastructure should form the basis of our fix for inline layout
of fragments that don't themselves constitute valid split points. That
will require some more work, however.
2015-08-08 00:01:31 -07:00
Matt Brubeck
8a09f738d4 Replace Arc<Box<TextRun>> with Arc<TextRun> 2015-08-05 18:28:20 -07:00
Patrick Walton
0a589d413d layout: When repairing styles for incremental reflow, only repair
styles of nodes that represent the dirty node, *including its
pseudo-element*.

Fixes lots more jumpiness.

A manual test, `inline-pseudo-repair-jumpiness.html`, has been added. I
was unable to automate it, so I will file a followup issue on that.
2015-08-04 09:02:41 -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
Jack Moffitt
dae1a398a4 Use local slice_chars
StrExt::slice_chars is deprecated and will be removed in Rust. This
lifts the implementation from Rust libstd and puts it in util::str.

This fixes a bunch of deprecation warnings in Servo.
2015-07-31 12:23:13 -06:00
Ms2ger
3984e39011 Replace the StyledNode trait with inherent methods. 2015-07-27 19:57:33 +02:00
Matt Brubeck
dfac8ce4a1 Basic support for bidirectional text 2015-07-23 20:05:55 -07:00
Patrick Walton
c84368b703 layout: Make the output of flow tree dumping easier to read when there
are many fragments.
2015-07-07 15:01:18 -07:00
Simon Sapin
75e3e787f6 Upgrade to rustc 1.3.0-dev (f3b97a74a 2015-07-03) 2015-07-04 11:32:41 +02:00
Matt Brubeck
a3b339c358 Simplify next_fragment and fix obsolete docs 2015-06-22 15:23:00 -07:00
ecoal95
8cbfb3482c Use euclid from crates.io 2015-06-19 00:04:24 +02:00
Manish Goregaokar
94fa868d2b Add unsafe blocks to make_unique
See #6376
2015-06-14 20:52:27 +05:30
Corey Farwell
5c408d2be9 rust-geom API changes
https://github.com/servo/rust-geom/pull/81
2015-06-13 12:28:21 -07:00
bors-servo
a8b6632a5a Auto merge of #6328 - mbrubeck:line-comment, r=pcwalton
r? @pcwalton

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6328)
<!-- Reviewable:end -->
2015-06-10 17:44:55 -06:00
Matt Brubeck
775953b11e Fix indices in Line::range doc comment 2015-06-10 14:04:15 -07:00
Manish Goregaokar
af364a412e Audit and reduce unstable usage in layout
Reasons behind existing unstable features:

alloc:

 - `make_unique()`
 - direct calls into `heap::allocate()`, etc
 - `boxed::into_raw()` (naming)

collections:

 - `slice_chars()` (needs to prove its worth)

core:

 - lots and lots of pointer manip
 - `raw` stuff

std_misc:

 - Handle stuff
 - hasher stuff

str_char:

 - CharRange
2015-06-10 00:54:14 +05:30
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
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
Kevin Butler
dcf91d9eba Skip empty fragments when justifying inline fragments.
Fixes #5856
2015-05-18 16:03:13 +01:00
Ms2ger
db61c54858 Remove an unused import. 2015-05-14 13:10:56 +02:00
Patrick Walton
a299a2c71c layout: Minor whitespace and formatting cleanups. 2015-05-13 12:00:55 -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
3875c9db4a layout: Support block-direction margins for inline-blocks.
Improves linux.com.
2015-05-11 17:49:12 -07:00
Patrick Walton
4b9cd4e65d layout: Implement <table width> and <center>.
Improves Hacker News.
2015-05-11 12:53:45 -07:00
Patrick Walton
614c877527 layout: Support vertical-align for inline-blocks.
Improves Twitter.
2015-05-08 17:59:01 -07:00
Patrick Walton
b17b90c8df layout: Implement inline margins.
Improves the Google SERPs.

We mark `html/rendering/replaced-elements/images/space.html` as failing.
This test tested whether `<img hspace>` and inline margins do the same
thing. Since this was trivially the case before (since we implemented
neither) and now is not, this test now fails.
2015-05-07 16:25:05 -07:00
Simon Sapin
8b522f2e7d Rename Au methods with f32/f64 instead of frac32/frac/subpx 2015-05-05 18:23:29 +02:00
Simon Sapin
32d5e24922 Replace Au-related free functions in util::geometry with Au methods. 2015-05-05 17:36:03 +02:00