Commit graph

340 commits

Author SHA1 Message Date
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
Simon Sapin
ef8edd4e87 Upgrade to rustc 551a74dddd84cf01440ee84148ebd18bc68bd7c8. 2015-05-05 10:07:34 -04:00
Glenn Watson
a5a5214783 Various fixes to getClientBoundingRect()
* Fix queries involving stacking contexts
 * The code was double accumulating stacking context origins.
* Handle queries of inline elements.
 * The node addresses being compared were incorrect (CharacterData vs. Span)
* Handle ScriptQuery reflows correctly.
 * The layout task was skipping the compute absolute positions traversal, so failed before window.onload.
2015-05-01 12:40:37 +10:00
Matt Brubeck
50f982bb0c Fix text-align left/right in RTL layout 2015-04-29 07:07:58 -07:00
Matt Brubeck
81e8f18662 Support text-align: start and end 2015-04-29 07:07:58 -07:00
Ms2ger
903305416a Implement Clone for Copy types. 2015-04-28 23:31:10 +02:00
Patrick Walton
4d46d257cd Address review comments 2015-04-27 17:12:08 +02:00
Patrick Walton
48299a53cb layout: Implement most of border-collapse per CSS 2.1 § 17.6.2.
Known issues:

* Collapsed borders do not correctly affect the border-box of the table
  itself.

* The content widths of all cells in a column and the content height of
  all cells in a row is the same in this patch, but not in Gecko and
  WebKit.

* Corners are not painted well. The spec does not say what to do here.

* Column spans are not handled well. The spec does not say what to do
  here either.
2015-04-27 17:12:07 +02:00
Ms2ger
6a55ae06d7 Remove some as_slice calls. 2015-04-24 17:44:47 +02:00
bors-servo
68f03c9dbb Auto merge of #5805 - pcwalton:whitespace-effect-on-minimum-inline-sizes, r=glennw
Improves Amazon.

r? @glennw

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5805)
<!-- Reviewable:end -->
2015-04-22 20:23:17 -05:00
Patrick Walton
f8b9b31680 layout: Take the white-space property into account when computing
intrinsic sizes of inline flows.

Improves Amazon.
2015-04-22 17:45:16 -07:00
Ms2ger
4d41f1c991 Stop using the deprecated range function. 2015-04-22 20:26:40 +02:00
Patrick Walton
acd08c67c6 layout: Use the same code path for computing static positions of regular
flows and static positions of hypothetical boxes.

Before this change, Servo used one code path that computed the position
of flows with `position: static` or `position: relative` and another
separate code path that computed the position of flows with `position:
absolute` or `position: fixed`. The latter code attempted to duplicate
the former code to determine the static position of hypothetical boxes,
but this was both fragile and incorrect in the case of hypothetical
boxes nested inside floats. In fact, it's impossible to determine the
static position of an absolute flow relative to its containing block at
inline-size assignment time, because that static position could depend
on a float that cannot be placed until block-size assignment!

This patch changes block layout to use the same code path for static
positioning of regular flows and static positioning of absolute flows
where applicable. This both simplifies the code and improves its
efficiency, since it allows the `hypothetical_position` field and
`static_block_offsets` data structure to be removed. Moreover, it
improves correctness in the above case (which the new reftest checks).
This allows the sidebar in Facebook Timeline to be positioned properly.
2015-04-14 13:00:10 -07:00
Glenn Watson
3815cb4a81 Remove unneeded assert (code below handles it) and a warning. Fixes #5230. 2015-04-10 09:55:59 +10:00
bors-servo
d7b6961104 Auto merge of #5623 - pcwalton:nested-inline-vertical-align, r=glennw
This allows things like `<sup><span>Foo</span></sup>` to work and
improves Wikipedia.

r? @glennw
2015-04-09 17:20:23 -05:00
Patrick Walton
18074bf908 layout: Lay out nested inline elements with different vertical-align
values properly in simple cases.

This allows things like `<sup><span>Foo</span></sup>` to work and
improves Wikipedia.
2015-04-09 14:55:05 -07:00
Patrick Walton
00a2685cbe layout: During inline layout, make place_between_floats use the same
line height computation logic as final block size assignment.

Improves Wikipedia.
2015-04-09 14:23:08 -07:00