Commit graph

880 commits

Author SHA1 Message Date
Patrick Walton
8fe2f8930c layout: Make inline margins on <input type=button> and friends apply
only to the button and not to the text inside.

Improves the Google home page.
2015-08-13 09:51:17 -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
8640cf5588 layout: Take relative position offsets for inlines and inline-blocks
into account only once.

There were two bugs here: (1) relative position applied to
scanned/unscanned text fragments independently of the container element
that applied that relative position, causing double-counting; (2)
relative position applied to inline block fragments independently of the
wrapped block itself, causing double-counting.

This commit also removes the `cascade_anonymous` function and the
related `Fragment` constructor. They were unused, and their
functionality has been replaced by the `modify_style_for_*` series of
functions.

Closes #7067.
2015-08-12 08:28:35 -07:00
Ms2ger
fdafc5c360 Store a Sender<ConstellationControlMsg> in LayoutTask. 2015-08-12 15:55:16 +02:00
Ms2ger
4f9ec8915d Store a Sender<ConstellationControlMsg> in ScriptReflow. 2015-08-12 15:47:35 +02:00
bors-servo
7dc83e7820 Auto merge of #7024 - pcwalton:whitespace-stripping, r=mbrubeck
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`

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7024)
<!-- Reviewable:end -->
2015-08-11 12:57:02 -06: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
d3d59ced36 layout: Make absolutely-positioned elements with z-index: auto not
stacking contexts.

Improves many sites.

Closes #7069.
2015-08-11 11:21:52 -07:00
Patrick Walton
bf26a2373f layout: Carry out some minor style cleanups. 2015-08-10 21:27:05 -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
11822f3eb1 layout: Remove the now-useless dirty field from the layout context.
At this point the only thing it does is to try to avoid adding display
items that are outside the root scrollable area, which is both wrong
(since it's incompatible with having scrollable areas outside the root)
and is useless (because we have displayports now).
2015-08-10 21:27:03 -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
bors-servo
2b9590c5a5 Auto merge of #6778 - nox:childnodes, r=jdm
Optimise Node.childNodes



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6778)
<!-- Reviewable:end -->
2015-08-10 14:05:02 -06:00
Patrick Walton
657e638ad4 layout: Minor whitespace cleanup. 2015-08-08 13:32:25 -07:00
Patrick Walton
7ca1137d25 layout: Allow list items to be absolute containing blocks.
Fixes overflowing highlight in the side menu on GitHub.
2015-08-08 13:32:24 -07:00
Patrick Walton
6b32e5d7a7 servo: Update ipc-channel to pick up bincode support.
Large improvement in page load times, especially in debug builds.
2015-08-08 09:43:53 -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
Simon Sapin
4833204653 Support @font-face in user and user agent stylesheets. 2015-08-07 21:08:53 +02:00
Matt Brubeck
4e8d2b0e38 Allow list markers to contain multiple fragments
Fixes #6913.
2015-08-07 07:33:06 -07: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
bors-servo
da06c2dda0 Auto merge of #7011 - pcwalton:inline-margin-intrinsic-size, r=mbrubeck
layout: Take inline margins into account when determining the intrinsic sizes of fragments.

Avoids a needless wrapped line in the repository name on GitHub.

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7011)
<!-- Reviewable:end -->
2015-08-06 18:28:13 -06:00
bors-servo
76b4bae6ee Auto merge of #7054 - Manishearth:rollup, r=Manishearth
Rollup of 3 pull requests

- Successful merges: #7028, #7034, #7039
- Failed merges:

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7054)
<!-- Reviewable:end -->
2015-08-06 17:43:09 -06:00
Manish Goregaokar
730ee4d341 Rollup merge of #7034 - Ms2ger:mem, r=jdm
Create a run_with_memory_reporting method to reduce the boilerplate a…

…ssociated with registering memory reporters.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7034)
<!-- Reviewable:end -->
2015-08-07 03:45:29 +05:30
Matt Brubeck
b5f9c06776 Rollup merge of #7015 - mbrubeck:arc-box, r=Ms2ger
Replace Arc<Box<TextRun>> with Arc<TextRun>

Removes an extraneous level of indirection.

r? @pcwalton

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7015)
<!-- Reviewable:end -->
2015-08-06 14:07:32 -07:00
Matt Brubeck
26087aab38 Rollup merge of #7014 - mbrubeck:box-string, r=pcwalton
Use Box<str> instead of Box<String> for UnscannedTextFragmentInfo

This removes an extraneous layer of indirection, without increasing the size of the `SpecificFragmentInfo` enum (because `Box<str>` is a fat pointer, which is the same size as the `FlowRef` trait object that is already stored in `InlineAbsoluteHypotheticalFragmentInfo`)

r? @pcwalton

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7014)
<!-- Reviewable:end -->
2015-08-06 14:07:31 -07:00
bors-servo
cf4b411832 Auto merge of #7008 - pcwalton:floated-negative-margins, r=mbrubeck
layout: Take negative margins of floats into account when placing them.

Removes extraneous inline space on GitHub pull requests.

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7008)
<!-- Reviewable:end -->
2015-08-06 11:55:58 -06:00
Ms2ger
bf3ecaa901 Create a run_with_memory_reporting method to reduce the boilerplate associated with registering memory reporters. 2015-08-06 15:24:27 +02:00
bors-servo
172f046688 Auto merge of #6836 - nick-thompson:layout_refactor, r=Ms2ger
Extract layout query code into layout/query.rs

Fix for #6787. I left the commits split up for ease of review, happy to squash when this gets accepted.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6836)
<!-- Reviewable:end -->
2015-08-06 03:29:16 -06:00
bors-servo
be8798b73a Auto merge of #6994 - servo:warnings, r=Manishearth
Fix unused mutability warnings.

They were introduced in 35ba731123.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6994)
<!-- Reviewable:end -->
2015-08-05 22:02:45 -06:00
Jack Moffitt
f570da28c2 Merge pull request #6988 from glennw/no-arc
No need for paint layer in stacking context to be an arc.
2015-08-05 20:06:09 -06:00
Matt Brubeck
8a09f738d4 Replace Arc<Box<TextRun>> with Arc<TextRun> 2015-08-05 18:28:20 -07:00
Matt Brubeck
c4dde7297e Use Box<str> instead of Box<String> for UnscannedTextFragmentInfo
This removes an extraneous layer of indirection, without increasing the size
of the `SpecificFragmentInfo` enum (because `Box<str>` is a fat pointer, which
is the same size as the `FlowRef` trait object that is already stored in
`InlineAbsoluteHypotheticalFragmentInfo`)
2015-08-05 18:05:05 -07:00
Patrick Walton
fba0a8164d layout: Take inline margins into account when determining the intrinsic
sizes of fragments.

Avoids a needless wrapped line in the repository name on GitHub.
2015-08-05 12:29:16 -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
Nick Thompson
f114304a3a Extract layout query code into query.rs 2015-08-05 10:24:00 -07:00
Ms2ger
a7ca54a325 Fix unused mutability warnings.
They were introduced in 35ba731123.
2015-08-05 15:45:05 +02:00
bors-servo
cc70e2f91f Auto merge of #6980 - pcwalton:inline-border-baseline, r=glennw
layout: Take borders into account when positioning inline fragments on their baselines.

Improves the Rust GitHub page.

r? @glennw

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6980)
<!-- Reviewable:end -->
2015-08-05 05:03:43 -06:00
bors-servo
56a9eab2a0 Auto merge of #6976 - pcwalton:vertical-marker-placement, r=mbrubeck
layout: Place list item markers correctly in the block direction.

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6976)
<!-- Reviewable:end -->
2015-08-05 00:57:19 -06:00
Glenn Watson
aca98b2901 No need for paint layer in stacking context to be an arc. 2015-08-05 14:35:49 +10:00
bors-servo
b9f00190e1 Auto merge of #6979 - mbrubeck:counter, r=pcwalton
Fix crash caused by negative numbers in list counters.

Fixes #6818.  The test still fails because of #6978.

r? @pcwalton

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6979)
<!-- Reviewable:end -->
2015-08-04 18:37:10 -06:00
Patrick Walton
2880aa2b02 layout: Take borders into account when positioning inline fragments on
their baselines.

Improves the Rust GitHub page.
2015-08-04 16:20:15 -07:00
Matt Brubeck
35ba731123 Fix handling of negative numbers in list counters.
Fixes #6818.
2015-08-04 16:18:09 -07:00
Patrick Walton
a746fa0ac1 layout: Place list item markers correctly in the block direction. 2015-08-04 14:44:54 -07:00
bors-servo
56d3426431 Auto merge of #6940 - pcwalton:inline-pseudo-repair-jumpiness, r=mbrubeck
layout: When repairing styles for incremental reflow, only repair styles of nodes that represent the dirty node, *including its pseudo-element*.

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6940)
<!-- Reviewable:end -->
2015-08-04 12:53:26 -06:00
Patrick Walton
04928bf1e3 layout: Don't use the block container inline size as the initial
computed table inline size.

Makes google.com fully centered.
2015-08-04 09:40:35 -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
672b38e83a Auto merge of #6946 - pcwalton:block-formatting-context-margins, r=mbrubeck
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.

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6946)
<!-- Reviewable:end -->
2015-08-04 02:41:40 -06:00
bors-servo
94cd76df61 Auto merge of #6938 - pcwalton:inline-repair-jumpiness, r=mbrubeck
construct: When repairing styles for incremental reflow, only repair styles of nodes that represent the dirty node.

Fixes jumpiness on many pages; e.g. the WPT results pages.

For some reason, this would not reproduce with an automated test.

r? @mbrubeck

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6938)
<!-- Reviewable:end -->
2015-08-03 23:37:47 -06: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